-
Notifications
You must be signed in to change notification settings - Fork 7
/
flake.nix
116 lines (107 loc) · 2.97 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
{
description = "strata - A cutting-edge, robust and sleek Wayland compositor with batteries included. ";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/master";
parts.url = "github:hercules-ci/flake-parts";
crane.url = "github:ipetkov/crane";
rust.url = "github:oxalica/rust-overlay";
nix-filter.url = "github:numtide/nix-filter";
};
outputs = inputs @ {
self,
nixpkgs,
parts,
crane,
rust,
nix-filter,
...
}:
parts.lib.mkFlake {inherit inputs;} {
systems = ["aarch64-linux" "x86_64-linux"];
perSystem = {
self',
lib,
system,
...
}: let
pkgs = nixpkgs.legacyPackages.${system}.extend rust.overlays.default;
rust-toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
craneLib = crane.lib.${system}.overrideToolchain rust-toolchain;
craneArgs = {
pname = "strata";
version = self.rev or "dirty";
src = nix-filter.lib.filter {
root = ./.;
include = [
./src
./strata-core
./strata-derive
./Cargo.toml
./Cargo.lock
./resources
];
exclude = [
./lua
];
};
cmakeFlags = ["PREFIX=~/.local"];
nativeBuildInputs = with pkgs; [
pkg-config
cmake
autoPatchelfHook
];
buildInputs = with pkgs; [
fontconfig
stdenv.cc.cc.lib
wayland
libdrm
libGL
libffi
libinput
libseat
libwacom
libxkbcommon
mesa # For libgbm
systemd # For libudev
];
runtimeDependencies = with pkgs; [
libGL
];
};
cargoArtifacts = craneLib.buildDepsOnly craneArgs;
strata = craneLib.buildPackage (craneArgs // {inherit cargoArtifacts;});
in {
apps.strata = {
type = "app";
program = lib.getExe self'.packages.default;
};
checks.strata = strata;
packages.default = strata;
devShells.default = pkgs.mkShell {
# Should there be packages here or use Nix purely for CI?
LD_LIBRARY_PATH = lib.makeLibraryPath (__concatMap (d: d.runtimeDependencies) (__attrValues self'.checks));
# Basic Developing Components using `nix develop`
buildInputs = with pkgs; [
rust-bin.nightly.latest.default
rust-analyzer
rustfmt
pkg-config
cmake
autoPatchelfHook
fontconfig
stdenv.cc.cc.lib
wayland
libdrm
libGL
libffi
libinput
libseat
libwacom
libxkbcommon
mesa # For libgbm
systemd # For libudev
];
};
};
};
}