mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-04-25 00:19:12 +00:00
lib: set as fixed point
This commit is contained in:
parent
8377dba214
commit
29b7b302e1
@ -1,7 +1,9 @@
|
|||||||
# All of the custom functions suitable for all environments.
|
# The entrypoint for our custom library set.
|
||||||
{ lib }:
|
{ lib }:
|
||||||
|
|
||||||
rec {
|
lib.makeExtensible
|
||||||
|
(self:
|
||||||
|
rec {
|
||||||
/* Count the attributes with the given predicate.
|
/* Count the attributes with the given predicate.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
@ -15,7 +17,26 @@ rec {
|
|||||||
lib.count (attr: pred attr.name attr.value)
|
lib.count (attr: pred attr.name attr.value)
|
||||||
(lib.mapAttrsToList lib.nameValuePair attrs);
|
(lib.mapAttrsToList lib.nameValuePair attrs);
|
||||||
|
|
||||||
|
/* 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};
|
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};
|
getUser = type: user: ../configs/${type}/_users/${user};
|
||||||
}
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user