From 95a0303ab949d2b4569e57bbace9067fcb6f142d Mon Sep 17 00:00:00 2001 From: Sascha Grunert Date: Wed, 21 Jul 2021 12:29:15 +0200 Subject: [PATCH] Bump nixpkgs Signed-off-by: Sascha Grunert --- Makefile | 2 +- nix/default-arm64.nix | 79 ++++--------------------------------------- nix/default.nix | 58 +++++-------------------------- nix/derivation.nix | 46 +++++++++++++++++++++++++ nix/nixpkgs.json | 8 ++--- nix/static.nix | 10 ++++++ 6 files changed, 77 insertions(+), 126 deletions(-) create mode 100644 nix/derivation.nix create mode 100644 nix/static.nix diff --git a/Makefile b/Makefile index ac2964f5902..6bf7b149205 100644 --- a/Makefile +++ b/Makefile @@ -226,7 +226,7 @@ bin/crio.cross.%: .gopathok .explicit_phony $(GO_BUILD) $(GO_LDFLAGS) -tags "containers_image_openpgp btrfs_noversion" -o "$@" $(PROJECT)/cmd/crio nixpkgs: - @nix run -f channel:nixos-20.09 nix-prefetch-git -c nix-prefetch-git \ + @nix run -f channel:nixpkgs-unstable nix-prefetch-git -c nix-prefetch-git \ --no-deepClone https://github.com/nixos/nixpkgs > nix/nixpkgs.json diff --git a/nix/default-arm64.nix b/nix/default-arm64.nix index adc6c784b5b..7bd3ed53a20 100644 --- a/nix/default-arm64.nix +++ b/nix/default-arm64.nix @@ -1,4 +1,6 @@ let + static = import ./static.nix; + pkgs = (import ./nixpkgs.nix { crossSystem = { config = "aarch64-unknown-linux-gnu"; @@ -9,81 +11,14 @@ let libassuan = (static pkg.libassuan); libgpgerror = (static pkg.libgpgerror); libseccomp = (static pkg.libseccomp); - glib = (static pkg.glib).overrideAttrs (x: { - outputs = [ "bin" "out" "dev" ]; - mesonFlags = [ - "-Ddefault_library=static" - "-Ddevbindir=${placeholder ''dev''}/bin" - "-Dgtk_doc=false" - "-Dnls=disabled" - ]; - postInstall = '' - moveToOutput "share/glib-2.0" "$dev" - substituteInPlace "$dev/bin/gdbus-codegen" --replace "$out" "$dev" - sed -i "$dev/bin/glib-gettextize" -e "s|^gettext_dir=.*|gettext_dir=$dev/share/glib-2.0/gettext|" - sed '1i#line 1 "${x.pname}-${x.version}/include/glib-2.0/gobject/gobjectnotifyqueue.c"' \ - -i "$dev"/include/glib-2.0/gobject/gobjectnotifyqueue.c - ''; - }); + gnupg = pkg.gnupg.override { + libusb1 = null; + pcsclite = null; + }; }; }; }); - static = pkg: pkg.overrideAttrs (x: { - doCheck = false; - configureFlags = (x.configureFlags or [ ]) ++ [ - "--without-shared" - "--disable-shared" - ]; - dontDisableStatic = true; - enableSharedExecutables = false; - enableStatic = true; - }); - - self = with pkgs; buildGoModule { - name = "cri-o"; - src = ./..; - vendorSha256 = null; - doCheck = false; - enableParallelBuilding = true; - outputs = [ "out" ]; - nativeBuildInputs = with buildPackages; [ - bash - gitMinimal - go-md2man - installShellFiles - makeWrapper - pkg-config - which - ]; - buildInputs = [ - glibc - glibc.static - gpgme - libassuan - libgpgerror - libseccomp - libapparmor - libselinux - ]; - prePatch = '' - export CFLAGS='-static -pthread' - export LDFLAGS='-s -w -static-libgcc -static' - export EXTRA_LDFLAGS='-s -w -linkmode external -extldflags "-static -lm"' - export BUILDTAGS='static netgo osusergo exclude_graphdriver_btrfs exclude_graphdriver_devicemapper seccomp apparmor selinux' - export CGO_ENABLED=1 - ''; - buildPhase = '' - patchShebangs . - make bin/crio - make bin/crio-status - make bin/pinns - ''; - installPhase = '' - install -Dm755 bin/crio $out/bin/crio - install -Dm755 bin/crio-status $out/bin/crio-status - install -Dm755 bin/pinns $out/bin/pinns - ''; - }; + self = import ./derivation.nix { inherit pkgs; }; in self diff --git a/nix/default.nix b/nix/default.nix index 110fc1d6f58..38da8961ee2 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -1,5 +1,6 @@ -{ system ? builtins.currentSystem }: let + static = import ./static.nix; + pkgs = (import ./nixpkgs.nix { config = { packageOverrides = pkg: { @@ -7,55 +8,14 @@ let libassuan = (static pkg.libassuan); libgpgerror = (static pkg.libgpgerror); libseccomp = (static pkg.libseccomp); - glib = (static pkg.glib).overrideAttrs(x: { - outputs = [ "bin" "out" "dev" ]; - mesonFlags = [ - "-Ddefault_library=static" - "-Ddevbindir=${placeholder ''dev''}/bin" - "-Dgtk_doc=false" - "-Dnls=disabled" - ]; - }); + gnupg = pkg.gnupg.override { + libusb1 = null; + pcsclite = null; + }; }; }; }); - static = pkg: pkg.overrideAttrs(x: { - doCheck = false; - configureFlags = (x.configureFlags or []) ++ [ - "--without-shared" - "--disable-shared" - ]; - dontDisableStatic = true; - enableSharedExecutables = false; - enableStatic = true; - }); - - self = with pkgs; buildGoModule rec { - name = "cri-o"; - src = ./..; - vendorSha256 = null; - doCheck = false; - enableParallelBuilding = true; - outputs = [ "out" ]; - nativeBuildInputs = [ bash gitMinimal go-md2man installShellFiles makeWrapper pkg-config which ]; - buildInputs = [ glibc glibc.static gpgme libassuan libgpgerror libseccomp libapparmor libselinux ]; - prePatch = '' - export CFLAGS='-static -pthread' - export LDFLAGS='-s -w -static-libgcc -static' - export EXTRA_LDFLAGS='-s -w -linkmode external -extldflags "-static -lm"' - export BUILDTAGS='static netgo osusergo exclude_graphdriver_btrfs exclude_graphdriver_devicemapper seccomp apparmor selinux' - ''; - buildPhase = '' - patchShebangs . - make bin/crio - make bin/crio-status - make bin/pinns - ''; - installPhase = '' - install -Dm755 bin/crio $out/bin/crio - install -Dm755 bin/crio-status $out/bin/crio-status - install -Dm755 bin/pinns $out/bin/pinns - ''; - }; -in self + self = import ./derivation.nix { inherit pkgs; }; +in +self diff --git a/nix/derivation.nix b/nix/derivation.nix new file mode 100644 index 00000000000..c7fd6295682 --- /dev/null +++ b/nix/derivation.nix @@ -0,0 +1,46 @@ +{ pkgs }: +with pkgs; buildGoModule { + name = "cri-o"; + src = ./..; + vendorSha256 = null; + doCheck = false; + enableParallelBuilding = true; + outputs = [ "out" ]; + nativeBuildInputs = with buildPackages; [ + bash + gitMinimal + go-md2man + installShellFiles + makeWrapper + pkg-config + which + ]; + buildInputs = [ + glibc + glibc.static + gpgme + libassuan + libgpgerror + libseccomp + libapparmor + libselinux + ]; + prePatch = '' + export CFLAGS='-static -pthread' + export LDFLAGS='-s -w -static-libgcc -static' + export EXTRA_LDFLAGS='-s -w -linkmode external -extldflags "-static -lm"' + export BUILDTAGS='static netgo osusergo exclude_graphdriver_btrfs exclude_graphdriver_devicemapper seccomp apparmor selinux' + export CGO_ENABLED=1 + ''; + buildPhase = '' + patchShebangs . + make bin/crio + make bin/crio-status + make bin/pinns + ''; + installPhase = '' + install -Dm755 bin/crio $out/bin/crio + install -Dm755 bin/crio-status $out/bin/crio-status + install -Dm755 bin/pinns $out/bin/pinns + ''; +} diff --git a/nix/nixpkgs.json b/nix/nixpkgs.json index 459fb28f82e..c506c7c4a24 100644 --- a/nix/nixpkgs.json +++ b/nix/nixpkgs.json @@ -1,9 +1,9 @@ { "url": "https://github.com/nixos/nixpkgs", - "rev": "30c2fb65feaf1068b1c413a0b75470afd351c291", - "date": "2021-01-28T21:27:34-05:00", - "path": "/nix/store/zk71rlw37vg9hqc5j0vqi9x8qzb2ir0m-nixpkgs", - "sha256": "0b1y1lgzbagpgh9cvi9szkm162laifz0q2ss4pibns3j3gqpf5gl", + "rev": "d5bece83ba1adef9542e30ed250b1b1bb56b49cf", + "date": "2021-07-21T10:48:39+02:00", + "path": "/nix/store/3ff7rdqakhgnhizdzp8vjrlm6cvh2fn6-nixpkgs", + "sha256": "1sj99n6ni7q60psx1asiqxycsn4fk8jcwn9y86xkzs10fh8p83zg", "fetchSubmodules": false, "deepClone": false, "leaveDotGit": false diff --git a/nix/static.nix b/nix/static.nix new file mode 100644 index 00000000000..52e669b6009 --- /dev/null +++ b/nix/static.nix @@ -0,0 +1,10 @@ +pkg: pkg.overrideAttrs (x: { + doCheck = false; + configureFlags = (x.configureFlags or [ ]) ++ [ + "--without-shared" + "--disable-shared" + ]; + dontDisableStatic = true; + enableSharedExecutables = false; + enableStatic = true; +})