♻️️ remove with lib; everywhere and partially switch to mkOpt

This commit is contained in:
Jo 2025-01-31 01:10:31 +01:00
parent c5283fe60b
commit 124d6b7ede
27 changed files with 72 additions and 53 deletions

View file

@ -1,9 +1,7 @@
{
lib,
pkgs,
namespace,
...
}: with lib; with lib.${namespace};
}:
{
# Declare user packages.
home.packages = with pkgs; [

View file

@ -1,8 +1,11 @@
{
lib,
...
}: with lib;
rec {
}:
let
inherit (lib) mkOption;
in
{
## Create a NixOS module option. (Stolen from Jake Hamilton)
##
## ```nix

View file

@ -5,12 +5,14 @@
osConfig,
namespace,
...
}: with lib; with lib.${namespace};
}:
let
inherit (lib) mkIf mkOption;
inherit (lib.${namespace}) mkOpt;
cfg = config.${namespace}.desktop.gnome;
in
{
options.${namespace}.desktop.gnome = with types; {
options.${namespace}.desktop.gnome = with lib.types; {
enabled-extensions = mkOption {
type = listOf package;
default = with pkgs.gnomeExtensions; [ dash-to-dock user-themes blur-my-shell appindicator unite color-picker clipboard-history ];
@ -19,7 +21,7 @@ in
};
favorite-apps = mkOption {
type = listOf str;
default = ["org.gnome.Nautilus.desktop" "obsidian.desktop" "zen.desktop" "dev.zed.Zed.desktop"];
default = ["org.gnome.Nautilus.desktop" "obsidian.desktop" "firefox.desktop" "dev.zed.Zed.desktop"];
example = ["org.gnome.Nautilus.desktop" "obsidian.desktop"];
description = "Specify your favorite apps (sorted left to right).";
};
@ -42,7 +44,7 @@ in
enable-blur = mkOpt bool false "Whether to enable blur-my-shell application blur.";
};
};
wallpaper = mkOpt str (builtins.toString ./wallpapers/abstract/amber-d.jxl) "Specify the path of your prefered Gnome wallpaper.";
wallpaper = mkOpt str (builtins.toString ./wallpapers/arcane/jinx_flare.jpg) "Specify the path of your prefered Gnome wallpaper.";
};
config = mkIf osConfig.${namespace}.desktop.gnome.enable {
@ -51,7 +53,7 @@ in
dconf.settings = {
"org/gnome/shell" = {
favorite-apps = cfg.favorite-apps;
enabled-extensions = forEach cfg.enabled-extensions (x: x.extensionUuid);
enabled-extensions = lib.forEach cfg.enabled-extensions (x: x.extensionUuid);
disabled-extensions = []; # Make sure none of our extensions are disabled on system rebuild
};
"org/gnome/shell/extensions/unite" = mkIf (builtins.elem pkgs.gnomeExtensions.unite cfg.enabled-extensions) {

View file

@ -1,15 +1,15 @@
{
lib,
namespace,
config,
pkgs,
...
}: with lib; with lib.${namespace};
}:
let
inherit (lib) mkOption;
palette = (pkgs.lib.importJSON (config.catppuccin.sources.palette + "/palette.json")).${config.catppuccin.flavor}.colors;
in
{
options.palette = mkOption { type = types.attrsOf types.raw; };
options.palette = mkOption { type = lib.types.attrsOf lib.types.raw; };
config = {
inherit palette;

View file

@ -4,8 +4,10 @@
config,
pkgs,
...
}: with lib; with lib.${namespace};
}:
let
inherit (lib) mkEnableOption mkIf;
# Stolen from Oli @ git.gay, basically just themes default libadwaita components.
css = pkgs.writeTextFile {
name = "gtk-css";

View file

@ -4,11 +4,10 @@
...
}:
let
inherit (lib) types;
inherit (lib.${namespace}) mkOpt;
in
{
options.${namespace}.admin = with types; {
options.${namespace}.admin = with lib.types; {
name = mkOpt str "Jo" "The short name of the system admin.";
full-name = mkOpt str "Johannes Reckers" "The full name of the system admin.";
email = mkOpt str "system@thevoid.cafe" "The E-Mail of the system admin. (Used for system services by default)";

View file

@ -3,8 +3,9 @@
namespace,
config,
...
}: with lib; with lib.${namespace};
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.${namespace}.archetypes.server;
in {
options.${namespace}.archetypes.server = { enable = mkEnableOption "Enable the server archetype for your current system"; };

View file

@ -3,8 +3,9 @@
namespace,
config,
...
}: with lib; with lib.${namespace};
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.${namespace}.archetypes.workstation;
in {
options.${namespace}.archetypes.workstation = { enable = mkEnableOption "Enable the workstation archetype for your current system"; };

View file

@ -3,8 +3,9 @@
namespace,
config,
...
}: with lib; with lib.${namespace};
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.${namespace}.common.audio;
in {
options.${namespace}.common.audio = { enable = mkEnableOption "whether to enable common audio support and tweaks"; };

View file

@ -4,8 +4,9 @@
namespace,
config,
...
}: with lib; with lib.${namespace};
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.${namespace}.common.bluetooth;
in {
options.${namespace}.common.bluetooth = { enable = mkEnableOption "Enable bluetooth support on your current system"; };

View file

@ -4,11 +4,12 @@
namespace,
config,
...
}: with lib; with lib.${namespace};
}:
let
inherit (lib) mkEnableOption mkIf mkOption;
cfg = config.${namespace}.common.fonts;
in {
options.${namespace}.common.fonts = with types; {
options.${namespace}.common.fonts = with lib.types; {
enable = mkEnableOption "Enable system font management";
fonts = mkOption {
type = listOf package;

View file

@ -3,8 +3,9 @@
namespace,
config,
...
}: with lib; with lib.${namespace};
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.${namespace}.common.grub;
in {
options.${namespace}.common.grub = { enable = mkEnableOption "grub"; };

View file

@ -3,8 +3,9 @@
namespace,
config,
...
}: with lib; with lib.${namespace};
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.${namespace}.common.hardware;
in {
options.${namespace}.common.hardware = { enable = mkEnableOption "whether to enable common hardware support"; };

View file

@ -4,18 +4,15 @@
namespace,
config,
...
}: with lib; with lib.${namespace};
}:
let
inherit (lib) mkEnableOption mkIf;
inherit (lib.${namespace}) mkOpt;
cfg = config.${namespace}.common.kernel;
in {
options.${namespace}.common.kernel = {
enable = mkEnableOption "Modify the standard kernel settings";
version = mkOption {
type = types.str;
default = "linuxPackages_latest";
example = "linuxPackages_latest";
description = "Set the kernel version to be used by your system";
};
version = mkOpt lib.types.str "linuxPackages_latest" "Set the kernel version to be used by your system";
};
config = mkIf cfg.enable {

View file

@ -3,29 +3,30 @@
namespace,
config,
...
}: with lib; with lib.${namespace};
}:
let
inherit (lib) mkEnableOption mkIf mkOption;
cfg = config.${namespace}.common.locale;
in {
options.${namespace}.common.locale = {
enable = mkEnableOption "whether to enable common locale tweaks";
language = mkOption {
type = types.str;
type = lib.types.str;
default = "en_US";
example = "en_US";
description = "Sets the language for most text, doesn't include monetary or measurement settings";
};
country = mkOption {
type = types.str;
type = lib.types.str;
default = "de_DE";
example = "de_DE";
description = "Sets the language used for monetary or measurement settings (USD vs Euro, etc...)";
};
keymap = mkOption {
type = types.str;
type = lib.types.str;
default = "de";
example = "de";
description = "Sets the keymap to be used by the system";

View file

@ -4,8 +4,9 @@
namespace,
config,
...
}: with lib; with lib.${namespace};
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.${namespace}.common.nix;
in {
options.${namespace}.common.nix = {

View file

@ -4,8 +4,9 @@
namespace,
config,
...
}: with lib; with lib.${namespace};
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.${namespace}.desktop.gnome;
in {
options.${namespace}.desktop.gnome = { enable = mkEnableOption "gnome"; };

View file

@ -3,8 +3,9 @@
namespace,
config,
...
}: with lib; with lib.${namespace};
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.${namespace}.desktop.plasma;
in {
options.${namespace}.desktop.plasma = { enable = mkEnableOption "Whether to enable the KDE Plasma desktop environment"; };

View file

@ -4,12 +4,13 @@
config,
namespace,
...
}: with lib; with lib.${namespace};
}:
let
inherit (lib) mkEnableOption mkIf mkOption;
cfg = config.${namespace}.security.yubikey;
in
{
options.${namespace}.security.yubikey = with types; {
options.${namespace}.security.yubikey = with lib.types; {
enable = mkEnableOption "Enable the Yubikey as a security device.";
key-id = mkOption {
type = listOf str;

View file

@ -4,8 +4,9 @@
config,
host,
...
}: with lib; with lib.${namespace};
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.${namespace}.services.bluesky.pds;
in {
options.${namespace}.services.bluesky.pds = {

View file

@ -4,8 +4,9 @@
config,
host,
...
}: with lib; with lib.${namespace};
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.${namespace}.services.duckdns;
in {
options.${namespace}.services.duckdns = {

View file

@ -4,9 +4,11 @@
config,
host,
...
}: with lib; with lib.${namespace};
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.${namespace}.services.homepage;
homepageConfigDirectory = lib.snowfall.fs.get-file "resources/services/homepage";
in {
options.${namespace}.services.homepage = { enable = mkEnableOption "Enable Homepage, an intuitive dashboard for your services."; };

View file

@ -4,8 +4,9 @@
config,
host,
...
}: with lib; with lib.${namespace};
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.${namespace}.services.sharkey;
in {
options.${namespace}.services.sharkey = { enable = mkEnableOption "Enable Sharkey, the activitypub-based microblogging service."; };

View file

@ -3,14 +3,15 @@
namespace,
config,
...
}: with lib; with lib.${namespace};
}:
let
inherit (lib) mkEnableOption mkIf mkOption;
cfg = config.${namespace}.services.traefik;
in {
options.${namespace}.services.traefik = {
enable = mkEnableOption "Enable the Traefik service.";
cloudflareEmail = mkOption {
type = types.str;
type = lib.types.str;
default = config.${namespace}.admin.email;
example = "system@thevoid.cafe";
description = "Specify the E-Mail associated with your Cloudflare account for ACME.";

View file

@ -4,8 +4,9 @@
config,
host,
...
}: with lib; with lib.${namespace};
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.${namespace}.services.vaultwarden;
in {
options.${namespace}.services.vaultwarden = { enable = mkEnableOption "Enable Vaultwarden, a self-hostable password manager."; };

View file

@ -4,8 +4,9 @@
namespace,
config,
...
}: with lib; with lib.${namespace};
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.${namespace}.tools.cachix;
in {
options.${namespace}.tools.cachix = { enable = mkEnableOption "Enable the cachix binary cache service on your system."; };
@ -14,4 +15,3 @@ in {
environment.systemPackages = with pkgs; [ cachix ];
};
}

View file

@ -2,9 +2,8 @@
lib,
pkgs,
inputs,
namespace,
...
}: with lib; with lib.${namespace};
}:
{
imports = [
./hardware-configuration.nix