-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathdefault.nix
54 lines (47 loc) · 1.88 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
# SPDX-FileCopyrightText: 2025 IObundle
#
# SPDX-License-Identifier: MIT
{ pkgs ? import <nixpkgs> {} }:
let
py2hwsw_commit = "8394efd39edeaa898d22248e1312f94506bbcf1b"; # Replace with the desired commit.
py2hwsw_sha256 = "wLj7K8vmvbEC44T2Sv42+0HnrDHNhBO/SIUU0jT2TSM="; # Replace with the actual SHA256 hash.
# Get local py2hwsw root from `PY2HWSW_ROOT` env variable
py2hwswRoot = builtins.getEnv "PY2HWSW_ROOT";
# For debug
force_py2_build = 0;
py2hwsw =
# If no root is provided, or there is a root but we want to force a rebuild
if py2hwswRoot == "" || force_py2_build != 0 then
pkgs.python3.pkgs.buildPythonPackage rec {
pname = "py2hwsw";
version = py2hwsw_commit;
src =
if py2hwswRoot != "" then
# Root provided, use local
pkgs.lib.cleanSource py2hwswRoot
else
# No root provided, use GitHub
(pkgs.fetchFromGitHub {
owner = "IObundle";
repo = "py2hwsw";
rev = py2hwsw_commit;
sha256 = py2hwsw_sha256;
fetchSubmodules = true;
}).overrideAttrs (_: {
GIT_CONFIG_COUNT = 1;
GIT_CONFIG_KEY_0 = "url.https://github.com/.insteadOf";
GIT_CONFIG_VALUE_0 = "git@github.com:";
});
# Add any necessary dependencies here.
#propagatedBuildInputs = [ pkgs.python38Packages.someDependency ];
}
else
null;
in
# If no root is provided, or there is a root but we want to force a rebuild
if py2hwswRoot == "" || force_py2_build != 0 then
# Use newly built nix package
import "${py2hwsw}/lib/python${builtins.substring 0 4 pkgs.python3.version}/site-packages/py2hwsw/lib/default.nix" { inherit pkgs; py2hwsw_pkg = py2hwsw; }
else
# Use local
import "${py2hwswRoot}/py2hwsw/lib/default.nix" { inherit pkgs; py2hwsw_pkg = py2hwsw; }