summaryrefslogtreecommitdiff
path: root/hosts/muhammed/linux-builder/default.nix
blob: a4d2b8d24f23b49a2108d5d9a1cd8c598fd4059c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Create a local Linux builder. This will allow us to build aarch64-linux
# targets directly on this machine.
#
# It also does some related stuff to make NixOS tests work.

{ ... }:

{
  nix.settings.trusted-users = ["linus"];

  nix.linux-builder = {
    enable = true;

    # Clearing the VM state upon startup should improve reliability at the cost
    # of some startup speed. Will have to re-evaluate if this trade off is
    # worth it at some point.
    ephemeral = true;

    config = {pkgs, ...}: {
      environment.systemPackages = with pkgs; [
        # cntr is used to jump into the sandbox of packages that use breakpointHook.
        pkgs.cntr

        # Nix is used to debug and fetch other tools as needed.
        pkgs.nix
      ];

      # Allow root login. This would normally be horrible but it's a local VM so who cares.
      users.users.root.hashedPassword = "$y$j9T$TosKLKCZ.g9be.Wz5/qVJ.$YWvn4nAp8tn.xhHGBMOz748PHma6QGhN/WShilEbz8A";
      services.openssh.permitRootLogin = "yes";
    };
  };

  # Add system-features to the nix daemon that are needed for NixOS tests
  # Starting with Nix 2.19, this will be automatic
  nix.settings.system-features = [
    "nixos-test"
    "apple-virt"
  ];
}