-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflake.nix
More file actions
74 lines (63 loc) · 2.38 KB
/
flake.nix
File metadata and controls
74 lines (63 loc) · 2.38 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
{
description = "OCF COSMIC Applets";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
crane.url = "github:ipetkov/crane";
};
outputs = { self, nixpkgs, flake-utils, crane }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
craneLib = crane.mkLib pkgs;
runtimeLibs = with pkgs; [ libGL libxkbcommon wayland vulkan-loader ];
commonArgs = {
src = pkgs.lib.cleanSourceWith {
src = ./.;
filter = path: type:
(craneLib.filterCargoSources path type) ||
(builtins.match ".*\.desktop$" path != null) ||
(builtins.match ".*\.svg$" path != null);
};
strictDeps = true;
nativeBuildInputs = with pkgs; [ pkg-config copyDesktopItems ];
buildInputs = runtimeLibs;
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
buildApplet = name: path: craneLib.buildPackage (commonArgs // {
inherit cargoArtifacts;
pname = name;
version = "0.1.0";
cargoExtraArgs = "-p ${name}";
postInstall = ''
install -Dm644 ${path}/${name}.desktop $out/share/applications/${name}.desktop
substituteInPlace $out/share/applications/${name}.desktop \
--replace "@EXEC_PATH@" "$out/bin/${name}"
'';
postFixup = ''
patchelf --add-rpath "${pkgs.lib.makeLibraryPath runtimeLibs}" $out/bin/${name}
'';
});
in
{
packages = {
paper = buildApplet "ocf-paper-quota-applet" "./paper-quota-applet";
status = buildApplet "ocf-logout-applet" "./logout-applet";
theme = buildApplet "ocf-theme-applet" "./theme-applet";
default = pkgs.symlinkJoin {
name = "all";
paths = [
self.packages.${system}.paper
self.packages.${system}.status
self.packages.${system}.theme
];
};
};
devShells.default = craneLib.devShell {
inputsFrom = [ self.packages.${system}.paper ];
packages = with pkgs; [ cargo rustc rust-analyzer clippy rustfmt ];
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath runtimeLibs;
};
}
);
}