From 80e263b3890565035c78341d7f937c2cf296f774 Mon Sep 17 00:00:00 2001 From: ryneeverett Date: Thu, 10 Sep 2020 16:13:07 +0000 Subject: [PATCH 01/14] nixos/lxd: explicitly load kernel modules This is analogous to #70447 and #76487. These are all needed to attach a container to the default bridge network, without which the final line of the following script fails with the error for each respective kernel module listed below. ```sh lxc storage create foo dir lxc launch -s foo ubuntu:trusty bar lxc network attach lxdbr0 bar ``` veth ---- > Error: Failed to start device 'lxdbr0': Failed to create the veth interfaces vethefbc3cd6 and vetha4abbcbc: Failed to run: ip link add dev vethefbc3cd6 type veth peer name vetha4abbcbc: RTNETLINK answers: Operation not supported iptable_mangle -------------- > lvl=eror msg="Failed to bring up network" err="Failed to list ipv4 rules for LXD network lxdbr0 (table mangle)" name=lxdbr0 xt_comment ---------- > lvl=error msg="Failed to bring up network" err="Failed to run: iptables -w -t filter -I INPUT -i lxdbr0 -p udp --dport 67 -j ACCEPT -m comment --comment generated for LXD network lxdbr0: iptables v1.8.4 (legacy): Couldn't load match `comment':No such file or directory\n\nTry `iptables -h' or 'iptables --help' for more information." name=lxdbr0 xt_MASQUERADE ------------- > vl=eror msg="Failed to bring up network" err="Failed to run: iptables -w -t nat -I POSTROUTING -s 10.0.107.0/24 ! -d 10.0.107.0/24 -j MASQUERADE -m comment --comment generated for LXD network lxdbr0: iptables v1.8.4 (legacy): Couldn't load target `MASQUERADE':No such file or directory\n\nTry `iptables -h' or 'iptables --help' for more information." name=lxdbr0 --- nixos/modules/virtualisation/lxd.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nixos/modules/virtualisation/lxd.nix b/nixos/modules/virtualisation/lxd.nix index 96e8d68ae50e..375fc1d256c3 100644 --- a/nixos/modules/virtualisation/lxd.nix +++ b/nixos/modules/virtualisation/lxd.nix @@ -169,5 +169,8 @@ in { "net.ipv6.neigh.default.gc_thresh3" = 8192; "kernel.keys.maxkeys" = 2000; }; + + boot.kernelModules = [ "veth" "xt_comment" "xt_MASQUERADE" ] + ++ optionals (!config.networking.nftables.enable) [ "iptable_mangle" ]; }; } From c1b8fdf83b9f7dd9172879334d8fef4ccc4c0f9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Sun, 6 Dec 2020 09:59:59 +0100 Subject: [PATCH 02/14] lxd: reference nixos tests --- pkgs/tools/admin/lxd/default.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/tools/admin/lxd/default.nix b/pkgs/tools/admin/lxd/default.nix index 417e01a325d3..9ab7d37d7671 100644 --- a/pkgs/tools/admin/lxd/default.nix +++ b/pkgs/tools/admin/lxd/default.nix @@ -7,6 +7,7 @@ , bash , installShellFiles , nftablesSupport ? false +, nixosTests }: let @@ -58,6 +59,8 @@ buildGoPackage rec { installShellCompletion --bash --name lxd go/src/github.com/lxc/lxd/scripts/bash/lxd-client ''; + passthru.tests.lxd = nixosTests.lxd; + nativeBuildInputs = [ installShellFiles pkg-config makeWrapper ]; buildInputs = [ lxc acl libcap libco-canonical.dev dqlite.dev raft-canonical.dev sqlite-replication udev.dev ]; From 243521f52f9e24033e18650adb5e37ae2a1f3025 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Sun, 6 Dec 2020 12:50:04 +0100 Subject: [PATCH 03/14] nixos/lxd: fix race condition in test --- nixos/tests/lxd.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nixos/tests/lxd.nix b/nixos/tests/lxd.nix index ab56b75c02e4..889ca9598e3f 100644 --- a/nixos/tests/lxd.nix +++ b/nixos/tests/lxd.nix @@ -96,6 +96,7 @@ in { ## limits.cpu ## machine.succeed("lxc config set test limits.cpu 1") + machine.succeed("lxc restart test") # Since Alpine doesn't have `nproc` pre-installed, we've gotta resort # to the primal methods @@ -105,6 +106,7 @@ in { ) machine.succeed("lxc config set test limits.cpu 2") + machine.succeed("lxc restart test") assert ( "2" @@ -115,6 +117,7 @@ in { ## limits.memory ## machine.succeed("lxc config set test limits.memory 64MB") + machine.succeed("lxc restart test") assert ( "MemTotal: 62500 kB" @@ -122,6 +125,7 @@ in { ) machine.succeed("lxc config set test limits.memory 128MB") + machine.succeed("lxc restart test") assert ( "MemTotal: 125000 kB" From 161a35b0b8e4a5cb8d5fac3d5083ee9fb82cfbe2 Mon Sep 17 00:00:00 2001 From: ryneeverett Date: Sun, 14 Feb 2021 01:12:43 -0500 Subject: [PATCH 04/14] nixos/lxd: explicitly load xt_CHECKSUM module This module is needed to create bridge networks such as the default lxdbr0 created by `lxd init`. Without this module, running `lxc network create lxdbr0` errors with: > Error: Failed to create network 'lxdbr0': Failed to run: iptables -w -t mangle -I POSTROUTING -o lxdbr0 -p udp --dport 68 -j CHECKSUM --checksum-fill -m comment --comment generated for LXD network lxdbr0: iptables v1.8.5 (legacy): unknown option "--checksum-fill" --- nixos/modules/virtualisation/lxd.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/virtualisation/lxd.nix b/nixos/modules/virtualisation/lxd.nix index 375fc1d256c3..42a1f2f1a301 100644 --- a/nixos/modules/virtualisation/lxd.nix +++ b/nixos/modules/virtualisation/lxd.nix @@ -170,7 +170,7 @@ in { "kernel.keys.maxkeys" = 2000; }; - boot.kernelModules = [ "veth" "xt_comment" "xt_MASQUERADE" ] + boot.kernelModules = [ "veth" "xt_comment" "xt_CHECKSUM" "xt_MASQUERADE" ] ++ optionals (!config.networking.nftables.enable) [ "iptable_mangle" ]; }; } From c69b9cee0418d04aed32b32634e6852fa804e4e8 Mon Sep 17 00:00:00 2001 From: Clemens Lutz Date: Fri, 4 Jun 2021 17:10:15 +0200 Subject: [PATCH 05/14] zoom-us: 5.6.16888.0424 -> 5.6.20278.0524 --- .../networking/instant-messengers/zoom-us/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/networking/instant-messengers/zoom-us/default.nix b/pkgs/applications/networking/instant-messengers/zoom-us/default.nix index 44bbbeece30c..364e6e294ec0 100644 --- a/pkgs/applications/networking/instant-messengers/zoom-us/default.nix +++ b/pkgs/applications/networking/instant-messengers/zoom-us/default.nix @@ -29,11 +29,11 @@ assert pulseaudioSupport -> libpulseaudio != null; let - version = "5.6.16888.0424"; + version = "5.6.20278.0524"; srcs = { x86_64-linux = fetchurl { url = "https://zoom.us/client/${version}/zoom_x86_64.pkg.tar.xz"; - sha256 = "H/G9cSVmxYM0AVfrdpXzm7ohssDbKq2xdvIBc4d+elc="; + sha256 = "1nkpmrpb0bz4zkg8nszxmcfy3ymigd2bmxhnxbjrcnv64ykdrgp7"; }; }; From 85ee1bdecd297003b877360b9a94052f00507483 Mon Sep 17 00:00:00 2001 From: "Ricardo M. Correia" Date: Thu, 3 Jun 2021 15:51:53 +0200 Subject: [PATCH 06/14] ocamlPackages.ansiterminal: 0.7 -> 0.8.2 --- .../ocaml-modules/ansiterminal/default.nix | 31 +++++++------------ 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/pkgs/development/ocaml-modules/ansiterminal/default.nix b/pkgs/development/ocaml-modules/ansiterminal/default.nix index 53b02a453a0e..edd40fb4df29 100644 --- a/pkgs/development/ocaml-modules/ansiterminal/default.nix +++ b/pkgs/development/ocaml-modules/ansiterminal/default.nix @@ -1,36 +1,29 @@ -{ lib, stdenv, fetchurl, ocaml, findlib, ocamlbuild }: +{ lib, buildDunePackage, fetchFromGitHub }: -stdenv.mkDerivation rec { +buildDunePackage rec { + pname = "ANSITerminal"; + version = "0.8.2"; - version = "0.7"; + useDune2 = true; - name = "ocaml${ocaml.version}-ansiterminal-${version}"; - - src = fetchurl { - url = "https://github.com/Chris00/ANSITerminal/releases/download/${version}/ANSITerminal-${version}.tar.gz"; - sha256 = "03pqfxvw9pa9720l8i5fgxky1qx70kw6wxbczd5i50xi668lh0i9"; + src = fetchFromGitHub { + owner = "Chris00"; + repo = pname; + rev = version; + sha256 = "0dyjischrgwlxqz1p5zbqq76jvk6pl1qj75i7ydhijssr9pj278d"; }; - buildInputs = [ ocaml findlib ocamlbuild ]; - - configurePhase = "ocaml setup.ml -configure --prefix $out"; - - buildPhase = "ocaml setup.ml -build"; - - installPhase = "ocaml setup.ml -install"; - - createFindlibDestdir = true; + doCheck = true; meta = with lib; { - homepage = "https://github.com/Chris00/ANSITerminal"; description = "A module allowing to use the colors and cursor movements on ANSI terminals"; longDescription = '' ANSITerminal is a module allowing to use the colors and cursor movements on ANSI terminals. It also works on the windows shell (but this part is currently work in progress). ''; + inherit (src.meta) homepage; license = licenses.lgpl3; - platforms = ocaml.meta.platforms or []; maintainers = [ maintainers.jirkamarsik ]; }; } From 25964547fbddc1f8867735838e88202777fd7799 Mon Sep 17 00:00:00 2001 From: Vincent Laporte Date: Fri, 4 Jun 2021 05:49:13 +0200 Subject: [PATCH 07/14] =?UTF-8?q?compcert:=203.8=20=E2=86=92=203.9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkgs/development/compilers/compcert/default.nix | 7 ++++++- pkgs/top-level/coq-packages.nix | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/compcert/default.nix b/pkgs/development/compilers/compcert/default.nix index 4679e01e9002..4e550bac9a6a 100644 --- a/pkgs/development/compilers/compcert/default.nix +++ b/pkgs/development/compilers/compcert/default.nix @@ -1,7 +1,7 @@ { lib, stdenv, fetchFromGitHub, fetchpatch, makeWrapper , coqPackages, ocamlPackages, coq2html , tools ? stdenv.cc -, version ? "3.8" +, version ? "3.9" }: let @@ -56,6 +56,10 @@ let param = { ]; useExternalFlocq = true; }; + "3.9" = { + sha256 = "1srcz2dqrvmbvv5cl66r34zqkm0hsbryk7gd3i9xx4slahc9zvdb"; + useExternalFlocq = true; + }; }."${version}"; in stdenv.mkDerivation rec { @@ -78,6 +82,7 @@ stdenv.mkDerivation rec { postPatch = '' substituteInPlace ./configure \ + --replace \$\{toolprefix\}ar 'ar' \ --replace '{toolprefix}gcc' '{toolprefix}cc' ''; diff --git a/pkgs/top-level/coq-packages.nix b/pkgs/top-level/coq-packages.nix index c35f0b48b0f3..bd957bdb49d5 100644 --- a/pkgs/top-level/coq-packages.nix +++ b/pkgs/top-level/coq-packages.nix @@ -80,7 +80,7 @@ let VST = callPackage ../development/coq-modules/VST (with lib.versions; lib.switch coq.coq-version [ { case = "8.11"; out = { compcert = compcert.override { coqPackages = self; version = "3.7"; }; }; } - { case = range "8.12" "8.13"; out = { compcert = compcert.override { coqPackages = self; }; }; } + { case = range "8.12" "8.13"; out = { compcert = compcert.override { coqPackages = self; version = "3.8"; }; }; } ] {}); zorns-lemma = callPackage ../development/coq-modules/zorns-lemma {}; filterPackages = doesFilter: if doesFilter then filterCoqPackages self else self; From 5971dc1aeb33e7314eb8576687144b262c8773b0 Mon Sep 17 00:00:00 2001 From: AndersonTorres Date: Fri, 4 Jun 2021 16:43:02 -0300 Subject: [PATCH 08/14] zig: 0.7.1 -> 0.8.0 Eliminated the check phase (file $src/test/stage1/behavior.zig not found). --- pkgs/development/compilers/zig/default.nix | 22 +++++++++------------- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/pkgs/development/compilers/zig/default.nix b/pkgs/development/compilers/zig/default.nix index 399cb62ba3d7..a31a9e6ca43f 100644 --- a/pkgs/development/compilers/zig/default.nix +++ b/pkgs/development/compilers/zig/default.nix @@ -1,5 +1,4 @@ { lib -, stdenv , fetchFromGitHub , cmake , llvmPackages @@ -7,19 +6,23 @@ , zlib }: -llvmPackages.stdenv.mkDerivation rec { +let + inherit (llvmPackages) stdenv; +in +stdenv.mkDerivation rec { pname = "zig"; - version = "0.7.1"; + version = "0.8.0"; src = fetchFromGitHub { owner = "ziglang"; repo = pname; rev = version; - hash = "sha256-rZYv8LFH3M70SyPwPVyul+Um9j82K8GZIepVmaonzPw="; + hash = "sha256-bILjcKX8jPl2n1HRYvYRb7jJkobwqmSJ+hHXSn9n2ag="; }; nativeBuildInputs = [ - cmake llvmPackages.llvm.dev + cmake + llvmPackages.llvm.dev ]; buildInputs = [ libxml2 @@ -34,14 +37,6 @@ llvmPackages.stdenv.mkDerivation rec { export HOME=$TMPDIR; ''; - checkPhase = '' - runHook preCheck - ./zig test --cache-dir "$TMPDIR" -I $src/test $src/test/stage1/behavior.zig - runHook postCheck - ''; - - doCheck = true; - meta = with lib; { homepage = "https://ziglang.org/"; description = @@ -53,3 +48,4 @@ llvmPackages.stdenv.mkDerivation rec { broken = stdenv.isDarwin; }; } +# TODO: checkPhase diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 88e6731df859..01e798e6e6b9 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -18656,7 +18656,7 @@ in libzra = callPackage ../development/libraries/libzra { }; zig = callPackage ../development/compilers/zig { - llvmPackages = llvmPackages_11; + llvmPackages = llvmPackages_12; }; zimlib = callPackage ../development/libraries/zimlib { }; From 51dbbde885d248d8a59b1eab4b8633864d7face8 Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Thu, 27 May 2021 22:29:02 +1000 Subject: [PATCH 09/14] go_1_15: disable on aarch64-darwin aarch64-darwin is only supported on >= 1.16 --- pkgs/development/compilers/go/1.15.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/development/compilers/go/1.15.nix b/pkgs/development/compilers/go/1.15.nix index 1aa0ec030174..eb516400fd6a 100644 --- a/pkgs/development/compilers/go/1.15.nix +++ b/pkgs/development/compilers/go/1.15.nix @@ -268,5 +268,6 @@ stdenv.mkDerivation rec { license = licenses.bsd3; maintainers = teams.golang.members; platforms = platforms.linux ++ platforms.darwin; + badPlatforms = [ "aarch64-darwin" ]; }; } From d038f9545034f237e83f1678ffd34e7b12adf955 Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Fri, 4 Jun 2021 11:18:32 +1000 Subject: [PATCH 10/14] go_1_15: 1.15.12 -> 1.15.13 --- pkgs/development/compilers/go/1.15.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/go/1.15.nix b/pkgs/development/compilers/go/1.15.nix index eb516400fd6a..58cd616728c3 100644 --- a/pkgs/development/compilers/go/1.15.nix +++ b/pkgs/development/compilers/go/1.15.nix @@ -11,7 +11,7 @@ let inherit (lib) optionals optionalString; - version = "1.15.12"; + version = "1.15.13"; go_bootstrap = buildPackages.callPackage ./bootstrap.nix { }; @@ -45,7 +45,7 @@ stdenv.mkDerivation rec { src = fetchurl { url = "https://dl.google.com/go/go${version}.src.tar.gz"; - sha256 = "sha256-HGkRk330onf6dOe378PQhZRJjExK3AtsSuNWYTdSgJE="; + sha256 = "sha256-mQaeciNHnM5FU/hPh0uTRfb0BF8nz1CJSJtUbaYZokQ="; }; # perl is used for testing go vet From b3a05d2ccb78b2c64d65f38b3516bfa84348a1b4 Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Fri, 4 Jun 2021 11:18:32 +1000 Subject: [PATCH 11/14] go_1_16: 1.16.4 -> 1.16.5 --- pkgs/development/compilers/go/1.16.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/go/1.16.nix b/pkgs/development/compilers/go/1.16.nix index 219f19ad27c7..93c9fa5c7788 100644 --- a/pkgs/development/compilers/go/1.16.nix +++ b/pkgs/development/compilers/go/1.16.nix @@ -11,7 +11,7 @@ let inherit (lib) optionals optionalString; - version = "1.16.4"; + version = "1.16.5"; go_bootstrap = buildPackages.callPackage ./bootstrap.nix { }; @@ -45,7 +45,7 @@ stdenv.mkDerivation rec { src = fetchurl { url = "https://dl.google.com/go/go${version}.src.tar.gz"; - sha256 = "sha256-rk9rbioWd9MYF5hGVadiB0tTVtpQ+1hyK5kQSHDUNQM="; + sha256 = "sha256-e/p+WQjHzJ512l3fMGbXy88/2fpRlFhRMl7rwX9QuoA="; }; # perl is used for testing go vet From 99697d891de658a5b6ea4bd4ea5ef9acfb62ea13 Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Fri, 4 Jun 2021 14:33:26 +1000 Subject: [PATCH 12/14] go: add runHooks to bootstrap binary --- pkgs/development/compilers/go/binary.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/development/compilers/go/binary.nix b/pkgs/development/compilers/go/binary.nix index 7eb8f8f7b984..a2fff4f6d074 100644 --- a/pkgs/development/compilers/go/binary.nix +++ b/pkgs/development/compilers/go/binary.nix @@ -29,6 +29,7 @@ stdenv.mkDerivation rec { dontStrip = stdenv.hostPlatform.isDarwin; installPhase = '' + runHook preInstall mkdir -p $out/share/go $out/bin mv bin/* $out/bin cp -r . $out/share/go @@ -37,5 +38,6 @@ stdenv.mkDerivation rec { --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ $out/bin/go '')} - '' ; + runHook postInstall + ''; } From 155ae682a5122960aed61724b4ed8c9711b53e99 Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Thu, 3 Jun 2021 17:45:04 +0200 Subject: [PATCH 13/14] buildGoModule/buildGoPackage: Introduce ldflags argument Previously it was not possible to define multiple ldflags, since only the last definition applies, and there's some quoting issues with `buildFlagsArray`. With the new `ldflags` argument it's possible to do this, e.g. ldflags = drv.ldflags or [] ++ [ "-X main.Version=1.0" ] can now properly append a flag without clearing all previous ldflags. --- doc/languages-frameworks/go.section.md | 19 +++++++++++-------- .../go-modules/generic/default.nix | 5 ++++- .../go-packages/generic/default.nix | 5 ++++- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/doc/languages-frameworks/go.section.md b/doc/languages-frameworks/go.section.md index b4228d9d313d..f52570ac8cca 100644 --- a/doc/languages-frameworks/go.section.md +++ b/doc/languages-frameworks/go.section.md @@ -114,21 +114,24 @@ Both `buildGoModule` and `buildGoPackage` can be tweaked to behave slightly diff ### `buildFlagsArray` and `buildFlags`: {#ex-goBuildFlags-noarray} -These attributes set build flags supported by `go build`. We recommend using `buildFlagsArray`. The most common use case of these attributes is to make the resulting executable aware of its own version. For example: +These attributes set build flags supported by `go build`. We recommend using `buildFlagsArray`. ```nix buildFlagsArray = [ - # Note: single quotes are not needed. - "-ldflags=-X main.Version=${version} -X main.Commit=${version}" + "-tags=release" ]; ``` +### `ldflags` {#var-go-ldflags} + +Arguments to pass to the Go linker tool via the `-ldflags` argument of `go build`. The most common use case for this argument is to make the resulting executable aware of its own version. For example: + ```nix - buildFlagsArray = '' - -ldflags= - -X main.Version=${version} - -X main.Commit=${version} - ''; + ldflags = [ + "-s" "-w" + "-X main.Version=${version}" + "-X main.Commit=${version}" + ]; ``` ### `deleteVendor` {#var-go-deleteVendor} diff --git a/pkgs/development/go-modules/generic/default.nix b/pkgs/development/go-modules/generic/default.nix index 8246eaefed4c..10beb80f2e6a 100644 --- a/pkgs/development/go-modules/generic/default.nix +++ b/pkgs/development/go-modules/generic/default.nix @@ -7,6 +7,9 @@ , passthru ? {} , patches ? [] +# Go linker flags, passed to go via -ldflags +, ldflags ? [] + # A function to override the go-modules derivation , overrideModAttrs ? (_oldAttrs : {}) @@ -153,7 +156,7 @@ let echo "$d" | grep -q "\(/_\|examples\|Godeps\|testdata\)" && return 0 [ -n "$excludedPackages" ] && echo "$d" | grep -q "$excludedPackages" && return 0 local OUT - if ! OUT="$(go $cmd $buildFlags "''${buildFlagsArray[@]}" -v -p $NIX_BUILD_CORES $d 2>&1)"; then + if ! OUT="$(go $cmd $buildFlags "''${buildFlagsArray[@]}" ''${ldflags:+-ldflags="$ldflags"} -v -p $NIX_BUILD_CORES $d 2>&1)"; then if ! echo "$OUT" | grep -qE '(no( buildable| non-test)?|build constraints exclude all) Go (source )?files'; then echo "$OUT" >&2 return 1 diff --git a/pkgs/development/go-packages/generic/default.nix b/pkgs/development/go-packages/generic/default.nix index 8a093a03d1c1..88d7acb42fc9 100644 --- a/pkgs/development/go-packages/generic/default.nix +++ b/pkgs/development/go-packages/generic/default.nix @@ -7,6 +7,9 @@ , preFixup ? "" , shellHook ? "" +# Go linker flags, passed to go via -ldflags +, ldflags ? [] + # We want parallel builds by default , enableParallelBuilding ? true @@ -148,7 +151,7 @@ let echo "$d" | grep -q "\(/_\|examples\|Godeps\)" && return 0 [ -n "$excludedPackages" ] && echo "$d" | grep -q "$excludedPackages" && return 0 local OUT - if ! OUT="$(go $cmd $buildFlags "''${buildFlagsArray[@]}" -v -p $NIX_BUILD_CORES $d 2>&1)"; then + if ! OUT="$(go $cmd $buildFlags "''${buildFlagsArray[@]}" ''${ldflags:+-ldflags="$ldflags"} -v -p $NIX_BUILD_CORES $d 2>&1)"; then if ! echo "$OUT" | grep -qE '(no( buildable| non-test)?|build constraints exclude all) Go (source )?files'; then echo "$OUT" >&2 return 1 From afdb5675a180f347bfa8ae909d4e419fb8b151bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edward=20Tj=C3=B6rnhammar?= Date: Tue, 1 Jun 2021 13:14:15 +0200 Subject: [PATCH 14/14] nixos/containers: add storage.conf --- nixos/modules/virtualisation/containers.nix | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/nixos/modules/virtualisation/containers.nix b/nixos/modules/virtualisation/containers.nix index 45d4f877ae5b..84824e2f90f0 100644 --- a/nixos/modules/virtualisation/containers.nix +++ b/nixos/modules/virtualisation/containers.nix @@ -65,6 +65,18 @@ in ''; }; + storage.settings = mkOption { + type = toml.type; + default = { + storage = { + driver = "overlay"; + graphroot = "/var/lib/containers/storage"; + runroot = "/run/containers/storage"; + }; + }; + description = "storage.conf configuration"; + }; + registries = { search = mkOption { type = types.listOf types.str; @@ -129,6 +141,9 @@ in environment.etc."containers/containers.conf".source = toml.generate "containers.conf" cfg.containersConf.settings; + environment.etc."containers/storage.conf".source = + toml.generate "storage.conf" cfg.storage.settings; + environment.etc."containers/registries.conf".source = toml.generate "registries.conf" { registries = lib.mapAttrs (n: v: { registries = v; }) cfg.registries; };