From 1e7de7c2823a9beea7103249b732f14b1b1e8f78 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 13 Mar 2022 18:35:03 +0100 Subject: nvfetcher --- flake.nix | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 5a62065d..f5008748 100644 --- a/flake.nix +++ b/flake.nix @@ -29,9 +29,16 @@ ref = "master"; inputs.nixpkgs.follows = "nixpkgs"; }; + nvfetcher = { + type = "github"; + owner = "berberman"; + repo = "nvfetcher"; + ref = "master"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = { self, nixpkgs, home-manager, sops-nix, deploy-rs, ... }@inputs: + outputs = { self, nixpkgs, home-manager, sops-nix, deploy-rs, nvfetcher, ... }@inputs: let inherit (builtins) attrNames attrValues elemAt toJSON isNull pathExists; inherit (nixpkgs) lib; @@ -48,6 +55,10 @@ accountName' = splitString "@" accountName; in elemAt accountName' 1; + mkSources = pkgs: optionalAttrs (pathExists _sources/generated.nix) { sources = pkgs.callPackage _sources/generated.nix {}; }; + + mkOverlay = path: final: prev: import path ({ inherit final; inherit prev; } // mkSources prev); + mkNixosConfiguration = addProfiles: dir: path: hostName: nixosSystem rec { specialArgs = { flake = self; @@ -61,9 +72,11 @@ ]; local = dir + "/${path}"; - argsModule._module.args = { - customUtils = utils; - inherit hostName; + argsModule = { pkgs, ... }: { + _module.args = { + customUtils = utils; + inherit hostName; + } // mkSources pkgs; }; accountModules = attrValues (filterAttrs accountMatchesHost self.nixosModules.accounts); accountMatchesHost = n: _v: accountHostName n == hostName; @@ -154,7 +167,7 @@ homeConfigurations = listToAttrs (concatLists (mapAttrsToList (hostname: nixosConfig: mapAttrsToList (username: configuration: nameValuePair "${username}@${hostname}" { inherit (configuration.home) activationPackage; }) nixosConfig.config.home-manager.users) self.nixosConfigurations)); overlays = let - overlays = mapAttrs (_name: path: import path) overlayPaths; + overlays = mapAttrs (_name: path: mkOverlay path) overlayPaths; in overlays // { default = final: prev: composeManyExtensions (attrValues overlays) final prev; }; overlays-path = forAllSystems (system: _: self.legacyPackages.${system}.writeText "overlays.nix" '' map import (builtins.attrValues (builtins.fromJSON ${self.legacyPackages.${system}.lib.strings.escapeNixString (toJSON overlayPaths)})) @@ -167,7 +180,11 @@ apps = activateNixosConfigurations; - devShells = forAllSystems (system: systemPkgs: { default = import ./shell.nix { pkgs = self.legacyPackages.${system}; deploy-rs = deploy-rs.defaultPackage.${system}; }; }); + devShells = forAllSystems (system: systemPkgs: { default = import ./shell.nix { + pkgs = self.legacyPackages.${system}; + deploy-rs = deploy-rs.packages.${system}.deploy-rs; + nvfetcher = nvfetcher.defaultPackage.${system}; + };}); templates.default = { path = ./.; -- cgit v1.2.3