aboutsummaryrefslogtreecommitdiff
path: root/nix
diff options
context:
space:
mode:
authorAlex <alex@adnab.me>2022-11-29 21:26:41 +0000
committerAlex <alex@adnab.me>2022-11-29 21:26:41 +0000
commit448dcc5cf4685f6a321b84ba1aa38e560f63a90a (patch)
tree5318ef82fd95e007e6738cce58fd22c9f446a886 /nix
parent280330ac72a12fbfb9c22018bb33d5a490c7a016 (diff)
parent60c26fbc628d7b450ae39214b578ab6a30583d5c (diff)
downloadgarage-448dcc5cf4685f6a321b84ba1aa38e560f63a90a.tar.gz
garage-448dcc5cf4685f6a321b84ba1aa38e560f63a90a.zip
Merge pull request 'Make repository into a Nix flake' (#424) from nix-remove-system into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/424
Diffstat (limited to 'nix')
-rw-r--r--nix/compile.nix33
1 files changed, 20 insertions, 13 deletions
diff --git a/nix/compile.nix b/nix/compile.nix
index 303c3aa4..3ea5035e 100644
--- a/nix/compile.nix
+++ b/nix/compile.nix
@@ -1,25 +1,32 @@
{
- system ? builtins.currentSystem,
- target,
+ system,
+ target ? null,
+ pkgsSrc,
+ cargo2nixOverlay,
compiler ? "rustc",
release ? false,
git_version ? null,
features ? null,
}:
-with import ./common.nix;
-
let
log = v: builtins.trace v v;
- pkgs = import pkgsSrc {
- inherit system;
- crossSystem = {
- config = target;
- isStatic = true;
- };
- overlays = [ cargo2nixOverlay ];
- };
+ pkgs =
+ if target != null then
+ import pkgsSrc {
+ inherit system;
+ crossSystem = {
+ config = target;
+ isStatic = true;
+ };
+ overlays = [ cargo2nixOverlay ];
+ }
+ else
+ import pkgsSrc {
+ inherit system;
+ overlays = [ cargo2nixOverlay ];
+ };
/*
Cargo2nix is built for rustOverlay which installs Rust from Mozilla releases.
@@ -34,7 +41,7 @@ let
NixOS ships them in separate ones. We reunite them with symlinkJoin.
*/
toolchainOptions =
- if target == "x86_64-unknown-linux-musl" || target == "aarch64-unknown-linux-musl" then {
+ if target == null || target == "x86_64-unknown-linux-musl" || target == "aarch64-unknown-linux-musl" then {
rustVersion = "1.63.0";
extraRustComponents = [ "clippy" ];
} else {