Add custom lib
This commit is contained in:
parent
8f97bc80e3
commit
2240c4e256
3 changed files with 22 additions and 0 deletions
|
|
@ -157,6 +157,7 @@
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
flakeSelf = self;
|
flakeSelf = self;
|
||||||
};
|
};
|
||||||
|
lib = import ./lib {nixpkgs = pkgs;};
|
||||||
modules =
|
modules =
|
||||||
[
|
[
|
||||||
agenix.nixosModules.default
|
agenix.nixosModules.default
|
||||||
|
|
|
||||||
8
lib/default.nix
Normal file
8
lib/default.nix
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
{nixpkgs}:
|
||||||
|
nixpkgs.lib.extend (final: prev: {
|
||||||
|
toast = let
|
||||||
|
importLib = file: import file {lib = final;};
|
||||||
|
in {
|
||||||
|
patches = importLib ./patches.nix;
|
||||||
|
};
|
||||||
|
})
|
||||||
13
lib/patches.nix
Normal file
13
lib/patches.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
{lib}: {
|
||||||
|
/**
|
||||||
|
Get a list of patches from a path.
|
||||||
|
*/
|
||||||
|
patchesInPath = path: let
|
||||||
|
pathContents = builtins.readDir path;
|
||||||
|
filter = name: value:
|
||||||
|
(value == "regular" || value == "symlink") && lib.strings.hasSuffix ".patch" name;
|
||||||
|
filteredContents = lib.attrsets.filterAttrs filter pathContents;
|
||||||
|
patchFilenames = builtins.attrNames filteredContents;
|
||||||
|
in
|
||||||
|
builtins.map (value: lib.path.append path value) patchFilenames;
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue