forked from OpenCloudGaming/OpenNOW
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
123 lines (102 loc) · 3.21 KB
/
flake.nix
File metadata and controls
123 lines (102 loc) · 3.21 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
{
description = "Custom GeForce Now Client Named OpenNOW";
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; };
electron = pkgs.electron;
nativeDeps = [
pkgs.pkg-config
pkgs.python3
pkgs.gcc
pkgs.makeWrapper
pkgs.copyDesktopItems
];
runtimeDeps = [
pkgs.openssl
pkgs.zlib
]
++ pkgs.lib.optionals pkgs.stdenv.isDarwin (
with pkgs.darwin.apple_sdk.frameworks;
[
CoreGraphics
CoreVideo
AppKit
IOKit
]
);
in
{
packages.default = pkgs.buildNpmPackage {
pname = "opennow";
version = "1.0.0";
src = ./opennow-stable;
npmDepsHash = "sha256-rd6DcBubFSl2MFWdkVlj+2WGI7vxhr361sMzyjcrst0=";
ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
nativeBuildInputs = nativeDeps;
buildInputs = runtimeDeps;
desktopItems = [
(pkgs.makeDesktopItem {
name = "opennow";
exec = "opennow %U";
icon = "opennow";
desktopName = "OpenNOW";
genericName = "Cloud Gaming Client";
categories = [
"Game"
"Network"
];
terminal = false;
})
];
npmBuild = "npm run build";
installPhase = ''
runHook preInstall
mkdir -p $out/lib/opennow
cp -r . $out/lib/opennow
mkdir -p $out/bin
for path in "out/main/index.js" "dist/main/index.js" "dist-electron/main.js"; do
if [ -f "$out/lib/opennow/$path" ]; then
MAIN_SCRIPT="$out/lib/opennow/$path"
break
fi
done
: ''${MAIN_SCRIPT:="$out/lib/opennow"}
makeWrapper ${electron}/bin/electron $out/bin/opennow \
--add-flags "$MAIN_SCRIPT" \
--set NODE_ENV production \
--inherit-argv0 \
--add-flags "--enable-features=WaylandWindowDecorations --platform-hint=auto"
mkdir -p $out/share/icons/hicolor/512x512/apps
if [ -f "src/renderer/src/assets/opennow-logo.png" ]; then
cp src/renderer/src/assets/opennow-logo.png $out/share/icons/hicolor/512x512/apps/opennow.png
fi
runHook postInstall
'';
meta = with pkgs.lib; {
description = "OpenCloudGaming OpenNOW Client";
homepage = "https://github.com/OpenCloudGaming/OpenNOW";
license = licenses.mit;
platforms = platforms.linux ++ platforms.darwin;
mainProgram = "opennow";
};
};
devShells.default = pkgs.mkShell {
inputsFrom = [ self.packages.${system}.default ];
shellHook = ''
export ELECTRON_SKIP_BINARY_DOWNLOAD=1
'';
};
}
);
}