-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
178 lines (157 loc) · 5.1 KB
/
flake.nix
File metadata and controls
178 lines (157 loc) · 5.1 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
{
description = "Per-core CPU stability tester and PBO Curve Optimizer tuner for AMD Ryzen on Linux";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
git-hooks = {
url = "github:cachix/git-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
git-hooks,
}:
let
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
pkgsFor =
system:
import nixpkgs {
localSystem.system = system;
config.allowUnfree = true;
};
in
{
# NixOS module — kernel modules, device access, udev rules, package
nixosModules.default = import ./nix/module.nix { inherit self; };
# Overlay — makes pkgs.linux-corecycler and pkgs.linux-corecycler-full available
overlays.default = final: _prev: {
linux-corecycler = self.packages.${final.stdenv.hostPlatform.system}.default;
linux-corecycler-full = self.packages.${final.stdenv.hostPlatform.system}.full;
};
formatter = forAllSystems (system: (pkgsFor system).nixfmt);
checks = forAllSystems (system: {
pre-commit = git-hooks.lib.${system}.run {
src = ./.;
hooks = {
nixfmt-rfc-style.enable = true;
};
};
});
packages = forAllSystems (
system:
let
pkgs = pkgsFor system;
python = pkgs.python312;
pythonPkgs = python.pkgs;
# Shared build function — backends list is the only difference
mkCoreCycler =
{
backends ? [
pkgs.stress-ng
pkgs.stressapptest
],
pnameSuffix ? "",
}:
pythonPkgs.buildPythonApplication {
pname = "corecycler${pnameSuffix}";
version = "0.0.1";
pyproject = true;
src = ./.;
build-system = [
pythonPkgs.setuptools
pythonPkgs.setuptools-scm
];
dependencies = [
pythonPkgs.pyside6
];
nativeCheckInputs = [ pythonPkgs.pytest ];
# Qt6 runtime needs
nativeBuildInputs = [ pkgs.qt6.wrapQtAppsHook ];
buildInputs = [ pkgs.qt6.qtbase ];
dontWrapQtApps = true;
preFixup = ''
makeWrapperArgs+=("''${qtWrapperArgs[@]}")
'';
# Install icon, desktop file, and asset SVGs
postInstall = ''
install -Dm644 assets/icon.svg $out/share/icons/hicolor/scalable/apps/corecycler.svg
install -Dm644 assets/corecycler.desktop $out/share/applications/corecycler.desktop
install -d $out/share/corecycler/assets
install -Dm644 assets/*.svg $out/share/corecycler/assets/
'';
# Make stress test backends available on PATH at runtime
postFixup = ''
wrapProgram $out/bin/corecycler \
--prefix PATH : ${
pkgs.lib.makeBinPath (
backends
++ [
pkgs.util-linux # for taskset
pkgs.dmidecode # for DIMM info in Memory tab
]
)
}
'';
meta = {
description = "Per-core CPU stability tester and PBO Curve Optimizer tuner for AMD Ryzen";
license = pkgs.lib.licenses.gpl3Plus;
mainProgram = "corecycler";
platforms = pkgs.lib.platforms.linux;
};
};
in
{
# FOSS-only: stress-ng only (no unfree software)
default = mkCoreCycler { };
# Full: includes mprime (unfree)
full = mkCoreCycler {
backends = [
pkgs.mprime
pkgs.stress-ng
pkgs.stressapptest
];
};
}
);
devShells = forAllSystems (
system:
let
pkgs = pkgsFor system;
python = pkgs.python312;
in
{
default = pkgs.mkShell {
packages = [
(python.withPackages (
ps: with ps; [
pyside6
pytest
ruff
]
))
pkgs.qt6.qtbase
pkgs.mprime
pkgs.stress-ng
pkgs.stressapptest
pkgs.util-linux # taskset
pkgs.nil
];
inputsFrom = [ self.checks.${system}.pre-commit ];
env.QT_QPA_PLATFORM_PLUGIN_PATH = "${pkgs.qt6.qtbase}/lib/qt-6/plugins/platforms";
shellHook = ''
${self.checks.${system}.pre-commit.shellHook}
echo "corecycler dev shell"
echo " Run: python src/main.py"
echo " Test: pytest tests/"
'';
};
}
);
};
}