Skip to content

Commit

Permalink
modules/nixos: add extraSpecialArgs
Browse files Browse the repository at this point in the history
  • Loading branch information
NotAShelf committed Dec 28, 2024
1 parent 11d9bad commit 2979f66
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions modules/nixos/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
...
}: let
inherit (lib.modules) mkIf mkMerge;
inherit (lib.options) mkOption;
inherit (lib.options) mkOption literalExpression;
inherit (lib.lists) filter map flatten concatLists;
inherit (lib.attrsets) filterAttrs mapAttrs' attrValues mapAttrsToList;
inherit (lib.trivial) flip;
inherit (lib.types) bool attrsOf submoduleWith listOf raw;
inherit (lib.types) bool attrsOf submoduleWith listOf raw attrs;

cfg = config.hjem;

hjemModule = submoduleWith {
description = "Hjem NixOS module";
class = "hjem";
specialArgs = {inherit pkgs lib;};
specialArgs = {inherit pkgs lib;} // cfg.extraSpecialArgs;
modules = concatLists [
[
({name, ...}: {
Expand Down Expand Up @@ -71,6 +71,16 @@ in {
extend each user configuration with additional options.
'';
};

extraSpecialArgs = mkOption {
type = attrs;
default = {};
example = literalExpression "{ inherit inputs; }";
description = ''
Additional `specialArgs` are passed to Hjem, allowing extra arguments
to be passed down to to all imported modules.
'';
};
};

config = mkMerge [
Expand Down

0 comments on commit 2979f66

Please sign in to comment.