forked from NixOS/nixops-hetzner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.nix
61 lines (48 loc) · 1.72 KB
/
release.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
{ src ? { outPath = ./.; revCount = 0; shortRev = "abcdef"; rev = "HEAD"; }
, officialRelease ? false
, nixpkgs ? <nixpkgs>
}:
let
pkgs = import nixpkgs { system = "x86_64-linux"; };
version = "1.7" +
(if officialRelease then ""
else if src ? lastModified then "pre${builtins.substring 0 8 src.lastModified}.${src.shortRev}"
else "pre${toString src.revCount}_${src.shortRev}");
in
rec {
build = pkgs.lib.genAttrs [ "x86_64-linux" "i686-linux" "x86_64-darwin" ] (system:
with import nixpkgs { inherit system; };
python2Packages.buildPythonApplication rec {
name = "nixops-hetzner-${version}";
namePrefix = "";
src = ./.;
prePatch = ''
for i in setup.py; do
substituteInPlace $i --subst-var-by version ${version}
done
'';
buildInputs = [ python2Packages.nose python2Packages.coverage ];
propagatedBuildInputs = with python2Packages;
[
hetzner
];
# For "nix-build --run-env".
shellHook = ''
export PYTHONPATH=$(pwd):$PYTHONPATH
export PATH=$(pwd)/scripts:${openssh}/bin:$PATH
'';
doCheck = false;
# Needed by libcloud during tests
SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
# Add openssh to nixops' PATH. On some platforms, e.g. CentOS and RHEL
# the version of openssh is causing errors when have big networks (40+)
makeWrapperArgs = ["--prefix" "PATH" ":" "${openssh}/bin" "--set" "PYTHONPATH" ":"];
postInstall =
''
mkdir -p $out/share/nix/nixops-hetzner
cp -av nix/* $out/share/nix/nixops-hetzner
'';
meta.description = "Nix package for ${stdenv.system}";
}
);
}