From babd6d51bc3e3b4665cec2b6d0750605c2d6c5bd Mon Sep 17 00:00:00 2001 From: Aria Shrimpton Date: Mon, 29 Jan 2024 22:48:13 +0000 Subject: nixos configuration --- nix/candelabra.nix | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 nix/candelabra.nix (limited to 'nix/candelabra.nix') 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.*" + ]} + '' -- cgit v1.2.3