about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/system/coolercontrol/coolercontrold.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/system/coolercontrol/coolercontrold.nix')
-rw-r--r--nixpkgs/pkgs/applications/system/coolercontrol/coolercontrold.nix42
1 files changed, 42 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/system/coolercontrol/coolercontrold.nix b/nixpkgs/pkgs/applications/system/coolercontrol/coolercontrold.nix
new file mode 100644
index 000000000000..087fa4ad215e
--- /dev/null
+++ b/nixpkgs/pkgs/applications/system/coolercontrol/coolercontrold.nix
@@ -0,0 +1,42 @@
+{ rustPlatform
+, buildNpmPackage
+, testers
+, coolercontrol
+}:
+
+{ version
+, src
+, meta
+}:
+
+rustPlatform.buildRustPackage {
+  pname = "coolercontrold";
+  inherit version src;
+  sourceRoot = "${src.name}/coolercontrold";
+
+  cargoHash = "sha256-Ybqr36AkcPnGJeFcCqg/zuWcaooZ1gJPCi5IbgXmeJ0=";
+
+  # copy the frontend static resources to a directory for embedding
+  postPatch = ''
+    mkdir -p ui-build
+    cp -R ${coolercontrol.coolercontrol-ui-data}/* ui-build/
+    substituteInPlace build.rs --replace '"./resources/app"' '"./ui-build"'
+  '';
+
+  postInstall = ''
+    install -Dm444 "${src}/packaging/systemd/coolercontrold.service" -t "$out/lib/systemd/system"
+    substituteInPlace "$out/lib/systemd/system/coolercontrold.service" \
+      --replace '/usr/bin' "$out/bin"
+  '';
+
+  passthru.tests.version = testers.testVersion {
+    package = coolercontrol.coolercontrold;
+    # coolercontrold prints its version with "v" prefix
+    version = "v${version}";
+  };
+
+  meta = meta // {
+    description = "${meta.description} (Main Daemon)";
+    mainProgram = "coolercontrold";
+  };
+}