coolercontrol.*: init at 1.1.1

This commit is contained in:
Guy Boldon 2024-02-11 21:17:19 +01:00
parent 607312f76a
commit 0824756d05
No known key found for this signature in database
GPG key ID: CF7BBB5BC7561BD3
9 changed files with 4903 additions and 0 deletions

View file

@ -162,6 +162,7 @@
./programs/clash-verge.nix
./programs/cnping.nix
./programs/command-not-found/command-not-found.nix
./programs/coolercontrol.nix
./programs/criu.nix
./programs/darling.nix
./programs/dconf.nix

View file

@ -0,0 +1,37 @@
{ config
, lib
, pkgs
, ...
}:
let
cfg = config.programs.coolercontrol;
in
{
##### interface
options = {
programs.coolercontrol.enable = lib.mkEnableOption (lib.mdDoc "CoolerControl GUI & its background services");
};
##### implementation
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs.coolercontrol; [
coolercontrol-gui
];
systemd = {
packages = with pkgs.coolercontrol; [
coolercontrol-liqctld
coolercontrold
];
# https://github.com/NixOS/nixpkgs/issues/81138
services = {
coolercontrol-liqctld.wantedBy = [ "multi-user.target" ];
coolercontrold.wantedBy = [ "multi-user.target" ];
};
};
};
meta.maintainers = with lib.maintainers; [ OPNA2608 codifryed ];
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,73 @@
{ lib
, buildNpmPackage
, rustPlatform
, dbus
, freetype
, gtk3
, libsoup
, openssl
, pkg-config
, webkitgtk
, libappindicator
, makeWrapper
, coolercontrol
}:
{ version
, src
, meta
}:
rustPlatform.buildRustPackage {
pname = "coolercontrol";
inherit version src;
sourceRoot = "${src.name}/coolercontrol-ui/src-tauri";
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"tauri-plugin-autostart-0.0.0" = "sha256-ATw3dbvG3IsLaLBg5wGk7hVRqipwL4xPGKdtD9a5VIw=";
};
};
buildFeatures = [ "custom-protocol" ];
nativeBuildInputs = [
makeWrapper
pkg-config
];
buildInputs = [
dbus
openssl
freetype
libsoup
gtk3
webkitgtk
libappindicator
];
checkFeatures = [ "custom-protocol" ];
# copy the frontend static resources to final build directory
# Also modify tauri.conf.json so that it expects the resources at the new location
postPatch = ''
mkdir -p ui-build
cp -R ${coolercontrol.coolercontrol-ui-data}/* ui-build/
substituteInPlace tauri.conf.json --replace '"distDir": "../dist"' '"distDir": "ui-build"'
'';
postInstall = ''
install -Dm644 "${src}/packaging/metadata/org.coolercontrol.CoolerControl.desktop" -t "$out/share/applications/"
install -Dm644 "${src}/packaging/metadata/org.coolercontrol.CoolerControl.metainfo.xml" -t "$out/share/metainfo/"
install -Dm644 "${src}/packaging/metadata/org.coolercontrol.CoolerControl.png" -t "$out/share/icons/hicolor/256x256/apps/"
install -Dm644 "${src}/packaging/metadata/org.coolercontrol.CoolerControl.svg" -t "$out/share/icons/hicolor/scalable/apps/"
wrapProgram $out/bin/coolercontrol \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ libappindicator ]}
'';
meta = meta // {
description = "${meta.description} (GUI)";
mainProgram = "coolercontrol";
};
}

View file

@ -0,0 +1,36 @@
{ python3
}:
{ version
, src
, meta
}:
python3.pkgs.buildPythonApplication {
pname = "coolercontrol-liqctld";
inherit version src;
sourceRoot = "${src.name}/coolercontrol-liqctld";
format = "pyproject";
nativeBuildInputs = with python3.pkgs; [
setuptools
];
propagatedBuildInputs = with python3.pkgs; [
liquidctl
setproctitle
fastapi
uvicorn
];
postInstall = ''
install -Dm444 "${src}/packaging/systemd/coolercontrol-liqctld.service" -t "$out/lib/systemd/system"
substituteInPlace "$out/lib/systemd/system/coolercontrol-liqctld.service" \
--replace '/usr/bin' "$out/bin"
'';
meta = meta // {
description = "${meta.description} (Liquidctl Daemon)";
mainProgram = "coolercontrol-liqctld";
};
}

View file

@ -0,0 +1,25 @@
{ buildNpmPackage
}:
{ version
, src
, meta
}:
buildNpmPackage {
pname = "coolercontrol-ui";
inherit version src;
sourceRoot = "${src.name}/coolercontrol-ui";
npmDepsHash = "sha256-7Hd1LT1ro83QMuoDGvFGsrTlQaSia+lVG8lyaAibiAo=";
postBuild = ''
cp -r dist $out
'';
dontInstall = true;
meta = meta // {
description = "${meta.description} (UI data)";
};
}

View file

@ -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";
};
}

View file

@ -0,0 +1,34 @@
{ lib
, fetchFromGitLab
, callPackage
}:
let
version = "1.1.1";
src = fetchFromGitLab {
owner = "coolercontrol";
repo = "coolercontrol";
rev = version;
hash = "sha256-QgUYfiiADKVHqOU9WTv+VAqep0IU6Ezy8ZzJwkdHIJQ=";
};
meta = with lib; {
description = "Monitor and control your cooling devices";
homepage = "https://gitlab.com/coolercontrol/coolercontrol";
license = licenses.gpl3Plus;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ codifryed OPNA2608 ];
};
applySharedDetails = drv: drv { inherit version src meta; };
in
rec {
coolercontrol-ui-data = applySharedDetails (callPackage ./coolercontrol-ui-data.nix { });
coolercontrold = applySharedDetails (callPackage ./coolercontrold.nix { });
coolercontrol-gui = applySharedDetails (callPackage ./coolercontrol-gui.nix { });
coolercontrol-liqctld = applySharedDetails (callPackage ./coolercontrol-liqctld.nix { });
}

View file

@ -561,6 +561,8 @@ with pkgs;
containerpilot = callPackage ../applications/networking/cluster/containerpilot { };
coolercontrol = recurseIntoAttrs (callPackage ../applications/system/coolercontrol { });
coost = callPackage ../development/libraries/coost { };
confetty = callPackage ../applications/misc/confetty { };