wrapper-manager-fds/modules: fix NixOS and home-manager module

This commit is contained in:
Gabriel Arazas 2024-07-03 23:18:26 +08:00
parent 664e891d91
commit cf9e4c0c20
3 changed files with 23 additions and 19 deletions

View File

@ -1,4 +1,4 @@
{ config, lib, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.wrapper-manager; cfg = config.wrapper-manager;
@ -7,6 +7,7 @@ let
description = "wrapper-manager module"; description = "wrapper-manager module";
class = "wrapperManager"; class = "wrapperManager";
specialArgs = cfg.extraSpecialArgs // { specialArgs = cfg.extraSpecialArgs // {
inherit pkgs;
modulesPath = builtins.toString ../wrapper-manager; modulesPath = builtins.toString ../wrapper-manager;
}; };
modules = [ modules = [
@ -18,6 +19,13 @@ let
}; };
in in
{ {
imports = [
# Bringing all of the arguments from the wrapper-manager environment for
# convenience. It would also allow its users for full control without using
# the integration module itself.
../wrapper-manager/extra-args.nix
];
options.wrapper-manager = { options.wrapper-manager = {
sharedModules = lib.mkOption { sharedModules = lib.mkOption {
type = with lib.types; listOf deferredModule; type = with lib.types; listOf deferredModule;

View File

@ -8,14 +8,12 @@ in
../common.nix ../common.nix
]; ];
options.wrapper-manager.wrappers = lib.mkOption { config = lib.mkMerge [
type = lib.types.submoduleWith { { wrapper-manager.extraSpecialArgs.hmConfig = config; }
specialArgs.hmConfig = config;
};
};
config = lib.mkIf (cfg.wrappers != {}) { (lib.mkIf (cfg.wrappers != {}) {
home.packages = home.packages =
lib.mapAttrsToList (_: wrapper: wrapper.config.build.toplevel) cfg.wrappers; lib.mapAttrsToList (_: wrapper: wrapper.build.toplevel) cfg.wrappers;
}; })
] ;
} }

View File

@ -8,14 +8,12 @@ in
../common.nix ../common.nix
]; ];
options.wrapper-manager.wrappers = lib.mkOption { config = lib.mkMerge [
type = lib.types.submoduleWith { { wrapper-manager.extraSpecialArgs.nixosConfig = config; }
specialArgs.nixosConfig = config;
};
};
config = lib.mkIf (cfg.wrappers != {}) { (lib.mkIf (cfg.wrappers != {}) {
environment.systemPackages = environment.systemPackages =
lib.mapAttrsToList (_: wrapper: wrapper.config.build.toplevel) cfg.wrappers; lib.mapAttrsToList (_: wrapper: wrapper.build.toplevel) cfg.wrappers;
}; })
];
} }