summaryrefslogtreecommitdiff
path: root/nix/default.nix
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-05-11 15:15:18 +0200
committerGitHub <noreply@github.com>2020-05-11 15:15:18 +0200
commitd473e6e35120ad254a62301a89be26e5ad589752 (patch)
tree99f35e8d868502febe889de3713f37fad58e3fcb /nix/default.nix
parent01f747fdc3b601492d496536ced1386172c4e3d8 (diff)
parentc21258b70ed91ab5ff8b1d345123fed1011a49c9 (diff)
downloadpodman-d473e6e35120ad254a62301a89be26e5ad589752.tar.gz
podman-d473e6e35120ad254a62301a89be26e5ad589752.tar.bz2
podman-d473e6e35120ad254a62301a89be26e5ad589752.zip
Merge pull request #5566 from openSUSE/static-binary
Add podman static build
Diffstat (limited to 'nix/default.nix')
-rw-r--r--nix/default.nix53
1 files changed, 53 insertions, 0 deletions
diff --git a/nix/default.nix b/nix/default.nix
new file mode 100644
index 000000000..211caee93
--- /dev/null
+++ b/nix/default.nix
@@ -0,0 +1,53 @@
+let
+ pkgs = import ./nixpkgs.nix {
+ config = {
+ packageOverrides = pkg: {
+ go_1_12 = pkg.go_1_14;
+ };
+ };
+ };
+
+ static = pkg: pkg.overrideAttrs(old: {
+ configureFlags = (old.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" ""
+ '';
+ 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 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