mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-01-30 22:57:55 +00:00
lib: standardize the required arguments
Just to make it consistent.
This commit is contained in:
parent
d183306336
commit
40352d6a74
@ -1,43 +1,14 @@
|
|||||||
# All of the functions suitable only for NixOS.
|
# All of the functions suitable only for NixOS.
|
||||||
{ pkgs, config, lib }:
|
{ pkgs, lib }:
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
# This is only used for home-manager users without a NixOS user counterpart.
|
|
||||||
mapHomeManagerUser = user: settings:
|
|
||||||
let
|
|
||||||
homeDirectory = "/home/${user}";
|
|
||||||
defaultUserConfig = {
|
|
||||||
extraGroups = pkgs.lib.mkDefault [ "wheel" ];
|
|
||||||
createHome = pkgs.lib.mkDefault true;
|
|
||||||
home = pkgs.lib.mkDefault homeDirectory;
|
|
||||||
isNormalUser = pkgs.lib.mkForce true;
|
|
||||||
};
|
|
||||||
in
|
|
||||||
({ lib, ... }: {
|
|
||||||
home-manager.users."${user}" = { ... }: {
|
|
||||||
imports = [
|
|
||||||
{
|
|
||||||
home.username = user;
|
|
||||||
home.homeDirectory = homeDirectory;
|
|
||||||
}
|
|
||||||
|
|
||||||
../configs/home-manager/${user}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
users.users."${user}" = lib.mkMerge [
|
|
||||||
defaultUserConfig
|
|
||||||
settings
|
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|
||||||
# Checks if the NixOS configuration is part of the nixos-generator build.
|
# Checks if the NixOS configuration is part of the nixos-generator build.
|
||||||
# Typically, we just check if there's a certain attribute that is imported
|
# Typically, we just check if there's a certain attribute that is imported
|
||||||
# from it.
|
# from it.
|
||||||
hasNixosFormat =
|
hasNixosFormat = config:
|
||||||
pkgs.lib.hasAttrByPath [ "formatAttr" ] config;
|
pkgs.lib.hasAttrByPath [ "formatAttr" ] config;
|
||||||
|
|
||||||
# Checks if the NixOS config is being built for a particular format.
|
# Checks if the NixOS config is being built for a particular format.
|
||||||
isFormat = format:
|
isFormat = config: format:
|
||||||
hasNixosFormat && config.formatAttr == format;
|
hasNixosFormat config && config.formatAttr == format;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{ config, pkgs, lib }:
|
{ pkgs, lib }:
|
||||||
|
|
||||||
{
|
{
|
||||||
isStandalone =
|
isStandalone = config:
|
||||||
!config?hmConfig && !config?nixosConfig && !config?darwinConfig;
|
!config?hmConfig && !config?nixosConfig && !config?darwinConfig;
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
# All of the extra module arguments to be passed as part of the home-manager
|
# All of the extra module arguments to be passed as part of the home-manager
|
||||||
# environment.
|
# environment.
|
||||||
{ options, pkgs, lib, ... }:
|
{ pkgs, lib, options, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
foodogsquaredLib = import ../../../lib { inherit pkgs; };
|
foodogsquaredLib = import ../../../lib { inherit pkgs; };
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
_module.args.foodogsquaredLib =
|
_module.args.foodogsquaredLib =
|
||||||
foodogsquaredLib.extend (final: prev:
|
foodogsquaredLib.extend (final: prev: {
|
||||||
import ../../../lib/home-manager.nix { inherit pkgs; lib = prev; }
|
home-manager = import ../../../lib/home-manager.nix { inherit pkgs; lib = prev; };
|
||||||
// lib.optionalAttrs (options?sops) {
|
} // lib.optionalAttrs (options?sops) {
|
||||||
sops-nix = import ../../../lib/sops.nix { inherit pkgs; lib = prev; };
|
sops-nix = import ../../../lib/sops.nix { inherit pkgs; lib = prev; };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
# All of the extra module arguments to be passed as part of the holistic NixOS
|
# All of the extra module arguments to be passed as part of the holistic NixOS
|
||||||
# system.
|
# system.
|
||||||
{ config, options, lib, pkgs, ... }:
|
{ pkgs, lib, options, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
foodogsquaredLib = import ../../../lib { inherit pkgs; };
|
foodogsquaredLib = import ../../../lib { inherit pkgs; };
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
_module.args.foodogsquaredLib =
|
_module.args.foodogsquaredLib =
|
||||||
foodogsquaredLib.extend (final: prev:
|
foodogsquaredLib.extend (final: prev: {
|
||||||
import ../../../lib/nixos.nix { inherit pkgs config; lib = prev; }
|
nixos = import ../../../lib/nixos.nix { inherit pkgs; lib = final; };
|
||||||
// lib.optionalAttrs (options?sops) {
|
} // lib.optionalAttrs (options?sops) {
|
||||||
sops-nix = import ../../../lib/sops.nix { inherit pkgs; lib = prev; };
|
sops-nix = import ../../../lib/sops.nix { inherit pkgs; lib = final; };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ let
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
_module.args.foodogsquaredLib =
|
_module.args.foodogsquaredLib =
|
||||||
foodogsquaredLib.extend (final: prev:
|
foodogsquaredLib.extend (final: prev: {
|
||||||
import ../../../lib/nixvim.nix { inherit config pkgs; lib = prev; });
|
nixvim = import ../../../lib/nixvim.nix { inherit pkgs; lib = prev; };
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user