-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
executable file
·83 lines (73 loc) · 2.24 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
82
83
{
description = "meowdy";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
naersk.url = "github:nmattia/naersk";
};
outputs =
{ self
, nixpkgs
, flake-utils
, rust-overlay
, naersk
} @ inputs:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
rust-toolchain =
(pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain).override {
extensions = [ "rust-src" ];
};
nightly-rustfmt = pkgs.rust-bin.nightly.latest.rustfmt;
naersk-lib = naersk.lib."${system}".override {
rustc = rust-toolchain;
};
format-pkgs = with pkgs; [
nixpkgs-fmt
];
in
rec
{
packages.meowdy = naersk-lib.buildPackage {
pname = "meowdy";
root = ./.;
nativeBuildInputs = with pkgs; [ ];
};
defaultPackage = packages.meowdy;
apps.meowdy = flake-utils.lib.mkApp {
drv = packages.meowdy;
};
defaultApp = apps.meowdy;
devShell = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
# The ordering of these two items is important. For nightly rustfmt to be used instead of
# the rustfmt provided by `rust-toolchain`, it must appear first in the list. This is
# because native build inputs are added to $PATH in the order they're listed here.
nightly-rustfmt
rust-toolchain
pkgconfig
] ++ format-pkgs;
buildInputs = with pkgs; [
dbus
udev alsaLib vulkan-loader
xlibsWrapper xorg.libXcursor xorg.libXrandr xorg.libXi xorg.libxcb
];
shellHook = with pkgs; ''export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${lib.makeLibraryPath [
dbus
udev alsaLib vulkan-loader xorg.libxcb
]}"'';
};
checks = {
format = pkgs.runCommand
"check-nix-format"
{ buildInputs = format-pkgs; }
''
${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt --check ${./.}
touch $out
'';
};
});
}