about summary refs log tree commit diff
path: root/nixosConfigurations/default.nix
blob: fe998cd178e8fb51a5dbbe72f9d68f0cfb9cf8ae (plain) (blame)
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
{
  inputs,
  lib,
}:
with lib; let
  mkConfiguration = name: {
    modules ? [],
    configuration ? ./${name},
    this ? my.configurations.${name},
    extraSpecialArgs ? {
      localUsername = my.username;
      localHostname = this.hostname;
    },
  }:
    nameValuePair name (nixosSystem {
      inherit (this) system;
      modules =
        modules
        ++ attrValues inputs.self.modules
        ++ attrValues inputs.self.nixosModules
        ++ optional (configuration != null) (import configuration);
      specialArgs =
        {
          inherit inputs lib this;
        }
        // extraSpecialArgs;
    });

  mkIso = system: {
    this = {
      hostname = "iso";
      inherit system;
      isHeadless = false;
      isHeadful = false;
    };
    configuration = ./iso;
    modules = with inputs; [
      "${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal-new-kernel.nix"
    ];
  };

  mkTest = this: {
    modules = with inputs; [
      "${nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
      nixpkgs.nixosModules.notDetected
    ];
    inherit this;
  };
in
  mapAttrs' mkConfiguration {
    # ISO images.
    iso-arm = mkIso "aarch64-linux";
    iso-x86 = mkIso "x86_64-linux";

    # Dummy configuration test profiles.
    test-headless = mkTest {
      hostname = "test-headless";
      system = "x86_64-linux";
      isHeadless = true;
      isHeadful = false;
    };
    test-headful = mkTest {
      hostname = "test-headful";
      system = "x86_64-linux";
      isHeadless = false;
      isHeadful = true;
    };

    # A beefy desktop: 7950x/rx6750xt/128GB.
    eonwe.modules = with inputs; [
      nixos-hardware.nixosModules.common-cpu-amd
      nixos-hardware.nixosModules.common-cpu-amd-pstate
      nixos-hardware.nixosModules.common-gpu-amd
      nixos-hardware.nixosModules.common-pc-ssd
      nixpkgs.nixosModules.notDetected
    ];

    # ThinkPad T480.
    melian.modules = with inputs; [
      nixos-hardware.nixosModules.common-pc-laptop-ssd
      nixos-hardware.nixosModules.lenovo-thinkpad-t480
      nixpkgs.nixosModules.notDetected
    ];

    # VPS: Germany
    manwe.modules = with inputs; [
      "${nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
      nixos-hardware.nixosModules.common-cpu-amd
      nixos-hardware.nixosModules.common-pc-ssd
      nixpkgs.nixosModules.notDetected
    ];

    # VPS: Germany
    varda.modules = with inputs; [
      "${nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
      nixos-hardware.nixosModules.common-cpu-amd
      nixos-hardware.nixosModules.common-pc-ssd
      nixpkgs.nixosModules.notDetected
    ];

    # VPS: France
    yavanna.modules = with inputs; [
      "${nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
      nixos-hardware.nixosModules.common-cpu-intel
      nixos-hardware.nixosModules.common-pc-hdd
      nixpkgs.nixosModules.notDetected
    ];
  }

Consider giving Nix/NixOS a try! <3