forked from iced-rs/iced
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
makes shell and test-all a lot faster, since there is less evaluation needed, and dependency deduplication
- Loading branch information
1 parent
e48ccca
commit b91c673
Showing
4 changed files
with
124 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,16 @@ | ||
{ | ||
lib, | ||
rustPlatform, | ||
expat, | ||
freetype, | ||
libX11, | ||
libxcb, | ||
libXcursor, | ||
libXi, | ||
libxkbcommon, | ||
libXrandr, | ||
vulkan-loader, | ||
wayland, | ||
}: | ||
{ lib, workspace }: | ||
pname: | ||
let | ||
rpathLibs = [ | ||
libXcursor | ||
libXi | ||
libxkbcommon | ||
libXrandr | ||
libX11 | ||
vulkan-loader | ||
wayland | ||
]; | ||
in | ||
rustPlatform.buildRustPackage { | ||
inherit pname; | ||
version = "0.1.0"; | ||
workspace.overrideAttrs { | ||
inherit pname; | ||
# HACK: think i need version override here because buildRustPackage checks that it is the same as in Cargo.toml | ||
# probably a way to disable this, though i can't be bothered rn | ||
version = "0.1.0"; | ||
|
||
src = let | ||
fs = lib.fileset; | ||
fileset = fs.difference | ||
(fs.gitTracked ./.) | ||
(fs.unions [ | ||
./npins | ||
(fs.fileFilter (f: f.hasExt "nix") ./.) | ||
]); | ||
in | ||
fs.toSource { | ||
root = ./.; | ||
inherit fileset; | ||
}; | ||
# examples are actually individual sub-crates (because theyre in a workspace?) | ||
# cargoBuildFlags = "--example ${pname}"; | ||
cargoBuildFlags = "--package ${pname}"; | ||
|
||
# examples are actually individual sub-crates (because theyre in a workspace?) | ||
# cargoBuildFlags = "--example ${pname}"; | ||
cargoBuildFlags = "--package ${pname}"; | ||
|
||
cargoLock.lockFile = ./Cargo.lock; | ||
|
||
buildInputs = [ | ||
expat | ||
freetype | ||
libxcb | ||
libX11 | ||
libxkbcommon | ||
]; | ||
|
||
fixupPhase = '' | ||
patchelf --set-rpath "${lib.makeLibraryPath rpathLibs}" "$out/bin/${pname}"; | ||
''; | ||
|
||
passthru = { inherit rpathLibs; }; | ||
# HACK: this is _could_ lead to some weird errors if this is wrong | ||
# should be fine for the examples though | ||
meta.mainProgram = pname; | ||
} | ||
fixupPhase = '' | ||
patchelf --set-rpath "${lib.makeLibraryPath workspace.rpathLibs}" "$out/bin/${pname}"; | ||
''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
{ | ||
lib, | ||
rustPlatform, | ||
pkg-config, | ||
expat, | ||
freetype, | ||
libX11, | ||
libxcb, | ||
libXcursor, | ||
libXi, | ||
libxkbcommon, | ||
libXrandr, | ||
vulkan-loader, | ||
wayland, | ||
}: | ||
let | ||
rpathLibs = [ | ||
libXcursor | ||
libXi | ||
libxkbcommon | ||
libXrandr | ||
libX11 | ||
vulkan-loader | ||
wayland | ||
]; | ||
in | ||
rustPlatform.buildRustPackage { | ||
pname = "iced-workspace"; | ||
version = "0.13.1"; | ||
|
||
src = let | ||
fs = lib.fileset; | ||
fileset = fs.difference | ||
(fs.gitTracked ./.) | ||
(fs.unions [ | ||
./npins | ||
(fs.fileFilter (f: f.hasExt "nix") ./.) | ||
]); | ||
in | ||
fs.toSource { | ||
root = ./.; | ||
inherit fileset; | ||
}; | ||
|
||
cargoLock.lockFile = ./Cargo.lock; | ||
|
||
nativeBuildInputs = [ | ||
pkg-config | ||
]; | ||
|
||
buildInputs = [ | ||
expat | ||
freetype | ||
libxcb | ||
libX11 | ||
libxkbcommon | ||
]; | ||
|
||
# build all packages in workspace | ||
cargoBuildFlags = "--workspace"; | ||
|
||
fixupPhase = '' | ||
for example in examples/*/; do | ||
exe=$(basename "$example") | ||
patchelf --set-rpath "${lib.makeLibraryPath rpathLibs}" "$out/bin/$exe"; | ||
done | ||
''; | ||
|
||
passthru = { inherit rpathLibs; }; | ||
} |