aboutsummaryrefslogtreecommitdiff
path: root/nix
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-11-16 22:21:24 +0100
committerAlex Auvolat <alex@adnab.me>2022-11-16 23:25:34 +0100
commite76dba9561128fb8eb26820214a3d103e7f5f9d1 (patch)
treeb596eb5228a26604c303cef07df6042a44dc7ae0 /nix
parentbcc97724707aaa39fd64490cdd81aa5073285f33 (diff)
downloadgarage-e76dba9561128fb8eb26820214a3d103e7f5f9d1.tar.gz
garage-e76dba9561128fb8eb26820214a3d103e7f5f9d1.zip
Make repository into a Nix flake
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 {