···29 folder.enable
30 ) cfg.settings.folders);
3132- updateConfig = pkgs.writers.writeDash "merge-syncthing-config" ''
033 set -efu
3435 # be careful not to leak secrets in the filesystem or in process listings
36-37 umask 0077
3839 # get the api key by parsing the config.xml
···51 --retry 1000 --retry-delay 1 --retry-all-errors \
52 "$@"
53 }
05455- # query the old config
56- old_cfg=$(curl ${cfg.guiAddress}/rest/config)
57-58- # generate the new config by merging with the NixOS config options
59- new_cfg=$(printf '%s\n' "$old_cfg" | ${pkgs.jq}/bin/jq -c ${escapeShellArg ''. * ${builtins.toJSON cleanedConfig} * {
60- "devices": ('${escapeShellArg (builtins.toJSON devices)}'${optionalString (cfg.settings.devices == {} || ! cfg.overrideDevices) " + .devices"}),
61- "folders": ('${escapeShellArg (builtins.toJSON folders)}'${optionalString (cfg.settings.folders == {} || ! cfg.overrideFolders) " + .folders"})
62- }''})
63-64- # send the new config
65- curl -X PUT -d "$new_cfg" ${cfg.guiAddress}/rest/config
66-0000000000000000000000000000000000000000000000000000000000067 # restart Syncthing if required
68 if curl ${cfg.guiAddress}/rest/config/restart-required |
69- ${pkgs.jq}/bin/jq -e .requiresRestart > /dev/null; then
70 curl -X POST ${cfg.guiAddress}/rest/system/restart
71 fi
72- '';
73in {
74 ###### interface
75 options = {
···29 folder.enable
30 ) cfg.settings.folders);
3132+ jq = "${pkgs.jq}/bin/jq";
33+ updateConfig = pkgs.writers.writeBash "merge-syncthing-config" (''
34 set -efu
3536 # be careful not to leak secrets in the filesystem or in process listings
037 umask 0077
3839 # get the api key by parsing the config.xml
···51 --retry 1000 --retry-delay 1 --retry-all-errors \
52 "$@"
53 }
54+ '' +
5556+ /* Syncthing's rest API for the folders and devices is almost identical.
57+ Hence we iterate them using lib.pipe and generate shell commands for both at
58+ the sime time. */
59+ (lib.pipe {
60+ # The attributes below are the only ones that are different for devices /
61+ # folders.
62+ devs = {
63+ new_conf_IDs = map (v: v.id) devices;
64+ GET_IdAttrName = "deviceID";
65+ override = cfg.overrideDevices;
66+ conf = devices;
67+ baseAddress = "${cfg.guiAddress}/rest/config/devices";
68+ };
69+ dirs = {
70+ new_conf_IDs = map (v: v.id) folders;
71+ GET_IdAttrName = "id";
72+ override = cfg.overrideFolders;
73+ conf = folders;
74+ baseAddress = "${cfg.guiAddress}/rest/config/folders";
75+ };
76+ } [
77+ # Now for each of these attributes, write the curl commands that are
78+ # identical to both folders and devices.
79+ (mapAttrs (conf_type: s:
80+ # We iterate the `conf` list now, and run a curl -X POST command for each, that
81+ # should update that device/folder only.
82+ lib.pipe s.conf [
83+ # Quoting https://docs.syncthing.net/rest/config.html:
84+ #
85+ # > PUT takes an array and POST a single object. In both cases if a
86+ # given folder/device already exists, it’s replaced, otherwise a new
87+ # one is added.
88+ #
89+ # What's not documented, is that using PUT will remove objects that
90+ # don't exist in the array given. That's why we use here `POST`, and
91+ # only if s.override == true then we DELETE the relevant folders
92+ # afterwards.
93+ (map (new_cfg: ''
94+ curl -d ${lib.escapeShellArg (builtins.toJSON new_cfg)} -X POST ${s.baseAddress}
95+ ''))
96+ (lib.concatStringsSep "\n")
97+ ]
98+ /* If we need to override devices/folders, we iterate all currently configured
99+ IDs, via another `curl -X GET`, and we delete all IDs that are not part of
100+ the Nix configured list of IDs
101+ */
102+ + lib.optionalString s.override ''
103+ old_conf_${conf_type}_ids="$(curl -X GET ${s.baseAddress} | ${jq} --raw-output '.[].${s.GET_IdAttrName}')"
104+ for id in ''${old_conf_${conf_type}_ids}; do
105+ if echo ${lib.concatStringsSep " " s.new_conf_IDs} | grep -q $id; then
106+ continue
107+ else
108+ curl -X DELETE ${s.baseAddress}/$id
109+ fi
110+ done
111+ ''
112+ ))
113+ builtins.attrValues
114+ (lib.concatStringsSep "\n")
115+ ]) +
116+ /* Now we update the other settings defined in cleanedConfig which are not
117+ "folders" or "devices". */
118+ (lib.pipe cleanedConfig [
119+ builtins.attrNames
120+ (lib.subtractLists ["folders" "devices"])
121+ (map (subOption: ''
122+ curl -X PUT -d ${lib.escapeShellArg (builtins.toJSON cleanedConfig.${subOption})} \
123+ ${cfg.guiAddress}/rest/config/${subOption}
124+ ''))
125+ (lib.concatStringsSep "\n")
126+ ]) + ''
127 # restart Syncthing if required
128 if curl ${cfg.guiAddress}/rest/config/restart-required |
129+ ${jq} -e .requiresRestart > /dev/null; then
130 curl -X POST ${cfg.guiAddress}/rest/system/restart
131 fi
132+ '');
133in {
134 ###### interface
135 options = {
+1-1
pkgs/build-support/go/module.nix
···5455 goModules = if (vendorHash == null) then "" else
56 (stdenv.mkDerivation {
57- name = "${name}-goModules";
5859 nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ go git cacert ];
60
···5455 goModules = if (vendorHash == null) then "" else
56 (stdenv.mkDerivation {
57+ name = "${name}-go-modules";
5859 nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ go git cacert ];
60
···36assert lib.asserts.assertOneOf "withPrecision" withPrecision [ "single" "double" ];
3738let
39+ mkSconsFlagsFromAttrSet = lib.mapAttrsToList (k: v:
40+ if builtins.isString v
41+ then "${k}=${v}"
42+ else "${k}=${builtins.toJSON v}");
000000000043in
44stdenv.mkDerivation rec {
45 pname = "godot";
46 version = "4.1-stable";
47+ commitHash = "970459615f6b2b4151742ec6d7ef8559f87fd5c5";
4849 src = fetchFromGitHub {
50 owner = "godotengine";
51 repo = "godot";
52+ rev = commitHash;
53 hash = "sha256-v9qKrPYQz4c+xkSu/2ru7ZE5EzKVyXhmrxyHZQkng2U=";
54 };
55···8788 enableParallelBuilding = true;
8990+ # Set the build name which is part of the version. In official downloads, this
91+ # is set to 'official'. When not specified explicitly, it is set to
92+ # 'custom_build'. Other platforms packaging Godot (Gentoo, Arch, Flatpack
93+ # etc.) usually set this to their name as well.
94+ #
95+ # See also 'methods.py' in the Godot repo and 'build' in
96+ # https://docs.godotengine.org/en/stable/classes/class_engine.html#class-engine-method-get-version-info
97+ BUILD_NAME = "nixpkgs";
98+99+ # Required for the commit hash to be included in the version number.
100+ #
101+ # `methods.py` reads the commit hash from `.git/HEAD` and manually follows
102+ # refs. Since we just write the hash directly, there is no need to emulate any
103+ # other parts of the .git directory.
104+ #
105+ # See also 'hash' in
106+ # https://docs.godotengine.org/en/stable/classes/class_engine.html#class-engine-method-get-version-info
107 preConfigure = ''
108+ mkdir -p .git
109+ echo ${commitHash} > .git/HEAD
00110 '';
111+112+ sconsFlags = mkSconsFlagsFromAttrSet {
113+ # Options from 'SConstruct'
114+ production = true; # Set defaults to build Godot for use in production
115+ platform = withPlatform;
116+ target = withTarget;
117+ precision = withPrecision; # Floating-point precision level
118+119+ # Options from 'platform/linuxbsd/detect.py'
120+ pulseaudio = withPulseaudio; # Use PulseAudio
121+ dbus = withDbus; # Use D-Bus to handle screensaver and portal desktop settings
122+ speechd = withSpeechd; # Use Speech Dispatcher for Text-to-Speech support
123+ fontconfig = withFontconfig; # Use fontconfig for system fonts support
124+ udev = withUdev; # Use udev for gamepad connection callbacks
125+ touch = withTouch; # Enable touch events
126+ };
127128 outputs = [ "out" "man" ];
129
+2-2
pkgs/os-specific/linux/kernel/linux-5.15.nix
···3with lib;
45buildLinux (args // rec {
6- version = "5.15.120";
78 # modDirVersion needs to be x.y.z, will automatically add .0 if needed
9 modDirVersion = versions.pad 3 version;
···1314 src = fetchurl {
15 url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz";
16- sha256 = "1xl3nrykbxdwv5a9rk0xnb7l61dsyjvkm1ryrdii09vbmsg0i6b4";
17 };
18} // (args.argsOverride or { }))
···3with lib;
45buildLinux (args // rec {
6+ version = "5.15.121";
78 # modDirVersion needs to be x.y.z, will automatically add .0 if needed
9 modDirVersion = versions.pad 3 version;
···1314 src = fetchurl {
15 url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz";
16+ sha256 = "07f3a68r1yb4p19z1azjwp2vhjb3ayh31hz9hfb4a98dn2ywxq07";
17 };
18} // (args.argsOverride or { }))
+2-2
pkgs/os-specific/linux/kernel/linux-6.1.nix
···3with lib;
45buildLinux (args // rec {
6- version = "6.1.39";
78 # modDirVersion needs to be x.y.z, will automatically add .0 if needed
9 modDirVersion = versions.pad 3 version;
···1314 src = fetchurl {
15 url = "mirror://kernel/linux/kernel/v6.x/linux-${version}.tar.xz";
16- sha256 = "1f45j3ch1ljbacjlg8q45iva9lvwys938rdg0s516mznzlifxpac";
17 };
18} // (args.argsOverride or { }))
···3with lib;
45buildLinux (args // rec {
6+ version = "6.1.40";
78 # modDirVersion needs to be x.y.z, will automatically add .0 if needed
9 modDirVersion = versions.pad 3 version;
···1314 src = fetchurl {
15 url = "mirror://kernel/linux/kernel/v6.x/linux-${version}.tar.xz";
16+ sha256 = "1w474pia4pxz4qbfai27ary1y1h2fnn7kvx7yz7wszd0jwhzrsj3";
17 };
18} // (args.argsOverride or { }))
+2-2
pkgs/os-specific/linux/kernel/linux-6.4.nix
···3with lib;
45buildLinux (args // rec {
6- version = "6.4.4";
78 # modDirVersion needs to be x.y.z, will automatically add .0 if needed
9 modDirVersion = versions.pad 3 version;
···1314 src = fetchurl {
15 url = "mirror://kernel/linux/kernel/v6.x/linux-${version}.tar.xz";
16- sha256 = "0apzfnn04w6jda9yw5cbgj8784frvqrryb1iw5ad390lwwmlmg4w";
17 };
18} // (args.argsOverride or { }))
···3with lib;
45buildLinux (args // rec {
6+ version = "6.4.5";
78 # modDirVersion needs to be x.y.z, will automatically add .0 if needed
9 modDirVersion = versions.pad 3 version;
···1314 src = fetchurl {
15 url = "mirror://kernel/linux/kernel/v6.x/linux-${version}.tar.xz";
16+ sha256 = "1dz9inr1bf7jx5s9n0dfa0srfzrwnz1zmdq42bbxyl9w8q3jqkip";
17 };
18} // (args.argsOverride or { }))
···1+--- a/tests/test_helper.py
2++++ b/tests/test_helper.py
3+@@ -269,9 +269,9 @@
4+ print("subprocess:", " ".join(cmd)) # very useful on failure
5+ env = {
6+ # We may need to find nanoemoji and other pip-installed cli tools
7+- "PATH": str(Path(shutil.which("nanoemoji")).parent),
8++ "PATH": str(Path(shutil.which("nanoemoji")).parent) + ":" + os.environ["PATH"],
9+ # We may need to find test modules
10+- "PYTHONPATH": os.pathsep.join((str(Path(__file__).parent),)),
11++ "PYTHONPATH": os.pathsep.join((str(Path(__file__).parent),)) + ":" + os.environ["PYTHONPATH"],
12+ }
13+ # Needed for windows CI to function; ref https://github.com/appveyor/ci/issues/1995
14+ if "SYSTEMROOT" in os.environ: