diff --git a/flake.nix b/flake.nix index 9259635b..ce96ddd0 100644 --- a/flake.nix +++ b/flake.nix @@ -128,10 +128,7 @@ in { # Exposes only my library with the custom functions to make it easier to # include in other flakes. - lib = import ./lib { - inherit inputs; - lib = nixpkgs.lib; - }; + lib = import ./lib { lib = nixpkgs.lib; }; # A list of NixOS configurations from the `./hosts` folder. It also has # some sensible default configurations. diff --git a/lib/default.nix b/lib/default.nix index 94b8b367..4ba26001 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,4 +1,5 @@ -{ lib, ... }: +# All of the custom functions used for this configuration. +{ lib }: rec { /* Create an attribute set that represents the structure of the modules @@ -109,6 +110,11 @@ rec { invalidUsernames = [ "config" "modules" ]; in lib.filterAttrs (n: _: !lib.elem n invalidUsernames && lib.elem n users) userModules; + + # Return the path of `user` from `type`. + getUser = type: user: + lib.getAttr user (getUsers type [ user ]); + # Return the path of `secrets` from `../secrets`. getSecret = path: ../secrets/${path}; diff --git a/lib/flake-utils.nix b/lib/flake-utils.nix index 12730ca3..554591e9 100644 --- a/lib/flake-utils.nix +++ b/lib/flake-utils.nix @@ -1,5 +1,5 @@ # A list of utilities specifically in my flake output. -{ lib, inputs, ... }: +{ lib, inputs }: let # Default system for our host configuration.