Skip to content

Commit

Permalink
feat: do not rely on nix experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
mightyiam committed Jun 16, 2024
1 parent 70607b5 commit 15e84f7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
pkgs = nixpkgs.legacyPackages.${system};
toolchain = fenix.packages.${system}.stable.completeToolchain;
craneLib = crane.lib.${system}.overrideToolchain toolchain;
NIX_CMD_PATH = "${nix.packages.${system}.nix}/bin/nix";
NIX_BIN_DIR = "${nix.packages.${system}.nix}/bin";

commonArgs = {
src = craneLib.cleanCargoSource (craneLib.path ./.);
Expand All @@ -36,7 +36,7 @@
packages.default = craneLib.buildPackage (
commonArgs
// {
inherit cargoArtifacts NIX_CMD_PATH;
inherit cargoArtifacts NIX_BIN_DIR;
nativeCheckInputs = [pkgs.nix];
# 1. integration tests execute `nix`, which fails creating `/nix/var`
# 2. integration tests require `/dev/ptmx`
Expand All @@ -45,7 +45,7 @@
);

devShells.default = craneLib.devShell {
inherit NIX_CMD_PATH;
inherit NIX_BIN_DIR;
inputsFrom = [self.packages.${system}.default];
packages = [
toolchain
Expand Down
4 changes: 2 additions & 2 deletions src/expression/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ impl ExpressionDriver {
}

async fn spawn_nix(&mut self, example: ExpressionExample) {
let task = tokio::process::Command::new(env!("NIX_CMD_PATH"))
.args(["eval", "--expr"])
let task = tokio::process::Command::new(concat!(env!("NIX_BIN_DIR"), "/nix-instantiate"))
.args(["--expr", "--eval"])
.arg(example.expression)
.output();

Expand Down
2 changes: 1 addition & 1 deletion src/repl/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ impl ReplDriver {
async fn spawn(&mut self, id: ExampleId) {
let (read_output, write_output) = nix::unistd::pipe().unwrap();

let child = tokio::process::Command::new(env!("NIX_CMD_PATH"))
let child = tokio::process::Command::new(concat!(env!("NIX_BIN_DIR"), "/nix"))
// even though a single `--quiet` would normally disable the pre-prompt message
// (at the time of writing `Nix 2.21.1`), two seem to be necessary here.
.args(["repl", "--quiet", "--quiet"])
Expand Down

0 comments on commit 15e84f7

Please sign in to comment.