github.com/containers/podman/v2@v2.2.2-0.20210501105131-c1e07d070c4c/nix/default.nix (about) 1 { system ? builtins.currentSystem }: 2 let 3 pkgs = (import ./nixpkgs.nix { 4 config = { 5 packageOverrides = pkg: { 6 gpgme = (static pkg.gpgme); 7 libassuan = (static pkg.libassuan); 8 libgpgerror = (static pkg.libgpgerror); 9 libseccomp = (static pkg.libseccomp); 10 glib = (static pkg.glib).overrideAttrs(x: { 11 outputs = [ "bin" "out" "dev" ]; 12 mesonFlags = [ 13 "-Ddefault_library=static" 14 "-Ddevbindir=${placeholder ''dev''}/bin" 15 "-Dgtk_doc=false" 16 "-Dnls=disabled" 17 ]; 18 }); 19 }; 20 }; 21 }); 22 23 static = pkg: pkg.overrideAttrs(x: { 24 doCheck = false; 25 configureFlags = (x.configureFlags or []) ++ [ 26 "--without-shared" 27 "--disable-shared" 28 ]; 29 dontDisableStatic = true; 30 enableSharedExecutables = false; 31 enableStatic = true; 32 }); 33 34 self = with pkgs; buildGoModule rec { 35 name = "podman"; 36 src = ./..; 37 vendorSha256 = null; 38 doCheck = false; 39 enableParallelBuilding = true; 40 outputs = [ "out" ]; 41 nativeBuildInputs = [ bash git go-md2man installShellFiles makeWrapper pkg-config which ]; 42 buildInputs = [ glibc glibc.static gpgme libassuan libgpgerror libseccomp libapparmor libselinux ]; 43 prePatch = '' 44 export CFLAGS='-static' 45 export LDFLAGS='-s -w -static-libgcc -static' 46 export EXTRA_LDFLAGS='-s -w -linkmode external -extldflags "-static -lm"' 47 export BUILDTAGS='static netgo osusergo exclude_graphdriver_btrfs exclude_graphdriver_devicemapper seccomp apparmor selinux' 48 ''; 49 buildPhase = '' 50 patchShebangs . 51 make bin/podman 52 ''; 53 installPhase = '' 54 install -Dm755 bin/podman $out/bin/podman 55 ''; 56 }; 57 in self