diff options
| author | Gregor Kleen <gkleen@yggdrasil.li> | 2022-03-13 18:35:03 +0100 |
|---|---|---|
| committer | Gregor Kleen <gkleen@yggdrasil.li> | 2022-03-13 18:35:03 +0100 |
| commit | 1e7de7c2823a9beea7103249b732f14b1b1e8f78 (patch) | |
| tree | ec073e219d67c52a163ae7ce2ca00737c21d2a31 /flake.nix | |
| parent | 49375b980197db7b4e0d17327b52d37d6ce33f35 (diff) | |
| download | nixos-1e7de7c2823a9beea7103249b732f14b1b1e8f78.tar nixos-1e7de7c2823a9beea7103249b732f14b1b1e8f78.tar.gz nixos-1e7de7c2823a9beea7103249b732f14b1b1e8f78.tar.bz2 nixos-1e7de7c2823a9beea7103249b732f14b1b1e8f78.tar.xz nixos-1e7de7c2823a9beea7103249b732f14b1b1e8f78.zip | |
nvfetcher
Diffstat (limited to 'flake.nix')
| -rw-r--r-- | flake.nix | 29 |
1 files changed, 23 insertions, 6 deletions
| @@ -29,9 +29,16 @@ | |||
| 29 | ref = "master"; | 29 | ref = "master"; |
| 30 | inputs.nixpkgs.follows = "nixpkgs"; | 30 | inputs.nixpkgs.follows = "nixpkgs"; |
| 31 | }; | 31 | }; |
| 32 | nvfetcher = { | ||
| 33 | type = "github"; | ||
| 34 | owner = "berberman"; | ||
| 35 | repo = "nvfetcher"; | ||
| 36 | ref = "master"; | ||
| 37 | inputs.nixpkgs.follows = "nixpkgs"; | ||
| 38 | }; | ||
| 32 | }; | 39 | }; |
| 33 | 40 | ||
| 34 | outputs = { self, nixpkgs, home-manager, sops-nix, deploy-rs, ... }@inputs: | 41 | outputs = { self, nixpkgs, home-manager, sops-nix, deploy-rs, nvfetcher, ... }@inputs: |
| 35 | let | 42 | let |
| 36 | inherit (builtins) attrNames attrValues elemAt toJSON isNull pathExists; | 43 | inherit (builtins) attrNames attrValues elemAt toJSON isNull pathExists; |
| 37 | inherit (nixpkgs) lib; | 44 | inherit (nixpkgs) lib; |
| @@ -48,6 +55,10 @@ | |||
| 48 | accountName' = splitString "@" accountName; | 55 | accountName' = splitString "@" accountName; |
| 49 | in elemAt accountName' 1; | 56 | in elemAt accountName' 1; |
| 50 | 57 | ||
| 58 | mkSources = pkgs: optionalAttrs (pathExists _sources/generated.nix) { sources = pkgs.callPackage _sources/generated.nix {}; }; | ||
| 59 | |||
| 60 | mkOverlay = path: final: prev: import path ({ inherit final; inherit prev; } // mkSources prev); | ||
| 61 | |||
| 51 | mkNixosConfiguration = addProfiles: dir: path: hostName: nixosSystem rec { | 62 | mkNixosConfiguration = addProfiles: dir: path: hostName: nixosSystem rec { |
| 52 | specialArgs = { | 63 | specialArgs = { |
| 53 | flake = self; | 64 | flake = self; |
| @@ -61,9 +72,11 @@ | |||
| 61 | ]; | 72 | ]; |
| 62 | 73 | ||
| 63 | local = dir + "/${path}"; | 74 | local = dir + "/${path}"; |
| 64 | argsModule._module.args = { | 75 | argsModule = { pkgs, ... }: { |
| 65 | customUtils = utils; | 76 | _module.args = { |
| 66 | inherit hostName; | 77 | customUtils = utils; |
| 78 | inherit hostName; | ||
| 79 | } // mkSources pkgs; | ||
| 67 | }; | 80 | }; |
| 68 | accountModules = attrValues (filterAttrs accountMatchesHost self.nixosModules.accounts); | 81 | accountModules = attrValues (filterAttrs accountMatchesHost self.nixosModules.accounts); |
| 69 | accountMatchesHost = n: _v: accountHostName n == hostName; | 82 | accountMatchesHost = n: _v: accountHostName n == hostName; |
| @@ -154,7 +167,7 @@ | |||
| 154 | homeConfigurations = listToAttrs (concatLists (mapAttrsToList (hostname: nixosConfig: mapAttrsToList (username: configuration: nameValuePair "${username}@${hostname}" { inherit (configuration.home) activationPackage; }) nixosConfig.config.home-manager.users) self.nixosConfigurations)); | 167 | homeConfigurations = listToAttrs (concatLists (mapAttrsToList (hostname: nixosConfig: mapAttrsToList (username: configuration: nameValuePair "${username}@${hostname}" { inherit (configuration.home) activationPackage; }) nixosConfig.config.home-manager.users) self.nixosConfigurations)); |
| 155 | 168 | ||
| 156 | overlays = let | 169 | overlays = let |
| 157 | overlays = mapAttrs (_name: path: import path) overlayPaths; | 170 | overlays = mapAttrs (_name: path: mkOverlay path) overlayPaths; |
| 158 | in overlays // { default = final: prev: composeManyExtensions (attrValues overlays) final prev; }; | 171 | in overlays // { default = final: prev: composeManyExtensions (attrValues overlays) final prev; }; |
| 159 | overlays-path = forAllSystems (system: _: self.legacyPackages.${system}.writeText "overlays.nix" '' | 172 | overlays-path = forAllSystems (system: _: self.legacyPackages.${system}.writeText "overlays.nix" '' |
| 160 | map import (builtins.attrValues (builtins.fromJSON ${self.legacyPackages.${system}.lib.strings.escapeNixString (toJSON overlayPaths)})) | 173 | map import (builtins.attrValues (builtins.fromJSON ${self.legacyPackages.${system}.lib.strings.escapeNixString (toJSON overlayPaths)})) |
| @@ -167,7 +180,11 @@ | |||
| 167 | 180 | ||
| 168 | apps = activateNixosConfigurations; | 181 | apps = activateNixosConfigurations; |
| 169 | 182 | ||
| 170 | devShells = forAllSystems (system: systemPkgs: { default = import ./shell.nix { pkgs = self.legacyPackages.${system}; deploy-rs = deploy-rs.defaultPackage.${system}; }; }); | 183 | devShells = forAllSystems (system: systemPkgs: { default = import ./shell.nix { |
| 184 | pkgs = self.legacyPackages.${system}; | ||
| 185 | deploy-rs = deploy-rs.packages.${system}.deploy-rs; | ||
| 186 | nvfetcher = nvfetcher.defaultPackage.${system}; | ||
| 187 | };}); | ||
| 171 | 188 | ||
| 172 | templates.default = { | 189 | templates.default = { |
| 173 | path = ./.; | 190 | path = ./.; |
