Skip to content

Commit cf007de

Browse files
authored
Merge pull request #145 from mlabs-haskell/bladyjoker/rust-flake-improvements
Enables devShellHook and devShellTools in rustFlake and removes system
2 parents c7330e1 + ee1bb80 commit cf007de

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

extras/flake-rust.nix

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
pkgs:
22

3-
{ crane, src, system, crateName, extraSources ? [ ], extraSourcesDir ? ".extras", data ? [ ], dataDir ? "data" }:
3+
{ crane, src, crateName, extraSources ? [ ], extraSourcesDir ? ".extras", data ? [ ], dataDir ? "data", devShellHook ? "", devShellTools ? [ ] }:
44
let
55
rustWithTools = pkgs.rust-bin.stable.latest.default.override {
66
extensions = [ "rustfmt" "rust-analyzer" "clippy" ];
77
};
8-
craneLib = crane.lib.${system}.overrideToolchain rustWithTools;
8+
craneLib = crane.lib.${pkgs.system}.overrideToolchain rustWithTools;
99

1010
# Library source code with extra dependencies attached
1111
fullSrc = pkgs.stdenv.mkDerivation {
@@ -16,7 +16,7 @@ let
1616
cp -r $src/* $out
1717
cd $out
1818
${copyExtraSources}
19-
${copyData}
19+
${copyData}
2020
'';
2121
};
2222
commonArgs = {
@@ -54,9 +54,11 @@ let
5454
in
5555
{
5656
devShells."dev-${crateName}-rust" = craneLib.devShell {
57+
packages = devShellTools;
5758
shellHook = ''
5859
${linkExtraSources}
5960
${linkData}
61+
${devShellHook}
6062
'';
6163
};
6264

runtimes/rust/lbr-prelude-derive/build.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
{ inputs, ... }: {
2-
perSystem = { system, config, ... }:
2+
perSystem = { config, ... }:
33
let
44
rustFlake =
55
config.lbf-nix.rustFlake {
6-
inherit system;
76
src = ./.;
87
crane = inputs.crane;
98
crateName = "lbr-prelude-derive";
@@ -13,6 +12,7 @@
1312
path = ../lbr-prelude;
1413
}
1514
];
15+
devShellHook = config.settings.shell.hook;
1616
};
1717
in
1818
{

runtimes/rust/lbr-prelude/build.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
{ inputs, ... }: {
2-
perSystem = { system, config, ... }:
2+
perSystem = { config, ... }:
33
let
44
rustFlake =
55
config.lbf-nix.rustFlake {
6-
inherit system;
76
src = ./.;
87
crane = inputs.crane;
98
crateName = "lbr-prelude";
@@ -13,6 +12,7 @@
1312
path = ../lbr-prelude-derive;
1413
}
1514
];
15+
devShellHook = config.settings.shell.hook;
1616
};
1717
in
1818
{

0 commit comments

Comments
 (0)