-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
81 lines (77 loc) · 2.42 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
{
inputs = {
naersk.url = "github:nmattia/naersk/master";
# This must be the stable nixpkgs if you're running the app on a
# stable NixOS install. Mixing EGL library versions doesn't work.
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-compat = {
url = github:edolstra/flake-compat;
flake = true;
};
};
outputs = { self, nixpkgs, utils, naersk, rust-overlay, ... }:
utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {inherit system overlays;};
naersk-lib = pkgs.callPackage naersk {
cargo = pkgs.rust-bin.stable.latest.default;
rustc = pkgs.rust-bin.stable.latest.default;
};
manifest = (builtins.fromTOML (builtins.readFile ./app/Cargo.toml)).package;
commonBuildInputs = with pkgs; [
gsettings-desktop-schemas #https://nixos.org/manual/nixpkgs/unstable/#ssec-gnome-common-issues
xorg.libxcb
gtk3.dev
pkg-config
libGL
libxkbcommon
wayland
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr
xorg.libxcb
fontconfig
];
runtimeDependencies = with pkgs; [
libGL
libxkbcommon
];
in
{
defaultPackage = naersk-lib.buildPackage {
src = pkgs.lib.cleanSource ./.;
doCheck = true;
pname = manifest.name;
nativeBuildInputs = [
pkgs.autoPatchelfHook
pkgs.wrapGAppsHook
];
runtimeDependencies = runtimeDependencies;
buildInputs = with pkgs; [
pkgs.rust-bin.stable.latest.default
] ++ commonBuildInputs;
};
defaultApp = utils.lib.mkApp {
drv = self.defaultPackage."${system}";
};
devShell = with pkgs; mkShell {
buildInputs = [
#cargo
cargo-insta
pre-commit
#rust-analyzer
#rustPackages.clippy
#rustc
#rustfmt
tokei
] ++ commonBuildInputs;
RUST_SRC_PATH = rustPlatform.rustLibSrc;
LD_LIBRARY_PATH = lib.makeLibraryPath commonBuildInputs;
GIT_EXTERNAL_DIFF = "${difftastic}/bin/difft";
};
});
}