Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
106 lines (89 loc) · 3.18 KB
/
Copy pathflake.nix
File metadata and controls
106 lines (89 loc) · 3.18 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
{
description = "Rein — remote desktop / couch keyboard";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
# Rein is Linux-only (uinput, PipeWire, ALSA); restrict outputs accordingly.
flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (system:
let
pkgs = import nixpkgs { inherit system; };
sharedLibs = with pkgs; [
gtk3
nss
nspr
alsa-lib
libglvnd
dbus
fuse
libxtst
libx11
libxext
gst_all_1.gstreamer
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-plugins-rs
pipewire
libnice
];
# Runtime executables the server shells out to.
runtimeBins = with pkgs; [
gst_all_1.gstreamer # gst-launch-1.0
pulseaudio # pactl (desktop-audio monitor detection)
];
rein = pkgs.buildNpmPackage {
pname = "rein";
version = "0.5.0";
src = ./.;
npmDepsHash = "sha256-kQq/gCIPiL18y0kJz3ip84nCY39vYYvlFvNUIyTjpW4=";
nativeBuildInputs = [ pkgs.nodejs_24 pkgs.makeWrapper ];
ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
npmFlags = [ "--ignore-scripts" ];
installPhase = ''
runHook preInstall
mkdir -p $out/lib/rein
cp -r .output $out/lib/rein/
cp -r node_modules $out/lib/rein/
cp package.json $out/lib/rein/
# Default server config, resolved at runtime via ../../src/server-config.json
mkdir -p $out/lib/rein/src
cp src/server-config.json $out/lib/rein/src/
mkdir -p $out/bin
makeWrapper ${pkgs.nodejs_24}/bin/node $out/bin/rein-serve \
--add-flags "$out/lib/rein/.output/server/index.mjs" \
--prefix PATH : "${pkgs.lib.makeBinPath runtimeBins}" \
--prefix LD_LIBRARY_PATH : "${pkgs.lib.makeLibraryPath sharedLibs}" \
--set GST_PLUGIN_SYSTEM_PATH_1_0 "${pkgs.lib.makeSearchPathOutput "lib" "lib/gstreamer-1.0" sharedLibs}"
runHook postInstall
'';
meta = {
description = "Rein — remote desktop / couch keyboard streaming server";
homepage = "https://github.com/AOSSIE-Org/Rein";
mainProgram = "rein-serve";
};
};
in
{
packages.default = rein;
packages.rein = rein;
apps.default = {
type = "app";
program = "${rein}/bin/rein-serve";
};
devShells.default = pkgs.mkShell {
packages = with pkgs; [
nodejs_24
git
pkg-config
procps
appimage-run
] ++ sharedLibs ++ runtimeBins;
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath sharedLibs;
GST_PLUGIN_SYSTEM_PATH_1_0 =
pkgs.lib.makeSearchPathOutput "lib" "lib/gstreamer-1.0" sharedLibs;
};
});
}