-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathflake.nix
More file actions
117 lines (100 loc) · 3.19 KB
/
flake.nix
File metadata and controls
117 lines (100 loc) · 3.19 KB
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
117
{
description = "A GTK4 panel for Wayland with integrated notifications, OSD, and quick settings";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
crane.url = "github:ipetkov/crane";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
crane,
flake-utils,
rust-overlay,
}:
flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
rustToolchain = pkgs.rust-bin.stable.latest.default;
craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain;
# Common build inputs needed for both the deps-only and full builds
nativeBuildInputs = with pkgs; [
pkg-config
wrapGAppsHook4
];
buildInputs = with pkgs; [
gtk4
gtk4-layer-shell
libpulseaudio
udev
dbus
wayland
];
# Filter source to only include Rust-relevant files (improves caching)
# Also include .xml (Wayland protocol) and .ttf (embedded font) files
src = pkgs.lib.cleanSourceWith {
src = craneLib.path ./.;
filter =
path: type:
(craneLib.filterCargoSources path type)
|| (pkgs.lib.hasSuffix ".xml" path)
|| (pkgs.lib.hasSuffix ".ttf" path);
};
commonArgs = {
pname = "vibepanel";
version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).workspace.package.version;
inherit src nativeBuildInputs buildInputs;
strictDeps = true;
};
# Build only the cargo dependencies so they can be cached
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
# Build the full package
vibepanel = craneLib.buildPackage (
commonArgs
// {
inherit cargoArtifacts;
# Allow the Nix-wrapped binary to find the host NVIDIA driver
preFixup = ''
gappsWrapperArgs+=(
--suffix LD_LIBRARY_PATH : "${pkgs.addDriverRunpath.driverLink}/lib:/usr/lib64:/usr/lib"
)
'';
meta = {
description = "A GTK4 panel for Wayland with integrated notifications, OSD, and quick settings";
homepage = "https://github.com/prankstr/vibepanel";
license = pkgs.lib.licenses.mit;
mainProgram = "vibepanel";
platforms = pkgs.lib.platforms.linux;
};
}
);
in
{
packages = {
default = vibepanel;
vibepanel = vibepanel;
};
devShells.default = craneLib.devShell {
packages = with pkgs; [
rust-analyzer
];
# Make the build inputs available in the dev shell
inputsFrom = [ vibepanel ];
};
}
)
// {
overlays.default = final: prev: {
vibepanel = self.packages.${final.system}.default;
};
};
}