Personal Nix flake
nixos home-manager nix
1
fork

Configure Feed

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

refactor: Minor fixes and tweaks

Rename nix/modules to the more appropriate nix/flakeModules

Move systems to an output instead of a privileged arg

Fix lib.loaders.load to actually take the filterFn into account

+35 -30
+4 -3
flake.nix
··· 6 6 {inherit inputs;} 7 7 ({flake-parts-lib, ...}: let 8 8 inherit (flake-parts-lib) importApply; 9 - import' = path: import path {inherit inputs systems;}; 10 - importApply' = path: importApply path {inherit inputs systems;}; 9 + import' = path: import path {inherit inputs;}; 10 + importApply' = path: importApply path {inherit inputs;}; 11 11 systems = ["aarch64-linux" "x86_64-linux"]; 12 12 in { 13 13 inherit systems; 14 14 imports = [ 15 + (importApply' ./nix/flakeModules) 15 16 (importApply' ./nix/apps) 16 - (importApply' ./nix/modules) 17 17 (importApply' ./nix/overlays) 18 18 (importApply' ./nix/packages) 19 19 (importApply' ./nix/legacyPackages) ··· 32 32 }; 33 33 }; 34 34 flake = { 35 + inherit systems; 35 36 lib = import' ./nix/lib; 36 37 schemas = 37 38 inputs.flake-schemas.schemas
+1 -1
nix/apps/default.nix
··· 1 1 args: { 2 2 imports = [ 3 3 ./assets.nix 4 - (import ./ci.nix args) 4 + ./ci.nix 5 5 ]; 6 6 }
+2 -5
nix/legacyPackages/ciMatrix.nix
··· 1 - { 2 - inputs, 3 - systems, 4 - ... 5 - }: let 1 + {inputs, ...}: let 6 2 inherit (inputs) self; 3 + inherit (self) systems; 7 4 in { 8 5 perSystem = { 9 6 lib,
+2 -2
nix/legacyPackages/default.nix
··· 1 1 args: { 2 2 imports = [ 3 - (import ./ciMatrix.nix args) 4 - (import ./scripts args) 3 + ./ciMatrix.nix 4 + ./scripts 5 5 ]; 6 6 }
+3
nix/legacyPackages/scripts/default.nix
··· 1 1 args: let 2 2 inherit ((import ../../lib args).loaders) loadNonDefault; 3 3 in { 4 + # For reasons beyond my understanding, removing an argument from the attribute 5 + # set here stops it from propagating to the loaded files even if the whole 6 + # systemArgs is used as an argument 4 7 perSystem = { 5 8 self', 6 9 pkgs,
+23 -19
nix/lib/loaders.nix
··· 27 27 else (path + /${name}))) 28 28 |> (lib.concatMapAttrs (name: path: {${lib.removeSuffix ".nix" name} = path;})) 29 29 )) 30 - |> (attr: builtins.removeAttrs attr ["default" "default.nix"]) 30 + |> (attr: removeAttrs attr ["default" "default.nix"]) 31 31 |> (lib.filterAttrsRecursive (_: path: filterFn path)); 32 32 33 33 # Lists files as paths ··· 40 40 |> (lib.collect builtins.isPath) 41 41 |> (builtins.filter (path: 42 42 path 43 - |> builtins.toString 43 + |> toString 44 44 |> filterFn)) 45 - |> (builtins.map ( 45 + |> (map ( 46 46 path: 47 47 path 48 - |> builtins.toString 48 + |> toString 49 49 |> (lib.removeSuffix "/default.nix") 50 50 |> (x: /. + x) 51 51 )); ··· 84 84 importDefault = path: args: 85 85 path 86 86 |> listDefault 87 - |> (builtins.map (path: import path args)); 87 + |> (map (path: import path args)); 88 88 89 89 # Imports modules not ending in default.nix 90 90 importNonDefault = path: args: 91 91 path 92 92 |> listNonDefault 93 - |> (builtins.map (path: import path args)); 93 + |> (map (path: import path args)); 94 94 95 95 # Loads modules while preserving directory structure 96 96 load = { 97 97 path, 98 98 args, 99 99 filterFn ? (x: true), 100 - loader ? inputs.haumea.lib.loaders.default, 101 100 }: 102 - path 103 - |> (path: 104 - inputs.haumea.lib.load { 105 - inherit loader; 106 - src = path; 107 - inputs = args; 108 - }) 109 - |> (attr: builtins.removeAttrs attr ["default"]); 101 + read { 102 + inherit path filterFn; 103 + recursive = true; 104 + } 105 + |> (lib.mapAttrsRecursiveCond 106 + builtins.isAttrs 107 + (_: x: let 108 + mod = import x; 109 + in 110 + if builtins.isAttrs mod 111 + then mod 112 + else mod args)) 113 + |> (attr: removeAttrs attr ["default"]); 110 114 111 115 # Loads files ending in default.nix while preserving directory structure 112 116 loadDefault = path: args: 113 117 load { 114 - inherit args path; 118 + inherit path args; 115 119 filterFn = lib.hasSuffix "default.nix"; 116 120 }; 117 121 118 122 # Loads files not ending in default.nix while preserving directory structure 119 123 loadNonDefault = path: args: 120 124 load { 121 - inherit args path; 125 + inherit path args; 122 126 filterFn = path: ! (lib.hasSuffix "default.nix" path); 123 127 }; 124 128 ··· 131 135 filterFn = lib.hasSuffix "default.nix"; 132 136 }) 133 137 |> (builtins.mapAttrs (_: path: 134 - lib.callPackageWith (builtins.removeAttrs pkgs ["root"]) path {})); 138 + lib.callPackageWith (removeAttrs pkgs ["root"]) path {})); 135 139 136 140 # Runs callPackage on files not ending in default.nix, always recursive 137 141 callPackageNonDefault = path: pkgs: ··· 142 146 filterFn = path: ! (lib.hasSuffix "default.nix" path); 143 147 }) 144 148 |> (builtins.mapAttrs (_: path: 145 - lib.callPackageWith (builtins.removeAttrs pkgs ["root"]) path {})); 149 + lib.callPackageWith (removeAttrs pkgs ["root"]) path {})); 146 150 }
nix/modules/default.nix nix/flakeModules/default.nix
nix/modules/ezConfigs.nix nix/flakeModules/ezConfigs.nix
nix/modules/gitHooks.nix nix/flakeModules/gitHooks.nix
nix/modules/just.nix nix/flakeModules/just.nix