Skip to content

Commit

Permalink
Nix/HM module: add sources and extraConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
fufexan committed Mar 26, 2024
1 parent 6acb755 commit ab28363
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion nix/hm-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ self: {
...
}: let
inherit (builtins) toString;
inherit (lib.types) bool float int listOf package str submodule;
inherit (lib.types) bool float int listOf lines nullOr package str submodule;
inherit (lib.modules) mkIf;
inherit (lib.options) mkOption mkEnableOption;

Expand Down Expand Up @@ -64,6 +64,18 @@ in {
default = self.packages.${pkgs.stdenv.hostPlatform.system}.hyprlock;
};

extraConfig = mkOption {
description = "Extra configuration lines, written verbatim";
type = nullOr lines;
default = null;
};

sources = mkOption {
description = "List of files to `source`";
type = listOf str;
default = [];
};

general = {
disable_loading_bar = mkOption {
description = "Whether to disable loading bar";
Expand Down Expand Up @@ -490,6 +502,10 @@ in {
home.packages = [cfg.package];

xdg.configFile."hypr/hyprlock.conf".text = ''
${builtins.concatStringsSep "\n" (map (source: ''
source = ${source}
'') cfg.sources)}
general {
disable_loading_bar = ${boolToString cfg.general.disable_loading_bar}
grace = ${toString cfg.general.grace}
Expand Down Expand Up @@ -586,6 +602,8 @@ in {
}
'')
cfg.labels)}
${lib.optionalString (cfg.extraConfig != null) cfg.extraConfig}
'';
};
}

0 comments on commit ab28363

Please sign in to comment.