tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
wine: replace sha256 fetcher arguments with hash
Stefan Frijters
3 years ago
cf692195
1e14a900
+23
-23
2 changed files
expand all
collapse all
unified
split
pkgs
applications
emulators
wine
sources.nix
update-lib.sh
+20
-20
pkgs/applications/emulators/wine/sources.nix
···
1
{ pkgs ? import <nixpkgs> {} }:
2
## we default to importing <nixpkgs> here, so that you can use
3
-
## a simple shell command to insert new sha256's into this file
4
## e.g. with emacs C-u M-x shell-command
5
##
6
## nix-prefetch-url sources.nix -A {stable{,.mono,.gecko64,.gecko32}, unstable, staging, winetricks}
7
8
# here we wrap fetchurl and fetchFromGitHub, in order to be able to pass additional args around it
9
-
let fetchurl = args@{url, sha256, ...}:
10
-
pkgs.fetchurl { inherit url sha256; } // args;
11
-
fetchFromGitHub = args@{owner, repo, rev, sha256, ...}:
12
-
pkgs.fetchFromGitHub { inherit owner repo rev sha256; } // args;
13
-
fetchFromGitLab = args@{domain, owner, repo, rev, sha256, ...}:
14
-
pkgs.fetchFromGitLab { inherit domain owner repo rev sha256; } // args;
15
16
updateScriptPreamble = ''
17
set -eou pipefail
···
26
stable = fetchurl rec {
27
version = "8.0";
28
url = "https://dl.winehq.org/wine/source/8.0/wine-${version}.tar.xz";
29
-
sha256 = "sha256-AnLCCTj4chrkUQr6qLNgN0V91XZh5NZkIxB5uekceS4=";
30
31
## see http://wiki.winehq.org/Gecko
32
gecko32 = fetchurl rec {
33
version = "2.47.3";
34
url = "https://dl.winehq.org/wine/wine-gecko/${version}/wine-gecko-${version}-x86.msi";
35
-
sha256 = "sha256-5bmwbTzjVWRqjS5y4ETjfh4MjRhGTrGYWtzRh6f0jgE=";
36
};
37
gecko64 = fetchurl rec {
38
version = "2.47.3";
39
url = "https://dl.winehq.org/wine/wine-gecko/${version}/wine-gecko-${version}-x86_64.msi";
40
-
sha256 = "sha256-pT7pVDkrbR/j1oVF9uTiqXr7yNyLA6i0QzSVRc4TlnU=";
41
};
42
43
## see http://wiki.winehq.org/Mono
44
mono = fetchurl rec {
45
version = "7.4.0";
46
url = "https://dl.winehq.org/wine/wine-mono/${version}/wine-mono-${version}-x86.msi";
47
-
sha256 = "sha256-ZBP/Mo679+x2icZI/rNUbYEC3thlB50fvwMxsUs6sOw=";
48
};
49
50
patches = [
···
61
# Can't use autobump on stable because we don't want the path
62
# <source/7.0/wine-7.0.tar.xz> to become <source/7.0.1/wine-7.0.1.tar.xz>.
63
if [[ "$UPDATE_NIX_OLD_VERSION" != "$latest_stable" ]]; then
64
-
set_version_and_sha256 stable "$latest_stable" "$(nix-prefetch-url "$wine_url_base/source/$major.0/wine-$latest_stable.tar.xz")"
65
fi
66
67
autobump stable.gecko32 "$latest_gecko"
···
72
};
73
74
unstable = fetchurl rec {
75
-
# NOTE: Don't forget to change the SHA256 for staging as well.
76
version = "8.0";
77
url = "https://dl.winehq.org/wine/source/8.0/wine-${version}.tar.xz";
78
-
sha256 = "sha256-AnLCCTj4chrkUQr6qLNgN0V91XZh5NZkIxB5uekceS4=";
79
inherit (stable) gecko32 gecko64 patches;
80
81
mono = fetchurl rec {
82
version = "7.4.0";
83
url = "https://dl.winehq.org/wine/wine-mono/${version}/wine-mono-${version}-x86.msi";
84
-
sha256 = "sha256-ZBP/Mo679+x2icZI/rNUbYEC3thlB50fvwMxsUs6sOw=";
85
};
86
87
updateScript = writeShellScript "update-wine-unstable" ''
···
92
93
update_staging() {
94
staging_url=$(get_source_attr staging.url)
95
-
set_source_attr staging sha256 "\"$(to_sri "$(nix-prefetch-url --unpack "''${staging_url//$1/$2}")")\""
96
}
97
98
autobump unstable "$latest_unstable" "" update_staging
···
105
staging = fetchFromGitHub rec {
106
# https://github.com/wine-staging/wine-staging/releases
107
inherit (unstable) version;
108
-
sha256 = "sha256-AZVDcwgnF8m+h/jyWSMCLOAWN34sqnhTu2HnJoNyCYc=";
109
owner = "wine-staging";
110
repo = "wine-staging";
111
rev = "v${version}";
···
116
wayland = fetchFromGitLab rec {
117
# https://gitlab.collabora.com/alf/wine/-/tree/wayland
118
version = "8.0";
119
-
sha256 = "sha256-whRnm21UyKZ4AQufNmctzivISVobnCeidmpYz65vlyk=";
120
domain = "gitlab.collabora.com";
121
owner = "alf";
122
repo = "wine";
···
135
if [[ "$wayland_rev" != "$latest_wayland_rev" ]]; then
136
latest_wayland=$(curl -s 'https://gitlab.collabora.com/alf/wine/-/raw/wayland/VERSION' | cut -f3 -d' ')
137
wayland_url=$(get_source_attr wayland.url)
138
-
set_version_and_sha256 wayland "$latest_wayland" "$(nix-prefetch-url --unpack "''${wayland_url/$wayland_rev/$latest_wayland_rev}")"
139
set_source_attr wayland rev "\"$latest_wayland_rev\""
140
fi
141
···
146
winetricks = fetchFromGitHub rec {
147
# https://github.com/Winetricks/winetricks/releases
148
version = "20220411";
149
-
sha256 = "sha256-FjH10nZDYbqXI6/vKpZJKfv2maXSVkahNDf5UTU3eyU=";
150
owner = "Winetricks";
151
repo = "winetricks";
152
rev = version;
···
1
{ pkgs ? import <nixpkgs> {} }:
2
## we default to importing <nixpkgs> here, so that you can use
3
+
## a simple shell command to insert new hashes into this file
4
## e.g. with emacs C-u M-x shell-command
5
##
6
## nix-prefetch-url sources.nix -A {stable{,.mono,.gecko64,.gecko32}, unstable, staging, winetricks}
7
8
# here we wrap fetchurl and fetchFromGitHub, in order to be able to pass additional args around it
9
+
let fetchurl = args@{url, hash, ...}:
10
+
pkgs.fetchurl { inherit url hash; } // args;
11
+
fetchFromGitHub = args@{owner, repo, rev, hash, ...}:
12
+
pkgs.fetchFromGitHub { inherit owner repo rev hash; } // args;
13
+
fetchFromGitLab = args@{domain, owner, repo, rev, hash, ...}:
14
+
pkgs.fetchFromGitLab { inherit domain owner repo rev hash; } // args;
15
16
updateScriptPreamble = ''
17
set -eou pipefail
···
26
stable = fetchurl rec {
27
version = "8.0";
28
url = "https://dl.winehq.org/wine/source/8.0/wine-${version}.tar.xz";
29
+
hash = "sha256-AnLCCTj4chrkUQr6qLNgN0V91XZh5NZkIxB5uekceS4=";
30
31
## see http://wiki.winehq.org/Gecko
32
gecko32 = fetchurl rec {
33
version = "2.47.3";
34
url = "https://dl.winehq.org/wine/wine-gecko/${version}/wine-gecko-${version}-x86.msi";
35
+
hash = "sha256-5bmwbTzjVWRqjS5y4ETjfh4MjRhGTrGYWtzRh6f0jgE=";
36
};
37
gecko64 = fetchurl rec {
38
version = "2.47.3";
39
url = "https://dl.winehq.org/wine/wine-gecko/${version}/wine-gecko-${version}-x86_64.msi";
40
+
hash = "sha256-pT7pVDkrbR/j1oVF9uTiqXr7yNyLA6i0QzSVRc4TlnU=";
41
};
42
43
## see http://wiki.winehq.org/Mono
44
mono = fetchurl rec {
45
version = "7.4.0";
46
url = "https://dl.winehq.org/wine/wine-mono/${version}/wine-mono-${version}-x86.msi";
47
+
hash = "sha256-ZBP/Mo679+x2icZI/rNUbYEC3thlB50fvwMxsUs6sOw=";
48
};
49
50
patches = [
···
61
# Can't use autobump on stable because we don't want the path
62
# <source/7.0/wine-7.0.tar.xz> to become <source/7.0.1/wine-7.0.1.tar.xz>.
63
if [[ "$UPDATE_NIX_OLD_VERSION" != "$latest_stable" ]]; then
64
+
set_version_and_hash stable "$latest_stable" "$(nix-prefetch-url "$wine_url_base/source/$major.0/wine-$latest_stable.tar.xz")"
65
fi
66
67
autobump stable.gecko32 "$latest_gecko"
···
72
};
73
74
unstable = fetchurl rec {
75
+
# NOTE: Don't forget to change the hash for staging as well.
76
version = "8.0";
77
url = "https://dl.winehq.org/wine/source/8.0/wine-${version}.tar.xz";
78
+
hash = "sha256-AnLCCTj4chrkUQr6qLNgN0V91XZh5NZkIxB5uekceS4=";
79
inherit (stable) gecko32 gecko64 patches;
80
81
mono = fetchurl rec {
82
version = "7.4.0";
83
url = "https://dl.winehq.org/wine/wine-mono/${version}/wine-mono-${version}-x86.msi";
84
+
hash = "sha256-ZBP/Mo679+x2icZI/rNUbYEC3thlB50fvwMxsUs6sOw=";
85
};
86
87
updateScript = writeShellScript "update-wine-unstable" ''
···
92
93
update_staging() {
94
staging_url=$(get_source_attr staging.url)
95
+
set_source_attr staging hash "\"$(to_sri "$(nix-prefetch-url --unpack "''${staging_url//$1/$2}")")\""
96
}
97
98
autobump unstable "$latest_unstable" "" update_staging
···
105
staging = fetchFromGitHub rec {
106
# https://github.com/wine-staging/wine-staging/releases
107
inherit (unstable) version;
108
+
hash = "sha256-AZVDcwgnF8m+h/jyWSMCLOAWN34sqnhTu2HnJoNyCYc=";
109
owner = "wine-staging";
110
repo = "wine-staging";
111
rev = "v${version}";
···
116
wayland = fetchFromGitLab rec {
117
# https://gitlab.collabora.com/alf/wine/-/tree/wayland
118
version = "8.0";
119
+
hash = "sha256-whRnm21UyKZ4AQufNmctzivISVobnCeidmpYz65vlyk=";
120
domain = "gitlab.collabora.com";
121
owner = "alf";
122
repo = "wine";
···
135
if [[ "$wayland_rev" != "$latest_wayland_rev" ]]; then
136
latest_wayland=$(curl -s 'https://gitlab.collabora.com/alf/wine/-/raw/wayland/VERSION' | cut -f3 -d' ')
137
wayland_url=$(get_source_attr wayland.url)
138
+
set_version_and_hash wayland "$latest_wayland" "$(nix-prefetch-url --unpack "''${wayland_url/$wayland_rev/$latest_wayland_rev}")"
139
set_source_attr wayland rev "\"$latest_wayland_rev\""
140
fi
141
···
146
winetricks = fetchFromGitHub rec {
147
# https://github.com/Winetricks/winetricks/releases
148
version = "20220411";
149
+
hash = "sha256-FjH10nZDYbqXI6/vKpZJKfv2maXSVkahNDf5UTU3eyU=";
150
owner = "Winetricks";
151
repo = "winetricks";
152
rev = version;
+3
-3
pkgs/applications/emulators/wine/update-lib.sh
···
14
sed_exprs+=(-e "${line}s@[^ ].*\$@$name = $value;@")
15
}
16
17
-
set_version_and_sha256() {
18
set_source_attr "$1" version "\"$2\""
19
-
set_source_attr "$1" sha256 "\"$(to_sri "$3")\""
20
}
21
22
get_latest_wine_version() {
···
39
version=$(get_source_attr "$attr.version")
40
if [[ "$version" != "$latest" ]]; then
41
url=$(get_source_attr "$attr.url")
42
-
set_version_and_sha256 "$attr" "$latest" "$($fetcher "${url//$version/$latest}")"
43
[[ -z "$more" ]] || $more "$version" "$latest"
44
fi
45
}
···
14
sed_exprs+=(-e "${line}s@[^ ].*\$@$name = $value;@")
15
}
16
17
+
set_version_and_hash() {
18
set_source_attr "$1" version "\"$2\""
19
+
set_source_attr "$1" hash "\"$(to_sri "$3")\""
20
}
21
22
get_latest_wine_version() {
···
39
version=$(get_source_attr "$attr.version")
40
if [[ "$version" != "$latest" ]]; then
41
url=$(get_source_attr "$attr.url")
42
+
set_version_and_hash "$attr" "$latest" "$($fetcher "${url//$version/$latest}")"
43
[[ -z "$more" ]] || $more "$version" "$latest"
44
fi
45
}