-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
78 lines (68 loc) · 2.28 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
{
lib,
rustPlatform,
pkgs,
fetchFromGitHub,
...
}:
rustPlatform.buildRustPackage rec {
gitOwner = "ShadowBlip";
pname = "PowerStation";
version = "v0.3.0";
gitHash = "sha256-RiuXEMQUijsBiyFA/OLn6AE2Qv7IXye483eWwSEosNY=";
src = fetchFromGitHub {
owner = gitOwner;
repo = pname;
rev = version;
hash = gitHash;
};
cargoLock =
let
fixupLockFile = path: (builtins.readFile path);
in
{
lockFileContents = fixupLockFile ./Cargo.lock;
allowBuiltinFetchGit = true;
};
postPatch = ''
ln -f -s ${./Cargo.lock} Cargo.lock
'';
cargoHash = "sha256-0ws3p0bpvap8rgrhksghcic8ppj26w60ig8i2cnw6yb4jf6g3yg1=";
# buildInputs - Dependencies that should exist in the runtime environment.
# propagatedBuildInputs - Dependencies that should exist in the runtime environment and also propagated to downstream runtime environments.
buildInputs = with pkgs; [
dbus
systemd
pciutils
];
# nativeBuildInputs - Dependencies that should only exist in the build environment.
# propagatedNativeBuildInputs - Dependencies that should only exist in the build environment and also propagated to downstream build environments.
nativeBuildInputs = with pkgs; [
pkg-config
cmake
rustPlatform.bindgenHook
];
postInstall = ''
install -D -m 644 rootfs/usr/share/dbus-1/system.d/org.shadowblip.PowerStation.conf $out/share/dbus-1/system.d/org.shadowblip.PowerStation.conf
install -D -m 644 rootfs/usr/lib/systemd/system/powerstation.service $out/lib/systemd/system/powerstation.service
sed -i \
-e "s|\[Service\]|[Service]\nBusName=org.shadowblip.PowerStation|" \
-e "s|\[Service\]|[Service]\nType=dbus|" \
-e "s|ExecStart=/usr|ExecStart=$out|" \
"$out/lib/systemd/system/powerstation.service"
mkdir -p $out/share/dbus-1/system-services
cat <<END > $out/share/dbus-1/system-services/org.shadowblip.PowerStation.service
[D-BUS Service]
Name=org.shadowblip.PowerStation
Exec=$out/bin/powerstation
User=root
SystemdService=powerstation.service
END
'';
meta = {
description = "Open source TDP control and performance daemon with DBus interface";
homepage = "https://github.com/ShadowBlip/PowerStation";
license = lib.licenses.gpl3;
maintainers = [ ];
};
}