-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup nix derivation for static builds
Signed-off-by: Wong Hoi Sing Edison <[email protected]>
- Loading branch information
Showing
6 changed files
with
63 additions
and
83 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
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 |
---|---|---|
|
@@ -31,4 +31,4 @@ release.txt | |
/test/copyimg/copyimg | ||
/test/goecho/goecho | ||
.vscode* | ||
result-bin | ||
result |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,53 +1,48 @@ | ||
{ system ? builtins.currentSystem }: | ||
let | ||
pkgs = import ./nixpkgs.nix { | ||
pkgs = (import ./nixpkgs.nix { | ||
config = { | ||
packageOverrides = pkg: { | ||
go_1_12 = pkg.go_1_14; | ||
gpgme = (static pkg.gpgme); | ||
libassuan = (static pkg.libassuan); | ||
libgpgerror = (static pkg.libgpgerror); | ||
libseccomp = (static pkg.libseccomp); | ||
}; | ||
}; | ||
}; | ||
}); | ||
|
||
static = pkg: pkg.overrideAttrs(old: { | ||
configureFlags = (old.configureFlags or []) ++ | ||
[ "--without-shared" "--disable-shared" ]; | ||
static = pkg: pkg.overrideAttrs(x: { | ||
doCheck = false; | ||
configureFlags = (x.configureFlags or []) ++ [ | ||
"--without-shared" | ||
"--disable-shared" | ||
]; | ||
dontDisableStatic = true; | ||
enableSharedExecutables = false; | ||
enableStatic = true; | ||
}); | ||
|
||
patchLvm2 = pkg: pkg.overrideAttrs(old: { | ||
configureFlags = [ | ||
"--disable-cmdlib" "--disable-readline" "--disable-udev_rules" | ||
"--disable-udev_sync" "--enable-pkgconfig" "--enable-static_link" | ||
]; | ||
preConfigure = old.preConfigure + '' | ||
substituteInPlace libdm/Makefile.in --replace \ | ||
SUBDIRS=dm-tools SUBDIRS= | ||
substituteInPlace tools/Makefile.in --replace \ | ||
"TARGETS += lvm.static" "" | ||
substituteInPlace tools/Makefile.in --replace \ | ||
"INSTALL_LVM_TARGETS += install_tools_static" "" | ||
self = with pkgs; buildGoModule rec { | ||
name = "podman"; | ||
src = ./..; | ||
vendorSha256 = null; | ||
doCheck = false; | ||
enableParallelBuilding = true; | ||
outputs = [ "out" ]; | ||
nativeBuildInputs = [ bash git go-md2man installShellFiles makeWrapper pkg-config which ]; | ||
buildInputs = [ glibc glibc.static gpgme libassuan libgpgerror libseccomp libapparmor libselinux ]; | ||
prePatch = '' | ||
export CFLAGS='-static' | ||
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 seccomp apparmor selinux' | ||
''; | ||
buildPhase = '' | ||
patchShebangs . | ||
make bin/podman | ||
''; | ||
installPhase = '' | ||
install -Dm755 bin/podman $out/bin/podman | ||
''; | ||
postInstall = ""; | ||
}); | ||
|
||
self = { | ||
podman-static = (pkgs.podman.overrideAttrs(old: { | ||
name = "podman-static"; | ||
buildInputs = old.buildInputs ++ (with pkgs; [ | ||
(static pkgs.libassuan) | ||
(static pkgs.libgpgerror) | ||
git | ||
glibc | ||
glibc.static | ||
]); | ||
src = ./..; | ||
EXTRA_LDFLAGS = ''-linkmode external -extldflags "-static -lm"''; | ||
BUILDTAGS = ''static netgo apparmor selinux seccomp systemd varlink containers_image_ostree_stub''; | ||
})).override { | ||
gpgme = (static pkgs.gpgme); | ||
libseccomp = (static pkgs.libseccomp); | ||
lvm2 = (patchLvm2 (static pkgs.lvm2)); | ||
}; | ||
}; | ||
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 |
---|---|---|
@@ -1,9 +1,7 @@ | ||
{ | ||
"url": "https://github.com/nixos/nixpkgs", | ||
"rev": "a08d4f605bca62c282ce9955d5ddf7d824e89809", | ||
"date": "2020-03-20T10:10:15+01:00", | ||
"sha256": "1bniq08dlmrmrz4aga1cj0d7rqbaq9xapm5ar15wdv2c6431z2m8", | ||
"fetchSubmodules": false, | ||
"deepClone": false, | ||
"leaveDotGit": false | ||
"rev": "02591d02a910b3b92092153c5f3419a8d696aa1d", | ||
"date": "2020-07-09T03:52:28+02:00", | ||
"sha256": "1pp9v4rqmgx1b298gxix8b79m8pvxy1rcf8l25rxxxxnkr5ls1ng", | ||
"fetchSubmodules": false | ||
} |