Initial commit
This commit is contained in:
commit
e483f73dd4
12 changed files with 479 additions and 0 deletions
43
examples/crane/flake.nix
Normal file
43
examples/crane/flake.nix
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
description = "An example of a shell environment with a Crane-built package";
|
||||
|
||||
inputs = {
|
||||
rust.url = "git+https://forgejo.alt0r.com/braunse/rust-part";
|
||||
nixpkgs.follows = "rust/nixpkgs";
|
||||
parts.follows = "rust/parts";
|
||||
rustManifest.follows = "rust/rustManifest";
|
||||
};
|
||||
|
||||
outputs = inputs: inputs.parts.lib.mkFlake { inherit inputs; } {
|
||||
imports = [ inputs.rust.flakeModules.crane ];
|
||||
|
||||
systems = [ "x86_64-linux" ];
|
||||
|
||||
perSystem =
|
||||
{ pkgs, craneLib, self', ... }: {
|
||||
packages.rusty-hello = craneLib.buildPackage {
|
||||
src = craneLib.cleanCargoSource (craneLib.path ./.);
|
||||
strictDeps = true;
|
||||
};
|
||||
|
||||
checks = {
|
||||
craneCompilesRustPackage = pkgs.stdenv.mkDerivation {
|
||||
name = "check-crane-compiles-rust-package";
|
||||
dontUnpack = true;
|
||||
buildPhase = ''
|
||||
set -euo pipefail
|
||||
|
||||
# Check that the compilation of our trivial package yielded something we can actually execute.
|
||||
OUTPUT="$(${self'.packages.rusty-hello}/bin/rusty-hello)"
|
||||
if [[ "$OUTPUT" != "Rusty-Hello" ]]; then
|
||||
echo "Received output '$OUTPUT', expected 'Rusty-Hello'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
touch $out
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue