Update library to be more concise with its inputs

This commit is contained in:
Gabriel Arazas 2022-01-07 11:08:50 +08:00
parent 2e182005ed
commit 9ab450a741
3 changed files with 9 additions and 6 deletions

View File

@ -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.

View File

@ -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};

View File

@ -1,5 +1,5 @@
# A list of utilities specifically in my flake output.
{ lib, inputs, ... }:
{ lib, inputs }:
let
# Default system for our host configuration.