This commit is contained in:
parent
4c748be113
commit
175d044930
3 changed files with 125 additions and 43 deletions
31
module.nix
31
module.nix
|
|
@ -8,9 +8,12 @@ let
|
|||
inherit (lib)
|
||||
mkEnableOption
|
||||
mkPackageOption
|
||||
mkOption
|
||||
mkIf
|
||||
getExe
|
||||
types
|
||||
;
|
||||
inherit (types) attrsOf bool;
|
||||
name = "Niri Tag Manager";
|
||||
in
|
||||
{
|
||||
|
|
@ -20,6 +23,18 @@ in
|
|||
nullable = true;
|
||||
default = "niri-tag";
|
||||
};
|
||||
prepopulate = mkOption {
|
||||
type = types.numbers.between 0 255;
|
||||
default = 3;
|
||||
};
|
||||
scratchpads = mkOption {
|
||||
type = attrsOf (types.numbers.between 1 255);
|
||||
default = { };
|
||||
};
|
||||
strict = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
config =
|
||||
let
|
||||
|
|
@ -40,6 +55,22 @@ in
|
|||
PrivateTmp = true;
|
||||
};
|
||||
};
|
||||
environment.etc."niri-tag/config.toml".source =
|
||||
let
|
||||
scratchpads =
|
||||
let
|
||||
contents = lib.mapAttrsToList (app: number: "${app} = ${toString number}\n") cfg.scratchpads;
|
||||
in
|
||||
lib.optionalString (lib.count <| lib.attrsToList cfg.scratchpads) ''
|
||||
[scratchpads]
|
||||
${contents}
|
||||
'';
|
||||
in
|
||||
pkgs.writeTextFile "config.toml" ''
|
||||
prepopulate = ${toString cfg.prepopulate}
|
||||
strict = ${lib.boolToString cfg.strict}
|
||||
${scratchpads}
|
||||
'';
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue