mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-01-30 22:57:55 +00:00
lib/trivial: move nixpkgs module functions to utils
This commit is contained in:
parent
20c0549706
commit
3e7cc9c7db
@ -1,7 +1,9 @@
|
||||
# The entrypoint for our custom library set. Take note, this is modularly
|
||||
# included as part of the environment so we cannot have any functions or
|
||||
# references that could make the evaluation go in an infinite recursion such as
|
||||
# a function that generates a valid nixpkgs module.
|
||||
# The entrypoint for our custom library set.
|
||||
#
|
||||
# Take note, this is modularly included as part of the environment so we cannot
|
||||
# have any functions or references that could make the evaluation go in an
|
||||
# infinite recursion such as a function that generates a valid nixpkgs module.
|
||||
# If you have to add those functions, you'll have to add them in configUtils.
|
||||
{ pkgs }:
|
||||
|
||||
pkgs.lib.makeExtensible
|
||||
@ -13,6 +15,6 @@ pkgs.lib.makeExtensible
|
||||
trivial = callLib ./trivial.nix;
|
||||
data = callLib ./data.nix;
|
||||
|
||||
inherit (self.trivial) countAttrs getConfig getUser;
|
||||
inherit (self.trivial) countAttrs;
|
||||
inherit (self.data) importYAML renderTeraTemplate;
|
||||
})
|
||||
|
@ -14,26 +14,11 @@
|
||||
lib.count (attr: pred attr.name attr.value)
|
||||
(lib.mapAttrsToList lib.nameValuePair attrs);
|
||||
|
||||
/* Returns the file path of the given config of the given environment.
|
||||
|
||||
Type: getConfig :: String -> String -> Path
|
||||
/* Filters and groups the attribute set into two separate attribute.
|
||||
|
||||
Example:
|
||||
getConfig "home-manager" "foo-dogsquared"
|
||||
=> ../configs/home-manager/foo-dogsquared
|
||||
filterAttrs' (n: v: v == 4) { a = 4; b = 2; c = 6; }
|
||||
=> { ok = { a = 4; }; reject = { b = 2; c = 6; }; }
|
||||
*/
|
||||
getConfig = type: config: ../configs/${type}/${config};
|
||||
|
||||
|
||||
/* Returns the file path of the given user subpart of the given
|
||||
environment. Only certain environments such as NixOS have this type of
|
||||
setup.
|
||||
|
||||
Type: getConfig :: String -> String -> Path
|
||||
|
||||
Example:
|
||||
getUser "nixos" "foo-dogsquared"
|
||||
=> ../configs/nixos/_users/foo-dogsquared
|
||||
*/
|
||||
getUser = type: user: ../configs/${type}/_users/${user};
|
||||
filterAttrs' = f: attrs: { };
|
||||
}
|
||||
|
@ -30,4 +30,25 @@
|
||||
];
|
||||
});
|
||||
|
||||
/* Returns the file path of the given config of the given environment.
|
||||
|
||||
Type: getConfig :: String -> String -> Path
|
||||
|
||||
Example:
|
||||
getConfig "home-manager" "foo-dogsquared"
|
||||
=> ../configs/home-manager/foo-dogsquared
|
||||
*/
|
||||
getConfig = type: config: ../../configs/${type}/${config};
|
||||
|
||||
/* Returns the file path of the given user subpart of the given
|
||||
environment. Only certain environments such as NixOS have this type of
|
||||
setup.
|
||||
|
||||
Type: getConfig :: String -> String -> Path
|
||||
|
||||
Example:
|
||||
getUser "nixos" "foo-dogsquared"
|
||||
=> ../configs/nixos/_users/foo-dogsquared
|
||||
*/
|
||||
getUser = type: user: ../../configs/${type}/_users/${user};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user