Skip to content

Commit

Permalink
Use absolute path to bash-env-json for module (#38)
Browse files Browse the repository at this point in the history
Thank you for this nice project 👍

This PR simplifies the setup for the module.

Before this change you would need to install `bash-env-json` separately.
Now you only need to load the module with

```nix
use ${bash-env-nushell.packages.${self.system}.module}/bash-env.nu
```
  • Loading branch information
fehnomenal authored Nov 5, 2024
1 parent 379d35d commit 11d7ff9
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,25 @@
inherit system overlays;
};

inherit (builtins) readFile;
inherit (pkgs) rust-bin symlinkJoin writeShellScriptBin writeTextFile;
inherit (pkgs) lib rust-bin stdenvNoCC writeShellScriptBin;
flakePkgs = {
bash-env-json = bash-env-json.packages.${system}.default;
};

bash-env-module = writeTextFile
{
name = "bash-env.nu";
text = readFile ./bash-env.nu;
destination = "/bash-env.nu";
};

bash-env-module-with-bash-env-json = symlinkJoin
bash-env-module-with-bash-env-json = stdenvNoCC.mkDerivation
{
name = "bash-env.nu-with-bash-env-json";
paths = [
bash-env-module
flakePkgs.bash-env-json
];
src = ./bash-env.nu;
dontUnpack = true;
preferLocalBuild = true;
allowSubstitutes = false;

buildPhase = ''
runHook preBuild
mkdir -p "$out"
substitute "$src" "$out/bash-env.nu" --replace-fail ${lib.escapeShellArg "bash-env-json"} ${lib.escapeShellArg "${flakePkgs.bash-env-json}/bin/bash-env-json"}
runHook postBuild
'';
};

# cargo-nightly based on https://github.com/oxalica/rust-overlay/issues/82
Expand Down

0 comments on commit 11d7ff9

Please sign in to comment.