Skip to content

Commit 3bdcacf

Browse files
authored
Merge pull request #19 from mBuschauer/main
nix: add theme setting to nix config
2 parents 6aeab29 + 6fe1c07 commit 3bdcacf

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

nix/modules/home-manager.nix

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ self: {
66
}: let
77
inherit (lib.options) mkEnableOption mkPackageOption mkOption;
88
inherit (lib.meta) getExe;
9-
inherit (lib.types) nullOr str;
9+
inherit (lib.types) nullOr str enum;
1010
inherit (lib) mkIf optionals;
1111

1212
cfg = config.services.tailray;
@@ -28,6 +28,13 @@ in {
2828
default = null;
2929
example = "https://headplane.example.com/admin/login";
3030
};
31+
32+
theme = mkOption {
33+
description = "Icon Theme";
34+
type = enum ["light" "dark"];
35+
default = "light";
36+
example = "dark";
37+
};
3138
};
3239

3340
config = mkIf cfg.enable {
@@ -47,9 +54,12 @@ in {
4754
ExecStart = "${getExe cfg.package}";
4855
Restart = "always";
4956
RestartSec = "10";
50-
Environment = optionals (cfg.adminUrl != null) [
51-
"TAILRAY_ADMIN_URL=${cfg.adminUrl}"
52-
];
57+
Environment =
58+
lib.optional (cfg.adminUrl != null)
59+
["TAILRAY_ADMIN_URL=${cfg.adminUrl}"]
60+
++ [
61+
"TAILRAY_THEME=${cfg.theme}"
62+
];
5363
};
5464
};
5565
};

nix/modules/nixos.nix

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ self: {
66
}: let
77
inherit (lib.options) mkEnableOption mkPackageOption mkOption;
88
inherit (lib.meta) getExe;
9-
inherit (lib.types) nullOr str;
9+
inherit (lib.types) nullOr str enum;
1010
inherit (lib) mkIf;
1111

1212
cfg = config.services.tailray;
@@ -28,6 +28,13 @@ in {
2828
default = null;
2929
example = "https://headplane.example.com/admin/login";
3030
};
31+
32+
theme = mkOption {
33+
description = "Icon Theme";
34+
type = enum ["light" "dark"];
35+
default = "light";
36+
example = "dark";
37+
};
3138
};
3239

3340
config = mkIf cfg.enable {
@@ -40,8 +47,10 @@ in {
4047
Restart = "always";
4148
RestartSec = "10";
4249
};
43-
44-
environment.TAILRAY_ADMIN_URL = mkIf (cfg.adminUrl != null) cfg.adminUrl;
50+
environment = {
51+
TAILRAY_THEME = cfg.theme;
52+
TAILRAY_ADMIN_URL = mkIf (cfg.adminUrl != null) cfg.adminUrl;
53+
};
4554
};
4655
};
4756
}

0 commit comments

Comments
 (0)