From 10c4c877ba4831908410d04573fc6fa628367fe4 Mon Sep 17 00:00:00 2001 From: Wong Hoi Sing Edison Date: Thu, 3 Jun 2021 11:16:15 +0800 Subject: [PATCH] Update nix pin with `make nixpkgs` - Bugfix `make nixpkgs` which pin with branch `nixos-21.05` - Code lint with `nixpkgs-fmt` - Code sync between x86\_64 and aarch64 Signed-off-by: Wong Hoi Sing Edison --- Makefile | 4 ++-- nix/default-arm64.nix | 32 ++++++++++++++++++++++++++++++-- nix/default.nix | 32 ++++++++++++++++++++++++++++++-- nix/nixpkgs.json | 8 ++++---- 4 files changed, 66 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 6bacd12e..e433a8ed 100644 --- a/Makefile +++ b/Makefile @@ -116,10 +116,10 @@ binary: cmd/skopeo .PHONY: nixpkgs nixpkgs: @nix run \ - -f channel:nixos-20.09 nix-prefetch-git \ + -f channel:nixos-21.05 nix-prefetch-git \ -c nix-prefetch-git \ --no-deepClone \ - https://github.com/nixos/nixpkgs refs/heads/nixos-20.09 > nix/nixpkgs.json + https://github.com/nixos/nixpkgs refs/heads/nixos-21.05 > nix/nixpkgs.json # Build statically linked binary .PHONY: static diff --git a/nix/default-arm64.nix b/nix/default-arm64.nix index 8ea8dcf6..fc6cdd6f 100644 --- a/nix/default-arm64.nix +++ b/nix/default-arm64.nix @@ -3,12 +3,25 @@ let crossSystem = { config = "aarch64-unknown-linux-gnu"; }; + overlays = [ + (final: pkg: { + pcre = (static pkg.pcre).overrideAttrs (x: { + configureFlags = x.configureFlags ++ [ + "--enable-static" + ]; + }); + }) + ]; config = { packageOverrides = pkg: { + autogen = (static pkg.autogen); + e2fsprogs = (static pkg.e2fsprogs); + gnupg = (static pkg.gnupg); gpgme = (static pkg.gpgme); libassuan = (static pkg.libassuan); libgpgerror = (static pkg.libgpgerror); libseccomp = (static pkg.libseccomp); + libuv = (static pkg.libuv); glib = (static pkg.glib).overrideAttrs (x: { outputs = [ "bin" "out" "dev" ]; mesonFlags = [ @@ -25,6 +38,21 @@ let -i "$dev"/include/glib-2.0/gobject/gobjectnotifyqueue.c ''; }); + gnutls = (static pkg.gnutls).overrideAttrs (x: { + configureFlags = (x.configureFlags or [ ]) ++ [ + "--disable-non-suiteb-curves" + "--disable-openssl-compatibility" + "--disable-rpath" + "--enable-local-libopts" + "--without-p11-kit" + ]; + }); + systemd = (static pkg.systemd).overrideAttrs (x: { + outputs = [ "out" "dev" ]; + mesonFlags = x.mesonFlags ++ [ + "-Dstatic-libsystemd=true" + ]; + }); }; }; }); @@ -47,8 +75,8 @@ let doCheck = false; enableParallelBuilding = true; outputs = [ "out" ]; - nativeBuildInputs = [ bash gitMinimal go-md2man installShellFiles makeWrapper pkg-config which ]; - buildInputs = [ glibc glibc.static gpgme libassuan libgpgerror libseccomp ]; + nativeBuildInputs = [ bash go-md2man installShellFiles makeWrapper pcre pkg-config which ]; + buildInputs = [ glibc glibc.static glib gpgme libassuan libgpgerror libseccomp ]; prePatch = '' export CFLAGS='-static -pthread' export LDFLAGS='-s -w -static-libgcc -static' diff --git a/nix/default.nix b/nix/default.nix index 02e6684a..5dc711ef 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -1,12 +1,25 @@ { system ? builtins.currentSystem }: let pkgs = (import ./nixpkgs.nix { + overlays = [ + (final: pkg: { + pcre = (static pkg.pcre).overrideAttrs (x: { + configureFlags = x.configureFlags ++ [ + "--enable-static" + ]; + }); + }) + ]; config = { packageOverrides = pkg: { + autogen = (static pkg.autogen); + e2fsprogs = (static pkg.e2fsprogs); + gnupg = (static pkg.gnupg); gpgme = (static pkg.gpgme); libassuan = (static pkg.libassuan); libgpgerror = (static pkg.libgpgerror); libseccomp = (static pkg.libseccomp); + libuv = (static pkg.libuv); glib = (static pkg.glib).overrideAttrs (x: { outputs = [ "bin" "out" "dev" ]; mesonFlags = [ @@ -23,6 +36,21 @@ let -i "$dev"/include/glib-2.0/gobject/gobjectnotifyqueue.c ''; }); + gnutls = (static pkg.gnutls).overrideAttrs (x: { + configureFlags = (x.configureFlags or [ ]) ++ [ + "--disable-non-suiteb-curves" + "--disable-openssl-compatibility" + "--disable-rpath" + "--enable-local-libopts" + "--without-p11-kit" + ]; + }); + systemd = (static pkg.systemd).overrideAttrs (x: { + outputs = [ "out" "dev" ]; + mesonFlags = x.mesonFlags ++ [ + "-Dstatic-libsystemd=true" + ]; + }); }; }; }); @@ -45,8 +73,8 @@ let doCheck = false; enableParallelBuilding = true; outputs = [ "out" ]; - nativeBuildInputs = [ bash gitMinimal go-md2man installShellFiles makeWrapper pkg-config which ]; - buildInputs = [ glibc glibc.static gpgme libassuan libgpgerror libseccomp ]; + nativeBuildInputs = [ bash go-md2man installShellFiles makeWrapper pcre pkg-config which ]; + buildInputs = [ glibc glibc.static glib gpgme libassuan libgpgerror libseccomp ]; prePatch = '' export CFLAGS='-static -pthread' export LDFLAGS='-s -w -static-libgcc -static' diff --git a/nix/nixpkgs.json b/nix/nixpkgs.json index 9b8b8289..799ea6f5 100644 --- a/nix/nixpkgs.json +++ b/nix/nixpkgs.json @@ -1,9 +1,9 @@ { "url": "https://github.com/nixos/nixpkgs", - "rev": "eb7e1ef185f6c990cda5f71fdc4fb02e76ab06d5", - "date": "2021-05-05T23:16:00+02:00", - "path": "/nix/store/a98lkhjlsqh32ic2kkrv5kkik6jy25wh-nixpkgs", - "sha256": "1ibz204c41g7baqga2iaj11yz9l75cfdylkiqjnk5igm81ivivxg", + "rev": "eaba7870ffc3400eca4407baa24184b7fe337ec1", + "date": "2021-06-02T10:22:59+02:00", + "path": "/nix/store/lcr7kwnx934b1z6wmb1zlqjycdlbaw9x-nixpkgs", + "sha256": "115disiz4b08iw46cidc7lm0advrxn5g2ldmlrxd53zf03skyb2w", "fetchSubmodules": false, "deepClone": false, "leaveDotGit": false