-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
63 lines (57 loc) · 1.81 KB
/
flake.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
naersk.url = "github:nix-community/naersk";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};
outputs = { self, flake-utils, naersk, nixpkgs }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = (import nixpkgs) {
inherit system;
};
lib = pkgs.lib;
buildInputs = with pkgs; [
udev alsa-lib vulkan-loader
xorg.libX11 xorg.libXcursor xorg.libXi xorg.libXrandr # To use the x11 feature
libxkbcommon wayland # To use the wayland feature
];
commonEnvironment = {
nativeBuildInputs = with pkgs; [
pkg-config
];
LD_LIBRARY_PATH = lib.makeLibraryPath buildInputs;
inherit buildInputs;
};
naersk' = pkgs.callPackage naersk { };
in
{
# For `nix build` & `nix run`:
defaultPackage = naersk'.buildPackage (lib.recursiveUpdate commonEnvironment {
src = ./.;
});
devShell = pkgs.mkShell (lib.recursiveUpdate commonEnvironment {
# Defaults to Bash for some reason???
shellHook = ''
exec $SHELL
'';
nativeBuildInputs = with pkgs; [
rustc
cargo
rust-analyzer
bacon
(pkgs.writeShellScriptBin "git" ''
name=NicoleKai
exec ${pkgs.git}/bin/git -c user.name=$name \
-c user.email=$email \
-c author.name=$name \
-c author.email=$email \
-c commiter.name=$name \
-c commiter.email=$email "$@"
'')
];
});
}
);
}