github.com/AbhinandanKurakure/podman/v3@v3.4.10/nix/default-arm64.nix (about)

     1  let
     2    pkgs = (import ./nixpkgs.nix {
     3      crossSystem = {
     4        config = "aarch64-unknown-linux-gnu";
     5      };
     6      config = {
     7        packageOverrides = pkg: {
     8          gpgme = (static pkg.gpgme);
     9          libassuan = (static pkg.libassuan);
    10          libgpgerror = (static pkg.libgpgerror);
    11          libseccomp = (static pkg.libseccomp);
    12          glib = (static pkg.glib).overrideAttrs (x: {
    13            outputs = [ "bin" "out" "dev" ];
    14            mesonFlags = [
    15              "-Ddefault_library=static"
    16              "-Ddevbindir=${placeholder ''dev''}/bin"
    17              "-Dgtk_doc=false"
    18              "-Dnls=disabled"
    19            ];
    20            postInstall = ''
    21              moveToOutput "share/glib-2.0" "$dev"
    22              substituteInPlace "$dev/bin/gdbus-codegen" --replace "$out" "$dev"
    23              sed -i "$dev/bin/glib-gettextize" -e "s|^gettext_dir=.*|gettext_dir=$dev/share/glib-2.0/gettext|"
    24              sed '1i#line 1 "${x.pname}-${x.version}/include/glib-2.0/gobject/gobjectnotifyqueue.c"' \
    25                -i "$dev"/include/glib-2.0/gobject/gobjectnotifyqueue.c
    26            '';
    27          });
    28          pcsclite = (static pkg.pcsclite).overrideAttrs (x: {
    29            configureFlags = [
    30              "--enable-confdir=/etc"
    31              "--enable-usbdropdir=/var/lib/pcsc/drivers"
    32              "--disable-libsystemd"
    33              "--disable-libudev"
    34              "--disable-libusb"
    35            ];
    36            buildInputs = [ pkgs.python3 pkgs.dbus ];
    37          });
    38          systemd = (static pkg.systemd).overrideAttrs (x: {
    39            outputs = [ "out" "dev" ];
    40            mesonFlags = x.mesonFlags ++ [
    41              "-Dglib=false"
    42              "-Dstatic-libsystemd=true"
    43            ];
    44          });
    45        };
    46      };
    47    });
    48  
    49    static = pkg: pkg.overrideAttrs (x: {
    50      doCheck = false;
    51      configureFlags = (x.configureFlags or [ ]) ++ [
    52        "--without-shared"
    53        "--disable-shared"
    54      ];
    55      dontDisableStatic = true;
    56      enableSharedExecutables = false;
    57      enableStatic = true;
    58    });
    59  
    60    self = with pkgs; buildGoModule rec {
    61      name = "podman";
    62      src = builtins.filterSource
    63        (path: type: !(type == "directory" && baseNameOf path == "bin")) ./..;
    64      vendorSha256 = null;
    65      doCheck = false;
    66      enableParallelBuilding = true;
    67      outputs = [ "out" ];
    68      nativeBuildInputs = [ bash gitMinimal go-md2man pkg-config which ];
    69      buildInputs = [ glibc glibc.static glib gpgme libassuan libgpgerror libseccomp libapparmor libselinux ];
    70      prePatch = ''
    71        export CFLAGS='-static -pthread'
    72        export LDFLAGS='-s -w -static-libgcc -static'
    73        export EXTRA_LDFLAGS='-s -w -linkmode external -extldflags "-static -lm"'
    74        export BUILDTAGS='static netgo osusergo exclude_graphdriver_btrfs exclude_graphdriver_devicemapper seccomp apparmor selinux'
    75        export CGO_ENABLED=1
    76      '';
    77      buildPhase = ''
    78        patchShebangs .
    79        make bin/podman
    80        make bin/podman-remote
    81      '';
    82      installPhase = ''
    83        install -Dm755 bin/podman $out/bin/podman
    84        install -Dm755 bin/podman-remote $out/bin/podman-remote
    85      '';
    86    };
    87  in
    88  self