From a76847911c1975bf89e031154c7722d7919ef053 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Fri, 16 May 2025 16:44:30 +0200 Subject: modules: Import external modules in the module that actually need them --- modules/by-name/bo/boot/module.nix | 5 +++ modules/by-name/di/disks/module.nix | 5 +++ modules/by-name/fi/firefox/module.nix | 5 +++ modules/by-name/ho/home-manager/module.nix | 36 +++++----------------- modules/by-name/im/impermanence/module.nix | 5 +++ modules/by-name/nv/nvim/module.nix | 5 +++ .../se/serverphone/module.currently_ignored.nix | 15 +++++++-- 7 files changed, 45 insertions(+), 31 deletions(-) diff --git a/modules/by-name/bo/boot/module.nix b/modules/by-name/bo/boot/module.nix index 8b9ca6dd..404352ac 100644 --- a/modules/by-name/bo/boot/module.nix +++ b/modules/by-name/bo/boot/module.nix @@ -11,6 +11,7 @@ config, lib, pkgs, + modules, ... }: let cfg = config.soispha.boot; @@ -21,6 +22,10 @@ in { # enableIsoEntry = lib.mkEnableOption "an tails iso boot entry"; }; + imports = [ + modules.lanzaboote.nixosModules.lanzaboote + ]; + config = lib.mkIf cfg.enable ( # let # cfg = config.boot.loader.systemd-boot; diff --git a/modules/by-name/di/disks/module.nix b/modules/by-name/di/disks/module.nix index 7d5cb9bf..d88fa3df 100644 --- a/modules/by-name/di/disks/module.nix +++ b/modules/by-name/di/disks/module.nix @@ -11,6 +11,7 @@ config, lib, pkgs, + modules, ... }: let # FIXME: The iso redeploy requires a bigger efi partition <2024-05-12> @@ -46,6 +47,10 @@ in { }; }; + imports = [ + modules.disko.nixosModules.default + ]; + config = lib.mkIf cfg.enable { systemd = lib.recursiveUpdate (import ./hibernate.nix {inherit pkgs;}) (import ./fstrim.nix {inherit pkgs lib cfg;}); diff --git a/modules/by-name/fi/firefox/module.nix b/modules/by-name/fi/firefox/module.nix index 9290f60a..b5c1ff9a 100644 --- a/modules/by-name/fi/firefox/module.nix +++ b/modules/by-name/fi/firefox/module.nix @@ -11,6 +11,7 @@ lib, config, pkgs, + modules, ... }: let cfg = config.soispha.programs.firefox; @@ -203,6 +204,10 @@ in { }; home-manager.users.soispha = { + imports = [ + modules.arkenfox-nixos.hmModules.arkenfox + ]; + home.sessionVariables = { # Improve touch input and make scrolling smother MOZ_USE_XINPUT2 = "1"; diff --git a/modules/by-name/ho/home-manager/module.nix b/modules/by-name/ho/home-manager/module.nix index 076d466e..d7eccbd6 100644 --- a/modules/by-name/ho/home-manager/module.nix +++ b/modules/by-name/ho/home-manager/module.nix @@ -10,22 +10,8 @@ { config, lib, - pkgsStable, - nixpkgs_open_prs, - sysLib, - # extra information system, - # bins - # TODO: Integrate these <2024-05-22> - shell_library, - qmk_firmware, - # external deps - user_js, - # modules - impermanence, - nix-index-database, - nixVim, - arkenfox-nixos, + modules, ... }: let cfg = config.soispha.home-manager; @@ -34,6 +20,10 @@ in { enable = lib.mkEnableOption "home-manager with custom config."; }; + imports = [ + modules.home-manager.nixosModules.home-manager + ]; + # TODO: Find a way to throw this error below, when a user `enable`s a home-manager # module, but not this module. Without having to plaster all the `home-manager` modules # with `assert`s. <2024-10-18> @@ -42,24 +32,12 @@ in { home-manager = { useGlobalPkgs = true; useUserPackages = true; + + # TODO(@bpeetz): Remove this once the legacy -> by-name migration is done. <2025-05-16> users.soispha = import ../../../home.legacy; extraSpecialArgs = { inherit - nixpkgs_open_prs - pkgsStable - sysLib - # extra information system - # bins - shell_library - qmk_firmware - # external deps - user_js - # modules - impermanence - nixVim - nix-index-database - arkenfox-nixos ; }; }; diff --git a/modules/by-name/im/impermanence/module.nix b/modules/by-name/im/impermanence/module.nix index 8943cb7a..4ce86b25 100644 --- a/modules/by-name/im/impermanence/module.nix +++ b/modules/by-name/im/impermanence/module.nix @@ -10,6 +10,7 @@ { config, lib, + modules, ... }: let cfg = config.soispha.impermanence; @@ -32,6 +33,10 @@ in { }; }; + imports = [ + modules.impermanence.nixosModules.impermanence + ]; + config = lib.mkIf cfg.enable { environment.persistence = { "/srv" = { diff --git a/modules/by-name/nv/nvim/module.nix b/modules/by-name/nv/nvim/module.nix index f394db3b..819646d6 100644 --- a/modules/by-name/nv/nvim/module.nix +++ b/modules/by-name/nv/nvim/module.nix @@ -11,6 +11,7 @@ pkgs, lib, config, + modules, ... }: let cfg = config.soispha.programs.nvim; @@ -33,6 +34,10 @@ in { config = lib.mkIf cfg.enable { home-manager.users.soispha = { + imports = [ + modules.nixvim.homeManagerModules.nixvim + ]; + home.sessionVariables = { EDITOR = "nvim"; VISUAL = "nvim"; diff --git a/modules/by-name/se/serverphone/module.currently_ignored.nix b/modules/by-name/se/serverphone/module.currently_ignored.nix index 378fc7c3..f7280bed 100644 --- a/modules/by-name/se/serverphone/module.currently_ignored.nix +++ b/modules/by-name/se/serverphone/module.currently_ignored.nix @@ -12,11 +12,22 @@ serverphone, system, lib, + modules, ... -}: { +}: let + cfg = config.soispha.serverphone; +in { # FIXME: Reactive this module, when serverphone is working again <2024-05-11> - config = lib.mkIf config.soispha.secrets.enable { + options.soispha.serverphone = { + enable = lib.mkEnableOption "serverphone"; + }; + + imports = [ + modules.serverphone.nixosModules.default + ]; + + config = lib.mkIf cfg.enable { age.secrets = { serverphoneCa = { file = ./private_keys/ca.key; -- cgit 1.4.1