From ab2836360bf82689e02e2265627698cc24176b0b Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Mon, 25 Mar 2024 23:16:05 +0200 Subject: [PATCH] Nix/HM module: add sources and extraConfig --- nix/hm-module.nix | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/nix/hm-module.nix b/nix/hm-module.nix index 89479ed..8a820a2 100644 --- a/nix/hm-module.nix +++ b/nix/hm-module.nix @@ -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; @@ -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"; @@ -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} @@ -586,6 +602,8 @@ in { } '') cfg.labels)} + + ${lib.optionalString (cfg.extraConfig != null) cfg.extraConfig} ''; }; }