-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathflake.nix
100 lines (99 loc) · 3.33 KB
/
flake.nix
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
{
description = "Pluto browser flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixpkgs-unstable";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
};
outputs =
{
self,
nixpkgs,
rust-overlay,
}:
let
system = "x86_64-linux";
rust-version = "1.77.0";
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
rust_toolchain = pkgs.pkgsBuildHost.rust-bin.stable.${rust-version}.default.override
{
extensions = [
"rust-analyzer"
"clippy"
];
};
buildInputs = with pkgs; [
pkg-config
webkitgtk_4_1
openssl.dev
glib-networking
dbus
];
nativeBuildInputs = with pkgs; [
gst_all_1.gstreamer
rust_toolchain
gst_all_1.gst-plugins-base
gst_all_1.gst-plugins-good
gst_all_1.gst-plugins-bad
gst_all_1.gst-plugins-ugly
gst_all_1.gst-libav
gst_all_1.gst-vaapi
openssl.dev
pkg-config
pango
glib
gdk-pixbuf
webkitgtk_4_1
gcc
gtk3
haskellPackages.webkit2gtk3-javascriptcore
cairo
librsvg
makeWrapper
];
in
with pkgs;
{
devShells.${system}.default = mkShell {
inherit buildInputs nativeBuildInputs;
shellHook = ''
export GIO_MODULE_DIR=${glib-networking}/lib/gio/modules/
export GST_PLUGIN_SYSTEM_PATH_1_0=${gst_all_1.gstreamer.out}/lib/gstreamer-1.0:${gst_all_1.gst-plugins-base}/lib/gstreamer-1.0:${gst_all_1.gst-plugins-good}/lib/gstreamer-1.0:${gst_all_1.gst-plugins-bad}/lib/gstreamer-1.0:${gst_all_1.gst-plugins-ugly}/lib/gstreamer-1.0
export XDG_DATA_DIRS=${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}:${gtk3}/share/gsettings-schemas/${gtk3.name}:$XDG_DATA_DIRS
'';
};
packages.${system}.pluto-browser =
let
manifest = (lib.importTOML ./Cargo.toml).package;
in
rustPlatform.buildRustPackage {
pname = "${manifest.name}";
version = manifest.version;
inherit buildInputs nativeBuildInputs;
doCheck = false;
src = fetchFromGitHub {
owner = "pluto-collections";
repo = "pluto-browser";
rev = "master";
hash = "sha256-mQorimpJipM4tbGzkX7OEbsNGeEm9ntXxTuDtd4KzuE=";
};
buildPhase = ''
export GIO_MODULE_DIR="${glib-networking}/lib/gio/modules/"
cargo build --release --target x86_64-unknown-linux-gnu
'';
cargoLock.lockFile = ./Cargo.lock;
installPhase = ''
mkdir -p $out/bin
mv target/x86_64-unknown-linux-gnu/release/pluto-browser $out/bin/
wrapProgram $out/bin/pluto-browser \
--set GIO_MODULE_DIR "${glib-networking}/lib/gio/modules/" \
--set GST_PLUGIN_SYSTEM_PATH_1_0 "${gst_all_1.gstreamer.out}/lib/gstreamer-1.0:${gst_all_1.gst-plugins-base}/lib/gstreamer-1.0:${gst_all_1.gst-plugins-good}/lib/gstreamer-1.0:${gst_all_1.gst-plugins-bad}/lib/gstreamer-1.0:${gst_all_1.gst-plugins-ugly}/lib/gstreamer-1.0"
'';
};
};
}