From 25fbee9f2f57367f0be3d781ecee5bdfcbec8815 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Mon, 22 Jul 2024 21:23:52 +0800 Subject: [PATCH] flake-parts/setups: refactor systems into shared config options --- modules/flake-parts/setups/home-manager.nix | 15 ++++++--------- modules/flake-parts/setups/nixos.nix | 18 +++++++----------- modules/flake-parts/setups/nixvim.nix | 11 ++++------- .../setups/shared/config-options.nix | 4 +++- modules/flake-parts/setups/wrapper-manager.nix | 2 +- 5 files changed, 21 insertions(+), 29 deletions(-) diff --git a/modules/flake-parts/setups/home-manager.nix b/modules/flake-parts/setups/home-manager.nix index f5c2c06e..bf898c73 100644 --- a/modules/flake-parts/setups/home-manager.nix +++ b/modules/flake-parts/setups/home-manager.nix @@ -158,15 +158,12 @@ in }; configs = lib.mkOption { - type = with lib.types; attrsOf (submoduleWith { - specialArgs = { inherit (config) systems; }; - modules = [ - (import ./shared/nix-conf.nix { inherit inputs; }) - ./shared/nixpkgs-options.nix - ./shared/config-options.nix - configType - ]; - }); + type = with lib.types; attrsOf (submodule [ + (import ./shared/nix-conf.nix { inherit inputs; }) + (import ./shared/config-options.nix { inherit (config) systems; }) + ./shared/nixpkgs-options.nix + configType + ]); default = { }; description = '' An attribute set of metadata for the declarative home-manager setups. diff --git a/modules/flake-parts/setups/nixos.nix b/modules/flake-parts/setups/nixos.nix index 6cf6e735..95231017 100644 --- a/modules/flake-parts/setups/nixos.nix +++ b/modules/flake-parts/setups/nixos.nix @@ -391,17 +391,13 @@ in }; configs = lib.mkOption { - type = with lib.types; attrsOf (submoduleWith { - specialArgs = { inherit (config) systems; }; - shorthandOnlyDefinesConfig = true; - modules = [ - (import ./shared/nix-conf.nix { inherit inputs; }) - ./shared/config-options.nix - ./shared/home-manager-users.nix - ./shared/nixpkgs-options.nix - configType - ]; - }); + type = with lib.types; attrsOf (submodule [ + (import ./shared/nix-conf.nix { inherit inputs; }) + (import ./shared/config-options.nix { inherit (config) systems; }) + ./shared/home-manager-users.nix + ./shared/nixpkgs-options.nix + configType + ]); default = { }; description = '' An attribute set of metadata for the declarative NixOS setups. This diff --git a/modules/flake-parts/setups/nixvim.nix b/modules/flake-parts/setups/nixvim.nix index ae4e8b7d..a503e95d 100644 --- a/modules/flake-parts/setups/nixvim.nix +++ b/modules/flake-parts/setups/nixvim.nix @@ -164,13 +164,10 @@ in { options.setups.nixvim = { configs = lib.mkOption { - type = with lib.types; attrsOf (submoduleWith { - specialArgs = { inherit (config) systems; }; - modules = [ - ./shared/config-options.nix - configType - ]; - }); + type = with lib.types; attrsOf (submodule [ + (import ./shared/config-options.nix { inherit (config) systems; }) + configType + ]); default = { }; description = '' A set of NixVim configurations to be integrated into the declarative diff --git a/modules/flake-parts/setups/shared/config-options.nix b/modules/flake-parts/setups/shared/config-options.nix index 9325c7e6..1c1bb9ea 100644 --- a/modules/flake-parts/setups/shared/config-options.nix +++ b/modules/flake-parts/setups/shared/config-options.nix @@ -1,4 +1,6 @@ -{ lib, name, systems, ... }: { +{ systems }: + +{ lib, name, ... }: { options = { systems = lib.mkOption { type = with lib.types; listOf str; diff --git a/modules/flake-parts/setups/wrapper-manager.nix b/modules/flake-parts/setups/wrapper-manager.nix index d06d050a..db34cd97 100644 --- a/modules/flake-parts/setups/wrapper-manager.nix +++ b/modules/flake-parts/setups/wrapper-manager.nix @@ -102,7 +102,7 @@ in configs = lib.mkOption { type = with lib.types; attrsOf (submodule [ - ./shared/config-options.nix + (import ./shared/config-options.nix { inherit (config) systems; }) ./shared/nixpkgs-options.nix wrapperManagerConfigModule ]);