Personal Nix flake
nixos home-manager nix
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor: Split default library file

Create flake, packages and services namespaces

Selectively inherit some of the less niche functions to the root level

+89 -67
+4 -2
nix/flakeModules/agenixRekey.nix
··· 2 2 inputs, 3 3 self, 4 4 ... 5 - }: { 5 + }: let 6 + inherit (self.lib) getStandaloneHomeConfigurations; 7 + in { 6 8 imports = [ 7 9 inputs.agenix-rekey.flakeModule 8 10 ]; ··· 11 13 agenix-rekey = { 12 14 inherit (self) nixosConfigurations; 13 15 agePackage = pkgs.rage; 14 - homeConfigurations = self.lib.getStandaloneHomeConfigurations self; 16 + homeConfigurations = getStandaloneHomeConfigurations self; 15 17 }; 16 18 }; 17 19 }
+2 -1
nix/legacyPackages/ciMatrix.nix
··· 5 5 ... 6 6 }: let 7 7 inherit (self) systems; 8 + inherit (self.lib) getStandaloneHomeConfigurations; 8 9 getOutputInfo = mkDerivationPath: output: 9 10 lib.mapAttrsToList (name: drv: { 10 11 inherit name; ··· 44 45 infos; 45 46 ciInfo = { 46 47 homeConfigurations = 47 - (self.lib.getStandaloneHomeConfigurations self) 48 + (getStandaloneHomeConfigurations self) 48 49 |> filterToBuild 49 50 |> getOutputInfo (name: ".#homeConfigurations.${name}.activationPackage") 50 51 |> spreadBranchOrDefault [];
+19 -62
nix/lib/default.nix
··· 1 - {inputs, ...} @ topLevelArgs: let 2 - inherit (inputs.nixpkgs) lib; 3 - args = topLevelArgs // {inherit lib;}; 4 - overlays = builtins.attrValues inputs.self.overlays; 5 - in { 1 + { 2 + inputs, 3 + lib, 4 + self, 5 + ... 6 + } @ args: { 6 7 config = import ./config.nix args; 8 + flake = import ./flake.nix args; 9 + packages = import ./packages.nix args; 7 10 secrets = import ./secrets.nix; 11 + services = import ./services.nix args; 8 12 storage = import ./storage args; 9 13 strings = import ./strings.nix args; 10 14 11 - mkPkgs = { 12 - system, 13 - nixpkgs ? inputs.nixpkgs, 14 - }: 15 - import nixpkgs { 16 - inherit system overlays; 17 - allowUnfree = true; 18 - }; 19 - callPackageWith = pkgs: path: extraArgs: 20 - lib.callPackageWith 21 - pkgs 22 - ( 23 - if (lib.pathIsDirectory path && builtins.pathExists "${path}/package.nix") 24 - then "${path}/package.nix" 25 - else if (lib.pathIsDirectory path && builtins.pathExists "${path}/default.nix") 26 - then "${path}/default.nix" 27 - else path 28 - ) 29 - extraArgs; 30 - callPackageRecursiveWith = pkgs: path: extraArgs: 31 - lib.packagesFromDirectoryRecursive { 32 - callPackage = lib.callPackageWith (pkgs // extraArgs); 33 - directory = path; 34 - } 35 - |> lib.filterAttrsRecursive (name: _: name != "default"); 15 + inherit 16 + (self.lib.flake) 17 + getStandaloneHomeConfigurations 18 + ; 19 + inherit 20 + (self.lib.packages) 21 + callPackageRecursiveWith 22 + callPackageWith 23 + mkPkgs 24 + ; 36 25 37 - getStandaloneHomeConfigurations = self: 38 - self.homeConfigurations 39 - |> lib.filterAttrs (name: _: self.lib.isStandaloneHome self.nixosConfigurations name); 40 - isStandaloneHome = nixosConfigurations: name: 41 - !(nixosConfigurations ? ${name |> lib.splitString "@" |> lib.last}); 42 - 43 - isNvidia = config: let 44 - drivers = config.services.xserver.videoDrivers or []; 45 - in 46 - builtins.elem "nvidia" drivers; 47 26 carapaceSpecFromNuScript = script: let 48 27 inherit (script) name system; 49 28 inherit (inputs.self.legacyPackages.${system}) scripts pkgs; ··· 62 41 | nu-generate-carapace-spec \ 63 42 > $out 64 43 ''; 65 - 66 44 nixFilesToAttrs = path: 67 45 builtins.readDir path 68 46 |> lib.filterAttrs (name: type: type == "regular" && lib.hasSuffix ".nix" name && name != "default.nix") 69 47 |> lib.concatMapAttrs (relativePath: _: { 70 48 ${relativePath |> lib.removeSuffix ".nix"} = path + /${relativePath}; 71 49 }); 72 - 73 - mkOneShotBootService = 74 - lib.recursiveUpdate 75 - { 76 - serviceConfig.Type = "oneshot"; 77 - wantedBy = ["default.target"]; 78 - }; 79 - mkOneShotSleepService = 80 - lib.recursiveUpdate 81 - { 82 - unitConfig = { 83 - DefaultDependencies = "no"; 84 - StopWhenUnneeded = "yes"; 85 - }; 86 - serviceConfig = { 87 - Type = "oneshot"; 88 - RemainAfterExit = "yes"; 89 - }; 90 - before = ["sleep.target"]; 91 - wantedBy = ["sleep.target"]; 92 - }; 93 50 }
+7
nix/lib/flake.nix
··· 1 + {lib, ...}: { 2 + getStandaloneHomeConfigurations = self: 3 + self.homeConfigurations 4 + |> lib.filterAttrs (name: _: self.lib.isStandaloneHome self.nixosConfigurations name); 5 + isStandaloneHome = nixosConfigurations: name: 6 + !(nixosConfigurations ? ${name |> lib.splitString "@" |> lib.last}); 7 + }
+33
nix/lib/packages.nix
··· 1 + { 2 + inputs, 3 + lib, 4 + ... 5 + }: let 6 + overlays = builtins.attrValues inputs.self.overlays; 7 + in { 8 + callPackageRecursiveWith = pkgs: path: extraArgs: 9 + lib.packagesFromDirectoryRecursive { 10 + callPackage = lib.callPackageWith (pkgs // extraArgs); 11 + directory = path; 12 + } 13 + |> lib.filterAttrsRecursive (name: _: name != "default"); 14 + callPackageWith = pkgs: path: extraArgs: 15 + lib.callPackageWith 16 + pkgs 17 + ( 18 + if (lib.pathIsDirectory path && builtins.pathExists "${path}/package.nix") 19 + then "${path}/package.nix" 20 + else if (lib.pathIsDirectory path && builtins.pathExists "${path}/default.nix") 21 + then "${path}/default.nix" 22 + else path 23 + ) 24 + extraArgs; 25 + mkPkgs = { 26 + system, 27 + nixpkgs ? inputs.nixpkgs, 28 + }: 29 + import nixpkgs { 30 + inherit system overlays; 31 + allowUnfree = true; 32 + }; 33 + }
+22
nix/lib/services.nix
··· 1 + {lib, ...}: { 2 + mkOneShotBootService = 3 + lib.recursiveUpdate 4 + { 5 + serviceConfig.Type = "oneshot"; 6 + wantedBy = ["default.target"]; 7 + }; 8 + mkOneShotSleepService = 9 + lib.recursiveUpdate 10 + { 11 + unitConfig = { 12 + DefaultDependencies = "no"; 13 + StopWhenUnneeded = "yes"; 14 + }; 15 + serviceConfig = { 16 + Type = "oneshot"; 17 + RemainAfterExit = "yes"; 18 + }; 19 + before = ["sleep.target"]; 20 + wantedBy = ["sleep.target"]; 21 + }; 22 + }
+1 -1
nix/nixos/profiles/formfactor/desktop.nix
··· 6 6 pkgs, 7 7 ... 8 8 }: let 9 - inherit (inputs.self.lib) mkOneShotBootService; 9 + inherit (inputs.self.lib.services) mkOneShotBootService; 10 10 cfg = config.my.profiles.formfactor.desktop; 11 11 in { 12 12 options.my.profiles.formfactor.desktop = lib.mkEnableOption "desktop profile";
+1 -1
nix/nixos/profiles/hardware/rgb.nix
··· 5 5 pkgs, 6 6 ... 7 7 }: let 8 - inherit (inputs.self.lib) mkOneShotSleepService; 8 + inherit (inputs.self.lib.services) mkOneShotSleepService; 9 9 inherit (config.services.hardware.openrgb) package; 10 10 cfg = config.my.profiles.hardware.rgb; 11 11 in {