aboutsummaryrefslogtreecommitdiff
path: root/nixos/configurations.nix
blob: 943b59ae0ac4fc2d385dd9656784ac082b95e035 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
self:
with self.inputs;
with builtins;
with nixpkgs.lib; let
  modules = hostname:
    [
      self.nixosModules.default
      shellrc.nixosModules.default
      usbkey.nixosModules.default
      nixbigclown.nixosModules.default
      (personal-secret.lib.personalSecrets hostname)
      {
        networking.hostName = hostname;
        nixpkgs.overlays = [
          self.overlays.default
          sterm.overlay
        ];
      }
    ]
    ++ (optional (hasAttr "machine-${hostname}" self.nixosModules) self.nixosModules."machine-${hostname}");
  specialArgs = {
    lib = nixpkgs.lib.extend (prev: final: import ../lib prev);
  };

  genericSystem = {
    system ? "x86_64-linux",
    extra_modules ? [],
  }: hostname: {
    ${hostname} = nixpkgs.lib.nixosSystem {
      system = system;
      modules = (modules hostname) ++ extra_modules;
      specialArgs = specialArgs;
    };
  };
  amd64System = genericSystem {};
  vpsSystem = genericSystem {
    extra_modules = [
      vpsadminos.nixosConfigurations.container
      {boot.loader.systemd-boot.enable = false;}
    ];
  };
  raspi2System = genericSystem {
    system = "armv7l-linux";
    extra_modules = [
      nixos-hardware.nixosModules.raspberry-pi-2
      nixturris.nixosModules.turris-crossbuild
      nixturris.nixosModules.armv7l-overlay
      ({pkgs, ...}: {
        boot.loader.systemd-boot.enable = false;
        boot.initrd.includeDefaultModules = false;
      })
    ];
  };
  raspi3System = genericSystem {
    system = "aarch64-linux";
    extra_modules = [
      nixturris.nixosModules.turris-crossbuild
      ({pkgs, ...}: {
        boot.kernelPackages = pkgs.linuxPackages_rpi3;
        boot.initrd.includeDefaultModules = false;
        boot.loader.grub.enable = false;
        boot.loader.systemd-boot.enable = false;
        boot.loader.raspberryPi = {
          enable = true;
          version = 3;
        };
      })
    ];
  };
  beagleboneSystem = genericSystem {
    system = "armv7l-linux";
    extra_modules = [
      nixturris.nixosModules.turris-crossbuild
      nixturris.nixosModules.armv7l-overlay
      {
        boot.loader.grub.enable = false;
        boot.loader.systemd-boot.enable = false;
        boot.loader.generic-extlinux-compatible.enable = true;
      }
    ];
  };

  vmSystem = system: hostSystem:
    genericSystem {
      system = system;
      extra_modules = [
        nixturris.nixosModules.turris-crossbuild
        {
          boot.loader.systemd-boot.enable = false;
          virtualisation.qemu.package = self.nixosConfigurations."${hostSystem}".pkgs.qemu;
        }
      ];
    };
  amd64vmSystem = vmSystem "x86_64-linux";
  armv7lvmSystem = vmSystem "armv7l-linux";
  aarch64vmSystem = vmSystem "aarch64-linux";

  turrisSystem = board: hostname: {
    ${hostname} = nixturris.lib.nixturrisSystem {
      nixpkgs = nixpkgs;
      board = board;
      modules = modules hostname;
      override.specialArgs = specialArgs;
    };
  };
  turrisMoxSystem = turrisSystem "mox";
  turrisOmniaSystem = turrisSystem "omnia";
in
  amd64System "albert"
  // amd64System "binky"
  // amd64System "errol"
  // amd64System "ridcully"
  // amd64System "susan"
  // vpsSystem "lipwig"
  // vpsSystem "mrpump"
  // raspi2System "spt-mpd"
  // raspi3System "adm-mpd"
  // beagleboneSystem "gaspode"
  // turrisMoxSystem "dean"
  // turrisOmniaSystem "spt-omnia"
  // turrisMoxSystem "spt-mox"
  // turrisMoxSystem "spt-mox2"
  // turrisOmniaSystem "adm-omnia"
  // turrisOmniaSystem "adm-omnia2"