-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathflake.nix
More file actions
111 lines (94 loc) · 3.64 KB
/
flake.nix
File metadata and controls
111 lines (94 loc) · 3.64 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
{
description = "BigLinux WebApps — turn websites into desktop apps";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
# Runtime libraries the three binaries link against.
runtimeDeps = with pkgs; [
glib
gtk4
libadwaita
webkitgtk_6_0
openssl
gettext
];
# Tools needed only during the build.
buildDeps = with pkgs; [
pkg-config
wrapGAppsHook4
gettext # msgfmt
];
in {
packages = rec {
default = biglinux-webapps;
biglinux-webapps = pkgs.rustPlatform.buildRustPackage {
pname = "biglinux-webapps";
version = "4.0.0";
src = pkgs.lib.cleanSource ./.;
cargoLock = {
lockFile = ./Cargo.lock;
};
nativeBuildInputs = buildDeps;
buildInputs = runtimeDeps;
# Compile message catalogs before install.
preBuild = ''
for po in po/*.po; do
lang=$(basename "$po" .po)
msgfmt -o "po/''${lang}.mo" "$po"
done
'';
# Install data files after cargo installs the binaries.
postInstall = ''
install -Dm644 biglinux-webapps/usr/share/applications/br.com.biglinux.webapps.desktop \
$out/share/applications/br.com.biglinux.webapps.desktop
install -Dm644 biglinux-webapps/usr/share/metainfo/br.com.biglinux.webapps.metainfo.xml \
$out/share/metainfo/br.com.biglinux.webapps.metainfo.xml
install -Dm644 biglinux-webapps/usr/share/icons/hicolor/scalable/apps/big-webapps.svg \
$out/share/icons/hicolor/scalable/apps/big-webapps.svg
install -Dm644 biglinux-webapps/usr/share/icons/hicolor/scalable/apps/big-webapps-symbolic.svg \
$out/share/icons/hicolor/scalable/apps/big-webapps-symbolic.svg
install -Dm644 biglinux-webapps/usr/share/biglinux-webapps/browsers.toml \
$out/share/biglinux-webapps/browsers.toml
for mo in po/*.mo; do
lang=$(basename "$mo" .mo)
locale_dir=''${lang//-/_}
install -Dm644 "$mo" \
"$out/share/locale/''${locale_dir}/LC_MESSAGES/biglinux-webapps.mo"
done
'';
meta = with pkgs.lib; {
description = "Turn any website into a desktop app (GTK4/libadwaita)";
homepage = "https://github.com/biglinux/biglinux-webapps";
license = licenses.gpl3Plus;
platforms = platforms.linux;
mainProgram = "big-webapps-gui";
};
};
};
# `nix run .` launches the GUI.
apps.default = {
type = "app";
program = "${self.packages.${system}.biglinux-webapps}/bin/big-webapps-gui";
};
# `nix develop` drops into a shell with cargo + all native deps wired up.
devShells.default = pkgs.mkShell {
inputsFrom = [ self.packages.${system}.biglinux-webapps ];
packages = with pkgs; [
rustc
cargo
clippy
rustfmt
cargo-outdated
cargo-audit
];
shellHook = ''
echo "biglinux-webapps dev shell — run: cargo build --release --workspace"
'';
};
});
}