-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
37 lines (30 loc) · 1.05 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
# based on https://blog.stigok.com/2019/11/05/packing-python-script-binary-nicely-in-nixos.html
{ nixpkgs ? import <nixpkgs> {}, pythonPkgs ? nixpkgs.pkgs.python310Packages, lib ? import <lib> {} }:
let
inherit (nixpkgs) pkgs;
inherit pythonPkgs;
f = { buildPythonPackage, watchdog, bash, lm_sensors, ectool, lib }:
buildPythonPackage rec {
pname = "fw-fanctrl";
version = "0.0.1";
src = builtins.fetchGit {
url = "https://github.com/mdvmeijer/fw-fanctrl";
ref = "main";
};
# Python runtime dependencies
propagatedBuildInputs = [ watchdog ];
# Runtime dependencies that the script calls with `subprocess.run`
makeWrapperArgs = [ "--prefix PATH : ${lib.makeBinPath [
bash
lm_sensors
(import (./. + "/fw-ectool/default.nix"))
]}" ];
meta = {
description = ''
Python script for better control of the Framework Laptop's fan
'';
};
};
drv = pythonPkgs.callPackage f {};
in
if pkgs.lib.inNixShell then drv.env else drv