Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
94 lines (92 loc) · 2.62 KB
/
Copy pathflake.nix
File metadata and controls
94 lines (92 loc) · 2.62 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
{
description = "Microsoft Rewards Script with the project-pinned Patchright browser";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/master";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{ nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
commonPackages = with pkgs; [ nodejs_24 bash coreutils git cacert ];
runtimeEnv = ''
export PLAYWRIGHT_BROWSERS_PATH=0
export SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt
'';
linuxEnvironment = {
name = "rewards-runtime";
multiArch = false;
targetPkgs =
p:
commonPackages
++ (with p; [
glibc
stdenv.cc.cc.lib
alsa-lib
at-spi2-atk
at-spi2-core
atk
cairo
cups
dbus
expat
fontconfig
freetype
glib
gtk3
libdrm
libgbm
libxkbcommon
nspr
nss
pango
udev
zlib
xorg.libX11
xorg.libxcb
xorg.libXcomposite
xorg.libXdamage
xorg.libXext
xorg.libXfixes
xorg.libXrandr
]);
profile = runtimeEnv + ''
export FONTCONFIG_FILE=${pkgs.makeFontsConf {
fontDirectories = [ pkgs.dejavu_fonts pkgs.noto-fonts-color-emoji ];
}}
'';
};
launch = pkgs.writeShellScript "rewards-launch" ''
exec bash ${./scripts/nix/launch.sh} "$@"
'';
runtime =
if pkgs.stdenv.isLinux then
pkgs.buildFHSEnv (linuxEnvironment // { runScript = launch; })
else
pkgs.writeShellApplication {
name = "rewards-runtime";
runtimeInputs = commonPackages;
text = runtimeEnv + ''
exec bash ${./scripts/nix/launch.sh} "$@"
'';
};
in
{
packages.default = runtime;
apps.default = {
type = "app";
program = "${runtime}/bin/rewards-runtime";
};
devShells.default =
if pkgs.stdenv.isLinux then
(pkgs.buildFHSEnv (linuxEnvironment // { runScript = "bash"; })).env
else
pkgs.mkShell {
packages = commonPackages;
shellHook = runtimeEnv;
};
}
);
}