forked from pop-os/cosmic-comp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
115 lines (100 loc) · 2.92 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
{
description = "Compositor for the COSMIC desktop environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
parts.url = "github:hercules-ci/flake-parts";
parts.inputs.nixpkgs-lib.follows = "nixpkgs";
crane.url = "github:ipetkov/crane";
rust.url = "github:oxalica/rust-overlay";
rust.inputs.nixpkgs.follows = "nixpkgs";
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.mkLib pkgs).overrideToolchain rust-toolchain;
craneArgs = {
pname = "cosmic-comp";
version = self.rev or "dirty";
src = nix-filter.lib.filter {
root = ./.;
include = [
./src
./i18n.toml
./Cargo.toml
./Cargo.lock
./resources
./cosmic-comp-config
];
};
nativeBuildInputs = with pkgs; [
pkg-config
autoPatchelfHook
cmake
];
buildInputs = with pkgs; [
wayland
systemd # For libudev
seatd # For libseat
libxkbcommon
libinput
mesa # For libgbm
fontconfig
stdenv.cc.cc.lib
pixman
];
runtimeDependencies = with pkgs; [
libglvnd # For libEGL
wayland # winit->wayland-sys wants to dlopen libwayland-egl.so
# for running in X11
xorg.libX11
xorg.libXcursor
xorg.libxcb
xorg.libXi
libxkbcommon
# for vulkan backend
vulkan-loader
];
};
cargoArtifacts = craneLib.buildDepsOnly craneArgs;
cosmic-comp = craneLib.buildPackage (craneArgs // { inherit cargoArtifacts; });
in
{
apps.cosmic-comp = {
type = "app";
program = lib.getExe self'.packages.default;
};
checks.cosmic-comp = cosmic-comp;
packages.default = cosmic-comp;
devShells.default = craneLib.devShell {
LD_LIBRARY_PATH = lib.makeLibraryPath (
__concatMap (d: d.runtimeDependencies) (__attrValues self'.checks)
);
# include build inputs
inputsFrom = [ cosmic-comp ];
};
};
};
}