aboutsummaryrefslogtreecommitdiff
path: root/nix/flake.nix
diff options
context:
space:
mode:
authorPreston Pan <ret2pop@gmail.com>2025-02-08 03:19:30 -0800
committerPreston Pan <ret2pop@gmail.com>2025-02-08 03:19:30 -0800
commit504b765606f02b610d74d259ddf2c85292e1f6c0 (patch)
tree49908b9e9064b0f0fc8bf8070e8cf5cdf547e3a6 /nix/flake.nix
parent56faa5e9caf4408c2c4d6df50287c3b1c9e6c1b4 (diff)
add nix-topology; make configuration options less bad; restructure project a bit; add flake system looping
Diffstat (limited to 'nix/flake.nix')
-rw-r--r--nix/flake.nix117
1 files changed, 53 insertions, 64 deletions
diff --git a/nix/flake.nix b/nix/flake.nix
index 4c703cd..bab8574 100644
--- a/nix/flake.nix
+++ b/nix/flake.nix
@@ -3,86 +3,75 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
-
+ nur.url = "github:nix-community/NUR";
+ sops-nix.url = "github:Mic92/sops-nix";
+ scripts.url = "github:ret2pop/scripts";
+ wallpapers.url = "github:ret2pop/wallpapers";
+ sounds.url = "github:ret2pop/sounds";
+ nix-topology = {
+ url = "github:oddlama/nix-topology";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
home-manager = {
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
-
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
-
lanzaboote = {
url = "github:nix-community/lanzaboote/v0.4.1";
inputs.nixpkgs.follows = "nixpkgs";
};
-
- nur.url = "github:nix-community/NUR";
- sops-nix.url = "github:Mic92/sops-nix";
- scripts.url = "github:ret2pop/scripts";
- wallpapers.url = "github:ret2pop/wallpapers";
- sounds.url = "github:ret2pop/sounds";
};
- outputs = { nixpkgs, home-manager, nur, disko, lanzaboote, sops-nix, ... }@attrs: {
- nixosConfigurations = {
- installer = nixpkgs.lib.nixosSystem {
- system = "x86_64-linux";
- modules = [
- (
- { pkgs, modulesPath, ... }:
- {
- imports = [ (modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix") ];
- }
- )
- ./systems/installer/default.nix
- ];
- };
+ outputs = { self, nixpkgs, home-manager, nur, disko, lanzaboote, sops-nix, nix-topology, ... }@attrs:
+ let
+ system = "x86_64-linux";
+ mkConfigs = map (hostname: {
+ name = "${hostname}";
+ value = nixpkgs.lib.nixosSystem {
+ system = system;
+ specialArgs = attrs;
+ modules = if (hostname == "installer") then [
+ (./. + "/systems/${hostname}/default.nix")
+ { networking.hostName = "${hostname}"; }
+ nix-topology.nixosModules.default
+ ] else [
+ nix-topology.nixosModules.default
+ lanzaboote.nixosModules.lanzaboote
+ disko.nixosModules.disko
+ home-manager.nixosModules.home-manager
+ sops-nix.nixosModules.sops
+ {
+ nixpkgs.overlays = [ nur.overlays.default ];
+ home-manager.extraSpecialArgs = attrs;
+ networking.hostName = "${hostname}";
+ }
+ (./. + "/systems/${hostname}/default.nix")
+ ];
+ };
+ });
- continuity = nixpkgs.lib.nixosSystem {
- system = "x86_64-linux";
- specialArgs = attrs;
- modules = [
- lanzaboote.nixosModules.lanzaboote
- disko.nixosModules.disko
- home-manager.nixosModules.home-manager
- sops-nix.nixosModules.sops
- { nixpkgs.overlays = [ nur.overlays.default ]; }
- { home-manager.extraSpecialArgs = attrs; }
- ./systems/continuity/default.nix
- ];
- };
+ pkgs = import nixpkgs {
+ inherit system;
+ overlays = [ nix-topology.overlays.default ];
+ };
+ in {
+ nixosConfigurations = builtins.listToAttrs (mkConfigs [
+ "affinity"
+ "continuity"
+ "installer"
+ "spontaneity"
+ ]);
- affinity = nixpkgs.lib.nixosSystem {
- system = "x86_64-linux";
- specialArgs = attrs;
- modules = [
- lanzaboote.nixosModules.lanzaboote
- disko.nixosModules.disko
- home-manager.nixosModules.home-manager
- sops-nix.nixosModules.sops
- { nixpkgs.overlays = [ nur.overlays.default ]; }
- { home-manager.extraSpecialArgs = attrs; }
- ./systems/affinity/default.nix
- ];
- };
-
- spontaneity = nixpkgs.lib.nixosSystem {
- system = "x86_64-linux";
- specialArgs = attrs;
- modules = [
- lanzaboote.nixosModules.lanzaboote
- disko.nixosModules.disko
- home-manager.nixosModules.home-manager
- sops-nix.nixosModules.sops
- { nixpkgs.overlays = [ nur.overlays.default ]; }
- { home-manager.extraSpecialArgs = attrs; }
- ./systems/spontaneity/hardware-configuration.nix
- ./systems/spontaneity/default.nix
+ topology."${system}" = import nix-topology {
+ inherit pkgs;
+ modules = [
+ ./topology/default.nix
+ { nixosConfigurations = self.nixosConfigurations; }
];
- };
+ };
};
- };
}