diff --git a/darwin/default.nix b/darwin/default.nix new file mode 100644 index 0000000..2d408e3 --- /dev/null +++ b/darwin/default.nix @@ -0,0 +1,25 @@ +{ agenix, darwin, nixstable, nixunstable, overlays, ... }: +let + mac = { + system ? "aarch64-darwin", + name, + channel ? nixunstable, + extraMods ? [] + }: + let + nixpkgs = channel; + in darwin.lib.darwinSystem { + inherit system; + specialArgs = { inherit nixpkgs; }; + modules = [ + { nixpkgs.overlays = overlays; } + agenix.nixosModule + ../modules-all + ../modules-darwin + ./${name} + ] ++ extraMods; + }; +in { + "C02G48H8MD6R" = mac { system = "x86_64-darwin"; name = "work"; }; + la23002 = mac { name = "ivr"; }; +} diff --git a/hosts/ivr/default.nix b/darwin/ivr/default.nix similarity index 100% rename from hosts/ivr/default.nix rename to darwin/ivr/default.nix diff --git a/hosts/work/default.nix b/darwin/work/default.nix similarity index 100% rename from hosts/work/default.nix rename to darwin/work/default.nix diff --git a/flake.lock b/flake.lock index adf2236..3da3186 100644 --- a/flake.lock +++ b/flake.lock @@ -103,18 +103,18 @@ "type": "github" } }, - "home-manager": { + "hm": { "inputs": { "nixpkgs": [ - "stable" + "nixstable" ] }, "locked": { - "lastModified": 1683543852, - "narHash": "sha256-aS9qNcg9GwSYFLCWa3Lw+2nVPG11mmQ3B7Oka1hh04M=", + "lastModified": 1683813037, + "narHash": "sha256-UMEXfYLVcI4p0JUHQD07UWglqj7XUw6xhdJqqNRu4KY=", "owner": "nix-community", "repo": "home-manager", - "rev": "3f3fa731ad0f99741d4dc98e8e1287b45e30b452", + "rev": "d97e8f8861a7ad3cb2f72adf5b2cd14ab302c593", "type": "github" }, "original": { @@ -156,6 +156,22 @@ "type": "github" } }, + "nixstable": { + "locked": { + "lastModified": 1682600000, + "narHash": "sha256-ha4BehR1dh8EnXSoE1m/wyyYVvHI9txjW4w5/oxsW5Y=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "50fc86b75d2744e1ab3837ef74b53f103a9b55a0", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-22.05", + "repo": "nixpkgs", + "type": "github" + } + }, "nixunstable": { "locked": { "lastModified": 1682879489, @@ -193,29 +209,13 @@ "darwin": "darwin", "ffmac": "ffmac", "flake-utils": "flake-utils", - "home-manager": "home-manager", + "hm": "hm", + "nixstable": "nixstable", "nixunstable": "nixunstable", "nurpkgs": "nurpkgs", - "stable": "stable", "wsl": "wsl" } }, - "stable": { - "locked": { - "lastModified": 1672580127, - "narHash": "sha256-3lW3xZslREhJogoOkjeZtlBtvFMyxHku7I/9IVehhT8=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "0874168639713f547c05947c76124f78441ea46c", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-22.05", - "repo": "nixpkgs", - "type": "github" - } - }, "wsl": { "inputs": { "flake-compat": "flake-compat", diff --git a/flake.nix b/flake.nix index 2839629..0491756 100644 --- a/flake.nix +++ b/flake.nix @@ -5,13 +5,13 @@ description = "Greg's machines!"; inputs = { - stable.url = "github:nixos/nixpkgs/nixos-22.05"; + nixstable.url = "github:nixos/nixpkgs/nixos-22.05"; nixunstable.url = "github:nixos/nixpkgs/nixos-unstable"; agenix.url = "github:ryantm/agenix"; flake-utils.url = "github:numtide/flake-utils"; - home-manager = { + hm = { url = "github:nix-community/home-manager/master"; - inputs.nixpkgs.follows = "stable"; + inputs.nixpkgs.follows = "nixstable"; }; darwin = { url = "github:lnl7/nix-darwin/master"; @@ -25,7 +25,7 @@ ffmac.url = "github:bandithedoge/nixpkgs-firefox-darwin"; }; - outputs = {stable, nixunstable, agenix, home-manager, nurpkgs, self, wsl, flake-utils, ...}@inputs: + outputs = {nixstable, nixunstable, agenix, hm, nurpkgs, self, wsl, flake-utils, darwin, ...}@inputs: let pkg-sets = ( final: prev: { @@ -41,110 +41,25 @@ inputs.ffmac.overlay ]; - unstable = args: (machine (args // { channel = nixunstable; })); - machine = { - system ? "x86_64-linux", - name, - channel ? stable, - extraMods ? [] - }: - let - nixpkgs = channel; - in nixpkgs.lib.nixosSystem { - inherit system; - modules = [ - { nixpkgs.overlays = overlays; } - agenix.nixosModule - ./modules-all - ./modules-linux - ./hosts/${name} - home-manager.nixosModules.home-manager { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.extraSpecialArgs = { - inherit nixpkgs; - }; - } - ] ++ extraMods; - specialArgs = { - home-manager = inputs.home-manager; - inherit nixpkgs; - }; - }; - - mac = { - system ? "aarch64-darwin", - name, - channel ? unstable, - extraMods ? [] - }: - let - nixpkgs = channel; - in inputs.darwin.lib.darwinSystem { - inherit system; - specialArgs = { inherit nixpkgs; }; - modules = [ - { nixpkgs.overlays = overlays; } - inputs.agenix.nixosModule - ./modules-all - ./modules-darwin - ./hosts/${name} - ] ++ extraMods; - }; in { - nixosConfigurations = { - "2maccabees" = unstable { system = "aarch64-linux"; name = "2maccabees"; }; - jude = unstable { name = "jude"; }; - "icdm-root" = unstable { name = "icdm-root"; }; - "linode" = machine { name = "linode"; }; - "linodeeu" = machine { name = "linodeeu"; }; - "lappy" = machine { name = "lappy"; }; - mm = unstable { name = "mm"; }; - "iso" = machine { name = "iso"; }; - # nix build '.#nixosConfigurations.wsl.config.system.build.installer' - "nixos" = unstable { name = "wsl"; system = "aarch64-linux"; extraMods = [ wsl.nixosModules.wsl ]; }; - # nix build '.#nixosConfigurations.wsl-aarch.config.system.build.installer' - "nixos-arm" = unstable { name = "wsl"; system = "aarch64-linux"; extraMods = [ wsl.nixosModules.wsl ]; }; - }; + nixosConfigurations = (import ./hosts { inherit nixstable nixunstable overlays wsl agenix; }); - darwinConfigurations = - let - nixpkgs = stable { - overlays = overlays; - }; - in { - "C02G48H8MD6R" = inputs.darwin.lib.darwinSystem { - system = "x86_64-darwin"; - specialArgs = { - nixpkgs = stable; - }; - modules = [ - { nixpkgs.overlays = overlays; } - inputs.agenix.nixosModule - ./modules-all - ./modules-darwin - ./hosts/work - ]; - }; - la23002 = mac { name = "ivr"; }; - }; + darwinConfigurations = (import ./darwin { inherit agenix darwin nixstable nixunstable overlays; }); defaultPackage = flake-utils.lib.eachDefaultSystemMap (system: inputs.self.homeConfigurations.gui."${system}".activationPackage); homeConfigurations = ( import ./home { - inherit nixunstable agenix home-manager overlays flake-utils; + inherit nixunstable agenix hm overlays flake-utils; nixpkgs = nixunstable; } ); - overlays = { - default = import ./overlays; - }; + overlays = { default = local_overlay; }; modules = (import ./modules-all {}) // (import ./modules-linux {}) // (import ./modules-darwin {}); - packages = import ./overlays/packages.nix { pkgs = stable; }; + packages = import ./overlays/packages.nix { pkgs = nixstable; }; }; } diff --git a/home/default.nix b/home/default.nix index 31b6222..096f330 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,7 +1,7 @@ { nixpkgs, overlays, - home-manager, + hm, flake-utils, ... }: @@ -33,7 +33,7 @@ let config.xdg.configHome = configDir; }; - in home-manager.lib.homeManagerConfiguration rec { + in hm.lib.homeManagerConfiguration rec { inherit pkgs; modules = [ (import ./home.nix { diff --git a/hosts/default.nix b/hosts/default.nix new file mode 100644 index 0000000..569abd1 --- /dev/null +++ b/hosts/default.nix @@ -0,0 +1,37 @@ +{ nixstable, nixunstable, overlays, wsl, agenix, ... }: +let + wsl = args: (unstable (args // { extraMods = [ wsl.nixosModules.wsl ]; })); + unstable = args: (machine (args // { channel = nixunstable; })); + machine = { + system ? "x86_64-linux", + name, + channel ? nixstable, + extraMods ? [] + }: + let + nixpkgs = channel; + in nixpkgs.lib.nixosSystem { + inherit system; + modules = [ + { nixpkgs.overlays = overlays; } + agenix.nixosModule + ../modules-all + ../modules-linux + ./${name} + ] ++ extraMods; + specialArgs = { inherit nixpkgs; }; + }; +in { + "2maccabees" = unstable { system = "aarch64-linux"; name = "2maccabees"; }; + jude = unstable { name = "jude"; }; + icdm-root = unstable { name = "icdm-root"; }; + linode = machine { name = "linode"; }; + linodeeu = machine { name = "linodeeu"; }; + lappy = machine { name = "lappy"; }; + mm = unstable { name = "mm"; }; + iso = machine { name = "iso"; }; + # nix build '.#nixosConfigurations.wsl.config.system.build.installer' + nixos = wsl { name = "wsl"; system = "aarch64-linux"; }; + # nix build '.#nixosConfigurations.wsl-aarch.config.system.build.installer' + nixos-arm = wsl { name = "wsl"; system = "aarch64-linux"; }; +} diff --git a/lib.nix b/lib.nix deleted file mode 100644 index e8fd609..0000000 --- a/lib.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ ... }: - -let - local_overlay = import ./overlays; -in { - makeMachine = - {system, name, pkgs, - agenix ? import , - home-manager ? import }: - let - mods = hostname: [ - agenix.nixosModule - ./modules-all - ./modules-linux - ./hosts/${hostname} - home-manager.nixosModules.home-manager { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.extraSpecialArgs = { - nixunstable = pkgs; - }; - } - ]; - in (pkgs.lib.nixosSystem { - inherit system; - modules = (mods name); - specialArgs = { - nixpkgs = pkgs; - agenix = agenix; - home-manager = home-manager; - }; - }); -}