tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
krunker: init at 2.1.3
seth
11 months ago
10ac8238
d9de10ce
+152
4 changed files
expand all
collapse all
unified
split
pkgs
by-name
kr
krunker
darwin.nix
linux.nix
package.nix
update.sh
+32
pkgs/by-name/kr/krunker/darwin.nix
···
1
1
+
{
2
2
+
stdenvNoCC,
3
3
+
fetchurl,
4
4
+
makeBinaryWrapper,
5
5
+
undmg,
6
6
+
}:
7
7
+
8
8
+
stdenvNoCC.mkDerivation (finalAttrs: {
9
9
+
pname = "krunker";
10
10
+
version = "2.1.3";
11
11
+
12
12
+
src = fetchurl {
13
13
+
url = "https://client2.krunker.io/Official%20Krunker.io%20Client-${finalAttrs.version}.dmg";
14
14
+
hash = "sha512-brvrOPCsXkkrUGcRxsa8bzpFsrY7GF3llt29ZIax6dC0XBsILKXUleESJ5LpurMOgSBsfxNYjZLPJhicIAtuUA==";
15
15
+
};
16
16
+
17
17
+
sourceRoot = ".";
18
18
+
19
19
+
nativeBuildInputs = [
20
20
+
makeBinaryWrapper
21
21
+
undmg
22
22
+
];
23
23
+
24
24
+
postInstall = ''
25
25
+
mkdir -p $out/Applications
26
26
+
cp -r *.app $out/Applications
27
27
+
28
28
+
makeBinaryWrapper \
29
29
+
$out/Applications/Official\ Krunker.io\ Client.app/Contents/MacOS/Official\ Krunker.io\ Client \
30
30
+
$out/bin/krunker
31
31
+
'';
32
32
+
})
+30
pkgs/by-name/kr/krunker/linux.nix
···
1
1
+
{ appimageTools, fetchurl }:
2
2
+
3
3
+
let
4
4
+
pname = "krunker";
5
5
+
version = "2.1.3";
6
6
+
7
7
+
appId = "io.krunker.desktop";
8
8
+
9
9
+
src = fetchurl {
10
10
+
url = "https://client2.krunker.io/Official%20Krunker.io%20Client-${version}.AppImage";
11
11
+
hash = "sha512-a8E5heLsKXOtv/wRKlrnV0GD48cY1mOiSSDW93c7YZ+HoeuBQDxtRaHKg5EqU51Yi+d4tPF5nOh10jZW36c7WQ==";
12
12
+
};
13
13
+
14
14
+
appimageContents = appimageTools.extractType2 {
15
15
+
inherit pname version src;
16
16
+
};
17
17
+
in
18
18
+
19
19
+
appimageTools.wrapType2 {
20
20
+
inherit pname version src;
21
21
+
22
22
+
extraInstallCommands = ''
23
23
+
mkdir -p $out/share/{applications,pixmaps}
24
24
+
install -Dm644 ${appimageContents}/${appId}.desktop -t $out/share/applications
25
25
+
install -Dm644 ${appimageContents}/${appId}.png -t $out/share/pixmaps
26
26
+
27
27
+
substituteInPlace $out/share/applications/${appId}.desktop \
28
28
+
--replace-fail 'Exec=AppRun' "Exec=$pname"
29
29
+
'';
30
30
+
}
+32
pkgs/by-name/kr/krunker/package.nix
···
1
1
+
{
2
2
+
lib,
3
3
+
stdenv,
4
4
+
callPackage,
5
5
+
}:
6
6
+
7
7
+
let
8
8
+
package =
9
9
+
if stdenv.hostPlatform.isDarwin then callPackage ./darwin.nix { } else callPackage ./linux.nix { };
10
10
+
in
11
11
+
12
12
+
package.overrideAttrs (
13
13
+
finalAttrs: oldAttrs: {
14
14
+
passthru = {
15
15
+
updateScript = ./update.sh;
16
16
+
} // oldAttrs.passthru or { };
17
17
+
18
18
+
# Point `nix edit`, etc. to the file that defines the attribute, not this
19
19
+
# entry point
20
20
+
pos = builtins.unsafeGetAttrPos "pname" finalAttrs;
21
21
+
22
22
+
meta = {
23
23
+
description = "Easy to get into fully moddable First Person Shooter with advanced movement mechanics";
24
24
+
homepage = "https://krunker.io";
25
25
+
license = lib.licenses.unfree;
26
26
+
maintainers = with lib.maintainers; [ getchoo ];
27
27
+
mainProgram = "krunker";
28
28
+
platforms = [ "x86_64-linux" ] ++ lib.platforms.darwin;
29
29
+
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
30
30
+
} // oldAttrs.meta or { };
31
31
+
}
32
32
+
)
+58
pkgs/by-name/kr/krunker/update.sh
···
1
1
+
#!/usr/bin/env nix-shell
2
2
+
#! nix-shell --pure -i bash -p bash cacert common-updater-scripts curl yq
3
3
+
# shellcheck shell=bash
4
4
+
set -euo pipefail
5
5
+
6
6
+
root=$(readlink -f "$0" | xargs dirname)
7
7
+
script_name="krunker-update"
8
8
+
updater_url="client2.krunker.io"
9
9
+
10
10
+
log() {
11
11
+
echo "$script_name: $*"
12
12
+
}
13
13
+
14
14
+
panic() {
15
15
+
log "$*"
16
16
+
exit 1
17
17
+
}
18
18
+
19
19
+
update() {
20
20
+
platform="${1:-}"
21
21
+
if [ -z "$platform" ]; then
22
22
+
panic "error: a platform must be supplied to \`update()\`!"
23
23
+
fi
24
24
+
25
25
+
nixfile="$root"/"$platform".nix
26
26
+
if [ ! -f "$nixfile" ]; then
27
27
+
panic "error: $platform is not supported!"
28
28
+
fi
29
29
+
30
30
+
electron_suffix=""
31
31
+
system="x86_64-linux"
32
32
+
if [ "$platform" == "darwin" ]; then
33
33
+
electron_suffix="-mac"
34
34
+
system="aarch64-darwin"
35
35
+
elif [ "$platform" == "linux" ]; then
36
36
+
electron_suffix="-linux"
37
37
+
fi
38
38
+
39
39
+
url="https://$updater_url/latest${electron_suffix}.yml"
40
40
+
log "fetching update information from from $url"
41
41
+
response="$(curl -sSL "$url")"
42
42
+
version="$(yq --raw-output '.version' <<<"$response")"
43
43
+
sha512="$(yq \
44
44
+
--raw-output \
45
45
+
'.files | map(select(.url | contains("dmg") or contains("AppImage"))) | first | .sha512' \
46
46
+
<<<"$response")"
47
47
+
48
48
+
update-source-version krunker "$version" sha512-"$sha512" --file="$nixfile" --system="$system"
49
49
+
}
50
50
+
51
51
+
supported_platforms=(
52
52
+
"darwin"
53
53
+
"linux"
54
54
+
)
55
55
+
56
56
+
for platform in "${supported_platforms[@]}"; do
57
57
+
update "$platform"
58
58
+
done