-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflake.nix
More file actions
180 lines (165 loc) · 5.78 KB
/
Copy pathflake.nix
File metadata and controls
180 lines (165 loc) · 5.78 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
{
description = "Standalone Nova top bar for Zellij";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
zjstatus = {
url = "github:dj95/zjstatus";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
fenix,
zjstatus,
}:
let
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems = nixpkgs.lib.genAttrs systems;
mkPkgs = system: nixpkgs.legacyPackages.${system};
toolPackage =
system: pkgs:
let
rustToolchain = fenix.packages.${system}.combine [
fenix.packages.${system}.stable.cargo
fenix.packages.${system}.stable.rustc
];
rustPlatform = pkgs.makeRustPlatform {
cargo = rustToolchain;
rustc = rustToolchain;
};
source = pkgs.lib.cleanSourceWith {
name = "nova-bar-source";
src = ./.;
filter =
path: _type:
let
relativePath = pkgs.lib.removePrefix ((toString ./.) + "/") (toString path);
in
relativePath != "target"
&& !pkgs.lib.hasPrefix "target/" relativePath
&& relativePath != ".git"
&& !pkgs.lib.hasPrefix ".git/" relativePath;
};
in
rustPlatform.buildRustPackage {
pname = "nova_bar_tools";
version = "0.1.0";
src = source;
cargoLock.lockFile = ./Cargo.lock;
meta = {
description = "Nova Bar widget command";
homepage = "https://github.com/Yazelix/nova-bar";
license = pkgs.lib.licenses.asl20;
mainProgram = "nova_bar_widget";
};
};
barPackage =
system: pkgs:
let
tools = toolPackage system pkgs;
zjstatusPackage = zjstatus.packages.${system}.default;
in
pkgs.stdenvNoCC.mkDerivation {
pname = "nova_bar";
version = "0.1.0";
src = pkgs.lib.cleanSourceWith {
name = "nova-bar-assets";
src = ./.;
filter =
path: _type:
let
relativePath = pkgs.lib.removePrefix ((toString ./.) + "/") (toString path);
in
relativePath == "presets"
|| relativePath == "presets/examples"
|| pkgs.lib.hasPrefix "presets/" relativePath
|| relativePath == "README.md";
};
dontConfigure = true;
dontBuild = true;
installPhase = ''
runHook preInstall
install -Dm644 ${zjstatusPackage}/bin/zjstatus.wasm "$out/share/nova_bar/zjstatus.wasm"
substitute presets/nova_bar.kdl "$out/share/nova_bar/nova_bar.kdl" \
--replace-fail "__NOVA_BAR_ZJSTATUS_WASM__" "file:$out/share/nova_bar/zjstatus.wasm"
install -Dm644 presets/nova_bar.kdl "$out/share/nova_bar/nova_bar.template.kdl"
install -Dm644 presets/nova_runtime_bar.template.kdl "$out/share/nova_bar/nova_runtime_bar.template.kdl"
install -Dm755 ${tools}/bin/nova_bar_widget "$out/bin/nova_bar_widget"
cp -R presets/examples "$out/share/nova_bar/examples"
install -Dm644 README.md "$out/share/doc/nova_bar/README.md"
runHook postInstall
'';
doInstallCheck = true;
nativeInstallCheckInputs = [
pkgs.coreutils
pkgs.gnugrep
];
installCheckPhase = ''
runHook preInstallCheck
test -s "$out/share/nova_bar/zjstatus.wasm"
test -x "$out/bin/nova_bar_widget"
grep -q 'location="file:' "$out/share/nova_bar/nova_bar.kdl"
! grep -q '__NOVA_BAR_ZJSTATUS_WASM__' "$out/share/nova_bar/nova_bar.kdl"
test -s "$out/share/nova_bar/nova_runtime_bar.template.kdl"
test -s "$out/share/nova_bar/examples/custom_command_widgets.kdl"
test -s "$out/share/nova_bar/examples/standalone_zellij_layout.kdl"
test -s "$out/share/nova_bar/examples/nova_runtime_widgets.kdl"
runHook postInstallCheck
'';
passthru = {
presetPath = "share/nova_bar/nova_bar.kdl";
templatePath = "share/nova_bar/nova_bar.template.kdl";
runtimeTemplatePath = "share/nova_bar/nova_runtime_bar.template.kdl";
examplesPath = "share/nova_bar/examples";
widgetPath = "bin/nova_bar_widget";
wasmPath = "share/nova_bar/zjstatus.wasm";
};
meta = {
description = "Standalone Nova top bar for Zellij";
homepage = "https://github.com/Yazelix/nova-bar";
license = pkgs.lib.licenses.asl20;
mainProgram = "nova_bar_widget";
};
};
in
{
packages = forAllSystems (
system:
let
pkgs = mkPkgs system;
bar = barPackage system pkgs;
tools = toolPackage system pkgs;
in
{
default = bar;
nova_bar = bar;
nova_bar_widget = tools;
}
);
apps = forAllSystems (system: {
default = {
type = "app";
program = "${self.packages.${system}.nova_bar_widget}/bin/nova_bar_widget";
};
nova_bar_widget = {
type = "app";
program = "${self.packages.${system}.nova_bar_widget}/bin/nova_bar_widget";
};
});
checks = forAllSystems (system: {
nova_bar = self.packages.${system}.nova_bar;
nova_bar_widget = self.packages.${system}.nova_bar_widget;
});
};
}