Skip to content

Commit ca80f3e

Browse files
authored
Merge pull request #19 from mlabs-haskell/szg251/rust-extra-sources
Rust extraSources simplification
2 parents 27185eb + f1d8409 commit ca80f3e

File tree

11 files changed

+65
-5
lines changed

11 files changed

+65
-5
lines changed

examples/build.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ _:
77
[
88
./haskell-flake-project/build.nix
99
./rust-flake-project/build.nix
10+
./rust-flake-project-with-extra-dependency/build.nix
1011
./typescript-flake-project/build.nix
1112
./typescript-flake-project-with-extra-dependency/build.nix
1213
./typescript-flake-project-with-transitive-extra-dependency/build.nix
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake ../../#dev-rust-flake-project-with-extra-dependency-rust
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/target
2+
/.direnv
3+
.extras

examples/rust-flake-project-with-extra-dependency/Cargo.lock

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[package]
2+
name = "rust-flake-project-with-extra-dependency"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7+
8+
[dependencies]
9+
rust-flake-project = { path = ".extras/rust-flake-project-0.1.0" }
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{ inputs, ... }: {
2+
perSystem = { config, ... }:
3+
4+
let
5+
rustFlake = config.lib.rustFlake
6+
{
7+
src = ./.;
8+
inherit (inputs) crane;
9+
crateName = "rust-flake-project-with-extra-dependency";
10+
11+
extraSources = [
12+
config.packages.rust-flake-project-rust-src
13+
];
14+
15+
devShellHook = config.settings.shell.hook;
16+
17+
};
18+
in
19+
{
20+
21+
inherit (rustFlake) packages checks devShells;
22+
23+
};
24+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
fn main() {
2+
let planet = rust_flake_project::get_planet();
3+
println!("Hello, {}!", planet);
4+
}

examples/rust-flake-project/.envrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
use flake ../../#dev-rust-flake-test-rust
1+
use flake ../../#dev-rust-flake-project-rust

examples/rust-flake-project/build.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{
77
src = ./.;
88
inherit (inputs) crane;
9-
crateName = "rust-flake-test";
9+
crateName = "rust-flake-project";
1010

1111
devShellHook = config.settings.shell.hook;
1212

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pub fn get_planet() -> String {
2+
String::from("Earth")
3+
}

0 commit comments

Comments
 (0)