aboutsummaryrefslogtreecommitdiff
path: root/nix
diff options
context:
space:
mode:
authorAlex Auvolat <lx@deuxfleurs.fr>2025-01-12 17:40:34 +0100
committerAlex Auvolat <lx@deuxfleurs.fr>2025-01-12 17:51:33 +0100
commit83887a851911e18106ede698f491b0102d16b7a4 (patch)
treed448ad8b73517e635bc5448e0820f77486ab0cc5 /nix
parent0a15db6960add3e06a130d64b51d6ae55cd2d759 (diff)
downloadgarage-83887a851911e18106ede698f491b0102d16b7a4.tar.gz
garage-83887a851911e18106ede698f491b0102d16b7a4.zip
nix build: remove clippy build env that doesn't work
Diffstat (limited to 'nix')
-rw-r--r--nix/compile.nix95
1 files changed, 7 insertions, 88 deletions
diff --git a/nix/compile.nix b/nix/compile.nix
index 61955d8a..2755f5be 100644
--- a/nix/compile.nix
+++ b/nix/compile.nix
@@ -1,4 +1,4 @@
-{ system, target ? null, pkgsSrc, cargo2nixOverlay, compiler ? "rustc"
+{ system, target ? null, pkgsSrc, cargo2nixOverlay
, release ? false, git_version ? null, features ? null, }:
let
@@ -24,20 +24,6 @@ let
extraRustComponents = [ "clippy" ];
};
- buildEnv = (drv:
- {
- rustc = drv.setBuildEnv;
- clippy = ''
- ${drv.setBuildEnv or ""}
- echo
- echo --- BUILDING WITH CLIPPY ---
- echo
-
- export NIX_RUST_BUILD_FLAGS="''${NIX_RUST_BUILD_FLAGS} --deny warnings"
- export RUSTC="''${CLIPPY_DRIVER}"
- '';
- }.${compiler});
-
/* Cargo2nix provides many overrides by default, you can take inspiration from them:
https://github.com/cargo2nix/cargo2nix/blob/master/overlay/overrides.nix
@@ -46,9 +32,7 @@ let
*/
packageOverrides = pkgs:
pkgs.rustBuilder.overrides.all ++ [
- /* [1] We add some logic to compile our crates with clippy, it provides us many additional lints
-
- [2] We need to alter Nix hardening to make static binaries: PIE,
+ /* [1] We need to alter Nix hardening to make static binaries: PIE,
Position Independent Executables seems to be supported only on amd64. Having
this flag set either 1. make our executables crash or 2. compile as dynamic on some platforms.
Here, we deactivate it. Later (find `codegenOpts`), we reactivate it for supported targets
@@ -56,11 +40,11 @@ let
PIE is a feature used by ASLR, which helps mitigate security issues.
Learn more about Nix Hardening at: https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/cc-wrapper/add-hardening.sh
- [3] We want to inject the git version while keeping the build deterministic.
+ [2] We want to inject the git version while keeping the build deterministic.
As we do not want to consider the .git folder as part of the input source,
we ask the user (the CI often) to pass the value to Nix.
- [4] We don't want libsodium-sys and zstd-sys to try to use pkgconfig to build against a system library.
+ [3] 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.
*/
@@ -68,7 +52,7 @@ let
name = "garage";
overrideAttrs = drv:
(if git_version != null then {
- # [3]
+ # [2]
preConfigure = ''
${drv.preConfigure or ""}
export GIT_VERSION="${git_version}"
@@ -76,86 +60,21 @@ let
} else
{ }) // {
# [1]
- setBuildEnv = (buildEnv drv);
- # [2]
hardeningDisable = [ "pie" ];
};
})
(pkgs.rustBuilder.rustLib.makeOverride {
- name = "garage_rpc";
- overrideAttrs = drv: { # [1]
- setBuildEnv = (buildEnv drv);
- };
- })
-
- (pkgs.rustBuilder.rustLib.makeOverride {
- name = "garage_db";
- overrideAttrs = drv: { # [1]
- setBuildEnv = (buildEnv drv);
- };
- })
-
- (pkgs.rustBuilder.rustLib.makeOverride {
- name = "garage_util";
- overrideAttrs = drv: { # [1]
- setBuildEnv = (buildEnv drv);
- };
- })
-
- (pkgs.rustBuilder.rustLib.makeOverride {
- name = "garage_table";
- overrideAttrs = drv: { # [1]
- setBuildEnv = (buildEnv drv);
- };
- })
-
- (pkgs.rustBuilder.rustLib.makeOverride {
- name = "garage_block";
- overrideAttrs = drv: { # [1]
- setBuildEnv = (buildEnv drv);
- };
- })
-
- (pkgs.rustBuilder.rustLib.makeOverride {
- name = "garage_model";
- overrideAttrs = drv: { # [1]
- setBuildEnv = (buildEnv drv);
- };
- })
-
- (pkgs.rustBuilder.rustLib.makeOverride {
- name = "garage_api";
- overrideAttrs = drv: { # [1]
- setBuildEnv = (buildEnv drv);
- };
- })
-
- (pkgs.rustBuilder.rustLib.makeOverride {
- name = "garage_web";
- overrideAttrs = drv: { # [1]
- setBuildEnv = (buildEnv drv);
- };
- })
-
- (pkgs.rustBuilder.rustLib.makeOverride {
- name = "k2v-client";
- overrideAttrs = drv: { # [1]
- setBuildEnv = (buildEnv drv);
- };
- })
-
- (pkgs.rustBuilder.rustLib.makeOverride {
name = "libsodium-sys";
overrideArgs = old: {
- features = [ ]; # [4]
+ features = [ ]; # [3]
};
})
(pkgs.rustBuilder.rustLib.makeOverride {
name = "zstd-sys";
overrideArgs = old: {
- features = [ ]; # [4]
+ features = [ ]; # [3]
};
})
];