From 8d77a76df1c3c20300b0b4fe2671cd74c82606e2 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 6 Sep 2022 15:48:27 +0200 Subject: Update .nix files --- nix/compile.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'nix') diff --git a/nix/compile.nix b/nix/compile.nix index 7986fb0d..5707ed41 100644 --- a/nix/compile.nix +++ b/nix/compile.nix @@ -125,14 +125,15 @@ let /* [1] */ setBuildEnv = (buildEnv drv); /* [2] */ hardeningDisable = [ "pie" ]; }; + overrideArgs = old: { + /* [4] */ features = [ "bundled-libs" ] + ++ (if release then [ "kubernetes-discovery" "telemetry-otlp" "metrics" ] else []); + }; }) (pkgs.rustBuilder.rustLib.makeOverride { name = "garage_rpc"; overrideAttrs = drv: { /* [1] */ setBuildEnv = (buildEnv drv); }; - overrideArgs = old: { - /* [4] */ features = if release then [ "kubernetes-discovery" ] else []; - }; }) (pkgs.rustBuilder.rustLib.makeOverride { -- cgit v1.2.3 From 7de53a4d66c71d9b5f22662f7bd473d055aa1c1f Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 6 Sep 2022 16:41:58 +0200 Subject: Force disable pkg-config for libsodum-sys and libzstd-sys --- nix/compile.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'nix') diff --git a/nix/compile.nix b/nix/compile.nix index 5707ed41..450b6398 100644 --- a/nix/compile.nix +++ b/nix/compile.nix @@ -118,6 +118,10 @@ let But we want to ship these additional features when we release Garage. In the end, we chose to exclude all features from debug builds while putting (all of) them in the release builds. Currently, the only feature of Garage is kubernetes-discovery from the garage_rpc crate. + + [5] We don't want libsodium-sys and zstd-sys to try to use pkgconfig to build against a system library. + However the features to do so get activated for some reason (due to a bug in cargo2nix?), + so disable them manually here. */ (pkgs.rustBuilder.rustLib.makeOverride { name = "garage"; @@ -183,6 +187,20 @@ let name = "k2v-client"; overrideAttrs = drv: { /* [1] */ setBuildEnv = (buildEnv drv); }; }) + + (pkgs.rustBuilder.rustLib.makeOverride { + name = "libsodium-sys"; + overrideArgs = old: { + features = [ ]; /* [5] */ + }; + }) + + (pkgs.rustBuilder.rustLib.makeOverride { + name = "zstd-sys"; + overrideArgs = old: { + features = [ ]; /* [5] */ + }; + }) ]; packageFun = import ../Cargo.nix; -- cgit v1.2.3 From 2c2b93acdf3db1d6c379964f557abf082df269b9 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 6 Sep 2022 17:20:10 +0200 Subject: Update Nix files with optional db engines --- nix/compile.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'nix') diff --git a/nix/compile.nix b/nix/compile.nix index 450b6398..ea431a7e 100644 --- a/nix/compile.nix +++ b/nix/compile.nix @@ -117,7 +117,6 @@ let It speeds up the compilation (when the feature is not required) and released crates have less dependency by default (less attack surface, disk space, etc.). But we want to ship these additional features when we release Garage. In the end, we chose to exclude all features from debug builds while putting (all of) them in the release builds. - Currently, the only feature of Garage is kubernetes-discovery from the garage_rpc crate. [5] We don't want libsodium-sys and zstd-sys to try to use pkgconfig to build against a system library. However the features to do so get activated for some reason (due to a bug in cargo2nix?), @@ -130,8 +129,8 @@ let /* [2] */ hardeningDisable = [ "pie" ]; }; overrideArgs = old: { - /* [4] */ features = [ "bundled-libs" ] - ++ (if release then [ "kubernetes-discovery" "telemetry-otlp" "metrics" ] else []); + /* [4] */ features = [ "bundled-libs" "sled" ] + ++ (if release then [ "kubernetes-discovery" "telemetry-otlp" "metrics" "lmdb" "sqlite" ] else []); }; }) -- cgit v1.2.3 From db61f41030678c5756c844c8aa41a210c658769e Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Wed, 7 Sep 2022 11:59:56 +0200 Subject: Move GIT_VERSION injection later in build chain to reduce build times --- nix/compile.nix | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'nix') diff --git a/nix/compile.nix b/nix/compile.nix index ea431a7e..d24cd917 100644 --- a/nix/compile.nix +++ b/nix/compile.nix @@ -146,15 +146,7 @@ let (pkgs.rustBuilder.rustLib.makeOverride { name = "garage_util"; - overrideAttrs = drv: - (if git_version != null then { - /* [3] */ preConfigure = '' - ${drv.preConfigure or ""} - export GIT_VERSION="${git_version}" - ''; - } else {}) - // - { /* [1] */ setBuildEnv = (buildEnv drv); }; + overrideAttrs = drv: { /* [1] */ setBuildEnv = (buildEnv drv); }; }) (pkgs.rustBuilder.rustLib.makeOverride { @@ -169,7 +161,15 @@ let (pkgs.rustBuilder.rustLib.makeOverride { name = "garage_model"; - overrideAttrs = drv: { /* [1] */ setBuildEnv = (buildEnv drv); }; + overrideAttrs = drv: + (if git_version != null then { + /* [3] */ preConfigure = '' + ${drv.preConfigure or ""} + export GIT_VERSION="${git_version}" + ''; + } else {}) + // + { /* [1] */ setBuildEnv = (buildEnv drv); }; }) (pkgs.rustBuilder.rustLib.makeOverride { -- cgit v1.2.3 From f310fce34b0273f9f75e7a6ea665f51003a1f795 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Wed, 7 Sep 2022 18:30:15 +0200 Subject: Inject GIT_VERSION even later --- nix/compile.nix | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'nix') diff --git a/nix/compile.nix b/nix/compile.nix index d24cd917..512a7354 100644 --- a/nix/compile.nix +++ b/nix/compile.nix @@ -124,7 +124,15 @@ let */ (pkgs.rustBuilder.rustLib.makeOverride { name = "garage"; - overrideAttrs = drv: { + overrideAttrs = drv: + (if git_version != null then { + /* [3] */ preConfigure = '' + ${drv.preConfigure or ""} + export GIT_VERSION="${git_version}" + ''; + } else {}) + // + { /* [1] */ setBuildEnv = (buildEnv drv); /* [2] */ hardeningDisable = [ "pie" ]; }; @@ -161,15 +169,7 @@ let (pkgs.rustBuilder.rustLib.makeOverride { name = "garage_model"; - overrideAttrs = drv: - (if git_version != null then { - /* [3] */ preConfigure = '' - ${drv.preConfigure or ""} - export GIT_VERSION="${git_version}" - ''; - } else {}) - // - { /* [1] */ setBuildEnv = (buildEnv drv); }; + overrideAttrs = drv: { /* [1] */ setBuildEnv = (buildEnv drv); }; }) (pkgs.rustBuilder.rustLib.makeOverride { -- cgit v1.2.3