From 2c6cd776ce2ff2c3a2d229415022b82cb40c97a5 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Wed, 9 Jul 2025 00:14:55 +0800 Subject: [PATCH] feat(nix): use module options instead of specialArgs for graphical --- nix/configurations.nix | 8 +++----- nix/modules/graphical/default.nix | 17 ++++++----------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/nix/configurations.nix b/nix/configurations.nix index aeb2592..a2ac765 100644 --- a/nix/configurations.nix +++ b/nix/configurations.nix @@ -6,6 +6,7 @@ }: let inherit (lib) nixosSystem; + inherit (lib.lists) optional; inherit (lib.attrsets) mapAttrs; inherit (cfg.lib.modules) forAllUsers'; cfg = config.flake; @@ -22,16 +23,13 @@ let name: value: if class == "nixos" then nixosSystem { - specialArgs = { - inherit (value) graphical; - hostName = name; - }; + specialArgs.hostName = name; modules = [ cfg.modules.nixos.default inputs.home-manager.nixosModules.home-manager { home-manager = globalCfg; } (value.extraCfg or { }) - ]; + ] ++ optional value.graphical cfg.modules.nixos.graphical; } else { } diff --git a/nix/modules/graphical/default.nix b/nix/modules/graphical/default.nix index 78874bf..c714a2d 100644 --- a/nix/modules/graphical/default.nix +++ b/nix/modules/graphical/default.nix @@ -1,19 +1,14 @@ { lib, ... }: let - inherit (lib.modules) mkIf; inherit (lib.options) mkEnableOption; in { - flake.modules.nixos.default = - { graphical, ... }: - { - config = mkIf graphical { - home-manager.sharedModules = [ { graphical = true; } ]; - services.pipewire = { - enable = true; - pulse.enable = true; - }; - }; + flake.modules.nixos.graphical = { + home-manager.sharedModules = [ { graphical = true; } ]; + services.pipewire = { + enable = true; + pulse.enable = true; }; + }; flake.modules.homeManager.default.options.graphical = mkEnableOption ""; }