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
cfg = config.wrapper-manager;
@ -7,6 +7,7 @@ let
description = "wrapper-manager module";
class = "wrapperManager";
specialArgs = cfg.extraSpecialArgs // {
inherit pkgs;
modulesPath = builtins.toString ../wrapper-manager;
};
modules = [
@ -18,6 +19,13 @@ let
};
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 = {
sharedModules = lib.mkOption {
type = with lib.types; listOf deferredModule;

View File

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

View File

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