forked from leonmavr/retrocube
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
35 lines (29 loc) · 1.18 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# To run this on nix/nixos, just run `nix-build` in the directory containing this file
# and then run any executable in the result/bin directory,
# e.g. `./result/bin/cube`
# Or, if there is a corresponding flake.nix file and you have "flakes" enabled,
# you can just run "nix run" and it will run the default executable ("cube").
{ pkgs ? import <nixpkgs> {}}:
with pkgs;
# fastStdenv.mkDerivation for optimization/faster running times (8-12%) BUT... nondeterministic builds :(
# Otherwise just use stdenv.mkDerivation
fastStdenv.mkDerivation {
name = "retrocube";
src = ./.;
enableParallelBuilding = true;
# any dependencies/build tools needed at compilation/build time
nativeBuildInputs = [ pkg-config ncurses gcc ];
# any dependencies needed at runtime
# (why is it not called "runtimeInputs"? and the build time inputs just called "buildInputs"?)
buildInputs = [ ];
# the bash shell steps to build it
buildPhase = ''
make all
'';
# for a generic copy to the nix store of all compiled executables:
# cp $(find * -maxdepth 1 -executable -type f) $out/bin/
installPhase = ''
mkdir -p $out/bin
cp $(find * -maxdepth 1 -executable -type f) $out/bin/
'';
}