File tree 11 files changed +65
-5
lines changed
11 files changed +65
-5
lines changed Original file line number Diff line number Diff line change 7
7
[
8
8
./haskell-flake-project/build.nix
9
9
./rust-flake-project/build.nix
10
+ ./rust-flake-project-with-extra-dependency/build.nix
10
11
./typescript-flake-project/build.nix
11
12
./typescript-flake-project-with-extra-dependency/build.nix
12
13
./typescript-flake-project-with-transitive-extra-dependency/build.nix
Original file line number Diff line number Diff line change
1
+ use flake ../../# dev-rust-flake-project-with-extra-dependency-rust
Original file line number Diff line number Diff line change
1
+ /target
2
+ /.direnv
3
+ .extras
Original file line number Diff line number Diff line change
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" }
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
1
+ fn main ( ) {
2
+ let planet = rust_flake_project:: get_planet ( ) ;
3
+ println ! ( "Hello, {}!" , planet) ;
4
+ }
Original file line number Diff line number Diff line change 1
- use flake ../../# dev-rust-flake-test -rust
1
+ use flake ../../# dev-rust-flake-project -rust
Original file line number Diff line number Diff line change 6
6
{
7
7
src = ./. ;
8
8
inherit ( inputs ) crane ;
9
- crateName = "rust-flake-test " ;
9
+ crateName = "rust-flake-project " ;
10
10
11
11
devShellHook = config . settings . shell . hook ;
12
12
Original file line number Diff line number Diff line change
1
+ pub fn get_planet ( ) -> String {
2
+ String :: from ( "Earth" )
3
+ }
Original file line number Diff line number Diff line change 3
3
{ crane
4
4
, src
5
5
, crateName
6
+ , version ? "0.1.0"
6
7
, rustVersion ? "latest"
7
8
, nativeBuildInputs ? [ ]
8
9
, buildInputs ? [ ]
38
39
'' ;
39
40
} ;
40
41
41
- # Library source code, intended to be in extraSourcesDir
42
+ # Library source code, intended to be used in extraSources
42
43
# Dependencies of this crate are not copied, to the extra sources directory
43
44
# but they are referenced from the parent directory (parent crate's extra sources).
44
45
vendoredSrc =
45
46
pkgs . stdenv . mkDerivation
46
47
{
47
48
src = cleanSrc ;
48
- name = "${ crateName } -vendored-src " ;
49
+ name = "${ crateName } -${ version } " ;
49
50
unpackPhase = ''
50
51
mkdir $out
51
52
cp -r $src/* $out
63
64
cargoArtifacts = craneLib . buildDepsOnly commonArgs ;
64
65
65
66
# Extra sources
66
- extra-sources = pkgs . linkFarm "extra-sources" extraSources ;
67
+ extra-sources = pkgs . linkFarm "extra-sources" ( builtins . map ( drv : { name = drv . name ; path = drv ; } ) extraSources ) ;
67
68
68
69
hasExtraSources = builtins . length extraSources > 0 ;
69
70
linkExtraSources = pkgs . lib . optionalString hasExtraSources ''
You can’t perform that action at this time.
0 commit comments