forked from containers/skopeo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefault.nix
More file actions
43 lines (41 loc) · 1.27 KB
/
default.nix
File metadata and controls
43 lines (41 loc) · 1.27 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
{ system ? builtins.currentSystem }:
let
pkgs = (import ./nixpkgs.nix {
config = {
packageOverrides = pkg: {
gpgme = (static pkg.gpgme);
libassuan = (static pkg.libassuan);
libgpgerror = (static pkg.libgpgerror);
};
};
});
static = pkg: pkg.overrideAttrs(x: {
configureFlags = (x.configureFlags or []) ++
[ "--without-shared" "--disable-shared" ];
dontDisableStatic = true;
enableSharedExecutables = false;
enableStatic = true;
});
self = with pkgs; buildGoPackage rec {
name = "skopeo";
src = ./..;
goPackagePath = "github.com/containers/skopeo";
doCheck = false;
enableParallelBuilding = true;
nativeBuildInputs = [ git go-md2man installShellFiles makeWrapper pkg-config ];
buildInputs = [ glibc glibc.static gpgme libassuan libgpgerror ];
prePatch = ''
export LDFLAGS='-s -w -static-libgcc -static'
export EXTRA_LDFLAGS='-s -w -linkmode external -extldflags "-static -lm"'
export BUILDTAGS='static netgo exclude_graphdriver_btrfs exclude_graphdriver_devicemapper'
'';
buildPhase = ''
pushd go/src/${goPackagePath}
patchShebangs .
make bin/skopeo
'';
installPhase = ''
install -Dm755 bin/skopeo $out/bin/skopeo
'';
};
in self