nix: apply a source filter to the main package
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Id6933272a05f17c70fe91719dbd3ac9c6a6a6964
This commit is contained in:
parent
b6aa958413
commit
172ff53561
1 changed files with 15 additions and 22 deletions
|
|
@ -5,14 +5,23 @@
|
|||
raylib,
|
||||
pkg-config,
|
||||
}:
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
stdenv.mkDerivation {
|
||||
pname = "rogged";
|
||||
version = "0.0.1";
|
||||
|
||||
src = builtins.path {
|
||||
path = ../.;
|
||||
name = finalAttrs.pname;
|
||||
};
|
||||
src = let
|
||||
fs = lib.fileset;
|
||||
s = ../.;
|
||||
in
|
||||
fs.toSource {
|
||||
root = s;
|
||||
fileset = fs.unions [
|
||||
(s + /assets)
|
||||
(s + /libs)
|
||||
(s + /src)
|
||||
(s + /build.zig)
|
||||
];
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
zig
|
||||
|
|
@ -21,25 +30,9 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
|
||||
buildInputs = [raylib];
|
||||
|
||||
dontConfigure = true;
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
export ZIG_GLOBAL_CACHE_DIR="$TMPDIR/zig-cache"
|
||||
zig build --release=fast
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out/bin
|
||||
cp zig-out/bin/roguelike $out/bin/
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "A turn-based roguelike game";
|
||||
license = lib.licenses.mit;
|
||||
mainProgram = "roguelike";
|
||||
};
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue