modules: fix custom library

This commit is contained in:
Gabriel Arazas 2024-02-25 22:27:05 +08:00
parent 5af7ac1c3d
commit ac036d10a9
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
8 changed files with 31 additions and 31 deletions

View File

@ -1,7 +1,7 @@
# The entrypoint for our custom library set.
{ lib }:
{ pkgs }:
lib.makeExtensible
pkgs.lib.makeExtensible
(self:
rec {
/* Count the attributes with the given predicate.
@ -14,8 +14,8 @@ lib.makeExtensible
=> 1
*/
countAttrs = pred: attrs:
lib.count (attr: pred attr.name attr.value)
(lib.mapAttrsToList lib.nameValuePair attrs);
pkgs.lib.count (attr: pred attr.name attr.value)
(pkgs.lib.mapAttrsToList pkgs.lib.nameValuePair attrs);
/* Returns the file path of the given config of the given environment.

View File

@ -1,5 +1,5 @@
# Custom libraries for home-manager library.
{ lib }:
{ pkgs, lib }:
rec {
/*
@ -15,7 +15,7 @@ rec {
# The default value when `attrPath` is missing.
default:
attrs ? nixosConfig && lib.attrByPath attrPath default attrs;
attrs ? nixosConfig && pkgs.lib.attrByPath attrPath default attrs;
hasDarwinConfigAttr =
# The configuration attribute set of the home-manager configuration.
@ -26,7 +26,7 @@ rec {
# The default value when `attrPath` is missing.
default:
attrs ? darwinConfig && lib.attrByPath attrPath default attrs;
attrs ? darwinConfig && pkgs.lib.attrByPath attrPath default attrs;
/*
A quick function to check if the optional NixOS system module is enabled.

View File

@ -1,5 +1,5 @@
# All of the functions suitable only for NixOS.
{ lib }:
{ pkgs, lib }:
rec {
# This is only used for home-manager users without a NixOS user counterpart.
@ -7,10 +7,10 @@ rec {
let
homeDirectory = "/home/${user}";
defaultUserConfig = {
extraGroups = lib.mkDefault [ "wheel" ];
createHome = lib.mkDefault true;
home = lib.mkDefault homeDirectory;
isNormalUser = lib.mkForce true;
extraGroups = pkgs.lib.mkDefault [ "wheel" ];
createHome = pkgs.lib.mkDefault true;
home = pkgs.lib.mkDefault homeDirectory;
isNormalUser = pkgs.lib.mkForce true;
};
in
({ lib, ... }: {

View File

@ -1,4 +1,4 @@
{ config, lib }:
{ config, pkgs, lib }:
{
isStandalone =

View File

@ -1,5 +1,5 @@
# A library specifically for environments with sops-nix.
{ lib }:
{ pkgs, lib }:
{
/* Get the secrets from a given sops file. This will set the individual
@ -21,7 +21,7 @@
let
getKey = key: { inherit key sopsFile; };
in
lib.mapAttrs
pkgs.lib.mapAttrs
(path: attrs:
(getKey path) // attrs)
secrets;
@ -44,9 +44,9 @@
}))
*/
attachSopsPathPrefix = prefix: secrets:
lib.mapAttrs'
pkgs.lib.mapAttrs'
(key: settings:
lib.nameValuePair
pkgs.lib.nameValuePair
"${prefix}/${key}"
({ inherit key; } // settings))
secrets;

View File

@ -1,15 +1,15 @@
# All of the extra module arguments to be passed as part of the home-manager
# environment.
{ options, lib, ... }:
{ options, pkgs, lib, ... }:
let
foodogsquaredLib = import ../../../lib { inherit lib; };
foodogsquaredLib = import ../../../lib { inherit pkgs; };
in
{
_module.args.foodogsquaredLib =
foodogsquaredLib.extend (self:
import ../../../lib/home-manager.nix { inherit lib; }
foodogsquaredLib.extend (final: prev:
import ../../../lib/home-manager.nix { inherit pkgs; lib = prev; }
// lib.optionalAttrs (options?sops) {
sops-nix = import ../../../lib/sops.nix { inherit lib; };
sops-nix = import ../../../lib/sops.nix { inherit pkgs; lib = prev; };
});
}

View File

@ -1,15 +1,15 @@
# All of the extra module arguments to be passed as part of the holistic NixOS
# system.
{ options, lib, ... }:
{ options, lib, pkgs, ... }:
let
foodogsquaredLib = import ../../../lib { inherit lib; };
foodogsquaredLib = import ../../../lib { inherit pkgs; };
in
{
_module.args.foodogsquaredLib =
foodogsquaredLib.extend (self:
import ../../../lib/nixos.nix { inherit lib; }
foodogsquaredLib.extend (final: prev:
import ../../../lib/nixos.nix { inherit pkgs; lib = prev; }
// lib.optionalAttrs (options?sops) {
sops-nix = import ../../../lib/sops.nix { inherit lib; };
sops-nix = import ../../../lib/sops.nix { inherit pkgs; lib = prev; };
});
}

View File

@ -1,11 +1,11 @@
# All of the extra module arguments to be passed as part of NixVim module.
{ options, lib, ... }:
{ options, config, lib, pkgs, ... }:
let
foodogsquaredLib = import ../../../lib { inherit lib; };
foodogsquaredLib = import ../../../lib { inherit pkgs; };
in
{
_module.args.foodogsquaredLib =
foodogsquaredLib.extend (self:
import ../../../lib/nixvim.nix { inherit lib; });
foodogsquaredLib.extend (final: prev:
import ../../../lib/nixvim.nix { inherit config pkgs; lib = prev; });
}