-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
42 lines (39 loc) · 1.24 KB
/
Copy pathflake.nix
File metadata and controls
42 lines (39 loc) · 1.24 KB
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
36
37
38
39
40
41
42
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
zig-overlay.url = "github:mitchellh/zig-overlay";
};
outputs = { self, nixpkgs, flake-utils, zig-overlay }:
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let
# Refer to https://github.com/mitchellh/zig-overlay if you want to use a specific version of Zig
zigPackage = zig-overlay.packages.${system}."0.14.0";
pkgs = nixpkgs.legacyPackages.${system};
in
{
formatter = pkgs.nixpkgs-fmt;
devShells.default = pkgs.mkShell {
name = "name_of_your_project";
packages = with pkgs; [
raylib
];
nativeBuildInputs = [
zigPackage
];
};
packages.default = pkgs.stdenv.mkDerivation {
name = "name_of_your_project";
src = ./.;
XDG_CACHE_HOME = "${placeholder "out"}";
buildInputs = [ pkgs.raylib ];
buildPhase = ''
${zigPackage}/bin/zig build
'';
installPhase = ''
${zigPackage}/bin/zig build install --prefix $out
rm -rf $out/zig # remove cache
'';
};
});
}