From 5783c1136e1b18cf482e7994cc73dd928a05fe43 Mon Sep 17 00:00:00 2001 From: Bloxx12 Date: Wed, 9 Apr 2025 15:31:18 +0200 Subject: [PATCH 1/3] boot/module.nix: add timeout of 0 for the bootloader --- modules/system/boot/module.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/system/boot/module.nix b/modules/system/boot/module.nix index 9c9214b..594308f 100644 --- a/modules/system/boot/module.nix +++ b/modules/system/boot/module.nix @@ -31,6 +31,8 @@ in { }; loader = { efi.canTouchEfiVariables = true; + # I love spamming space + timeout = 0; systemd-boot = { enable = cfg.systemd-boot.enable; editor = mkForce false; From 0b78657f3b90032dd24f5f87659b23783199c7e3 Mon Sep 17 00:00:00 2001 From: Bloxx12 Date: Wed, 9 Apr 2025 15:31:18 +0200 Subject: [PATCH 2/3] hyprland: cleanup, fix xdg portal --- modules/wms/wayland/hyprland/binds.nix | 6 ++--- modules/wms/wayland/hyprland/module.nix | 30 ++++++------------------- 2 files changed, 9 insertions(+), 27 deletions(-) diff --git a/modules/wms/wayland/hyprland/binds.nix b/modules/wms/wayland/hyprland/binds.nix index e225f57..3e923a1 100644 --- a/modules/wms/wayland/hyprland/binds.nix +++ b/modules/wms/wayland/hyprland/binds.nix @@ -1,10 +1,8 @@ { - config, lib, pkgs, ... }: let - cfg = config.modules.desktops.hyprland; inherit (builtins) map genList toString; inherit (lib.meta) getExe getExe'; in { @@ -49,10 +47,10 @@ in { "$mainMod, V, togglespecialworkspace, audio" # Reload hyprland - "$mainMod, R, exec, ${cfg.package}/bin/hyprctl reload" + "$mainMod, R, exec, ${getExe' pkgs.hyprland "hyprctl"} reload" # Restart waybar - "$mainMod CONTROL, B, exec, ${pkgs.procps}/bin/pkill waybar || ${pkgs.waybar}/bin/waybar" + "$mainMod CONTROL, B, exec, ${pkgs.procps}/bin/pkill waybar || ${getExe pkgs.waybar}" ]; binde = [ diff --git a/modules/wms/wayland/hyprland/module.nix b/modules/wms/wayland/hyprland/module.nix index e745493..2ecec85 100644 --- a/modules/wms/wayland/hyprland/module.nix +++ b/modules/wms/wayland/hyprland/module.nix @@ -5,11 +5,11 @@ pkgs, ... }: let - cfg = config.modules.desktops.hyprland; - # inherit (inputs.hyprsplit.packages.${pkgs.system}) hyprsplit; - inherit (lib.modules) mkIf mkDefault; + inherit (lib.modules) mkIf; inherit (lib.options) mkOption; - inherit (lib.types) bool enum package; + inherit (lib.types) bool; + + cfg = config.modules.desktops.hyprland; in { imports = [ ./binds.nix @@ -19,8 +19,6 @@ in { ./workspaces.nix inputs.hyprland.nixosModules.default ]; - # we disable the default hyprland module - # disabledModules = ["programs/hyprland.nix"]; options.modules.desktops.hyprland = { enable = mkOption { @@ -30,19 +28,6 @@ in { Whether to enable Hyprland wayland compositor. ''; }; - - package = mkOption { - type = package; - default = pkgs.hyprland; - description = '' - The Hyprland package to be used. - ''; - }; - portalPackage = mkOption { - type = package; - default = pkgs.xdg-desktop-portal-hyprland; - description = "The hyprland portal package"; - }; }; config = mkIf cfg.enable { @@ -59,15 +44,14 @@ in { # xdg Portal xdg.portal = { enable = true; - configPackages = mkDefault [ - pkgs.xdg-desktop-portal-hyprland - ]; + xdgOpenUsePortal = true; extraPortals = [ pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-hyprland ]; config = { - common.default = ["gtk" "hyprland"]; + common.default = ["*"]; + hyprland.default = ["gtk" "hyprland"]; }; }; }; From f05dfab5c59d6d4cc47abd86f90ed031bded2c4b Mon Sep 17 00:00:00 2001 From: Bloxx12 Date: Wed, 9 Apr 2025 15:31:18 +0200 Subject: [PATCH 3/3] flake: inherit explicitly from parts of lib Instea of doing `inherit (lib) ``, all inherits now use `inherit (lib.) `, which is much nicer. --- hosts/default.nix | 7 ++++--- modules/options/system/monitors.nix | 2 +- modules/options/system/networking/default.nix | 2 +- modules/options/system/programs/default.nix | 15 ++++++++------- modules/other/system.nix | 5 +++-- modules/programs/cli/nh.nix | 3 ++- modules/programs/gui/foot.nix | 6 +++--- modules/programs/gui/minecraft.nix | 3 ++- modules/programs/tui/btop.nix | 4 +++- modules/services/kanata/module.nix | 3 ++- modules/services/nextcloud/module.nix | 1 + modules/services/postgresql/module.nix | 1 + modules/services/ssh.nix | 2 +- modules/style/colors.nix | 3 +-- modules/style/gtk.nix | 3 ++- modules/style/qt.nix | 3 ++- modules/style/theming.nix | 11 +++++++---- modules/system/boot/module.nix | 2 +- modules/system/hardware/bluetooth.nix | 3 ++- modules/system/hardware/cpu/intel.nix | 3 +-- modules/system/hardware/sound/pipewire/module.nix | 3 ++- modules/system/nix/module.nix | 3 ++- modules/system/os/impermanence/module.nix | 2 +- modules/system/os/networking/networkmanager.nix | 2 +- modules/system/os/security/sudo.nix | 2 +- modules/wms/wayland/hyprland/settings.nix | 5 +++-- modules/wms/wayland/hyprland/workspaces.nix | 6 ++++-- modules/wms/wayland/variables.nix | 4 +++- packages/helix.nix | 3 ++- 29 files changed, 67 insertions(+), 45 deletions(-) diff --git a/hosts/default.nix b/hosts/default.nix index a9a28c7..7a34711 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -1,11 +1,12 @@ inputs: let inherit (inputs) self; - inherit (inputs.nixpkgs) lib; - inherit (lib.lists) concatLists flatten singleton; - inherit (lib) nixosSystem recursiveUpdate; inherit (builtins) filter map toString; + inherit (inputs.nixpkgs) lib; + inherit (lib.attrsets) recursiveUpdate; inherit (lib.filesystem) listFilesRecursive; + inherit (lib.lists) concatLists flatten singleton; inherit (lib.strings) hasSuffix; + inherit (lib) nixosSystem; # NOTE: This was inspired by raf, and I find this # to be quite a sane way of managing all modules in my flake. diff --git a/modules/options/system/monitors.nix b/modules/options/system/monitors.nix index 4294f2e..314d3f6 100644 --- a/modules/options/system/monitors.nix +++ b/modules/options/system/monitors.nix @@ -1,5 +1,5 @@ {lib, ...}: let - inherit (lib) mkOption; + inherit (lib.options) mkOption; inherit (lib.types) submodule int ints number attrsOf ; in { options.modules.system.hardware.monitors = mkOption { diff --git a/modules/options/system/networking/default.nix b/modules/options/system/networking/default.nix index 8a8c298..68fa733 100644 --- a/modules/options/system/networking/default.nix +++ b/modules/options/system/networking/default.nix @@ -1,5 +1,5 @@ {lib, ...}: let - inherit (lib) mkEnableOption mkOption types; + inherit (lib.options) mkEnableOption; in { options.modules.system.networking = { nftbles.enable = mkEnableOption "Nftables firewall"; diff --git a/modules/options/system/programs/default.nix b/modules/options/system/programs/default.nix index 9f7e0d3..403de42 100644 --- a/modules/options/system/programs/default.nix +++ b/modules/options/system/programs/default.nix @@ -1,5 +1,6 @@ {lib, ...}: let - inherit (lib) mkEnableOption mkOption types; + inherit (lib.types) str enum; + inherit (lib.options) mkEnableOption mkOption; in { options.modules.system.programs = { editors = { @@ -19,30 +20,30 @@ in { git = { signingKey = mkOption { - type = types.str; + type = str; default = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILPiRe9OH/VtWFWyy5QbAVcN7CLxr4zUtRCwmxD6aeN6"; description = "The default gpg key used for signing commits"; }; }; default = { terminal = mkOption { - type = types.enum ["foot" "kitty"]; + type = enum ["foot" "kitty"]; default = "foot"; }; fileManager = mkOption { - type = types.enum ["thunar" "dolphin" "nemo"]; + type = enum ["thunar" "dolphin" "nemo"]; default = "thunar"; }; browser = mkOption { - type = types.enum ["firefox" "librewolf" "chromium"]; + type = enum ["firefox" "librewolf" "chromium"]; default = "firefox"; }; editor = mkOption { - type = types.enum ["neovim" "helix" "emacs"]; + type = enum ["neovim" "helix" "emacs"]; default = "emacs"; }; launcher = mkOption { - type = types.enum ["anyrun" "rofi" "wofi"]; + type = enum ["anyrun" "rofi" "wofi"]; default = "anyrun"; }; }; diff --git a/modules/other/system.nix b/modules/other/system.nix index aa876e9..d533cf5 100644 --- a/modules/other/system.nix +++ b/modules/other/system.nix @@ -1,10 +1,11 @@ {lib, ...}: let - inherit (lib) mkOption types; + inherit (lib.options) mkOption; + inherit (lib.types) str; in { options.modules.other.system = { username = mkOption { description = "username for this system"; - type = types.str; + type = str; }; }; } diff --git a/modules/programs/cli/nh.nix b/modules/programs/cli/nh.nix index 1190441..18033fa 100644 --- a/modules/programs/cli/nh.nix +++ b/modules/programs/cli/nh.nix @@ -5,7 +5,8 @@ }: let cfg = config.modules.programs.nh; inherit (config.modules.other.system) username; - inherit (lib) mkEnableOption mkIf; + inherit (lib.modules) mkIf; + inherit (lib.options) mkEnableOption; in { options.modules.programs.nh.enable = mkEnableOption "nh"; diff --git a/modules/programs/gui/foot.nix b/modules/programs/gui/foot.nix index 32c5a71..3ad1f3f 100644 --- a/modules/programs/gui/foot.nix +++ b/modules/programs/gui/foot.nix @@ -4,11 +4,11 @@ pkgs, ... }: let + inherit (lib.modules) mkIf; + + inherit (config.meta.mainUser) username; cfg = config.modules.system.programs.terminals.foot; colours = config.modules.style.colorScheme.colors; - inherit (config.meta.mainUser) username; - - inherit (lib) mkIf; foot-config = pkgs.writeText "foot.ini" (lib.generators.toINI {} { main = { diff --git a/modules/programs/gui/minecraft.nix b/modules/programs/gui/minecraft.nix index aa82068..753faeb 100644 --- a/modules/programs/gui/minecraft.nix +++ b/modules/programs/gui/minecraft.nix @@ -4,9 +4,10 @@ pkgs, ... }: let - cfg = config.modules.programs.minecraft; inherit (lib.options) mkEnableOption; inherit (lib.modules) mkIf; + + cfg = config.modules.programs.minecraft; in { options.modules.programs.minecraft = { enable = mkEnableOption "minecraft"; diff --git a/modules/programs/tui/btop.nix b/modules/programs/tui/btop.nix index 324a280..df1d29b 100644 --- a/modules/programs/tui/btop.nix +++ b/modules/programs/tui/btop.nix @@ -4,7 +4,9 @@ pkgs, ... }: let - inherit (lib) mkEnableOption mkIf; + inherit (lib.options) mkEnableOption; + inherit (lib.modules) mkIf; + cfg = config.modules.programs.btop; btop-settings = pkgs.writeTextDir "btop/btop.conf" '' diff --git a/modules/services/kanata/module.nix b/modules/services/kanata/module.nix index 430b360..b7164d5 100644 --- a/modules/services/kanata/module.nix +++ b/modules/services/kanata/module.nix @@ -3,9 +3,10 @@ lib, ... }: let - cfg = config.modules.services.kanata; inherit (lib.modules) mkIf; inherit (lib.options) mkEnableOption; + + cfg = config.modules.services.kanata; in { options.modules.services.kanata.enable = mkEnableOption "kanata"; config = mkIf cfg.enable { diff --git a/modules/services/nextcloud/module.nix b/modules/services/nextcloud/module.nix index 53456e5..5a3a570 100644 --- a/modules/services/nextcloud/module.nix +++ b/modules/services/nextcloud/module.nix @@ -6,6 +6,7 @@ }: let inherit (lib.meta) getExe'; inherit (lib.modules) mkIf; + cfg = config.modules.system.services.nextcloud; in { options.modules.system.services.nextcloud.enable = lib.mkEnableOption "nextcloud"; diff --git a/modules/services/postgresql/module.nix b/modules/services/postgresql/module.nix index f47a158..84e95b5 100644 --- a/modules/services/postgresql/module.nix +++ b/modules/services/postgresql/module.nix @@ -6,6 +6,7 @@ }: let inherit (lib.modules) mkIf; inherit (lib.options) mkEnableOption; + cfg = config.modules.system.services.database.postgresql; in { options.modules.system.services.database.postgresql.enable = mkEnableOption "postgresql"; diff --git a/modules/services/ssh.nix b/modules/services/ssh.nix index 0731e20..bca460c 100644 --- a/modules/services/ssh.nix +++ b/modules/services/ssh.nix @@ -1,5 +1,5 @@ {lib, ...}: let - inherit (lib) mkEnableOption; + inherit (lib.options) mkEnableOption; in { options.modules.programs.ssh.enable = mkEnableOption "ssh"; config = { diff --git a/modules/style/colors.nix b/modules/style/colors.nix index ba2a272..07934ae 100644 --- a/modules/style/colors.nix +++ b/modules/style/colors.nix @@ -11,9 +11,8 @@ ... }: let inherit (lib.options) mkOption literalExpression; - inherit (lib.types) str nullOr enum mkOptionType attrsOf coercedTo; inherit (lib.strings) toLower replaceStrings removePrefix hasPrefix isString; - # inherit (lib) serializeTheme; + inherit (lib.types) str nullOr enum mkOptionType attrsOf coercedTo; cfg = config.modules.style; diff --git a/modules/style/gtk.nix b/modules/style/gtk.nix index 7440c41..2e180bc 100644 --- a/modules/style/gtk.nix +++ b/modules/style/gtk.nix @@ -4,9 +4,10 @@ pkgs, ... }: let + inherit (lib.modules) mkIf; inherit (lib.options) mkOption mkEnableOption; inherit (lib.types) str package; - inherit (lib.modules) mkIf; + cfg = config.modules.theming.gtk; in { options.modules.theming.gtk = { diff --git a/modules/style/qt.nix b/modules/style/qt.nix index 69260f0..77413e4 100644 --- a/modules/style/qt.nix +++ b/modules/style/qt.nix @@ -5,8 +5,9 @@ ... }: let inherit (lib.modules) mkIf; - inherit (lib) mkEnableOption mkOption; + inherit (lib.options) mkEnableOption mkOption; inherit (lib.types) str package; + cfg = config.modules.theming.qt; in { options.modules.theming.qt = { diff --git a/modules/style/theming.nix b/modules/style/theming.nix index 5e3655e..d276442 100644 --- a/modules/style/theming.nix +++ b/modules/style/theming.nix @@ -4,13 +4,16 @@ pkgs, ... }: let + inherit (builtins) toString isBool; + inherit (lib.generators) toINI; inherit (lib.modules) mkMerge mkIf; inherit (lib.options) mkEnableOption; - cfg = config.modules.theming; - inherit (builtins) toString isBool; - inherit (lib) boolToString escape generators; + inherit (lib.strings) escape; + inherit (lib.trivial) boolToString; - toGtk3Ini = generators.toINI { + cfg = config.modules.theming; + + toGtk3Ini = toINI { mkKeyValue = key: value: let value' = if isBool value diff --git a/modules/system/boot/module.nix b/modules/system/boot/module.nix index 594308f..882b70d 100644 --- a/modules/system/boot/module.nix +++ b/modules/system/boot/module.nix @@ -5,8 +5,8 @@ ... }: let inherit (lib.modules) mkForce; - inherit (lib.modules) mkIf; inherit (lib.options) mkEnableOption; + cfg = config.modules.system.boot; in { options.modules.system.boot = { diff --git a/modules/system/hardware/bluetooth.nix b/modules/system/hardware/bluetooth.nix index 6ef8d98..b882011 100644 --- a/modules/system/hardware/bluetooth.nix +++ b/modules/system/hardware/bluetooth.nix @@ -4,8 +4,9 @@ pkgs, ... }: let + inherit (lib.modules) mkIf; + cfg = config.modules.system.hardware.bluetooth; - inherit (lib) mkIf; in { config = mkIf cfg.enable { hardware.bluetooth = { diff --git a/modules/system/hardware/cpu/intel.nix b/modules/system/hardware/cpu/intel.nix index c9a5f23..ee059aa 100644 --- a/modules/system/hardware/cpu/intel.nix +++ b/modules/system/hardware/cpu/intel.nix @@ -4,8 +4,7 @@ pkgs, ... }: let - inherit (lib) mkDefault mkIf; - inherit (config.modules.system.video) nvidia amd; + inherit (lib.modules) mkDefault; in { hardware = { cpu.intel.updateMicrocode = mkDefault config.hardware.enableRedistributableFirmware; diff --git a/modules/system/hardware/sound/pipewire/module.nix b/modules/system/hardware/sound/pipewire/module.nix index 43a098e..a18d3de 100644 --- a/modules/system/hardware/sound/pipewire/module.nix +++ b/modules/system/hardware/sound/pipewire/module.nix @@ -3,8 +3,9 @@ lib, ... }: let + inherit (lib.modules) mkIf; + cfg = config.modules.system.sound; - inherit (lib) mkIf; in { config = mkIf cfg.enable { services.pipewire = { diff --git a/modules/system/nix/module.nix b/modules/system/nix/module.nix index 696f22c..1472607 100644 --- a/modules/system/nix/module.nix +++ b/modules/system/nix/module.nix @@ -6,7 +6,8 @@ pkgs, ... }: let - inherit (lib) mapAttrsToList mkForce; + inherit (lib.attrsets) mapAttrsToList; + inherit (lib.modules) mkForce; in { imports = [ ./documentation.nix # nixos documentation diff --git a/modules/system/os/impermanence/module.nix b/modules/system/os/impermanence/module.nix index e5e67f4..8484f52 100644 --- a/modules/system/os/impermanence/module.nix +++ b/modules/system/os/impermanence/module.nix @@ -4,7 +4,7 @@ lib, ... }: let - inherit (lib) mkIf mkForce; + inherit (lib.modules) mkIf mkForce; inherit (builtins) map; cfg = config.modules.system.impermanence; diff --git a/modules/system/os/networking/networkmanager.nix b/modules/system/os/networking/networkmanager.nix index 1f9a6a5..d0c2228 100644 --- a/modules/system/os/networking/networkmanager.nix +++ b/modules/system/os/networking/networkmanager.nix @@ -1,5 +1,5 @@ {lib, ...}: let - inherit (lib) mkForce; + inherit (lib.modules) mkForce; in { networking.networkmanager = { enable = true; diff --git a/modules/system/os/security/sudo.nix b/modules/system/os/security/sudo.nix index 0af4efc..30b3b2b 100644 --- a/modules/system/os/security/sudo.nix +++ b/modules/system/os/security/sudo.nix @@ -3,7 +3,7 @@ pkgs, ... }: let - inherit (lib) mkForce mkDefault; + inherit (lib.modules) mkForce mkDefault; in { security = { sudo-rs.enable = mkForce false; diff --git a/modules/wms/wayland/hyprland/settings.nix b/modules/wms/wayland/hyprland/settings.nix index f0484ac..03314fd 100644 --- a/modules/wms/wayland/hyprland/settings.nix +++ b/modules/wms/wayland/hyprland/settings.nix @@ -3,10 +3,11 @@ lib, ... }: let - inherit (config.modules.system.hardware) monitors; - inherit (lib) mapAttrsToList; inherit (builtins) toString; + inherit (lib.attrsets) mapAttrsToList; + inherit (config.modules.style.colorScheme) colors; + inherit (config.modules.system.hardware) monitors; in { config = { programs.hyprland = { diff --git a/modules/wms/wayland/hyprland/workspaces.nix b/modules/wms/wayland/hyprland/workspaces.nix index 83d6ad2..f526436 100644 --- a/modules/wms/wayland/hyprland/workspaces.nix +++ b/modules/wms/wayland/hyprland/workspaces.nix @@ -3,9 +3,11 @@ lib, ... }: let - inherit (config.modules.system.hardware) monitors; - inherit (lib) imap0 flatten optionalString; inherit (builtins) map genList attrNames toString; + inherit (lib.lists) imap0 flatten; + inherit (lib.strings) optionalString; + + inherit (config.modules.system.hardware) monitors; in { programs.hyprland.settings = { # INFO: This is a custom function to map all of my monitors to workspaces. diff --git a/modules/wms/wayland/variables.nix b/modules/wms/wayland/variables.nix index 895ffbb..3b2aec7 100644 --- a/modules/wms/wayland/variables.nix +++ b/modules/wms/wayland/variables.nix @@ -3,8 +3,10 @@ lib, ... }: let + inherit (lib.modules) mkIf; + inherit (lib.options) mkEnableOption; + cfg = config.modules.wms.wayland; - inherit (lib) mkIf mkEnableOption; in { options.modules.wms.wayland.enable = mkEnableOption "wayland"; config = mkIf cfg.enable { diff --git a/packages/helix.nix b/packages/helix.nix index 50fed6f..f98a7f9 100644 --- a/packages/helix.nix +++ b/packages/helix.nix @@ -32,7 +32,8 @@ basedpyright, ... }: let - inherit (lib) getExe; + inherit (lib.meta) getExe; + toml = formats.toml {}; helix-config = { theme = "gruvbox";