-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathflake.nix
96 lines (82 loc) · 2.7 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
{
description = "Zoomer application for wayland inspired by tsoding's boomer";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, crane, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
craneLib = crane.mkLib pkgs;
# Common arguments can be set here to avoid repeating them later
# Note: changes here will rebuild all dependency crates
commonArgs = rec {
src = let
shaderFilter = path: _type: builtins.match ".*fs$" path != null;
shaderOrCargo = path: type:
(shaderFilter path type) || (craneLib.filterCargoSources path type);
in
pkgs.lib.cleanSourceWith {
src = craneLib.path ./.;
filter = shaderOrCargo;
};
strictDeps = true;
nativeBuildInputs = (with pkgs; [
cmake
pkg-config
clang
wayland
]);
buildInputs = (with pkgs; [
wayland
glfw
]) ++ (
with pkgs.xorg; [
libX11.dev
libXrandr.dev
libXinerama.dev
libXcursor.dev
libXi.dev
]);
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;
LIBCLANG_PATH = pkgs.libclang.lib + "/lib/";
};
woomer = craneLib.buildPackage (commonArgs // {
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
postFixup = ''
patchelf $out/bin/woomer \
--add-needed libwayland-client.so \
--add-needed libwayland-cursor.so \
--add-needed libwayland-egl.so \
--add-rpath ${pkgs.lib.makeLibraryPath [ pkgs.wayland ]}
'';
meta = with nixpkgs.lib; {
description = "Zoomer application for Wayland inspired by tsoding's boomer";
license = licenses.mit;
mainProgram = "woomer";
};
});
in
{
checks = {
inherit woomer;
};
packages.default = woomer;
apps.default = flake-utils.lib.mkApp {
drv = woomer;
};
devShells.default = craneLib.devShell {
inherit (commonArgs) nativeBuildInputs buildInputs LIBCLANG_PATH LD_LIBRARY_PATH;
# Inherit inputs from checks.
checks = self.checks.${system};
packages = with pkgs; [
rust-analyzer
];
};
});
}