lib.helpers
lib.helpers:
Section titled “lib.helpers:”lib.helpers.mkPub
Section titled “lib.helpers.mkPub”Create a public key for a given host
Arguments
Section titled “Arguments”- [host] the host to create the public key for
- [key] this is a attrset with the key type and key
mkPub :: (String -> AttrSet -> AttrSet) -> String -> AttrSet -> AttrSetExample
Section titled “Example”mkPub "github.com" { type = "rsa"; key = "AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==";}=> { "github.com-rsa" = { hostNames = [ "github.com" ]; publicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ=="; };}lib.helpers.mkPubs
Section titled “lib.helpers.mkPubs”Create public keys for a given host
Arguments
Section titled “Arguments”- [host] the host to create the public keys for
- [keys] the list of keys to create
mkPubs :: (String -> List) -> String -> List -> AttrSetExample
Section titled “Example”mkPubs "github.com" [ { type = "rsa"; key = "AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ=="; } { type = "ed25519"; key = "AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl"; }]=> { "github.com-ed25519" = { hostNames = [ "github.com" ]; publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl"; }; "github.com-rsa" = { hostNames = [ "github.com" ]; publicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ=="; };}lib.helpers.giturl
Section titled “lib.helpers.giturl”Create git url aliases for a given domain
Arguments
Section titled “Arguments”- [domain] the domain to create the alias for
- [alias] the alias to use
- [user] the user to use, this defaults to “git”
- [port] the port to use, this is optional
giturl :: (String -> String -> String -> Int) -> AttrSetExample
Section titled “Example”giturl { domain = "github.com"; alias = "gh"; }=> { "https://github.com/".insteadOf = "gh:"; "ssh://git@github.com/".pushInsteadOf = "gh:";}lib.helpers.filterNixFiles
Section titled “lib.helpers.filterNixFiles”filter files for the .nix suffix
Arguments
Section titled “Arguments”- [k] they key, which is the file name
- [v] the value, which is the type of the file
filterNixFiles :: String -> String -> BoolExample
Section titled “Example”filterNixFiles "default.nix" "regular"=> truelib.helpers.importNixFiles
Section titled “lib.helpers.importNixFiles”Import all file that filterNixFiles allows for
Arguments
Section titled “Arguments”- [path] the path to the directory
importNixFiles :: String -> ListExample
Section titled “Example”importNixFiles ./.=> [ {...} ]lib.helpers.importNixFilesAndDirs
Section titled “lib.helpers.importNixFilesAndDirs”import all nix files and directories
Arguments
Section titled “Arguments”- [dir] the directory to search for nix files
importNixFilesAndDirs :: String -> ListExample
Section titled “Example”importNixFilesAndDirs ./.=> [ "flake.nix" ]lib.helpers.boolToNum
Section titled “lib.helpers.boolToNum”return an int based on boolean value
Arguments
Section titled “Arguments”- [bool] the boolean value
boolToNum :: Bool -> IntExample
Section titled “Example”boolToNum true=> 1lib.helpers.containsStrings
Section titled “lib.helpers.containsStrings”a function that checks if a list contains a list of given strings
Arguments
Section titled “Arguments”- [list] the list to search in
- [targetStrings] the list of strings to search for
containsStrings :: List -> List -> BoolExample
Section titled “Example”containsStrings ["a" "b" "c"] ["a" "b"]=> truelib.helpers.indexOf
Section titled “lib.helpers.indexOf”a function that returns the index of an element in a list
Arguments
Section titled “Arguments”- [list] the list to search in
- [elem] the element to search for
indexOf :: List -> Any -> IntExample
Section titled “Example”indexOf [1 2 3] 2=> 1lib.helpers.intListToStringList
Section titled “lib.helpers.intListToStringList”convert a list of integers to a list of string
Arguments
Section titled “Arguments”- [list] the list of integers
intListToStringList :: List -> ListExample
Section titled “Example”intListToStringList [1 2 3]=> ["1" "2" "3"]