Nix config files for my laptop and servers
1{
2 description = "A full rewrite of my system configuration";
3
4 inputs = {
5 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6
7 home-manager = {
8 url = "github:nix-community/home-manager/master";
9 inputs.nixpkgs.follows = "nixpkgs";
10 };
11
12 nixos-hardware.url = "github:NixOS/nixos-hardware/master";
13
14 agenix.url = "github:ryantm/agenix";
15
16 disko = {
17 url = "github:nix-community/disko";
18 inputs.nixpkgs.follows = "nixpkgs";
19 };
20
21 niri = {
22 url = "github:sodiboo/niri-flake";
23 inputs.nixpkgs.follows = "nixpkgs";
24 };
25
26 noctalia = {
27 url = "github:noctalia-dev/noctalia-shell";
28 inputs.nixpkgs.follows = "nixpkgs";
29 };
30 };
31
32 outputs = inputs @ {
33 nixpkgs,
34 home-manager,
35 nixos-hardware,
36 agenix,
37 disko,
38 ...
39 }: let
40 lib = nixpkgs.lib;
41 createSystem = {
42 host,
43 user,
44 platform,
45 optionalModules ? [],
46 }:
47 lib.nixosSystem {
48 specialArgs = {inherit inputs;};
49 modules =
50 [
51 ./hosts/${host}
52 ./users/${user}
53 home-manager.nixosModules.home-manager
54 {
55 home-manager.useGlobalPkgs = true;
56 home-manager.useUserPackages = true;
57 home-manager.backupFileExtension = "bak";
58 home-manager.users.${user} = import ./users/${user}/platforms/${platform}.nix;
59 home-manager.extraSpecialArgs = {inherit inputs;};
60 }
61 ]
62 ++ optionalModules;
63 };
64 in {
65 nixosConfigurations = {
66 seafoam = createSystem {
67 host = "seafoam";
68 user = "hari";
69 platform = "pc";
70 optionalModules = [
71 nixos-hardware.nixosModules.dell-inspiron-14-5420
72 ];
73 };
74
75 cerulean = createSystem {
76 host = "cerulean";
77 user = "hari";
78 platform = "server";
79 };
80
81 verdigris = createSystem {
82 host = "verdigris";
83 user = "hari";
84 platform = "server";
85 optionalModules = [
86 disko.nixosModules.disko
87 agenix.nixosModules.default
88 ];
89 };
90
91 cyan = createSystem {
92 host = "cyan";
93 user = "hari";
94 platform = "server";
95 optionalModules = [
96 disko.nixosModules.disko
97 agenix.nixosModules.default
98 ];
99 };
100 };
101 };
102}