-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdater.nix
42 lines (35 loc) · 1.33 KB
/
updater.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
{ lib, pkgs, nimPackages, fetchurl, fetchFromGitHub, busybox, gnutar, xz }:
let
q = fetchFromGitHub {
owner = "OpenSystemsLab";
repo = "q.nim";
rev = "0.0.8";
sha256 = "sha256-juYoPW1pIizSNeEf203gs/3zm64iHxzV41fKFeSuqaY=";
};
in
nimPackages.buildNimPackage rec {
pname = "updater";
version = "0.3.0";
nimBinOnly = true;
nimRelease = true;
nimDefines = [ "ssl" ];
src = ./src;
# set relative paths for dependencies, so they can be discovered in a nix bundle
postPatch = ''
substituteInPlace updater/updater.nim --replace 'systemXZ = "xz"' 'systemXZ = "${xz}/bin/xz"'
substituteInPlace updater/updater.nim --replace 'systemTar = "tar"' 'systemTar = "${gnutar}/bin/tar"'
substituteInPlace updater/updater.nim --replace 'systemSha256 = "sha256sum"' 'systemSha256 = "${busybox}/bin/sha256sum"'
substituteInPlace updater/updater.nim --replace 'systemShell = "/bin/sh"' 'systemShell = "${busybox}/bin/sh"'
'';
doCheck = true;
checkPhase = ''testament all'';
nativeBuildInputs = [ pkgs.removeReferencesTo ];
buildInputs = (with nimPackages; [
q
]) ++
[ pkgs.nim-unwrapped ]; # needs to be declared als buildInput, so the path is known for the postFixup
propagatedBuildInputs = [ busybox gnutar xz ];
postFixup = ''
remove-references-to -t ${pkgs.nim-unwrapped} $out/bin/updater
'';
}