···20 mkBot = n: c:
21 format.generate "${n}.json" (c.settings // {
22 SteamLogin = if c.username == "" then n else c.username;
0023 SteamPassword = c.passwordFile;
24 # sets the password format to file (https://github.com/JustArchiNET/ArchiSteamFarm/wiki/Security#file)
25 PasswordFormat = 4;
26- Enabled = c.enabled;
27 });
28in
29{
···127 default = "";
128 };
129 passwordFile = lib.mkOption {
130- type = lib.types.path;
131- description = lib.mdDoc "Path to a file containing the password. The file must be readable by the `archisteamfarm` user/group.";
0000132 };
133 enabled = lib.mkOption {
134 type = lib.types.bool;
···20 mkBot = n: c:
21 format.generate "${n}.json" (c.settings // {
22 SteamLogin = if c.username == "" then n else c.username;
23+ Enabled = c.enabled;
24+ } // lib.optionalAttrs (c.passwordFile != null) {
25 SteamPassword = c.passwordFile;
26 # sets the password format to file (https://github.com/JustArchiNET/ArchiSteamFarm/wiki/Security#file)
27 PasswordFormat = 4;
028 });
29in
30{
···128 default = "";
129 };
130 passwordFile = lib.mkOption {
131+ type = with lib.types; nullOr path;
132+ default = null;
133+ description = lib.mdDoc ''
134+ Path to a file containing the password. The file must be readable by the `archisteamfarm` user/group.
135+ Omit or set to null to provide the password a different way, such as through the web-ui.
136+ '';
137 };
138 enabled = lib.mkOption {
139 type = lib.types.bool;
···1#!/usr/bin/env nix-shell
2-#!nix-shell -I nixpkgs=../../../../ -i python3 -p "python3.withPackages (ps: with ps; [ nix-prefetch-github ])" -p "git"
34import json
5import os
6import subprocess
7import sys
8-from pathlib import Path
9from concurrent.futures import ThreadPoolExecutor
0001011SCRIPT_PATH = Path(__file__).absolute().parent
12HASHES_PATH = SCRIPT_PATH / "hashes.json"
13GET_REPO_THREADS = int(os.environ.get("GET_REPO_THREADS", 8))
000000000014CORES = {
15 "2048": {"repo": "libretro-2048"},
16 "atari800": {"repo": "libretro-atari800"},
···73 "opera": {"repo": "opera-libretro"},
74 "parallel-n64": {"repo": "parallel-n64"},
75 # libretro/lrps2 is a hard-fork of pcsx2 with simplified code to target
76- # only libretro, while libretro/pcsx2 is supposedly closer to upstream.
77- # TODO: switch to libretro/pcsx2 since this is more up-to-date
078 "pcsx2": {"repo": "lrps2"},
79 "pcsx_rearmed": {"repo": "pcsx_rearmed"},
80 "picodrive": {"repo": "picodrive", "fetch_submodules": True},
···115 print(*msg, file=sys.stderr)
116117000000000000000000000000118def get_repo_hash_fetchFromGitHub(
119 repo,
120 owner="libretro",
···146 text=True,
147 )
148 j = json.loads(result.stdout)
000149 # Remove False values
150 return {k: v for k, v in j.items() if v}
151
···1#!/usr/bin/env nix-shell
2+#!nix-shell -I nixpkgs=./ -i python3 -p "python3.withPackages (ps: with ps; [ requests ])" -p git -p nix-prefetch-github
34import json
5import os
6import subprocess
7import sys
08from concurrent.futures import ThreadPoolExecutor
9+from pathlib import Path
10+11+import requests
1213SCRIPT_PATH = Path(__file__).absolute().parent
14HASHES_PATH = SCRIPT_PATH / "hashes.json"
15GET_REPO_THREADS = int(os.environ.get("GET_REPO_THREADS", 8))
16+# To add a new core, add it to the dictionary below. You need to set at least
17+# `repo`, that is the repository name if the owner of the repository is
18+# `libretro` itself, otherwise also set `owner`.
19+# You may set `deep_clone`, `fetch_submodules` or `leave_dot_git` options to
20+# `True` and they're similar to `fetchgit` options. Also if for some reason you
21+# need to pin a specific revision, set `rev` to a commit.
22+# To generate the hash file for your new core, you can run `update_cores.py
23+# <core>`. The script needs to be run from the root of your `nixpkgs` clone.
24+# Do not forget to add your core to `cores.nix` file with the proper overrides
25+# so the core can be build.
26CORES = {
27 "2048": {"repo": "libretro-2048"},
28 "atari800": {"repo": "libretro-atari800"},
···85 "opera": {"repo": "opera-libretro"},
86 "parallel-n64": {"repo": "parallel-n64"},
87 # libretro/lrps2 is a hard-fork of pcsx2 with simplified code to target
88+ # only libretro, while libretro/pcsx2 is supposedly closer to upstream but
89+ # it is a WIP.
90+ # TODO: switch to libretro/pcsx2 when upstream switches to it.
91 "pcsx2": {"repo": "lrps2"},
92 "pcsx_rearmed": {"repo": "pcsx_rearmed"},
93 "picodrive": {"repo": "picodrive", "fetch_submodules": True},
···128 print(*msg, file=sys.stderr)
129130131+def get_rev_date_fetchFromGitHub(repo, owner, rev):
132+ # https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#get-a-commit
133+ url = f"https://api.github.com/repos/{owner}/{repo}/commits/{rev}"
134+ headers = {
135+ "Accept": "application/vnd.github+json",
136+ "X-GitHub-Api-Version": "2022-11-28",
137+ }
138+ if token := os.environ.get("GITHUB_TOKEN"):
139+ headers["Authorization"] = f"Bearer {token}"
140+ r = requests.get(url, headers=headers)
141+142+ try:
143+ j = r.json()
144+ except requests.exceptions.JSONDecodeError:
145+ return None
146+147+ date = j.get("commit", {}).get("committer", {}).get("date")
148+ if date:
149+ # Date format returned by API: 2023-01-30T06:29:13Z
150+ return f"unstable-{date[:10]}"
151+ else:
152+ return None
153+154+155def get_repo_hash_fetchFromGitHub(
156 repo,
157 owner="libretro",
···183 text=True,
184 )
185 j = json.loads(result.stdout)
186+ date = get_rev_date_fetchFromGitHub(repo, owner, j["rev"])
187+ if date:
188+ j["date"] = date
189 # Remove False values
190 return {k: v for k, v in j.items() if v}
191
···1+{ lib
2+, stdenv
3+, fetchurl
4+}:
5+6+stdenv.mkDerivation (finalAttrs: {
7+ pname = "tecla";
8+ version = "1.6.3";
9+10+ src = fetchurl {
11+ url = "https://www.astro.caltech.edu/~mcs/tecla/libtecla-${finalAttrs.version}.tar.gz";
12+ hash = "sha256-8nV8xVBAhZ/Pj1mgt7JuAYSiK+zkTtlWikU0pHjB7ho=";
13+ };
14+15+ outputs = [ "out" "man" ];
16+17+ postPatch = ''
18+ substituteInPlace install-sh \
19+ --replace "stripprog=" "stripprog=\$STRIP # "
20+ '';
21+22+ env = lib.optionalAttrs stdenv.cc.isClang {
23+ NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration";
24+ };
25+26+ meta = {
27+ homepage = "https://www.astro.caltech.edu/~mcs/tecla/";
28+ description = "Command-line editing library";
29+ longDescription = ''
30+ The tecla library provides UNIX and LINUX programs with interactive
31+ command line editing facilities, similar to those of the UNIX tcsh
32+ shell. In addition to simple command-line editing, it supports recall of
33+ previously entered command lines, TAB completion of file names or other
34+ tokens, and in-line wild-card expansion of filenames. The internal
35+ functions which perform file-name completion and wild-card expansion are
36+ also available externally for optional use by programs.
37+38+ In addition, the library includes a path-searching module. This allows an
39+ application to provide completion and lookup of files located in UNIX
40+ style paths. Although not built into the line editor by default, it can
41+ easily be called from custom tab-completion callback functions. This was
42+ originally conceived for completing the names of executables and
43+ providing a way to look up their locations in the user's PATH environment
44+ variable, but it can easily be asked to look up and complete other types
45+ of files in any list of directories.
46+47+ Note that special care has been taken to allow the use of this library in
48+ threaded programs. The option to enable this is discussed in the
49+ Makefile, and specific discussions of thread safety are presented in the
50+ included man pages.
51+ '';
52+ changelog = "https://sites.astro.caltech.edu/~mcs/tecla/release.html";
53+ license = with lib.licenses; [ mit ];
54+ mainProgram = "enhance";
55+ maintainers = with lib.maintainers; [ AndersonTorres ];
56+ platforms = lib.platforms.unix;
57+ };
58+})
···5, lib
6, fetchFromGitHub
7, fetchurl
08, makeDesktopItem
9, python3
10, libX11
···21, libpulseaudio
22, libpng
23, imagemagick
24-, requireFile
25-26-, oot ? rec {
27- enable = true;
28- variant = "debug";
29-30- rom = requireFile {
31- name = "oot-${variant}.z64";
32- message = ''
33- This nix expression requires that oot-${variant}.z64 is already part of the store.
34- To get this file you can dump your Ocarina of Time's cartridge to a file,
35- and add it to the nix store with nix-store --add-fixed sha1 <FILE>, or override the package:
36- shipwright.override { oot = { enable = true; variant = "debug"; rom = path/to/oot-debug-mq.z64; } }
37-38- The supported variants are:
39- - debug: Ocarina of Time Debug PAL GC (not Master Quest)
40- - pal-gc: Ocarina of Time PAL GameCube (may lead to crashes and instability)
41-42- This is optional if you have imported an Ocarina of Time Master Quest ROM.
43- If so, please set oot.enable to false and ootMq.enable to true.
44- If both are enabled, Ship of Harkinian will be built with both ROMs.
45- '';
46-47- # From upstream: https://github.com/HarbourMasters/Shipwright/blob/e46c60a7a1396374e23f7a1f7122ddf9efcadff7/README.md#1-check-your-sha1
48- sha1 = {
49- debug = "cee6bc3c2a634b41728f2af8da54d9bf8cc14099";
50- pal-gc = "0227d7c0074f2d0ac935631990da8ec5914597b4";
51- }.${variant} or (throw "Unsupported romVariant ${variant}. Valid options are 'debug' and 'pal-gc'.");
52- };
53- }
54-55-, ootMq ? rec {
56- enable = false;
57- variant = "debug-mq";
58-59- rom = requireFile {
60- name = "oot-${variant}.z64";
61- message = ''
62- This nix expression requires that oot-${variant}.z64 is already part of the store.
63- To get this file you can dump your Ocarina of Time Master Quest's cartridge to a file,
64- and add it to the nix store with nix-store --add-fixed sha1 <FILE>, or override the package:
65- shipwright.override { ootMq = { enable = true; variant = "debug-mq"; rom = path/to/oot-debug-mq.z64; } }
66-67- The supported variants are:
68- - debug-mq: Ocarina of Time Debug PAL GC MQ (Dungeons will be Master Quest)
69- - debug-mq-alt: Alternate ROM, not produced by decompilation.
70-71- This is optional if you have imported an Ocarina of Time ROM.
72- If so, please set oot.enable to true and ootMq.enable to false.
73- If both are enabled, Ship of Harkinian will be built with both ROMs.
74- '';
75-76- # From upstream: https://github.com/HarbourMasters/Shipwright/blob/e46c60a7a1396374e23f7a1f7122ddf9efcadff7/README.md#1-check-your-sha1
77- sha1 = {
78- debug-mq = "079b855b943d6ad8bd1eb026c0ed169ecbdac7da";
79- debug-mq-alt = "50bebedad9e0f10746a52b07239e47fa6c284d03";
80- }.${variant} or (throw "Unsupported mqRomVariant ${variant}. Valid options are 'debug-mq' and 'debug-mq-alt'.");
81- };
82- }
83}:
8485-let
86- checkAttrs = attrs:
87- let
88- validAttrs = [ "enable" "rom" "variant" ];
89- in
90- lib.all (name: lib.elem name validAttrs) (lib.attrNames attrs);
91-in
92-assert (lib.assertMsg (checkAttrs oot) "oot must have the attributes 'enable' and 'rom', and none other");
93-assert (lib.assertMsg (checkAttrs ootMq) "ootMq must have the attributes 'enable' and 'rom', and none other");
94-assert (lib.assertMsg (oot.enable || ootMq.enable) "At least one of 'oot.enable' and 'ootMq.enable' must be true");
95-96-stdenv.mkDerivation rec {
97 pname = "shipwright";
98- version = "7.1.1";
99100 src = fetchFromGitHub {
101 owner = "harbourmasters";
102 repo = "shipwright";
103- rev = version;
104- hash = "sha256-zgxJj65wKsQWvVxeCspyHG9YqoYqZxd6GrYptOA8Byk=";
105 fetchSubmodules = true;
106 };
107···109 # https://github.com/HarbourMasters/Shipwright/blob/e46c60a7a1396374e23f7a1f7122ddf9efcadff7/soh/CMakeLists.txt#L736
110 gamecontrollerdb = fetchurl {
111 name = "gamecontrollerdb.txt";
112- url = "https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/c5b4df0e1061175cb11e3ebbf8045178339864a5/gamecontrollerdb.txt";
113- hash = "sha256-2VFCsaalXoe+JYWCH6IbgjnLXNKxe0UqSyJNGZMn5Ko=";
114 };
115116 nativeBuildInputs = [
···120 lsb-release
121 python3
122 imagemagick
00123 ];
124125 buildInputs = [
···135 SDL2_net
136 libpulseaudio
137 libpng
0138 ];
139140 cmakeFlags = [
141 "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}/lib"
0142 ];
143144 dontAddPrefix = true;
···147 hardeningDisable = [ "format" ];
148149 postBuild = ''
150- cp ${gamecontrollerdb} ${gamecontrollerdb.name}
151-152 pushd ../OTRExporter
153- ${lib.optionalString oot.enable "python3 ./extract_assets.py -z ../build/ZAPD/ZAPD.out ${oot.rom}"}
154- ${lib.optionalString ootMq.enable "python3 ./extract_assets.py -z ../build/ZAPD/ZAPD.out ${ootMq.rom}"}
155 popd
156 '';
157···162163 postInstall = ''
164 mkdir -p $out/bin
165-166- # Copy the extracted assets, required to be in the same directory as the executable
167- ${lib.optionalString oot.enable "cp ../OTRExporter/oot.otr $out/lib"}
168- ${lib.optionalString ootMq.enable "cp ../OTRExporter/oot-mq.otr $out/lib"}
169-170 ln -s $out/lib/soh.elf $out/bin/soh
00000171 '';
172173 desktopItems = [
···175 name = "soh";
176 icon = "soh";
177 exec = "soh";
0178 genericName = "Ship of Harkinian";
179 desktopName = "soh";
180 categories = [ "Game" ];
181 })
182 ];
183184- meta = with lib; {
185 homepage = "https://github.com/HarbourMasters/Shipwright";
186 description = "A PC port of Ocarina of Time with modern controls, widescreen, high-resolution, and more";
187- longDescription = ''
188- An PC port of Ocarina of Time with modern controls, widescreen, high-resolution and more, based off of decompilation.
189- Note that you must supply an OoT rom yourself to use this package because propietary assets are extracted from it.
190-191- You can change the game variant like this:
192- shipwright.override { oot.enable = false; ootMq.enable = true }
193-194- The default ROM variants for Oot and OotMq are debug and debug-mq respectively.
195- If you have a pal-gc rom, you should override like this:
196- shipwright.override { oot = { enable = true; variant = "pal-gc"; rom = path/to/oot-pal-gc.z64; } }
197-198- The supported Oot variants are:
199- - debug: Ocarina of Time Debug PAL GC (not Master Quest)
200- - pal-gc: Ocarina of Time PAL GameCube (may lead to crashes and instability)
201-202- The supported OotMq variants are:
203- - debug-mq: Ocarina of Time Debug PAL GC MQ (Dungeons will be Master Quest)
204- - debug-mq-alt: Alternate ROM, not produced by decompilation.
205- '';
206 mainProgram = "soh";
207 platforms = [ "x86_64-linux" ];
208- maintainers = with maintainers; [ ivar j0lol ];
209- license = with licenses; [
210 # OTRExporter, OTRGui, ZAPDTR, libultraship
211 mit
212 # Ship of Harkinian itself
213 unfree
214 ];
215 };
216-}
···705 ### N ###
706707 ncdu_2 = ncdu; # Added 2022-07-22
708-709 net_snmp = throw "'net_snmp' has been renamed to/replaced by 'net-snmp'"; # Converted to throw 2023-09-10
710 netbox_3_3 = throw "netbox 3.3 series has been removed as it was EOL"; # Added 2023-09-02
711 netbox_3_5 = throw "netbox 3.5 series has been removed as it was EOL"; # Added 2024-01-22
···705 ### N ###
706707 ncdu_2 = ncdu; # Added 2022-07-22
708+ nestopia = throw "nestopia was forked; use nestopia-ue instead"; # Added 2024-01-24
709 net_snmp = throw "'net_snmp' has been renamed to/replaced by 'net-snmp'"; # Converted to throw 2023-09-10
710 netbox_3_3 = throw "netbox 3.3 series has been removed as it was EOL"; # Added 2023-09-02
711 netbox_3_5 = throw "netbox 3.5 series has been removed as it was EOL"; # Added 2024-01-22