Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
176 lines (157 loc) · 6.75 KB
/
Copy pathflake.nix
File metadata and controls
176 lines (157 loc) · 6.75 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
{
description = "anvil — a block-aware Linux terminal workspace";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{ self, nixpkgs, flake-utils }:
flake-utils.lib.eachSystem
[
"x86_64-linux"
"aarch64-linux"
]
(
system:
let
pkgs = nixpkgs.legacyPackages.${system};
manifest = builtins.fromTOML (builtins.readFile ./Cargo.toml);
package = pkgs.rustPlatform.buildRustPackage {
pname = manifest.package.name;
version = manifest.package.version;
# Historical source bundles are not production inputs.
src = self;
cargoLock = {
lockFile = ./Cargo.lock;
# Git dependencies are not covered by Cargo.lock checksums, so
# Nix needs an explicit hash per revision. A jterm_core repin can
# also move its transitive jagent pin: compare both source lines
# in Cargo.lock, set each affected value to pkgs.lib.fakeHash,
# then run `nix flake check --no-write-lock-file` and copy `got:`.
# Full revisions beside the hashes make a stale repin conspicuous.
outputHashes = {
# git+https://github.com/beamiter/jterm_core.git?rev=aeecbb58f3a06b6686af983256e443bb0e6c200a#aeecbb58f3a06b6686af983256e443bb0e6c200a
"jterm_core-0.2.0" = "sha256-YcHanSMcVJ0NWhQI4Cgp/i5Iojtt7107x6cs4L7+lBE=";
# git+https://github.com/beamiter/jagent.git?rev=b6ecae39a901f4836543541b0147a15a76ecbc4e#b6ecae39a901f4836543541b0147a15a76ecbc4e
"jagent-0.7.0" = "sha256-f+WxFhzuaeQHADgqNX4EAgaijuUPh1JUAosE5PxZuNw=";
# git+https://github.com/beamiter/jcompanion.git?rev=240fe5ac33f34d86906e40ad5baa64fc2a9d90d9#240fe5ac33f34d86906e40ad5baa64fc2a9d90d9
"companion-core-0.1.0" = "sha256-sTVjiphhh9MFqHk/SHhVndk0ppUyt7jWwnZ7eJckCQ8=";
};
};
strictDeps = true;
buildFeatures = [ "shared-terminal" ];
preBuild = "python3 tools/check-process-bundle.py && python3 tools/check-host-bundle.py";
nativeBuildInputs = with pkgs; [
pkg-config
python3
wrapGAppsHook4
];
buildInputs = with pkgs; [
gtk4
libadwaita
pcre2
fcitx5-gtk
];
# Embedded at compile time and used only when the caller has not
# already selected an input-method setup.
FCITX5_GTK_PATH = "${pkgs.fcitx5-gtk}/lib/gtk-4.0";
# GTK tests are exercised under Xvfb in GitHub Actions. Running them
# inside the sandbox without a display would produce false failures.
doCheck = false;
postInstall = ''
install -Dm644 data/io.github.beamiter.anvil.desktop \
"$out/share/applications/io.github.beamiter.anvil.desktop"
install -Dm644 data/io.github.beamiter.anvil.metainfo.xml \
"$out/share/metainfo/io.github.beamiter.anvil.metainfo.xml"
install -Dm644 data/io.github.beamiter.anvil.svg \
"$out/share/icons/hicolor/scalable/apps/io.github.beamiter.anvil.svg"
install -Dm644 data/io.github.beamiter.anvil-128.png \
"$out/share/icons/hicolor/128x128/apps/io.github.beamiter.anvil.png"
install -Dm644 data/io.github.beamiter.anvil-256.png \
"$out/share/icons/hicolor/256x256/apps/io.github.beamiter.anvil.png"
install -Dm644 config.toml.example \
"$out/share/doc/anvil/config.toml.example"
install -Dm644 README.md \
"$out/share/doc/anvil/README.md"
install -Dm644 Cargo.lock \
"$out/share/doc/anvil/Cargo.lock"
install -Dm755 scripts/support-bundle.sh \
"$out/bin/anvil-support-bundle"
install -d "$out/share/anvil/shell-integration"
install -m644 scripts/shell-integration/README.md \
"$out/share/anvil/shell-integration/"
install -m644 scripts/shell-integration/anvil.* \
"$out/share/anvil/shell-integration/"
install -d "$out/share/anvil/workflows"
install -m644 scripts/workflows/*.yaml \
"$out/share/anvil/workflows/"
install -Dm644 scripts/notebooks/welcome.jtnb.md \
"$out/share/anvil/notebooks/welcome.jtnb.md"
'';
preFixup = ''
gappsWrapperArgs+=(
--set-default ANVIL_WORKFLOW_DIR "$out/share/anvil/workflows"
--set-default ANVIL_ASSET_DIR "$out/share/anvil"
)
'';
meta = with pkgs.lib; {
description = manifest.package.description;
homepage = manifest.package.repository;
mainProgram = "anvil";
platforms = platforms.linux;
};
};
in
{
packages.default = package;
apps.default = flake-utils.lib.mkApp { drv = package; };
checks.package = package;
formatter = pkgs.nixfmt-rfc-style;
devShells.default = pkgs.mkShell {
inputsFrom = [ package ];
packages = with pkgs; [
cargo
rustc
rustfmt
clippy
cargo-audit
cargo-watch
shellcheck
dbus
xorg-server
xauth
xvfb-run
gtk4
glib
pkg-config
libadwaita
# Independent historical renderer oracle only; not package inputs.
vte
vte-gtk4
pcre2
fcitx5-gtk
glade
cambalache
xdotool
jq
valgrind
strace
patchelf
fuse
fakeroot
openssl
];
shellHook = ''
export GSETTINGS_SCHEMA_DIR="${pkgs.gtk4}/share/gsettings-schemas/:${pkgs.glib}/share/gsettings-schemas/"
export RUST_BACKTRACE=1
export GTK_IM_MODULE="''${GTK_IM_MODULE:-fcitx}"
export XMODIFIERS="''${XMODIFIERS:-@im=fcitx}"
export QT_IM_MODULE="''${QT_IM_MODULE:-fcitx}"
export GTK_PATH="${pkgs.fcitx5-gtk}/lib/gtk-4.0''${GTK_PATH:+:$GTK_PATH}"
export FCITX5_GTK_PATH="${pkgs.fcitx5-gtk}/lib/gtk-4.0"
echo "anvil development environment ready. Run 'make verify'."
'';
};
}
);
}