diff --git a/flake.lock b/flake.lock index 5ad0509..06847cf 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1662241716, - "narHash": "sha256-urqPvSvvGUhkwzTDxUI8N1nsdMysbAfjmBNZaTYBZRU=", + "lastModified": 1665870395, + "narHash": "sha256-Tsbqb27LDNxOoPLh0gw2hIb6L/6Ow/6lIBvqcHzEKBI=", "owner": "ryantm", "repo": "agenix", - "rev": "c96da5835b76d3d8e8d99a0fec6fe32f8539ee2e", + "rev": "a630400067c6d03c9b3e0455347dc8559db14288", "type": "github" }, "original": { @@ -25,11 +25,11 @@ ] }, "locked": { - "lastModified": 1662478528, - "narHash": "sha256-Myjd0HPL5lXri3NXOcJ6gP7IKod2eMweQBKM4uxgEGw=", + "lastModified": 1665392861, + "narHash": "sha256-bCd8fYJMAb0LzabsiXl4nxECDoz483bJOCa2hjox7N0=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "3b69bf3cc26ae19de847bfe54d6ab22d7381a90a", + "rev": "ef56fd8979b5f4e800c4716f62076e00600b1172", "type": "github" }, "original": { @@ -42,15 +42,15 @@ "home-manager": { "inputs": { "nixpkgs": [ - "nixpkgs" + "stable" ] }, "locked": { - "lastModified": 1656169755, - "narHash": "sha256-Nlnm4jeQWEGjYrE6hxi/7HYHjBSZ/E0RtjCYifnNsWk=", + "lastModified": 1665475263, + "narHash": "sha256-T4at7d+KsQNWh5rfjvOtQCaIMWjSDlSgQZKvxb+LcEY=", "owner": "nix-community", "repo": "home-manager", - "rev": "4a3d01fb53f52ac83194081272795aa4612c2381", + "rev": "17208be516fc36e2ab0ceb064d931e90eb88b2a3", "type": "github" }, "original": { @@ -62,43 +62,27 @@ }, "nixpkgs": { "locked": { - "lastModified": 1638587357, - "narHash": "sha256-2ySMW3QARG8BsRPmwe7clTbdCuaObromOKewykP+UJc=", - "owner": "nixos", + "lastModified": 1665732960, + "narHash": "sha256-WBZ+uSHKFyjvd0w4inbm0cNExYTn8lpYFcHEes8tmec=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "e34c5379866833f41e2a36f309912fa675d687c7", + "rev": "4428e23312933a196724da2df7ab78eb5e67a88e", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixos-21.11", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_2": { - "locked": { - "lastModified": 1662099760, - "narHash": "sha256-MdZLCTJPeHi/9fg6R9fiunyDwP3XHJqDd51zWWz9px0=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "67e45078141102f45eff1589a831aeaa3182b41e", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-22.05", + "owner": "NixOS", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } }, "nixunstable": { "locked": { - "lastModified": 1662019588, - "narHash": "sha256-oPEjHKGGVbBXqwwL+UjsveJzghWiWV0n9ogo1X6l4cw=", + "lastModified": 1665848363, + "narHash": "sha256-3Jow1YxzPtQnck1bAAvbVxgRH4gNnkIdw871Vm6UtAU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "2da64a81275b68fdad38af669afeda43d401e94b", + "rev": "83b198a2083774844962c854f811538323f9f7b1", "type": "github" }, "original": { @@ -110,11 +94,11 @@ }, "nurpkgs": { "locked": { - "lastModified": 1662716683, - "narHash": "sha256-NU+YC3jT99fp8CPhtm+mgM/c8PP6DwIRzIGkuCO3Vss=", + "lastModified": 1665979830, + "narHash": "sha256-0xcqP+Pr2zeX8A2BpqodcPwN5sR0TfC8twuXUjzG2g4=", "owner": "nix-community", "repo": "NUR", - "rev": "44284844e8329dfd07163965d0b9e2c3192911bc", + "rev": "704e1ef5bdb1af57b4f7988abf2ef80c897dfc9b", "type": "github" }, "original": { @@ -128,9 +112,25 @@ "agenix": "agenix", "darwin": "darwin", "home-manager": "home-manager", - "nixpkgs": "nixpkgs_2", "nixunstable": "nixunstable", - "nurpkgs": "nurpkgs" + "nurpkgs": "nurpkgs", + "stable": "stable" + } + }, + "stable": { + "locked": { + "lastModified": 1665927063, + "narHash": "sha256-2oImLqwQqVOQhTXsGUahqrYpe+Pufq+8XTsceYwBfJs=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "8de8b98839d1f20089582cfe1a81207258fcc1f1", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-22.05", + "repo": "nixpkgs", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index f67463d..e0ce43e 100644 --- a/flake.nix +++ b/flake.nix @@ -5,12 +5,12 @@ description = "Greg's machines!"; inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05"; + stable.url = "github:nixos/nixpkgs/nixos-22.05"; nixunstable.url = "github:nixos/nixpkgs/nixos-unstable"; agenix.url = "github:ryantm/agenix"; home-manager = { url = "github:nix-community/home-manager/release-22.05"; - inputs.nixpkgs.follows = "nixpkgs"; + inputs.nixpkgs.follows = "stable"; }; darwin = { url = "github:lnl7/nix-darwin/master"; @@ -19,69 +19,69 @@ nurpkgs.url = "github:nix-community/NUR"; }; - outputs = {nixpkgs, nixunstable, agenix, home-manager, nurpkgs, self, ...}@inputs: + outputs = {stable, nixunstable, agenix, home-manager, nurpkgs, self, ...}@inputs: let local_overlay = import ./overlays; overlays = [ + agenix.overlay local_overlay nurpkgs.overlay ]; - overlaid = system: import nixpkgs { - inherit overlays system; - }; - - mods = hostname: [ - { nixpkgs.overlays = overlays; } - agenix.nixosModule - ./modules-all - ./modules-linux - ./hosts/${hostname} - home-manager.nixosModules.home-manager { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.extraSpecialArgs = { - inherit nixunstable; - }; - } - ]; - - machine = system: name: nixpkgs.lib.nixosSystem { - inherit system; - specialArgs = inputs; - modules = mods name; - }; darwinMods = hostname: [ - { nixpkgs.overlays = overlays; } + { stable.overlays = overlays; } inputs.agenix.nixosModule ./modules-all ./modules-darwin ./hosts/${hostname} ]; - unstableMachine = system: name: inputs.nixunstable.lib.nixosSystem { - system = system; - modules = mods name; + machine = { + system ? "x86_64-linux", + name, + channel ? stable + }: + 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; + }; + } + ]; specialArgs = { - nixpkgs = inputs.nixunstable; - nixunstable = inputs.nixunstable; - agenix = inputs.agenix; home-manager = inputs.home-manager; - nur = inputs.nur; + inherit nixpkgs; }; }; in { nixosConfigurations = { - "2maccabees" = unstableMachine "aarch64-linux" "2maccabees"; + "2maccabees" = machine { + system = "aarch64-linux"; + name = "2maccabees"; + channel = nixunstable; + }; - "linode" = machine "x86_64-linux" "linode"; - "jude" = unstableMachine "x86_64-linux" "jude"; + jude = machine { + name = "jude"; + channel = nixunstable; + }; - "lappy" = machine "x86_64-linux" "lappy"; - - "iso" = machine "x86_64-linux" "iso"; + "linode" = machine { name = "linode"; }; + "lappy" = machine { name = "lappy"; }; + "iso" = machine { name = "iso"; }; }; darwinConfigurations = { @@ -97,7 +97,8 @@ homeConfigurations = ( import ./home { - inherit nixpkgs nixunstable agenix home-manager nurpkgs; + inherit nixunstable agenix home-manager nurpkgs; + nixpkgs = nixunstable; } ); @@ -107,6 +108,6 @@ ./modules-linux ./modules-darwin ]; - packages = import ./overlays/packages.nix { pkgs = nixpkgs; }; + packages = import ./overlays/packages.nix { pkgs = stable; }; }; } diff --git a/lib.nix b/lib.nix new file mode 100644 index 0000000..e8fd609 --- /dev/null +++ b/lib.nix @@ -0,0 +1,33 @@ +{ ... }: + +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; + }; + }); +} diff --git a/modules-all/automatic/programs.nix b/modules-all/automatic/programs.nix index e1418a6..8e4aa03 100644 --- a/modules-all/automatic/programs.nix +++ b/modules-all/automatic/programs.nix @@ -1,4 +1,4 @@ -{ pkgs, agenix, ... }: +{ pkgs, ... }: let myPackages = pypackages: with pypackages; [ @@ -10,7 +10,7 @@ let in { # Base packages that need to be in all my hosts environment.systemPackages = with pkgs; [ - agenix.defaultPackage."${system}" + agenix android-file-transfer bitwarden-cli diffutils