Skip to content

Commit

Permalink
Re-add generate-config script (#68)
Browse files Browse the repository at this point in the history
Thanks to @spikespaz for spotting this:
#63 (comment)
  • Loading branch information
9999years authored Mar 22, 2024
1 parent 2b5c716 commit 1b9c7a3
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions nix/packages/nix-your-shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
inputs,
rustPlatform,
rust-analyzer,
runCommand,
}: let
src = lib.cleanSourceWith {
src = crane-lib.path ../../.;
Expand Down Expand Up @@ -71,10 +72,15 @@
rust-analyzer
];
};
in

generate-config = shell:
runCommand "nix-your-shell-config" {} ''
${lib.getExe pkg} ${lib.escapeShellArg shell} >> "$out"
'';

# Build the actual crate itself, reusing the dependency
# artifacts from above.
crane-lib.buildPackage (commonArgs
pkg = crane-lib.buildPackage (commonArgs
// {
# Don't run tests; we'll do that in a separate derivation.
# This will allow people to install and depend on `ghciwatch`
Expand All @@ -85,7 +91,7 @@ in
cargoBuildCommand = "cargoWithProfile build";

passthru = {
inherit checks devShell;
inherit checks devShell generate-config;
};

meta = {
Expand All @@ -95,4 +101,6 @@ in
platforms = import inputs.systems;
mainProgram = cargoToml.package.name;
};
})
});
in
pkg

0 comments on commit 1b9c7a3

Please sign in to comment.