aboutsummaryrefslogtreecommitdiff
path: root/nix/candelabra.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nix/candelabra.nix')
-rw-r--r--nix/candelabra.nix31
1 files changed, 31 insertions, 0 deletions
diff --git a/nix/candelabra.nix b/nix/candelabra.nix
new file mode 100644
index 0000000..da0a51c
--- /dev/null
+++ b/nix/candelabra.nix
@@ -0,0 +1,31 @@
+inputs @ {
+ pkgs,
+ crane,
+ ...
+}: let
+ inherit (pkgs) system;
+ toolchain = pkgs.rust-bin.fromRustupToolchain ((builtins.fromTOML (builtins.readFile ../src/rust-toolchain.toml)).toolchain // {profile = "minimal";});
+ craneLib = crane.lib.${system}.overrideToolchain toolchain;
+
+ rustCrate = craneLib.buildPackage {
+ pname = "candelabra-unwrapped";
+ version = "1.0.0";
+
+ src = craneLib.cleanCargoSource (craneLib.path ../src);
+ doCheck = false;
+ propagatedBuildInputs = [(pkgs.callPackage ./racket-env.nix inputs)];
+
+ cargoExtraArgs = "-p candelabra-cli";
+ };
+in
+ pkgs.runCommand "candelabra" {} ''
+ . ${pkgs.makeWrapper}/nix-support/setup-hook
+ mkdir -p $out/bin
+ makeWrapper ${rustCrate}/bin/candelabra $out/bin/candelabra \
+ --set CANDELABRA_SRC_DIR ${pkgs.lib.sourceByRegex ../src [
+ ".*crates"
+ ".*racket_specs.*"
+ ".*crates/library.*"
+ ".*crates/benchmarker.*"
+ ]}
+ ''