Skip to content

Commit 33de6df

Browse files
authored
deepcool-digital-linux: init package and module (#418236)
2 parents 4923722 + 7eef226 commit 33de6df

File tree

3 files changed

+92
-0
lines changed

3 files changed

+92
-0
lines changed

nixos/modules/module-list.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,7 @@
638638
./services/hardware/brltty.nix
639639
./services/hardware/buffyboard.nix
640640
./services/hardware/ddccontrol.nix
641+
./services/hardware/deepcool-digital-linux.nix
641642
./services/hardware/display.nix
642643
./services/hardware/fancontrol.nix
643644
./services/hardware/freefall.nix
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
config,
3+
pkgs,
4+
lib,
5+
...
6+
}:
7+
let
8+
cfg = config.services.hardware.deepcool-digital-linux;
9+
in
10+
{
11+
meta.maintainers = [ lib.maintainers.NotAShelf ];
12+
13+
options.services.hardware.deepcool-digital-linux = {
14+
enable = lib.mkEnableOption "DeepCool Digital monitoring daemon";
15+
package = lib.mkPackageOption pkgs "deepcool-digital-linux" { };
16+
17+
extraArgs = lib.mkOption {
18+
type = lib.types.listOf lib.types.str;
19+
default = [ ];
20+
example = lib.literalExpression ''
21+
[
22+
# Change the update interval
23+
"--update 750"
24+
# Enable the alarm
25+
"--alarm"
26+
]
27+
'';
28+
description = ''
29+
Extra command line arguments to be passed to the deepcool-digital-linux daemon.
30+
'';
31+
};
32+
};
33+
34+
config = lib.mkIf cfg.enable {
35+
environment.systemPackages = [ cfg.package ];
36+
systemd.services.deepcool-digital-linux = {
37+
description = "DeepCool Digital";
38+
wantedBy = [ "multi-user.target" ];
39+
serviceConfig = {
40+
StateDirectory = "deepcool-digital-linux";
41+
WorkingDirectory = "/var/lib/deepcool-digital-linux";
42+
ExecStart = "${lib.getExe cfg.package} ${lib.escapeShellArgs cfg.extraArgs}";
43+
Restart = "always";
44+
};
45+
};
46+
};
47+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
lib,
3+
rustPlatform,
4+
fetchFromGitHub,
5+
pkg-config,
6+
libudev-zero,
7+
versionCheckHook,
8+
nix-update-script,
9+
}:
10+
rustPlatform.buildRustPackage (finalAttrs: {
11+
pname = "deepcool-digital-linux";
12+
version = "0.8.3-alpha";
13+
14+
src = fetchFromGitHub {
15+
owner = "Nortank12";
16+
repo = "deepcool-digital-linux";
17+
tag = "v${finalAttrs.version}";
18+
hash = "sha256-Whmjd6NCOUkE7hM3FaN7grMwcC/suL7AJDVSgnZSKzM=";
19+
};
20+
21+
cargoHash = "sha256-K1pEbUyENPUS4QK0lztWmw8ov1fGrx8KHdODmSByfek=";
22+
23+
buildInputs = [ libudev-zero ];
24+
25+
nativeBuildInputs = [
26+
pkg-config
27+
];
28+
29+
doInstallCheck = false; # FIXME: version cmd returns 0.8.3, set to true when we switch to a stable version
30+
nativeInstallCheckInputs = [ versionCheckHook ];
31+
versionCheckProgramArg = "--version";
32+
33+
passthru.updateScript = nix-update-script { };
34+
35+
meta = {
36+
changelog = "https://github.com/Nortank12/deepcool-digital-linux/releases/tag/v${finalAttrs.version}";
37+
description = "Linux version for the DeepCool Digital Windows software";
38+
homepage = "https://github.com/Nortank12/deepcool-digital-linux";
39+
license = lib.licenses.gpl3Only;
40+
maintainers = with lib.maintainers; [ NotAShelf ];
41+
mainProgram = "deepcool-digital-linux";
42+
platforms = lib.platforms.linux;
43+
};
44+
})

0 commit comments

Comments
 (0)