-
Notifications
You must be signed in to change notification settings - Fork 802
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add nix derivation for static builds
Signed-off-by: Wong Hoi Sing Edison <[email protected]>
- Loading branch information
Showing
11 changed files
with
85 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
*.1 | ||
/layers-* | ||
/skopeo | ||
result | ||
|
||
# ignore JetBrains IDEs (GoLand) config folder | ||
.idea | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ to start a container, then within the container: | |
SKOPEO_CONTAINER_TESTS=1 PS1='nested> ' go test -tags openshift_shell -timeout=24h ./integration -v -check.v -check.vv -check.f='CopySuite.TestRunShell' | ||
An example of what can be done within the container: | ||
cd ..; make binary-local install | ||
cd ..; make bin/skopeo install | ||
./skopeo --tls-verify=false copy [email protected] docker://busybox:latest atomic:localhost:5000/myns/personal:personal | ||
oc get istag personal:personal -o json | ||
curl -L -v 'http://localhost:5000/v2/' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"url": "https://github.com/nixos/nixpkgs", | ||
"rev": "78e324d2726127828a15f87a75b4d3199a8955ec", | ||
"date": "2020-06-16T18:23:14-07:00", | ||
"path": "/nix/store/bwhp0061k3fk00j8fskpfak261jdcjl6-nixpkgs", | ||
"sha256": "1j58aa9ngdmvbnds4x4a497nynj390dzqyb5yrvmhjc7k9anq6jm", | ||
"fetchSubmodules": false, | ||
"deepClone": false, | ||
"leaveDotGit": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
let | ||
json = builtins.fromJSON (builtins.readFile ./nixpkgs.json); | ||
nixpkgs = import (builtins.fetchTarball { | ||
name = "nixos-unstable"; | ||
url = "${json.url}/archive/${json.rev}.tar.gz"; | ||
inherit (json) sha256; | ||
}); | ||
in nixpkgs |