This commit is contained in:
parent
4c748be113
commit
18f145e04a
3 changed files with 133 additions and 43 deletions
33
module.nix
33
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,24 @@ in
|
|||
PrivateTmp = true;
|
||||
};
|
||||
};
|
||||
environment.etc."niri-tag/config.toml".text =
|
||||
let
|
||||
scratchpads =
|
||||
let
|
||||
contents =
|
||||
lib.mapAttrsToList (app: number: "${app} = ${toString number}") cfg.scratchpads
|
||||
|> lib.concatStringsSep "\n";
|
||||
in
|
||||
lib.optionalString ((lib.attrsToList cfg.scratchpads |> builtins.length) > 0) ''
|
||||
[scratchpads]
|
||||
${contents}
|
||||
'';
|
||||
in
|
||||
''
|
||||
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