diff --git a/.github/workflows/periodic-merge-24h.yml b/.github/workflows/periodic-merge-24h.yml
index e8ec13496025..44892f926eb7 100644
--- a/.github/workflows/periodic-merge-24h.yml
+++ b/.github/workflows/periodic-merge-24h.yml
@@ -34,6 +34,10 @@ jobs:
pairs:
- from: master
into: haskell-updates
+ - from: release-22.11
+ into: staging-next-22.11
+ - from: staging-next-22.11
+ into: staging-22.11
- from: release-22.05
into: staging-next-22.05
- from: staging-next-22.05
diff --git a/.version b/.version
index f07cdfac44f1..f8c860969712 100644
--- a/.version
+++ b/.version
@@ -1 +1 @@
-22.11
\ No newline at end of file
+23.05
diff --git a/doc/builders/fetchers.chapter.md b/doc/builders/fetchers.chapter.md
index 12d8a5d887fd..43aead0ad5e4 100644
--- a/doc/builders/fetchers.chapter.md
+++ b/doc/builders/fetchers.chapter.md
@@ -100,10 +100,10 @@ stdenv.mkDerivation {
name = "hello";
src = fetchgit {
url = "https://...";
- sparseCheckout = ''
- directory/to/be/included
- another/directory
- '';
+ sparseCheckout = [
+ "directory/to/be/included"
+ "another/directory"
+ ];
sha256 = "0000000000000000000000000000000000000000000000000000";
};
}
diff --git a/doc/builders/testers.chapter.md b/doc/builders/testers.chapter.md
index ad1e1036d508..58bb06f23137 100644
--- a/doc/builders/testers.chapter.md
+++ b/doc/builders/testers.chapter.md
@@ -35,6 +35,70 @@ passthru.tests.version = testers.testVersion {
};
```
+## `testBuildFailure` {#tester-testBuildFailure}
+
+Make sure that a build does not succeed. This is useful for testing testers.
+
+This returns a derivation with an override on the builder, with the following effects:
+
+ - Fail the build when the original builder succeeds
+ - Move `$out` to `$out/result`, if it exists (assuming `out` is the default output)
+ - Save the build log to `$out/testBuildFailure.log` (same)
+
+Example:
+
+```nix
+runCommand "example" {
+ failed = testers.testBuildFailure (runCommand "fail" {} ''
+ echo ok-ish >$out
+ echo failing though
+ exit 3
+ '');
+} ''
+ grep -F 'ok-ish' $failed/result
+ grep -F 'failing though' $failed/testBuildFailure.log
+ [[ 3 = $(cat $failed/testBuildFailure.exit) ]]
+ touch $out
+'';
+```
+
+While `testBuildFailure` is designed to keep changes to the original builder's
+environment to a minimum, some small changes are inevitable.
+
+ - The file `$TMPDIR/testBuildFailure.log` is present. It should not be deleted.
+ - `stdout` and `stderr` are a pipe instead of a tty. This could be improved.
+ - One or two extra processes are present in the sandbox during the original
+ builder's execution.
+ - The derivation and output hashes are different, but not unusual.
+ - The derivation includes a dependency on `buildPackages.bash` and
+ `expect-failure.sh`, which is built to include a transitive dependency on
+ `buildPackages.coreutils` and possibly more. These are not added to `PATH`
+ or any other environment variable, so they should be hard to observe.
+
+## `testEqualContents` {#tester-equalContents}
+
+Check that two paths have the same contents.
+
+Example:
+
+```nix
+testers.testEqualContents {
+ assertion = "sed -e performs replacement";
+ expected = writeText "expected" ''
+ foo baz baz
+ '';
+ actual = runCommand "actual" {
+ # not really necessary for a package that's in stdenv
+ nativeBuildInputs = [ gnused ];
+ base = writeText "base" ''
+ foo bar baz
+ '';
+ } ''
+ sed -e 's/bar/baz/g' $base >$out
+ '';
+}
+```
+
## `testEqualDerivation` {#tester-testEqualDerivation}
Checks that two packages produce the exact same build instructions.
diff --git a/doc/languages-frameworks/javascript.section.md b/doc/languages-frameworks/javascript.section.md
index 490daf991588..fa10747dacc4 100644
--- a/doc/languages-frameworks/javascript.section.md
+++ b/doc/languages-frameworks/javascript.section.md
@@ -196,7 +196,7 @@ buildNpmPackage rec {
* `makeCacheWritable`: Whether to make the cache writable prior to installing dependencies. Don't set this unless npm tries to write to the cache directory, as it can slow down the build.
* `npmBuildScript`: The script to run to build the project. Defaults to `"build"`.
* `npmFlags`: Flags to pass to all npm commands.
-* `npmInstallFlags`: Flags to pass to `npm ci`.
+* `npmInstallFlags`: Flags to pass to `npm ci` and `npm prune`.
* `npmBuildFlags`: Flags to pass to `npm run ${npmBuildScript}`.
* `npmPackFlags`: Flags to pass to `npm pack`.
diff --git a/doc/languages-frameworks/rust.section.md b/doc/languages-frameworks/rust.section.md
index 849c836b03fc..48890cf53efa 100644
--- a/doc/languages-frameworks/rust.section.md
+++ b/doc/languages-frameworks/rust.section.md
@@ -15,7 +15,7 @@ For other versions such as daily builds (beta and nightly),
use either `rustup` from nixpkgs (which will manage the rust installation in your home directory),
or use a community maintained [Rust overlay](#using-community-rust-overlays).
-## Compiling Rust applications with Cargo {#compiling-rust-applications-with-cargo}
+## `buildRustPackage`: Compiling Rust applications with Cargo {#compiling-rust-applications-with-cargo}
Rust applications are packaged by using the `buildRustPackage` helper from `rustPlatform`:
@@ -608,7 +608,7 @@ buildPythonPackage rec {
}
```
-## Compiling Rust crates using Nix instead of Cargo {#compiling-rust-crates-using-nix-instead-of-cargo}
+## `buildRustCrate`: Compiling Rust crates using Nix instead of Cargo {#compiling-rust-crates-using-nix-instead-of-cargo}
### Simple operation {#simple-operation}
diff --git a/lib/attrsets.nix b/lib/attrsets.nix
index de88763854d6..8b5c0ef4cea6 100644
--- a/lib/attrsets.nix
+++ b/lib/attrsets.nix
@@ -3,7 +3,7 @@
let
inherit (builtins) head tail length;
- inherit (lib.trivial) id;
+ inherit (lib.trivial) flip id mergeAttrs pipe;
inherit (lib.strings) concatStringsSep concatMapStringsSep escapeNixIdentifier sanitizeDerivationName;
inherit (lib.lists) foldr foldl' concatMap concatLists elemAt all partition groupBy take foldl;
in
@@ -77,6 +77,25 @@ rec {
let errorMsg = "cannot find attribute `" + concatStringsSep "." attrPath + "'";
in attrByPath attrPath (abort errorMsg);
+ /* Map each attribute in the given set and merge them into a new attribute set.
+
+ Type:
+ concatMapAttrs ::
+ (String -> a -> AttrSet)
+ -> AttrSet
+ -> AttrSet
+
+ Example:
+ concatMapAttrs
+ (name: value: {
+ ${name} = value;
+ ${name + value} = value;
+ })
+ { x = "a"; y = "b"; }
+ => { x = "a"; xa = "a"; y = "b"; yb = "b"; }
+ */
+ concatMapAttrs = f: flip pipe [ (mapAttrs f) attrValues (foldl' mergeAttrs { }) ];
+
/* Update or set specific paths of an attribute set.
@@ -606,7 +625,7 @@ rec {
getMan = getOutput "man";
/* Pick the outputs of packages to place in buildInputs */
- chooseDevOutputs = drvs: builtins.map getDev drvs;
+ chooseDevOutputs = builtins.map getDev;
/* Make various Nix tools consider the contents of the resulting
attribute set when looking for what to build, find, etc.
diff --git a/lib/default.nix b/lib/default.nix
index 8bb06954518b..cc4bedc5869b 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -78,7 +78,7 @@ let
inherit (self.attrsets) attrByPath hasAttrByPath setAttrByPath
getAttrFromPath attrVals attrValues getAttrs catAttrs filterAttrs
filterAttrsRecursive foldAttrs collect nameValuePair mapAttrs
- mapAttrs' mapAttrsToList mapAttrsRecursive mapAttrsRecursiveCond
+ mapAttrs' mapAttrsToList concatMapAttrs mapAttrsRecursive mapAttrsRecursiveCond
genAttrs isDerivation toDerivation optionalAttrs
zipAttrsWithNames zipAttrsWith zipAttrs recursiveUpdateUntil
recursiveUpdate matchAttrs overrideExisting showAttrPath getOutput getBin
diff --git a/lib/systems/platforms.nix b/lib/systems/platforms.nix
index 41c25484cea0..d574943e47df 100644
--- a/lib/systems/platforms.nix
+++ b/lib/systems/platforms.nix
@@ -557,7 +557,7 @@ rec {
else if platform.isRiscV then riscv-multiplatform
- else if platform.parsed.cpu == lib.systems.parse.cpuTypes.mipsel then fuloong2f_n32
+ else if platform.parsed.cpu == lib.systems.parse.cpuTypes.mipsel then (import ./examples.nix { inherit lib; }).mipsel-linux-gnu
else if platform.parsed.cpu == lib.systems.parse.cpuTypes.powerpc64le then powernv
diff --git a/lib/tests/misc.nix b/lib/tests/misc.nix
index 31c938a8ffda..b73da4f1010d 100644
--- a/lib/tests/misc.nix
+++ b/lib/tests/misc.nix
@@ -478,6 +478,23 @@ runTests {
# ATTRSETS
+ testConcatMapAttrs = {
+ expr = concatMapAttrs
+ (name: value: {
+ ${name} = value;
+ ${name + value} = value;
+ })
+ {
+ foo = "bar";
+ foobar = "baz";
+ };
+ expected = {
+ foo = "bar";
+ foobar = "baz";
+ foobarbaz = "baz";
+ };
+ };
+
# code from the example
testRecursiveUpdateUntil = {
expr = recursiveUpdateUntil (path: l: r: path == ["foo"]) {
diff --git a/lib/trivial.nix b/lib/trivial.nix
index 142ed32c9e5a..70bc53016456 100644
--- a/lib/trivial.nix
+++ b/lib/trivial.nix
@@ -195,7 +195,7 @@ rec {
On each release the first letter is bumped and a new animal is chosen
starting with that new letter.
*/
- codeName = "Raccoon";
+ codeName = "Stoat";
/* Returns the current nixpkgs version suffix as string. */
versionSuffix =
diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix
index 33d6bcd382f3..ee2014d6525b 100644
--- a/maintainers/maintainer-list.nix
+++ b/maintainers/maintainer-list.nix
@@ -1285,6 +1285,15 @@
fingerprint = "DD52 6BC7 767D BA28 16C0 95E5 6840 89CE 67EB B691";
}];
};
+ ataraxiasjel = {
+ email = "nix@ataraxiadev.com";
+ github = "AtaraxiaSjel";
+ githubId = 5314145;
+ name = "Dmitriy";
+ keys = [{
+ fingerprint = "922D A6E7 58A0 FE4C FAB4 E4B2 FD26 6B81 0DF4 8DF2";
+ }];
+ };
atemu = {
name = "Atemu";
email = "atemu.main+nixpkgs@gmail.com";
@@ -4820,6 +4829,12 @@
githubId = 868283;
name = "Fatih Altinok";
};
+ fstamour = {
+ email = "fr.st-amour@gmail.com";
+ github = "fstamour";
+ githubId = 2881922;
+ name = "Francis St-Amour";
+ };
ftrvxmtrx = {
email = "ftrvxmtrx@gmail.com";
github = "ftrvxmtrx";
@@ -4949,6 +4964,13 @@
githubId = 37017396;
name = "gbtb";
};
+ gdamjan = {
+ email = "gdamjan@gmail.com";
+ matrix = "@gdamjan:spodeli.org";
+ github = "gdamjan";
+ githubId = 81654;
+ name = "Damjan Georgievski";
+ };
gdinh = {
email = "nix@contact.dinh.ai";
github = "gdinh";
@@ -9419,12 +9441,6 @@
githubId = 2072185;
name = "Marc Scholten";
};
- mpsyco = {
- email = "fr.st-amour@gmail.com";
- github = "fstamour";
- githubId = 2881922;
- name = "Francis St-Amour";
- };
mtrsk = {
email = "marcos.schonfinkel@protonmail.com";
github = "mtrsk";
@@ -14271,6 +14287,12 @@
githubId = 32751441;
name = "urlordjames";
};
+ ursi = {
+ email = "masondeanm@aol.com";
+ github = "ursi";
+ githubId = 17836748;
+ name = "Mason Mackaman";
+ };
uskudnik = {
email = "urban.skudnik@gmail.com";
github = "uskudnik";
@@ -15893,4 +15915,10 @@
github = "wuyoli";
githubId = 104238274;
};
+ jordanisaacs = {
+ name = "Jordan Isaacs";
+ email = "nix@jdisaacs.com";
+ github = "jordanisaacs";
+ githubId = 19742638;
+ };
}
diff --git a/nixos/doc/manual/from_md/release-notes/rl-2211.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2211.section.xml
index 8e97e58f81a6..763010ae82a3 100644
--- a/nixos/doc/manual/from_md/release-notes/rl-2211.section.xml
+++ b/nixos/doc/manual/from_md/release-notes/rl-2211.section.xml
@@ -278,6 +278,16 @@
services.prometheus.sachet.
+
+
+ EVCC is an EV charge
+ controller with PV integration. It supports a multitude of
+ chargers, meters, vehicle APIs and more and ties that together
+ with a well-tested backend and a lightweight web frontend.
+ Available as
+ services.evcc.
+
+
infnoise,
@@ -580,6 +590,15 @@
future Git update without notice.
+
+
+ The fetchgit fetcher supports sparse
+ checkouts via the sparseCheckout option.
+ This used to accept a multi-line string with
+ directories/patterns to check out, but now requires a list of
+ strings.
+
+
openssh was updated to version 9.1,
@@ -1392,6 +1411,26 @@ services.github-runner.serviceOverrides.SupplementaryGroups = [
if you intend to add packages to /bin.
+
+
+ The proxmox.qemuConf.bios option was added,
+ it corresponds to Hardware->BIOS field
+ in Proxmox web interface. Use
+ "ovmf" value to build UEFI image,
+ default value remains "bios". New
+ option proxmox.partitionTableType defaults
+ to either "legacy" or
+ "efi", depending on the
+ bios value. Setting
+ partitionTableType to
+ "hybrid" results in an image,
+ which supports both methods
+ ("bios" and
+ "ovmf"), thereby remaining
+ bootable after change to Proxmox
+ Hardware->BIOS field.
+
+
memtest86+ was updated from 5.00-coreboot-002 to 6.00-beta2.
diff --git a/nixos/doc/manual/from_md/release-notes/rl-2305.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2305.section.xml
new file mode 100644
index 000000000000..51dafd38c1ac
--- /dev/null
+++ b/nixos/doc/manual/from_md/release-notes/rl-2305.section.xml
@@ -0,0 +1,51 @@
+
+ Release 23.05 (“Stoat”, 2023.05/??)
+
+ Support is planned until the end of December 2023, handing over to
+ 23.11.
+
+
+ Highlights
+
+ In addition to numerous new and upgraded packages, this release
+ has the following highlights:
+
+
+
+
+ Create the first release note entry in this section!
+
+
+
+
+
+ New Services
+
+
+
+ Create the first release note entry in this section!
+
+
+
+
+
+ Backward Incompatibilities
+
+
+
+ Create the first release note entry in this section!
+
+
+
+
+
+ Other Notable Changes
+
+
+
+ Create the first release note entry in this section!
+
+
+
+
+
diff --git a/nixos/doc/manual/release-notes/release-notes.xml b/nixos/doc/manual/release-notes/release-notes.xml
index ee5009faf6f4..bb5cc677afb8 100644
--- a/nixos/doc/manual/release-notes/release-notes.xml
+++ b/nixos/doc/manual/release-notes/release-notes.xml
@@ -8,6 +8,7 @@
This section lists the release notes for each stable version of NixOS and
current unstable revision.
+
diff --git a/nixos/doc/manual/release-notes/rl-2211.section.md b/nixos/doc/manual/release-notes/rl-2211.section.md
index ecfba7215c8b..b8aa0cc09fa9 100644
--- a/nixos/doc/manual/release-notes/rl-2211.section.md
+++ b/nixos/doc/manual/release-notes/rl-2211.section.md
@@ -98,6 +98,8 @@ In addition to numerous new and upgraded packages, this release has the followin
- [Sachet](https://github.com/messagebird/sachet/), an SMS alerting tool for the Prometheus Alertmanager. Available as [services.prometheus.sachet](#opt-services.prometheus.sachet.enable).
+- [EVCC](https://evcc.io) is an EV charge controller with PV integration. It supports a multitude of chargers, meters, vehicle APIs and more and ties that together with a well-tested backend and a lightweight web frontend. Available as [services.evcc](#opt-services.evcc.enable).
+
- [infnoise](https://github.com/leetronics/infnoise), a hardware True Random Number Generator dongle.
Available as [services.infnoise](options.html#opt-services.infnoise.enable).
@@ -191,6 +193,8 @@ Available as [services.patroni](options.html#opt-services.patroni.enable).
- The `fetchgit` fetcher now uses [cone mode](https://www.git-scm.com/docs/git-sparse-checkout/2.37.0#_internalscone_mode_handling) by default for sparse checkouts. [Non-cone mode](https://www.git-scm.com/docs/git-sparse-checkout/2.37.0#_internalsnon_cone_problems) can be enabled by passing `nonConeMode = true`, but note that non-cone mode is deprecated and this option may be removed alongside a future Git update without notice.
+- The `fetchgit` fetcher supports sparse checkouts via the `sparseCheckout` option. This used to accept a multi-line string with directories/patterns to check out, but now requires a list of strings.
+
- `openssh` was updated to version 9.1, disabling the generation of DSA keys when using `ssh-keygen -A` as they are insecure. Also, `SetEnv` directives in `ssh_config` and `sshd_config` are now first-match-wins
- `bsp-layout` no longer uses the command `cycle` to switch to other window layouts, as it got replaced by the commands `previous` and `next`.
@@ -451,6 +455,8 @@ Available as [services.patroni](options.html#opt-services.patroni.enable).
- `dockerTools.buildImage` deprecates the misunderstood `contents` parameter, in favor of `copyToRoot`.
Use `copyToRoot = buildEnv { ... };` or similar if you intend to add packages to `/bin`.
+- The `proxmox.qemuConf.bios` option was added, it corresponds to `Hardware->BIOS` field in Proxmox web interface. Use `"ovmf"` value to build UEFI image, default value remains `"bios"`. New option `proxmox.partitionTableType` defaults to either `"legacy"` or `"efi"`, depending on the `bios` value. Setting `partitionTableType` to `"hybrid"` results in an image, which supports both methods (`"bios"` and `"ovmf"`), thereby remaining bootable after change to Proxmox `Hardware->BIOS` field.
+
- memtest86+ was updated from 5.00-coreboot-002 to 6.00-beta2. It is now the upstream version from https://www.memtest.org/, as coreboot's fork is no longer available.
- Option descriptions, examples, and defaults writting in DocBook are now deprecated. Using CommonMark is preferred and will become the default in a future release.
diff --git a/nixos/doc/manual/release-notes/rl-2305.section.md b/nixos/doc/manual/release-notes/rl-2305.section.md
new file mode 100644
index 000000000000..5bc6c8614895
--- /dev/null
+++ b/nixos/doc/manual/release-notes/rl-2305.section.md
@@ -0,0 +1,29 @@
+# Release 23.05 (“Stoat”, 2023.05/??) {#sec-release-23.05}
+
+Support is planned until the end of December 2023, handing over to 23.11.
+
+## Highlights {#sec-release-23.05-highlights}
+
+In addition to numerous new and upgraded packages, this release has the following highlights:
+
+
+
+- Create the first release note entry in this section!
+
+## New Services {#sec-release-23.05-new-services}
+
+
+
+- Create the first release note entry in this section!
+
+## Backward Incompatibilities {#sec-release-23.05-incompatibilities}
+
+
+
+- Create the first release note entry in this section!
+
+## Other Notable Changes {#sec-release-23.05-notable-changes}
+
+
+
+- Create the first release note entry in this section!
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 2a23a32eaba6..bc5f6f1d76cd 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -491,6 +491,7 @@
./services/hardware/vdr.nix
./services/home-automation/home-assistant.nix
./services/home-automation/zigbee2mqtt.nix
+ ./services/home-automation/evcc.nix
./services/logging/SystemdJournal2Gelf.nix
./services/logging/awstats.nix
./services/logging/filebeat.nix
diff --git a/nixos/modules/services/databases/redis.nix b/nixos/modules/services/databases/redis.nix
index 1f143f9c66f6..95c0afb8f835 100644
--- a/nixos/modules/services/databases/redis.nix
+++ b/nixos/modules/services/databases/redis.nix
@@ -361,8 +361,10 @@ in {
fi
echo 'include "${redisConfStore}"' > "${redisConfRun}"
${optionalString (conf.requirePassFile != null) ''
- {echo -n "requirepass "
- cat ${escapeShellArg conf.requirePassFile}} >> "${redisConfRun}"
+ {
+ echo -n "requirepass "
+ cat ${escapeShellArg conf.requirePassFile}
+ } >> "${redisConfRun}"
''}
'');
Type = "notify";
diff --git a/nixos/modules/services/hardware/udev.nix b/nixos/modules/services/hardware/udev.nix
index 7a7f8330243a..d95261332419 100644
--- a/nixos/modules/services/hardware/udev.nix
+++ b/nixos/modules/services/hardware/udev.nix
@@ -46,6 +46,11 @@ let
SUBSYSTEM=="input", KERNEL=="mice", TAG+="systemd"
'';
+ nixosInitrdRules = ''
+ # Mark dm devices as db_persist so that they are kept active after switching root
+ SUBSYSTEM=="block", KERNEL=="dm-[0-9]*", ACTION=="add|change", OPTIONS+="db_persist"
+ '';
+
# Perform substitutions in all udev rules files.
udevRulesFor = { name, udevPackages, udevPath, udev, systemd, binPackages, initrdBin ? null }: pkgs.runCommand name
{ preferLocalBuild = true;
@@ -364,8 +369,10 @@ in
EOF
'';
+ boot.initrd.services.udev.rules = nixosInitrdRules;
+
boot.initrd.systemd.additionalUpstreamUnits = [
- # TODO: "initrd-udevadm-cleanup-db.service" is commented out because of https://github.com/systemd/systemd/issues/12953
+ "initrd-udevadm-cleanup-db.service"
"systemd-udevd-control.socket"
"systemd-udevd-kernel.socket"
"systemd-udevd.service"
diff --git a/nixos/modules/services/home-automation/evcc.nix b/nixos/modules/services/home-automation/evcc.nix
new file mode 100644
index 000000000000..c12ba9d0c1e2
--- /dev/null
+++ b/nixos/modules/services/home-automation/evcc.nix
@@ -0,0 +1,92 @@
+{ lib
+, pkgs
+, config
+, ...
+}:
+
+with lib;
+
+let
+ cfg = config.services.evcc;
+
+ format = pkgs.formats.yaml {};
+ configFile = format.generate "evcc.yml" cfg.settings;
+
+ package = pkgs.evcc;
+in
+
+{
+ meta.maintainers = with lib.maintainers; [ hexa ];
+
+ options.services.evcc = with types; {
+ enable = mkEnableOption (lib.mdDoc "EVCC, the extensible EV Charge Controller with PV integration");
+
+ extraArgs = mkOption {
+ type = listOf str;
+ default = [];
+ description = lib.mdDoc ''
+ Extra arguments to pass to the evcc executable.
+ '';
+ };
+
+ settings = mkOption {
+ type = format.type;
+ description = lib.mdDoc ''
+ evcc configuration as a Nix attribute set.
+
+ Check for possible options in the sample [evcc.dist.yaml](https://github.com/andig/evcc/blob/${package.version}/evcc.dist.yaml].
+ '';
+ };
+ };
+
+ config = mkIf cfg.enable {
+ systemd.services.evcc = {
+ after = [
+ "network-online.target"
+ "mosquitto.target"
+ ];
+ wantedBy = [
+ "multi-user.target"
+ ];
+
+ serviceConfig = {
+ ExecStart = "${package}/bin/evcc --config ${configFile} ${escapeShellArgs cfg.extraArgs}";
+ CapabilityBoundingSet = [ "" ];
+ DeviceAllow = [
+ "char-ttyUSB"
+ ];
+ DevicePolicy = "closed";
+ DynamicUser = true;
+ LockPersonality = true;
+ MemoryDenyWriteExecute = true;
+ RestrictAddressFamilies = [
+ "AF_INET"
+ "AF_INET6"
+ "AF_UNIX"
+ ];
+ RestrictNamespaces = true;
+ RestrictRealtime = true;
+ PrivateTmp = true;
+ PrivateUsers = true;
+ ProcSubset = "pid";
+ ProtectClock = true;
+ ProtectControlGroups= true;
+ ProtectHome = true;
+ ProtectHostname = true;
+ ProtectKernelLogs = true;
+ ProtectKernelModules = true;
+ ProtectKernelTunables = true;
+ ProtectProc = "invisible";
+ SystemCallArchitectures = "native";
+ SystemCallFilter = [
+ "@system-service"
+ "~@privileged"
+ ];
+ UMask = "0077";
+ User = "evcc";
+ };
+ };
+ };
+
+ meta.buildDocsInSandbox = false;
+}
diff --git a/nixos/modules/services/matrix/mautrix-telegram.nix b/nixos/modules/services/matrix/mautrix-telegram.nix
index fc8b95051ddb..2d9c2dc76c29 100644
--- a/nixos/modules/services/matrix/mautrix-telegram.nix
+++ b/nixos/modules/services/matrix/mautrix-telegram.nix
@@ -7,8 +7,8 @@ let
registrationFile = "${dataDir}/telegram-registration.yaml";
cfg = config.services.mautrix-telegram;
settingsFormat = pkgs.formats.json {};
- settingsFileUnsubstituted = settingsFormat.generate "mautrix-telegram-config-unsubstituted.json" cfg.settings;
- settingsFile = "${dataDir}/config.json";
+ settingsFile =
+ settingsFormat.generate "mautrix-telegram-config.json" cfg.settings;
in {
options = {
@@ -97,12 +97,23 @@ in {
default = null;
description = lib.mdDoc ''
File containing environment variables to be passed to the mautrix-telegram service,
- in which secret tokens can be specified securely by defining values for
+ in which secret tokens can be specified securely by defining values for e.g.
`MAUTRIX_TELEGRAM_APPSERVICE_AS_TOKEN`,
`MAUTRIX_TELEGRAM_APPSERVICE_HS_TOKEN`,
`MAUTRIX_TELEGRAM_TELEGRAM_API_ID`,
`MAUTRIX_TELEGRAM_TELEGRAM_API_HASH` and optionally
`MAUTRIX_TELEGRAM_TELEGRAM_BOT_TOKEN`.
+
+ These environment variables can also be used to set other options by
+ replacing hierachy levels by `.`, converting the name to uppercase
+ and prepending `MAUTRIX_TELEGRAM_`.
+ For example, the first value above maps to
+ {option}`settings.appservice.as_token`.
+
+ The environment variable values can be prefixed with `json::` to have
+ them be parsed as JSON. For example, `login_shared_secret_map` can be
+ set as follows:
+ `MAUTRIX_TELEGRAM_BRIDGE_LOGIN_SHARED_SECRET_MAP=json::{"example.com":"secret"}`.
'';
};
@@ -141,16 +152,6 @@ in {
environment.HOME = dataDir;
preStart = ''
- # Not all secrets can be passed as environment variable (yet)
- # https://github.com/tulir/mautrix-telegram/issues/584
- [ -f ${settingsFile} ] && rm -f ${settingsFile}
- old_umask=$(umask)
- umask 0177
- ${pkgs.envsubst}/bin/envsubst \
- -o ${settingsFile} \
- -i ${settingsFileUnsubstituted}
- umask $old_umask
-
# generate the appservice's registration file if absent
if [ ! -f '${registrationFile}' ]; then
${pkgs.mautrix-telegram}/bin/mautrix-telegram \
@@ -186,8 +187,6 @@ in {
--config='${settingsFile}'
'';
};
-
- restartTriggers = [ settingsFileUnsubstituted ];
};
};
diff --git a/nixos/modules/services/security/vaultwarden/default.nix b/nixos/modules/services/security/vaultwarden/default.nix
index 81423e57fd2c..3ef0bfb090ac 100644
--- a/nixos/modules/services/security/vaultwarden/default.nix
+++ b/nixos/modules/services/security/vaultwarden/default.nix
@@ -22,9 +22,9 @@ let
# we can only check for values consistently after converting them to their corresponding environment variable name.
configEnv =
let
- configEnv = listToAttrs (concatLists (mapAttrsToList (name: value:
- if value != null then [ (nameValuePair (nameToEnvVar name) (if isBool value then boolToString value else toString value)) ] else []
- ) cfg.config));
+ configEnv = concatMapAttrs (name: value: optionalAttrs (value != null) {
+ ${nameToEnvVar name} = if isBool value then boolToString value else toString value;
+ }) cfg.config;
in { DATA_FOLDER = "/var/lib/bitwarden_rs"; } // optionalAttrs (!(configEnv ? WEB_VAULT_ENABLED) || configEnv.WEB_VAULT_ENABLED == "true") {
WEB_VAULT_FOLDER = "${cfg.webVaultPackage}/share/vaultwarden/vault";
} // configEnv;
diff --git a/nixos/modules/services/system/dbus.nix b/nixos/modules/services/system/dbus.nix
index c0de00bb914c..b87e48f2945d 100644
--- a/nixos/modules/services/system/dbus.nix
+++ b/nixos/modules/services/system/dbus.nix
@@ -1,8 +1,6 @@
# D-Bus configuration and system bus daemon.
-{ config, lib, options, pkgs, ... }:
-
-with lib;
+{ config, lib, pkgs, ... }:
let
@@ -16,11 +14,11 @@ let
serviceDirectories = cfg.packages;
};
+ inherit (lib) mkOption types;
+
in
{
- ###### interface
-
options = {
services.dbus = {
@@ -65,31 +63,13 @@ in
'';
default = "disabled";
};
-
- socketActivated = mkOption {
- type = types.nullOr types.bool;
- default = null;
- visible = false;
- description = lib.mdDoc ''
- Removed option, do not use.
- '';
- };
};
};
- ###### implementation
-
- config = mkIf cfg.enable {
- warnings = optional (cfg.socketActivated != null) (
- let
- files = showFiles options.services.dbus.socketActivated.files;
- in
- "The option 'services.dbus.socketActivated' in ${files} no longer has"
- + " any effect and can be safely removed: the user D-Bus session is"
- + " now always socket activated."
- );
-
- environment.systemPackages = [ pkgs.dbus.daemon pkgs.dbus ];
+ config = lib.mkIf cfg.enable {
+ environment.systemPackages = [
+ pkgs.dbus
+ ];
environment.etc."dbus-1".source = configDir;
@@ -102,10 +82,12 @@ in
users.groups.messagebus.gid = config.ids.gids.messagebus;
- systemd.packages = [ pkgs.dbus.daemon ];
+ systemd.packages = [
+ pkgs.dbus
+ ];
security.wrappers.dbus-daemon-launch-helper = {
- source = "${pkgs.dbus.daemon}/libexec/dbus-daemon-launch-helper";
+ source = "${pkgs.dbus}/libexec/dbus-daemon-launch-helper";
owner = "root";
group = "messagebus";
setuid = true;
@@ -114,26 +96,36 @@ in
};
services.dbus.packages = [
- pkgs.dbus.out
+ pkgs.dbus
config.system.path
];
systemd.services.dbus = {
# Don't restart dbus-daemon. Bad things tend to happen if we do.
reloadIfChanged = true;
- restartTriggers = [ configDir ];
- environment = { LD_LIBRARY_PATH = config.system.nssModules.path; };
- };
-
- systemd.user = {
- services.dbus = {
- # Don't restart dbus-daemon. Bad things tend to happen if we do.
- reloadIfChanged = true;
- restartTriggers = [ configDir ];
+ restartTriggers = [
+ configDir
+ ];
+ environment = {
+ LD_LIBRARY_PATH = config.system.nssModules.path;
};
- sockets.dbus.wantedBy = [ "sockets.target" ];
};
- environment.pathsToLink = [ "/etc/dbus-1" "/share/dbus-1" ];
+ systemd.user.services.dbus = {
+ # Don't restart dbus-daemon. Bad things tend to happen if we do.
+ reloadIfChanged = true;
+ restartTriggers = [
+ configDir
+ ];
+ };
+
+ systemd.user.sockets.dbus.wantedBy = [
+ "sockets.target"
+ ];
+
+ environment.pathsToLink = [
+ "/etc/dbus-1"
+ "/share/dbus-1"
+ ];
};
}
diff --git a/nixos/modules/services/web-apps/mastodon.nix b/nixos/modules/services/web-apps/mastodon.nix
index d159d2ade063..1e9e04dcc055 100644
--- a/nixos/modules/services/web-apps/mastodon.nix
+++ b/nixos/modules/services/web-apps/mastodon.nix
@@ -688,7 +688,7 @@ in {
inherit (cfg) group;
};
})
- (lib.attrsets.setAttrByPath [ cfg.user "packages" ] [ cfg.package mastodonEnv ])
+ (lib.attrsets.setAttrByPath [ cfg.user "packages" ] [ cfg.package mastodonEnv pkgs.imagemagick ])
];
users.groups.${cfg.group}.members = lib.optional cfg.configureNginx config.services.nginx.user;
diff --git a/nixos/modules/services/web-apps/outline.nix b/nixos/modules/services/web-apps/outline.nix
index 8a312d79584e..701930393f01 100644
--- a/nixos/modules/services/web-apps/outline.nix
+++ b/nixos/modules/services/web-apps/outline.nix
@@ -6,10 +6,10 @@ let
in
{
# See here for a reference of all the options:
- # https://github.com/outline/outline/blob/v0.65.2/.env.sample
- # https://github.com/outline/outline/blob/v0.65.2/app.json
- # https://github.com/outline/outline/blob/v0.65.2/server/env.ts
- # https://github.com/outline/outline/blob/v0.65.2/shared/types.ts
+ # https://github.com/outline/outline/blob/v0.67.0/.env.sample
+ # https://github.com/outline/outline/blob/v0.67.0/app.json
+ # https://github.com/outline/outline/blob/v0.67.0/server/env.ts
+ # https://github.com/outline/outline/blob/v0.67.0/shared/types.ts
# The order is kept the same here to make updating easier.
options.services.outline = {
enable = lib.mkEnableOption (lib.mdDoc "outline");
@@ -123,7 +123,7 @@ in
description = lib.mdDoc ''
To support uploading of images for avatars and document attachments an
s3-compatible storage must be provided. AWS S3 is recommended for
- redundency however if you want to keep all file storage local an
+ redundancy however if you want to keep all file storage local an
alternative such as [minio](https://github.com/minio/minio)
can be used.
@@ -435,6 +435,16 @@ in
'';
};
+ sentryTunnel = lib.mkOption {
+ type = lib.types.nullOr lib.types.str;
+ default = null;
+ description = lib.mdDoc ''
+ Optionally add a
+ [Sentry proxy tunnel](https://docs.sentry.io/platforms/javascript/troubleshooting/#using-the-tunnel-option)
+ for bypassing ad blockers in the UI.
+ '';
+ };
+
logo = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
@@ -621,6 +631,7 @@ in
DEBUG = cfg.debugOutput;
GOOGLE_ANALYTICS_ID = lib.optionalString (cfg.googleAnalyticsId != null) cfg.googleAnalyticsId;
SENTRY_DSN = lib.optionalString (cfg.sentryDsn != null) cfg.sentryDsn;
+ SENTRY_TUNNEL = lib.optionalString (cfg.sentryTunnel != null) cfg.sentryTunnel;
TEAM_LOGO = lib.optionalString (cfg.logo != null) cfg.logo;
DEFAULT_LANGUAGE = cfg.defaultLanguage;
diff --git a/nixos/modules/tasks/filesystems/ext.nix b/nixos/modules/tasks/filesystems/ext.nix
index 9b61f21643ab..edc0efc55213 100644
--- a/nixos/modules/tasks/filesystems/ext.nix
+++ b/nixos/modules/tasks/filesystems/ext.nix
@@ -3,13 +3,14 @@
let
inInitrd = lib.any (fs: fs == "ext2" || fs == "ext3" || fs == "ext4") config.boot.initrd.supportedFilesystems;
+ inSystem = lib.any (fs: fs == "ext2" || fs == "ext3" || fs == "ext4") config.boot.supportedFilesystems;
in
{
config = {
- system.fsPackages = lib.mkIf (config.boot.initrd.systemd.enable -> inInitrd) [ pkgs.e2fsprogs ];
+ system.fsPackages = lib.mkIf (config.boot.initrd.systemd.enable -> (inInitrd || inSystem)) [ pkgs.e2fsprogs ];
# As of kernel 4.3, there is no separate ext3 driver (they're also handled by ext4.ko)
boot.initrd.availableKernelModules = lib.mkIf (config.boot.initrd.systemd.enable -> inInitrd) [ "ext2" "ext4" ];
diff --git a/nixos/modules/virtualisation/proxmox-image.nix b/nixos/modules/virtualisation/proxmox-image.nix
index 4fca8ce9e7eb..42c52c12edf0 100644
--- a/nixos/modules/virtualisation/proxmox-image.nix
+++ b/nixos/modules/virtualisation/proxmox-image.nix
@@ -53,6 +53,13 @@ with lib;
Guest memory in MB
'';
};
+ bios = mkOption {
+ type = types.enum [ "seabios" "ovmf" ];
+ default = "seabios";
+ description = ''
+ Select BIOS implementation (seabios = Legacy BIOS, ovmf = UEFI).
+ '';
+ };
# optional configs
name = mkOption {
@@ -99,6 +106,17 @@ with lib;
Additional options appended to qemu-server.conf
'';
};
+ partitionTableType = mkOption {
+ type = types.enum [ "efi" "hybrid" "legacy" "legacy+gpt" ];
+ description = ''
+ Partition table type to use. See make-disk-image.nix partitionTableType for details.
+ Defaults to 'legacy' for 'proxmox.qemuConf.bios="seabios"' (default), other bios values defaults to 'efi'.
+ Use 'hybrid' to build grub-based hybrid bios+efi images.
+ '';
+ default = if config.proxmox.qemuConf.bios == "seabios" then "legacy" else "efi";
+ defaultText = lib.literalExpression ''if config.proxmox.qemuConf.bios == "seabios" then "legacy" else "efi"'';
+ example = "hybrid";
+ };
filenameSuffix = mkOption {
type = types.str;
default = config.proxmox.qemuConf.name;
@@ -122,9 +140,33 @@ with lib;
${lib.concatStrings (lib.mapAttrsToList cfgLine properties)}
#qmdump#map:virtio0:drive-virtio0:local-lvm:raw:
'';
+ inherit (cfg) partitionTableType;
+ supportEfi = partitionTableType == "efi" || partitionTableType == "hybrid";
+ supportBios = partitionTableType == "legacy" || partitionTableType == "hybrid" || partitionTableType == "legacy+gpt";
+ hasBootPartition = partitionTableType == "efi" || partitionTableType == "hybrid";
+ hasNoFsPartition = partitionTableType == "hybrid" || partitionTableType == "legacy+gpt";
in {
+ assertions = [
+ {
+ assertion = config.boot.loader.systemd-boot.enable -> config.proxmox.qemuConf.bios == "ovmf";
+ message = "systemd-boot requires 'ovmf' bios";
+ }
+ {
+ assertion = partitionTableType == "efi" -> config.proxmox.qemuConf.bios == "ovmf";
+ message = "'efi' disk partitioning requires 'ovmf' bios";
+ }
+ {
+ assertion = partitionTableType == "legacy" -> config.proxmox.qemuConf.bios == "seabios";
+ message = "'legacy' disk partitioning requires 'seabios' bios";
+ }
+ {
+ assertion = partitionTableType == "legacy+gpt" -> config.proxmox.qemuConf.bios == "seabios";
+ message = "'legacy+gpt' disk partitioning requires 'seabios' bios";
+ }
+ ];
system.build.VMA = import ../../lib/make-disk-image.nix {
name = "proxmox-${cfg.filenameSuffix}";
+ inherit partitionTableType;
postVM = let
# Build qemu with PVE's patch that adds support for the VMA format
vma = (pkgs.qemu_kvm.override {
@@ -181,7 +223,18 @@ with lib;
boot = {
growPartition = true;
kernelParams = [ "console=ttyS0" ];
- loader.grub.device = lib.mkDefault "/dev/vda";
+ loader.grub = {
+ device = lib.mkDefault (if (hasNoFsPartition || supportBios) then
+ # Even if there is a separate no-fs partition ("/dev/disk/by-partlabel/no-fs" i.e. "/dev/vda2"),
+ # which will be used the bootloader, do not set it as loader.grub.device.
+ # GRUB installation fails, unless the whole disk is selected.
+ "/dev/vda"
+ else
+ "nodev");
+ efiSupport = lib.mkDefault supportEfi;
+ efiInstallAsRemovable = lib.mkDefault supportEfi;
+ };
+
loader.timeout = 0;
initrd.availableKernelModules = [ "uas" "virtio_blk" "virtio_pci" ];
};
@@ -191,6 +244,10 @@ with lib;
autoResize = true;
fsType = "ext4";
};
+ fileSystems."/boot" = lib.mkIf hasBootPartition {
+ device = "/dev/disk/by-label/ESP";
+ fsType = "vfat";
+ };
services.qemuGuest.enable = lib.mkDefault true;
};
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index d3dc8b9ca08a..7b1006ba6015 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -198,6 +198,7 @@ in {
etebase-server = handleTest ./etebase-server.nix {};
etesync-dav = handleTest ./etesync-dav.nix {};
extra-python-packages = handleTest ./extra-python-packages.nix {};
+ evcc = handleTest ./evcc.nix {};
fancontrol = handleTest ./fancontrol.nix {};
fcitx = handleTest ./fcitx {};
fenics = handleTest ./fenics.nix {};
diff --git a/nixos/tests/evcc.nix b/nixos/tests/evcc.nix
new file mode 100644
index 000000000000..0fc261142f78
--- /dev/null
+++ b/nixos/tests/evcc.nix
@@ -0,0 +1,96 @@
+import ./make-test-python.nix ({ pkgs, lib, ...} :
+
+{
+ name = "evcc";
+ meta.maintainers = with lib.maintainers; [ hexa ];
+
+ nodes = {
+ machine = { config, ... }: {
+ services.evcc = {
+ enable = true;
+ settings = {
+ network = {
+ schema = "http";
+ host = "localhost";
+ port = 7070;
+ };
+
+ log = "info";
+
+ site = {
+ title = "NixOS Test";
+ meters = {
+ grid = "grid";
+ pv = "pv";
+ };
+ };
+
+ meters = [ {
+ type = "custom";
+ name = "grid";
+ power = {
+ source = "script";
+ cmd = "/bin/sh -c 'echo -4500'";
+ };
+ } {
+ type = "custom";
+ name = "pv";
+ power = {
+ source = "script";
+ cmd = "/bin/sh -c 'echo 7500'";
+ };
+ } ];
+
+ chargers = [ {
+ name = "dummy-charger";
+ type = "custom";
+ status = {
+ source = "script";
+ cmd = "/bin/sh -c 'echo charger status F'";
+ };
+ enabled = {
+ source = "script";
+ cmd = "/bin/sh -c 'echo charger enabled state false'";
+ };
+ enable = {
+ source = "script";
+ cmd = "/bin/sh -c 'echo set charger enabled state true'";
+ };
+ maxcurrent = {
+ source = "script";
+ cmd = "/bin/sh -c 'echo set charger max current 7200'";
+ };
+ } ];
+
+ loadpoints = [ {
+ title = "Dummy";
+ charger = "dummy-charger";
+ } ];
+ };
+ };
+ };
+ };
+
+ testScript = ''
+ start_all()
+
+ machine.wait_for_unit("evcc.service")
+ machine.wait_for_open_port(7070)
+
+ with subtest("Check package version propagates into frontend"):
+ machine.fail(
+ "curl --fail http://localhost:7070 | grep '0.0.1-alpha'"
+ )
+ machine.succeed(
+ "curl --fail http://localhost:7070 | grep '${pkgs.evcc.version}'"
+ )
+
+ with subtest("Check journal for errors"):
+ _, output = machine.execute("journalctl -o cat -u evcc.service")
+ assert "ERROR" not in output
+
+ with subtest("Check systemd hardening"):
+ _, output = machine.execute("systemd-analyze security evcc.service | grep -v '✓'")
+ machine.log(output)
+ '';
+})
diff --git a/nixos/tests/hibernate.nix b/nixos/tests/hibernate.nix
index 7a4b331169a3..cb75322ca5f9 100644
--- a/nixos/tests/hibernate.nix
+++ b/nixos/tests/hibernate.nix
@@ -26,8 +26,9 @@ let
powerManagement.resumeCommands = "systemctl --no-block restart backdoor.service";
- fileSystems = {
- "/".device = "/dev/vda2";
+ fileSystems."/" = {
+ device = "/dev/vda2";
+ fsType = "ext3";
};
swapDevices = mkOverride 0 [ { device = "/dev/vda1"; } ];
boot.resumeDevice = mkIf systemdStage1 "/dev/vda1";
diff --git a/nixos/tests/systemd-initrd-luks-password.nix b/nixos/tests/systemd-initrd-luks-password.nix
index e8e651f7b35f..55d0b4324b40 100644
--- a/nixos/tests/systemd-initrd-luks-password.nix
+++ b/nixos/tests/systemd-initrd-luks-password.nix
@@ -23,6 +23,8 @@ import ./make-test-python.nix ({ lib, pkgs, ... }: {
cryptroot2.device = "/dev/vdd";
};
virtualisation.bootDevice = "/dev/mapper/cryptroot";
+ # test mounting device unlocked in initrd after switching root
+ virtualisation.fileSystems."/cryptroot2".device = "/dev/mapper/cryptroot2";
};
};
@@ -31,6 +33,8 @@ import ./make-test-python.nix ({ lib, pkgs, ... }: {
machine.wait_for_unit("multi-user.target")
machine.succeed("echo -n supersecret | cryptsetup luksFormat -q --iter-time=1 /dev/vdc -")
machine.succeed("echo -n supersecret | cryptsetup luksFormat -q --iter-time=1 /dev/vdd -")
+ machine.succeed("echo -n supersecret | cryptsetup luksOpen -q /dev/vdd cryptroot2")
+ machine.succeed("mkfs.ext4 /dev/mapper/cryptroot2")
# Boot from the encrypted disk
machine.succeed("bootctl set-default nixos-generation-1-specialisation-boot-luks.conf")
@@ -44,5 +48,6 @@ import ./make-test-python.nix ({ lib, pkgs, ... }: {
machine.wait_for_unit("multi-user.target")
assert "/dev/mapper/cryptroot on / type ext4" in machine.succeed("mount")
+ assert "/dev/mapper/cryptroot2 on /cryptroot2 type ext4" in machine.succeed("mount")
'';
})
diff --git a/pkgs/applications/audio/open-stage-control/default.nix b/pkgs/applications/audio/open-stage-control/default.nix
index 11b5f26ee035..015265774507 100644
--- a/pkgs/applications/audio/open-stage-control/default.nix
+++ b/pkgs/applications/audio/open-stage-control/default.nix
@@ -16,7 +16,7 @@ buildNpmPackage rec {
./package-lock.json.patch
];
- npmDepsHash = "sha256-UF3pZ+SlrgDLqntciXRNbWfpPMtQw1DXl41x9r37QN4=";
+ npmDepsHash = "sha256-SGLcFjPnmhFoeXtP4gfGr4Qa1dTaXwSnzkweEvYW/1k=";
nativeBuildInputs = [
copyDesktopItems
diff --git a/pkgs/applications/audio/puddletag/default.nix b/pkgs/applications/audio/puddletag/default.nix
index 3fa0ea533b26..705820950b0d 100644
--- a/pkgs/applications/audio/puddletag/default.nix
+++ b/pkgs/applications/audio/puddletag/default.nix
@@ -59,8 +59,9 @@ python3.pkgs.buildPythonApplication rec {
rapidfuzz
];
+ # the file should be executable but it isn't so our wrapper doesn't run
preFixup = ''
- makeWrapperArgs+=("''${qtWrapperArgs[@]}")
+ chmod 555 $out/bin/puddletag
'';
doCheck = false; # there are no tests
diff --git a/pkgs/applications/audio/whipper/default.nix b/pkgs/applications/audio/whipper/default.nix
index dfe540f04e65..e3c4b4522489 100644
--- a/pkgs/applications/audio/whipper/default.nix
+++ b/pkgs/applications/audio/whipper/default.nix
@@ -2,6 +2,7 @@
, python3
, fetchFromGitHub
, fetchpatch
+, installShellFiles
, libcdio-paranoia
, cdrdao
, libsndfile
@@ -35,6 +36,8 @@ in python3.pkgs.buildPythonApplication rec {
];
nativeBuildInputs = with python3.pkgs; [
+ installShellFiles
+
setuptools-scm
docutils
setuptoolsCheckHook
@@ -65,6 +68,11 @@ in python3.pkgs.buildPythonApplication rec {
export SETUPTOOLS_SCM_PRETEND_VERSION="${version}"
'';
+ outputs = [ "out" "man" ];
+ postBuild = ''
+ make -C man
+ '';
+
preCheck = ''
# disable tests that require internet access
# https://github.com/JoeLametta/whipper/issues/291
@@ -73,6 +81,10 @@ in python3.pkgs.buildPythonApplication rec {
export HOME=$TMPDIR
'';
+ postInstall = ''
+ installManPage man/*.1
+ '';
+
passthru.tests.version = testers.testVersion {
package = whipper;
command = "HOME=$TMPDIR whipper --version";
diff --git a/pkgs/applications/editors/nano/default.nix b/pkgs/applications/editors/nano/default.nix
index 5d4d84e6fe9b..d7b1f54d3912 100644
--- a/pkgs/applications/editors/nano/default.nix
+++ b/pkgs/applications/editors/nano/default.nix
@@ -16,11 +16,11 @@ let
in stdenv.mkDerivation rec {
pname = "nano";
- version = "6.4";
+ version = "7.0";
src = fetchurl {
url = "mirror://gnu/nano/${pname}-${version}.tar.xz";
- sha256 = "QZmujKeKd5beVt4aQbgh3EeRLAMH6YFrVswxffNGYcA=";
+ sha256 = "jdbqw4srh4bYJoHw4a/YT2t1IQ0XORtkQ8Q35FFVIUk=";
};
nativeBuildInputs = [ texinfo ] ++ optional enableNls gettext;
diff --git a/pkgs/applications/editors/notepadqq/default.nix b/pkgs/applications/editors/notepadqq/default.nix
index 545d64ef5122..3aa08559bdf7 100644
--- a/pkgs/applications/editors/notepadqq/default.nix
+++ b/pkgs/applications/editors/notepadqq/default.nix
@@ -1,22 +1,40 @@
-{ mkDerivation, lib, fetchFromGitHub, pkg-config, which, qtbase, qtsvg, qttools, qtwebkit }:
+{ mkDerivation
+, lib
+, fetchFromGitHub
+, pkg-config
+, which
+, libuchardet
+, qtbase
+, qtsvg
+, qttools
+, qtwebengine
+, qtwebsockets
+}:
mkDerivation rec {
pname = "notepadqq";
- version = "1.4.8";
+ # shipping a beta build as there's no proper release which supports qtwebengine
+ version = "2.0.0-beta";
src = fetchFromGitHub {
owner = "notepadqq";
repo = "notepadqq";
rev = "v${version}";
- sha256 = "0lbv4s7ng31dkznzbkmp2cvkqglmfj6lv4mbg3r410fif2nrva7k";
+ sha256 = "sha256-XA9Ay9kJApY+bDeOf0iPv+BWYFuTmIuqsLEPgRTCZCE=";
};
nativeBuildInputs = [
- pkg-config which qttools
+ pkg-config
+ which
+ qttools
];
buildInputs = [
- qtbase qtsvg qtwebkit
+ libuchardet
+ qtbase
+ qtsvg
+ qtwebengine
+ qtwebsockets
];
preConfigure = ''
diff --git a/pkgs/applications/editors/vim/plugins/nvim-treesitter/overrides.nix b/pkgs/applications/editors/vim/plugins/nvim-treesitter/overrides.nix
index 0272c73b1730..f1c72991a506 100644
--- a/pkgs/applications/editors/vim/plugins/nvim-treesitter/overrides.nix
+++ b/pkgs/applications/editors/vim/plugins/nvim-treesitter/overrides.nix
@@ -14,18 +14,18 @@ let
# ocaml-interface
# tree-sitter-ocaml-interface
# tree-sitter-ocaml_interface
- builtGrammars = generatedGrammars // lib.listToAttrs
- (lib.concatLists (lib.mapAttrsToList
- (k: v:
- let
- replaced = lib.replaceStrings [ "_" ] [ "-" ] k;
- in
- map (lib.flip lib.nameValuePair v)
- ([ "tree-sitter-${k}" ] ++ lib.optionals (k != replaced) [
- replaced
- "tree-sitter-${replaced}"
- ]))
- generatedDerivations));
+ builtGrammars = generatedGrammars // lib.concatMapAttrs
+ (k: v:
+ let
+ replaced = lib.replaceStrings [ "_" ] [ "-" ] k;
+ in
+ {
+ "tree-sitter-${k}" = v;
+ } // lib.optionalAttrs (k != replaced) {
+ ${replaced} = v;
+ "tree-sitter-${replaced}" = v;
+ })
+ generatedDerivations;
allGrammars = lib.attrValues generatedDerivations;
@@ -62,6 +62,10 @@ let
in
{
+ postPatch = ''
+ rm -r parser
+ '';
+
passthru = {
inherit builtGrammars allGrammars withPlugins withAllGrammars;
diff --git a/pkgs/applications/misc/bottles/default.nix b/pkgs/applications/misc/bottles/default.nix
index e5d846606a71..3ac928a3d36f 100644
--- a/pkgs/applications/misc/bottles/default.nix
+++ b/pkgs/applications/misc/bottles/default.nix
@@ -1,10 +1,28 @@
-{ lib, fetchFromGitHub, gitUpdater
-, meson, ninja, pkg-config, wrapGAppsHook
-, desktop-file-utils, gsettings-desktop-schemas, libnotify, libhandy, webkitgtk
-, python3Packages, gettext
-, appstream-glib, gdk-pixbuf, glib, gobject-introspection, gspell, gtk3, gtksourceview4, gnome
-, steam, xdg-utils, pciutils, cabextract
-, freetype, p7zip, gamemode, mangohud
+{ lib
+, fetchFromGitHub
+, fetchFromGitLab
+, gitUpdater
+, python3Packages
+, blueprint-compiler
+, meson
+, ninja
+, pkg-config
+, wrapGAppsHook4
+, appstream-glib
+, desktop-file-utils
+, librsvg
+, gtk4
+, gtksourceview5
+, libadwaita
+, steam
+, cabextract
+, p7zip
+, xdpyinfo
+, imagemagick
+, procps
+, gamescope
+, mangohud
+, vmtouch
, wine
, bottlesExtraLibraries ? pkgs: [ ] # extra packages to add to steam.run multiPkgs
, bottlesExtraPkgs ? pkgs: [ ] # extra packages to add to steam.run targetPkgs
@@ -21,75 +39,77 @@ let
in
python3Packages.buildPythonApplication rec {
pname = "bottles";
- version = "2022.5.28-trento-3";
+ version = "2022.10.14.1";
src = fetchFromGitHub {
owner = "bottlesdevs";
repo = pname;
rev = version;
- sha256 = "sha256-KIDLRqDLFTsVAczRpTchnUtKJfVHqbYzf8MhIR5UdYY=";
+ sha256 = "sha256-FO91GSGlc2f3TSLrlmRDPi5p933/Y16tdEpX4RcKhL0=";
};
+ patches = [ ./vulkan_icd.patch ];
+
postPatch = ''
chmod +x build-aux/meson/postinstall.py
patchShebangs build-aux/meson/postinstall.py
- substituteInPlace src/backend/wine/winecommand.py \
+ substituteInPlace bottles/backend/wine/winecommand.py \
--replace \
- 'self.__get_runner()' \
- '(lambda r: (f"${steam-run}/bin/steam-run {r}", r)[r == "wine" or r == "wine64"])(self.__get_runner())'
- '';
+ "command = f\"{runner} {command}\"" \
+ "command = f\"{''' if runner == 'wine' or runner == 'wine64' else '${steam-run}/bin/steam-run '}{runner} {command}\"" \
+ --replace \
+ "command = f\"{_picked['entry_point']} {command}\"" \
+ "command = f\"${steam-run}/bin/steam-run {_picked['entry_point']} {command}\""
+ '';
nativeBuildInputs = [
+ blueprint-compiler
meson
ninja
pkg-config
- wrapGAppsHook
- gettext
+ wrapGAppsHook4
+ gtk4 # gtk4-update-icon-cache
appstream-glib
desktop-file-utils
];
buildInputs = [
- gdk-pixbuf
- glib
- gobject-introspection
- gsettings-desktop-schemas
- gspell
- gtk3
- gtksourceview4
- libhandy
- libnotify
- webkitgtk
- gnome.adwaita-icon-theme
+ librsvg
+ gtk4
+ gtksourceview5
+ libadwaita
];
propagatedBuildInputs = with python3Packages; [
pyyaml
- pytoml
requests
- pycairo
pygobject3
- lxml
- dbus-python
- gst-python
- liblarch
patool
markdown
+ fvs
+ pefile
+ urllib3
+ chardet
+ certifi
+ idna
+ pillow
+ orjson
+ icoextract
] ++ [
- steam-run
- xdg-utils
- pciutils
cabextract
- wine
- freetype
p7zip
- gamemode # programs.gamemode.enable
+ xdpyinfo
+ imagemagick
+ procps
+
+ gamescope
mangohud
+ vmtouch
+ wine
];
format = "other";
- strictDeps = false; # broken with gobject-introspection setup hook, see https://github.com/NixOS/nixpkgs/issues/56943
dontWrapGApps = true; # prevent double wrapping
preFixup = ''
diff --git a/pkgs/applications/misc/bottles/vulkan_icd.patch b/pkgs/applications/misc/bottles/vulkan_icd.patch
new file mode 100644
index 000000000000..d638917151ea
--- /dev/null
+++ b/pkgs/applications/misc/bottles/vulkan_icd.patch
@@ -0,0 +1,13 @@
+diff --git a/bottles/backend/utils/vulkan.py b/bottles/backend/utils/vulkan.py
+index 6673493..07f70d1 100644
+--- a/bottles/backend/utils/vulkan.py
++++ b/bottles/backend/utils/vulkan.py
+@@ -29,6 +29,8 @@ class VulkanUtils:
+ "/etc/vulkan",
+ "/usr/local/share/vulkan",
+ "/usr/local/etc/vulkan"
++ "/run/opengl-driver/share/vulkan/",
++ "/run/opengl-driver-32/share/vulkan/",
+ ]
+ if "FLATPAK_ID" in os.environ:
+ __vk_icd_dirs += [
diff --git a/pkgs/applications/misc/keepmenu/default.nix b/pkgs/applications/misc/keepmenu/default.nix
new file mode 100644
index 000000000000..d169e19a19a5
--- /dev/null
+++ b/pkgs/applications/misc/keepmenu/default.nix
@@ -0,0 +1,36 @@
+{ lib, python3Packages, python3, xvfb-run }:
+
+python3Packages.buildPythonApplication rec {
+ pname = "keepmenu";
+ version = "1.2.2";
+
+ src = python3Packages.fetchPypi {
+ inherit pname version;
+ sha256 = "SeVNtONH1bn2hb2pBOVM3Oafrb+jARgfvRe7vUu6Gto=";
+ };
+
+ preConfigure = ''
+ export HOME=$TMPDIR
+ mkdir -p $HOME/.config/keepmenu
+ cp config.ini.example $HOME/.config/keepmenu/config.ini
+ '';
+
+ propagatedBuildInputs = with python3Packages; [
+ pykeepass
+ pynput
+ ];
+
+ checkInputs = [ xvfb-run ];
+ checkPhase = ''
+ xvfb-run python setup.py test
+ '';
+
+ pythonImportsCheck = [ "keepmenu" ];
+
+ meta = with lib; {
+ homepage = "https://github.com/firecat53/keepmenu";
+ description = "Dmenu/Rofi frontend for Keepass databases";
+ license = licenses.gpl3Only;
+ maintainers = with maintainers; [ elliot ];
+ };
+}
diff --git a/pkgs/applications/misc/nerd-font-patcher/default.nix b/pkgs/applications/misc/nerd-font-patcher/default.nix
index e865479f8da0..21c77316c1ab 100644
--- a/pkgs/applications/misc/nerd-font-patcher/default.nix
+++ b/pkgs/applications/misc/nerd-font-patcher/default.nix
@@ -9,10 +9,10 @@ python3Packages.buildPythonApplication rec {
owner = "ryanoasis";
repo = "nerd-fonts";
rev = "v${version}";
- sparseCheckout = ''
- font-patcher
- /src/glyphs
- '';
+ sparseCheckout = [
+ "font-patcher"
+ "/src/glyphs"
+ ];
sha256 = "sha256-boZUd1PM8puc9BTgOwCJpkfk6VMdXLsIyp+fQmW/ZqI=";
};
diff --git a/pkgs/development/python-modules/tumpa/default.nix b/pkgs/applications/misc/tumpa/default.nix
similarity index 81%
rename from pkgs/development/python-modules/tumpa/default.nix
rename to pkgs/applications/misc/tumpa/default.nix
index 6309e8937a36..f7dfdd95d5db 100644
--- a/pkgs/development/python-modules/tumpa/default.nix
+++ b/pkgs/applications/misc/tumpa/default.nix
@@ -1,17 +1,12 @@
{ lib
-, buildPythonPackage
+, python3
, fetchFromGitHub
-, setuptools
-, pyside2
-, johnnycanencrypt
-, pythonOlder
, wrapQtAppsHook
}:
-buildPythonPackage rec {
+python3.pkgs.buildPythonApplication rec {
pname = "tumpa";
version = "0.1.2";
- disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "kushaldas";
@@ -20,7 +15,7 @@ buildPythonPackage rec {
sha256 = "17nhdildapgic5l05f3q1wf5jvz3qqdjv543c8gij1x9rdm8hgxi";
};
- propagatedBuildInputs = [
+ propagatedBuildInputs = with python3.pkgs; [
setuptools
johnnycanencrypt
pyside2
@@ -42,5 +37,6 @@ buildPythonPackage rec {
homepage = "https://github.com/kushaldas/tumpa";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ _0x4A6F ];
+ broken = true;
};
}
diff --git a/pkgs/applications/misc/waylock/default.nix b/pkgs/applications/misc/waylock/default.nix
new file mode 100644
index 000000000000..2a29eab29730
--- /dev/null
+++ b/pkgs/applications/misc/waylock/default.nix
@@ -0,0 +1,52 @@
+{
+ lib,
+ stdenv,
+ fetchFromGitHub,
+ zig,
+ wayland,
+ pkg-config,
+ scdoc,
+ wayland-protocols,
+ libxkbcommon,
+ pam,
+}:
+stdenv.mkDerivation rec {
+ pname = "waylock";
+ version = "0.4.2";
+
+ src = fetchFromGitHub {
+ owner = "ifreund";
+ repo = pname;
+ rev = "v${version}";
+ sha256 = "sha256-yWjWcnGa4a+Dpc82H65yr8H7v88g/tDq0FSguubhbEI=";
+ fetchSubmodules = true;
+ };
+
+ nativeBuildInputs = [zig wayland scdoc pkg-config];
+
+ buildInputs = [
+ wayland-protocols
+ libxkbcommon
+ pam
+ ];
+
+ dontConfigure = true;
+
+ preBuild = ''
+ export HOME=$TMPDIR
+ '';
+
+ installPhase = ''
+ runHook preInstall
+ zig build -Drelease-safe -Dman-pages --prefix $out install
+ runHook postInstall
+ '';
+
+ meta = with lib; {
+ homepage = "https://github.com/ifreund/waylock";
+ description = "A small screenlocker for Wayland compositors";
+ license = licenses.isc;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [jordanisaacs];
+ };
+}
diff --git a/pkgs/applications/networking/cluster/werf/default.nix b/pkgs/applications/networking/cluster/werf/default.nix
index f42a3be95944..fb19070e4591 100644
--- a/pkgs/applications/networking/cluster/werf/default.nix
+++ b/pkgs/applications/networking/cluster/werf/default.nix
@@ -10,13 +10,13 @@
buildGoModule rec {
pname = "werf";
- version = "1.2.188";
+ version = "1.2.190";
src = fetchFromGitHub {
owner = "werf";
repo = "werf";
rev = "v${version}";
- hash = "sha256-C8y86q+uf+8EZ9kBAZehld7PpGByJLjhYQOrc3YKH1A=";
+ hash = "sha256-xjZVBLdDLLlfnXX87lwgIeQ6ySI9cNoE5nrRJVBS/l0=";
};
vendorHash = "sha256-GjcmpHyjhjCWE5gQR/oTHfhHYg5WRu8uhgAuWhdxlYk=";
diff --git a/pkgs/applications/networking/gns3/default.nix b/pkgs/applications/networking/gns3/default.nix
index 44c9477c1c43..b17986daf588 100644
--- a/pkgs/applications/networking/gns3/default.nix
+++ b/pkgs/applications/networking/gns3/default.nix
@@ -3,7 +3,7 @@
}:
let
- stableVersion = "2.2.34";
+ stableVersion = "2.2.35.1";
previewVersion = stableVersion;
addVersion = args:
let version = if args.stable then stableVersion else previewVersion;
@@ -12,23 +12,18 @@ let
extraArgs = rec {
mkOverride = attrname: version: sha256:
self: super: {
- ${attrname} = super.${attrname}.overridePythonAttrs (oldAttrs: {
+ "${attrname}" = super."${attrname}".overridePythonAttrs (oldAttrs: {
inherit version;
src = oldAttrs.src.override {
inherit version sha256;
};
});
};
- commonOverrides = [
- (self: super: {
- jsonschema = super.jsonschema_3;
- })
- ];
};
mkGui = args: libsForQt5.callPackage (import ./gui.nix (addVersion args // extraArgs)) { };
mkServer = args: callPackage (import ./server.nix (addVersion args // extraArgs)) { };
- guiSrcHash = "sha256-1YsVMrUYI46lJZbPjf3jnOFDr9Hp54m8DVMz9y4dvVc=";
- serverSrcHash = "sha256-h4d9s+QvqN/EFV97rPRhQiyC06wkZ9C2af9gx1Z/x/8=";
+ guiSrcHash = "sha256-iVvADwIp01HeZoDayvH1dilYRHRkRBTBR3Fh395JBq0=";
+ serverSrcHash = "sha256-41dbiSjvmsDNYr9/rRkeQVOnPSVND34xx1SNknCgHfc=";
in {
guiStable = mkGui {
diff --git a/pkgs/applications/networking/gns3/gui.nix b/pkgs/applications/networking/gns3/gui.nix
index be08fe4f4c76..756cbd7c8b97 100644
--- a/pkgs/applications/networking/gns3/gui.nix
+++ b/pkgs/applications/networking/gns3/gui.nix
@@ -3,25 +3,15 @@
, version
, sha256Hash
, mkOverride
-, commonOverrides
}:
{ lib
, python3
, fetchFromGitHub
, wrapQtAppsHook
-, packageOverrides ? self: super: {}
}:
-let
- defaultOverrides = commonOverrides ++ [
- ];
-
- python = python3.override {
- packageOverrides = lib.foldr lib.composeExtensions (self: super: { }) ([ packageOverrides ] ++ defaultOverrides);
- };
-
-in python.pkgs.buildPythonPackage rec {
+python3.pkgs.buildPythonPackage rec {
pname = "gns3-gui";
inherit version;
@@ -36,7 +26,7 @@ in python.pkgs.buildPythonPackage rec {
wrapQtAppsHook
];
- propagatedBuildInputs = with python.pkgs; [
+ propagatedBuildInputs = with python3.pkgs; [
distro
jsonschema
psutil
@@ -55,10 +45,8 @@ in python.pkgs.buildPythonPackage rec {
postPatch = ''
substituteInPlace requirements.txt \
- --replace "sentry-sdk==" "sentry-sdk>=" \
--replace "psutil==" "psutil>=" \
- --replace "distro==" "distro>=" \
- --replace "setuptools==" "setuptools>="
+ --replace "jsonschema>=4.17.0,<4.18" "jsonschema"
'';
meta = with lib; {
diff --git a/pkgs/applications/networking/gns3/server.nix b/pkgs/applications/networking/gns3/server.nix
index a07409810c01..5eee199d6915 100644
--- a/pkgs/applications/networking/gns3/server.nix
+++ b/pkgs/applications/networking/gns3/server.nix
@@ -3,24 +3,14 @@
, version
, sha256Hash
, mkOverride
-, commonOverrides
}:
{ lib
, python3
, fetchFromGitHub
-, packageOverrides ? self: super: {}
}:
-let
- defaultOverrides = commonOverrides ++ [
- ];
-
- python = python3.override {
- packageOverrides = lib.foldr lib.composeExtensions (self: super: { }) ([ packageOverrides ] ++ defaultOverrides);
- };
-
-in python.pkgs.buildPythonApplication {
+python3.pkgs.buildPythonApplication {
pname = "gns3-server";
inherit version;
@@ -33,23 +23,17 @@ in python.pkgs.buildPythonApplication {
postPatch = ''
substituteInPlace requirements.txt \
- --replace "aiohttp==" "aiohttp>=" \
- --replace "aiofiles==" "aiofiles>=" \
- --replace "Jinja2==" "Jinja2>=" \
- --replace "sentry-sdk==" "sentry-sdk>=" \
- --replace "async-timeout==" "async-timeout>=" \
--replace "psutil==" "psutil>=" \
- --replace "distro==" "distro>=" \
- --replace "py-cpuinfo==" "py-cpuinfo>=" \
- --replace "setuptools==" "setuptools>="
+ --replace "jsonschema>=4.17.0,<4.18" "jsonschema"
'';
- propagatedBuildInputs = with python.pkgs; [
+ propagatedBuildInputs = with python3.pkgs; [
aiofiles
aiohttp
aiohttp-cors
async_generator
distro
+ importlib-resources
jinja2
jsonschema
multidict
diff --git a/pkgs/applications/networking/mullvad-vpn/default.nix b/pkgs/applications/networking/mullvad-vpn/default.nix
index 0d79f41828f9..9b1a609d8325 100644
--- a/pkgs/applications/networking/mullvad-vpn/default.nix
+++ b/pkgs/applications/networking/mullvad-vpn/default.nix
@@ -43,11 +43,11 @@ in
stdenv.mkDerivation rec {
pname = "mullvad-vpn";
- version = "2022.4";
+ version = "2022.5";
src = fetchurl {
url = "https://github.com/mullvad/mullvadvpn-app/releases/download/${version}/MullvadVPN-${version}_amd64.deb";
- sha256 = "sha256-OwTtWzlZjHNFSN5/UjFJbcrPCv9+ucWYEL2idYjeozU=";
+ sha256 = "sha256-G3B4kb+ugukYtCVH3HHI43u3n9G0dX6WyYUA3X/sZ+o=";
};
nativeBuildInputs = [
@@ -75,7 +75,6 @@ stdenv.mkDerivation rec {
mv opt/Mullvad\ VPN/* $out/share/mullvad
ln -s $out/share/mullvad/mullvad-{gui,vpn} $out/bin/
- ln -s $out/share/mullvad/resources/mullvad-daemon $out/bin/mullvad-daemon
ln -sf $out/share/mullvad/resources/mullvad-problem-report $out/bin/mullvad-problem-report
wrapProgram $out/bin/mullvad-vpn --set MULLVAD_DISABLE_UPDATE_NOTIFICATION 1
@@ -92,7 +91,7 @@ stdenv.mkDerivation rec {
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.gpl3Only;
platforms = [ "x86_64-linux" ];
- maintainers = with maintainers; [ Br1ght0ne ymarkus ];
+ maintainers = with maintainers; [ Br1ght0ne ymarkus ataraxiasjel ];
};
}
diff --git a/pkgs/applications/networking/mullvad/libwg.nix b/pkgs/applications/networking/mullvad/libwg.nix
index d54a2cafe8c0..287797fd8e67 100644
--- a/pkgs/applications/networking/mullvad/libwg.nix
+++ b/pkgs/applications/networking/mullvad/libwg.nix
@@ -13,7 +13,7 @@ buildGoModule {
sourceRoot = "source/wireguard/libwg";
- vendorSha256 = "qvymWCdJ+GY90W/Fpdp+r1+mTq6O4LyN2Yw/PjKdFm0=";
+ vendorSha256 = "QNde5BqkSuqp3VJQOhn7aG6XknRDZQ62PE3WGhEJ5LU=";
# XXX: hack to make the ar archive go to the correct place
# This is necessary because passing `-o ...` to `ldflags` does not work
diff --git a/pkgs/applications/networking/mullvad/mullvad.nix b/pkgs/applications/networking/mullvad/mullvad.nix
index 65aeab2de49d..03bc81c8b543 100644
--- a/pkgs/applications/networking/mullvad/mullvad.nix
+++ b/pkgs/applications/networking/mullvad/mullvad.nix
@@ -15,16 +15,16 @@
}:
rustPlatform.buildRustPackage rec {
pname = "mullvad";
- version = "2022.4";
+ version = "2022.5";
src = fetchFromGitHub {
owner = "mullvad";
repo = "mullvadvpn-app";
rev = version;
- hash = "sha256-s0Cmeh10lQUB5BK4i1qxkDy/ylx/3c6V66dxH+kcnLs=";
+ hash = "sha256-LiaELeEBIn/GZibKf25W3DHe+IkpaTY8UC7ca/7lp8k=";
};
- cargoHash = "sha256-HPURL+CFUVLWRq8nzLiZxDhckgH76b6JBUObLGtoEEw=";
+ cargoHash = "sha256-KpBhdZce8Ug3ws7f1qg+5LtOMQw2Mf/uJsBg/TZSYyk=";
nativeBuildInputs = [
pkg-config
diff --git a/pkgs/applications/terminal-emulators/xterm/default.nix b/pkgs/applications/terminal-emulators/xterm/default.nix
index c277e241ca30..ff0856734628 100644
--- a/pkgs/applications/terminal-emulators/xterm/default.nix
+++ b/pkgs/applications/terminal-emulators/xterm/default.nix
@@ -4,14 +4,14 @@
stdenv.mkDerivation rec {
pname = "xterm";
- version = "374";
+ version = "375";
src = fetchurl {
urls = [
"ftp://ftp.invisible-island.net/xterm/${pname}-${version}.tgz"
"https://invisible-mirror.net/archives/xterm/${pname}-${version}.tgz"
];
- sha256 = "sha256-EdTWJmcNTW17aft0Z+nsIxgX5a0iUC+RZ3aP2IrBvfU=";
+ sha256 = "sha256-MCxZor+B55xqcBUl13gWGiGNEjnyFWjYnivdMcAVIX8=";
};
strictDeps = true;
diff --git a/pkgs/applications/video/go2tv/default.nix b/pkgs/applications/video/go2tv/default.nix
new file mode 100644
index 000000000000..1137193ef41c
--- /dev/null
+++ b/pkgs/applications/video/go2tv/default.nix
@@ -0,0 +1,57 @@
+{ lib
+, stdenv
+, buildGoModule
+, fetchFromGitHub
+, Carbon
+, Cocoa
+, Kernel
+, UserNotifications
+, xorg
+, libglvnd
+, pkg-config
+, withGui ? true
+}:
+
+buildGoModule rec {
+ pname = "go2tv" + lib.optionalString (!withGui) "-lite";
+ version = "1.13.0";
+
+ src = fetchFromGitHub {
+ owner = "alexballas";
+ repo = "go2tv";
+ rev = "v${version}";
+ sha256 = "sha256-ZHKfBKOX3/kVR6Nc+jSmLgfmpihc6QMb6NvTFlsBr5E=";
+ };
+
+ vendorSha256 = "sha256-msXfXFWXyZeT6zrRPZkBV7PEyPqYkx+JlpTWUwgFavI=";
+
+ nativeBuildInputs = [ pkg-config ];
+
+ buildInputs = [
+ xorg.libX11
+ xorg.libXcursor
+ xorg.libXrandr
+ xorg.libXinerama
+ xorg.libXi
+ xorg.libXext
+ xorg.libXxf86vm
+ libglvnd
+ ] ++ lib.optionals stdenv.isDarwin [ Carbon Cocoa Kernel UserNotifications ];
+
+ ldflags = [
+ "-s" "-w"
+ "-linkmode=external"
+ ];
+
+ # conditionally build with GUI or not (go2tv or go2tv-lite sub-packages)
+ subPackages = [ "cmd/${pname}" ];
+
+ doCheck = false;
+
+ meta = with lib; {
+ description = "Cast media files to UPnP/DLNA Media Renderers and Smart TVs";
+ homepage = "https://github.com/alexballas/go2tv";
+ license = licenses.mit;
+ maintainers = with maintainers; [ gdamjan ];
+ };
+}
diff --git a/pkgs/applications/video/jellyfin-mpv-shim/default.nix b/pkgs/applications/video/jellyfin-mpv-shim/default.nix
index da75adab7b51..69248dc75301 100644
--- a/pkgs/applications/video/jellyfin-mpv-shim/default.nix
+++ b/pkgs/applications/video/jellyfin-mpv-shim/default.nix
@@ -1,6 +1,7 @@
{ lib
, buildPythonApplication
, fetchPypi
+, gobject-introspection
, jellyfin-apiclient-python
, jinja2
, mpv
@@ -9,6 +10,7 @@
, python-mpv-jsonipc
, pywebview
, tkinter
+, wrapGAppsHook
}:
buildPythonApplication rec {
@@ -20,6 +22,11 @@ buildPythonApplication rec {
sha256 = "sha256-JiSC6WjrLsWk3/m/EHq7KNXaJ6rqT2fG9TT1jPvYlK0=";
};
+ nativeBuildInputs = [
+ wrapGAppsHook
+ gobject-introspection
+ ];
+
propagatedBuildInputs = [
jellyfin-apiclient-python
mpv
@@ -52,6 +59,12 @@ buildPythonApplication rec {
--replace "notify_updates: bool = True" "notify_updates: bool = False"
'';
+ # needed for pystray to access appindicator using GI
+ preFixup = ''
+ makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
+ '';
+ dontWrapGApps = true;
+
# no tests
doCheck = false;
pythonImportsCheck = [ "jellyfin_mpv_shim" ];
diff --git a/pkgs/applications/video/plex-mpv-shim/default.nix b/pkgs/applications/video/plex-mpv-shim/default.nix
index 2d0643c4ddb9..b7a5f2ce38c1 100644
--- a/pkgs/applications/video/plex-mpv-shim/default.nix
+++ b/pkgs/applications/video/plex-mpv-shim/default.nix
@@ -1,4 +1,5 @@
-{ lib, buildPythonApplication, fetchFromGitHub, mpv, requests, python-mpv-jsonipc, pystray, tkinter }:
+{ lib, buildPythonApplication, fetchFromGitHub, mpv, requests, python-mpv-jsonipc, pystray, tkinter
+, wrapGAppsHook, gobject-introspection }:
buildPythonApplication rec {
pname = "plex-mpv-shim";
@@ -11,8 +12,19 @@ buildPythonApplication rec {
sha256 = "0hgv9g17dkrh3zbsx27n80yvkgix9j2x0rgg6d3qsf7hp5j3xw4r";
};
+ nativeBuildInputs = [
+ wrapGAppsHook
+ gobject-introspection
+ ];
+
propagatedBuildInputs = [ mpv requests python-mpv-jsonipc pystray tkinter ];
+ # needed for pystray to access appindicator using GI
+ preFixup = ''
+ makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
+ '';
+ dontWrapGApps = true;
+
# does not contain tests
doCheck = false;
diff --git a/pkgs/applications/window-managers/i3/i3ipc-glib.nix b/pkgs/applications/window-managers/i3/i3ipc-glib.nix
index 572b12d986c1..a6a77600ee5f 100644
--- a/pkgs/applications/window-managers/i3/i3ipc-glib.nix
+++ b/pkgs/applications/window-managers/i3/i3ipc-glib.nix
@@ -4,7 +4,6 @@
}:
stdenv.mkDerivation rec {
-
pname = "i3ipc-glib";
version = "1.0.1";
@@ -15,10 +14,10 @@ stdenv.mkDerivation rec {
sha256 = "01fzvrbnzcwx0vxw29igfpza9zwzp2s7msmzb92v01z0rz0y5m0p";
};
- nativeBuildInputs = [ autoreconfHook which pkg-config ];
-
- buildInputs = [ libxcb json-glib gtk-doc xorgproto gobject-introspection ];
+ strictDeps = true;
+ nativeBuildInputs = [ autoreconfHook which pkg-config gtk-doc gobject-introspection ];
+ buildInputs = [ libxcb json-glib xorgproto ];
preAutoreconf = ''
gtkdocize
diff --git a/pkgs/build-support/build-pecl.nix b/pkgs/build-support/build-pecl.nix
index 8168c7a3de18..d30a073d2fb9 100644
--- a/pkgs/build-support/build-pecl.nix
+++ b/pkgs/build-support/build-pecl.nix
@@ -9,7 +9,7 @@
, postPhpize ? ""
, makeFlags ? [ ]
, src ? fetchurl {
- url = "http://pecl.php.net/get/${pname}-${version}.tgz";
+ url = "https://pecl.php.net/get/${pname}-${version}.tgz";
inherit (args) sha256;
}
, ...
diff --git a/pkgs/build-support/docker/default.nix b/pkgs/build-support/docker/default.nix
index a3145e504f23..6b07865928e6 100644
--- a/pkgs/build-support/docker/default.nix
+++ b/pkgs/build-support/docker/default.nix
@@ -547,10 +547,14 @@ rec {
pure = writeText "${baseName}-config.json" (builtins.toJSON {
inherit created config;
architecture = defaultArch;
+ preferLocalBuild = true;
os = "linux";
});
impure = runCommand "${baseName}-config.json"
- { nativeBuildInputs = [ jq ]; }
+ {
+ nativeBuildInputs = [ jq ];
+ preferLocalBuild = true;
+ }
''
jq ".created = \"$(TZ=utc date --iso-8601="seconds")\"" ${pure} > $out
'';
@@ -925,6 +929,7 @@ rec {
{
inherit fromImage maxLayers created;
imageName = lib.toLower name;
+ preferLocalBuild = true;
passthru.imageTag =
if tag != null
then tag
@@ -1015,6 +1020,7 @@ rec {
result = runCommand "stream-${baseName}"
{
inherit (conf) imageName;
+ preferLocalBuild = true;
passthru = passthru // {
inherit (conf) imageTag;
diff --git a/pkgs/build-support/fetchgit/default.nix b/pkgs/build-support/fetchgit/default.nix
index f516c3d5a03b..1fec0c887474 100644
--- a/pkgs/build-support/fetchgit/default.nix
+++ b/pkgs/build-support/fetchgit/default.nix
@@ -15,7 +15,7 @@ in
{ url, rev ? "HEAD", md5 ? "", sha256 ? "", hash ? "", leaveDotGit ? deepClone
, fetchSubmodules ? true, deepClone ? false
, branchName ? null
-, sparseCheckout ? ""
+, sparseCheckout ? []
, nonConeMode ? false
, name ? urlToName url rev
, # Shell code executed after the file has been fetched
@@ -55,13 +55,16 @@ in
*/
assert deepClone -> leaveDotGit;
-assert nonConeMode -> (sparseCheckout != "");
+assert nonConeMode -> !(sparseCheckout == "" || sparseCheckout == []);
if md5 != "" then
throw "fetchgit does not support md5 anymore, please use sha256"
else if hash != "" && sha256 != "" then
throw "Only one of sha256 or hash can be set"
else
+# Added 2022-11-12
+lib.warnIf (builtins.isString sparseCheckout)
+ "Please provide directories/patterns for sparse checkout as a list of strings. Support for passing a (multi-line) string is deprecated and will be removed in the next release."
stdenvNoCC.mkDerivation {
inherit name;
builder = ./builder.sh;
@@ -79,7 +82,12 @@ stdenvNoCC.mkDerivation {
else
lib.fakeSha256;
- inherit url rev leaveDotGit fetchLFS fetchSubmodules deepClone branchName sparseCheckout nonConeMode postFetch;
+ # git-sparse-checkout(1) says:
+ # > When the --stdin option is provided, the directories or patterns are read
+ # > from standard in as a newline-delimited list instead of from the arguments.
+ sparseCheckout = if builtins.isString sparseCheckout then sparseCheckout else builtins.concatStringsSep "\n" sparseCheckout;
+
+ inherit url rev leaveDotGit fetchLFS fetchSubmodules deepClone branchName nonConeMode postFetch;
postHook = if netrcPhase == null then null else ''
${netrcPhase}
diff --git a/pkgs/build-support/fetchgit/tests.nix b/pkgs/build-support/fetchgit/tests.nix
index 62fe3f77bbdd..a18be65327b5 100644
--- a/pkgs/build-support/fetchgit/tests.nix
+++ b/pkgs/build-support/fetchgit/tests.nix
@@ -12,10 +12,10 @@
name = "nix-source";
url = "https://github.com/NixOS/nix";
rev = "9d9dbe6ed05854e03811c361a3380e09183f4f4a";
- sparseCheckout = ''
- src
- tests
- '';
+ sparseCheckout = [
+ "src"
+ "tests"
+ ];
sha256 = "sha256-g1PHGTWgAcd/+sXHo1o6AjVWCvC6HiocOfMbMh873LQ=";
};
@@ -23,10 +23,10 @@
name = "nix-source";
url = "https://github.com/NixOS/nix";
rev = "9d9dbe6ed05854e03811c361a3380e09183f4f4a";
- sparseCheckout = ''
- src
- tests
- '';
+ sparseCheckout = [
+ "src"
+ "tests"
+ ];
nonConeMode = true;
sha256 = "sha256-FknO6C/PSnMPfhUqObD4vsW4PhkwdmPa9blNzcNvJQ4=";
};
diff --git a/pkgs/build-support/fetchgithub/default.nix b/pkgs/build-support/fetchgithub/default.nix
index cfb6a6ca7cd8..fcde7447cbd3 100644
--- a/pkgs/build-support/fetchgithub/default.nix
+++ b/pkgs/build-support/fetchgithub/default.nix
@@ -3,7 +3,7 @@
{ owner, repo, rev, name ? "source"
, fetchSubmodules ? false, leaveDotGit ? null
, deepClone ? false, private ? false, forceFetchGit ? false
-, sparseCheckout ? ""
+, sparseCheckout ? []
, githubBase ? "github.com", varPrefix ? null
, meta ? { }
, ... # For hash agility
@@ -24,7 +24,7 @@ let
};
passthruAttrs = removeAttrs args [ "owner" "repo" "rev" "fetchSubmodules" "forceFetchGit" "private" "githubBase" "varPrefix" ];
varBase = "NIX${if varPrefix == null then "" else "_${varPrefix}"}_GITHUB_PRIVATE_";
- useFetchGit = fetchSubmodules || (leaveDotGit == true) || deepClone || forceFetchGit || (sparseCheckout != "");
+ useFetchGit = fetchSubmodules || (leaveDotGit == true) || deepClone || forceFetchGit || !(sparseCheckout == "" || sparseCheckout == []);
# We prefer fetchzip in cases we don't need submodules as the hash
# is more stable in that case.
fetcher = if useFetchGit then fetchgit else fetchzip;
diff --git a/pkgs/build-support/node/build-npm-package/default.nix b/pkgs/build-support/node/build-npm-package/default.nix
index 1038bb2abcb4..5ab86996e56b 100644
--- a/pkgs/build-support/node/build-npm-package/default.nix
+++ b/pkgs/build-support/node/build-npm-package/default.nix
@@ -17,7 +17,7 @@
, npmBuildScript ? "build"
# Flags to pass to all npm commands.
, npmFlags ? [ ]
- # Flags to pass to `npm ci`.
+ # Flags to pass to `npm ci` and `npm prune`.
, npmInstallFlags ? [ ]
# Flags to pass to `npm rebuild`.
, npmRebuildFlags ? [ ]
diff --git a/pkgs/build-support/node/build-npm-package/hooks/default.nix b/pkgs/build-support/node/build-npm-package/hooks/default.nix
index 4ac981af916c..ff0930426d4e 100644
--- a/pkgs/build-support/node/build-npm-package/hooks/default.nix
+++ b/pkgs/build-support/node/build-npm-package/hooks/default.nix
@@ -7,10 +7,11 @@
substitutions = {
nodeSrc = srcOnly nodejs;
- # Specify the stdenv's `diff` and `jq` by abspath to ensure that the user's build
+ # Specify `diff`, `jq`, and `prefetch-npm-deps` by abspath to ensure that the user's build
# inputs do not cause us to find the wrong binaries.
diff = "${buildPackages.diffutils}/bin/diff";
jq = "${buildPackages.jq}/bin/jq";
+ prefetchNpmDeps = "${buildPackages.prefetch-npm-deps}/bin/prefetch-npm-deps";
nodeVersion = nodejs.version;
nodeVersionMajor = lib.versions.major nodejs.version;
diff --git a/pkgs/build-support/node/build-npm-package/hooks/npm-build-hook.sh b/pkgs/build-support/node/build-npm-package/hooks/npm-build-hook.sh
index b99c9d94faff..7f601512c7e7 100644
--- a/pkgs/build-support/node/build-npm-package/hooks/npm-build-hook.sh
+++ b/pkgs/build-support/node/build-npm-package/hooks/npm-build-hook.sh
@@ -20,6 +20,7 @@ npmBuildHook() {
echo
echo "Here are a few things you can try, depending on the error:"
echo "1. Make sure your build script ($npmBuildScript) exists"
+ echo " If there is none, set `dontNpmBuild = true`."
echo '2. If the error being thrown is something similar to "error:0308010C:digital envelope routines::unsupported", add `NODE_OPTIONS = "--openssl-legacy-provider"` to your derivation'
echo " See https://github.com/webpack/webpack/issues/14532 for more information."
echo
diff --git a/pkgs/build-support/node/build-npm-package/hooks/npm-config-hook.sh b/pkgs/build-support/node/build-npm-package/hooks/npm-config-hook.sh
index 723d8c1a4643..6fa6a0f940b1 100644
--- a/pkgs/build-support/node/build-npm-package/hooks/npm-config-hook.sh
+++ b/pkgs/build-support/node/build-npm-package/hooks/npm-config-hook.sh
@@ -5,9 +5,18 @@ npmConfigHook() {
echo "Configuring npm"
- export HOME=$TMPDIR
+ export HOME="$TMPDIR"
export npm_config_nodedir="@nodeSrc@"
+ if [ -z "${npmDeps-}" ]; then
+ echo
+ echo "ERROR: no dependencies were specified"
+ echo 'Hint: set `npmDeps` if using these hooks individually. If this is happening with `buildNpmPackage`, please open an issue.'
+ echo
+
+ exit 1
+ fi
+
local -r cacheLockfile="$npmDeps/package-lock.json"
local -r srcLockfile="$PWD/package-lock.json"
@@ -47,15 +56,17 @@ npmConfigHook() {
exit 1
fi
+ @prefetchNpmDeps@ --fixup-lockfile "$srcLockfile"
+
local cachePath
if [ -z "${makeCacheWritable-}" ]; then
- cachePath=$npmDeps
+ cachePath="$npmDeps"
else
echo "Making cache writable"
cp -r "$npmDeps" "$TMPDIR/cache"
chmod -R 700 "$TMPDIR/cache"
- cachePath=$TMPDIR/cache
+ cachePath="$TMPDIR/cache"
fi
npm config set cache "$cachePath"
@@ -71,7 +82,7 @@ npmConfigHook() {
echo "Here are a few things you can try, depending on the error:"
echo '1. Set `makeCacheWritable = true`'
echo " Note that this won't help if npm is complaining about not being able to write to the logs directory -- look above that for the actual error."
- echo '2. Set `npmInstallFlags = [ "--legacy-peer-deps" ]`'
+ echo '2. Set `npmFlags = [ "--legacy-peer-deps" ]`'
echo
exit 1
@@ -96,6 +107,8 @@ npmConfigHook() {
rm node_modules/.meow
fi
+ patchShebangs node_modules
+
echo "Finished npmConfigHook"
}
diff --git a/pkgs/build-support/node/build-npm-package/hooks/npm-install-hook.sh b/pkgs/build-support/node/build-npm-package/hooks/npm-install-hook.sh
index 4a222de26bbf..c3983e289568 100644
--- a/pkgs/build-support/node/build-npm-package/hooks/npm-install-hook.sh
+++ b/pkgs/build-support/node/build-npm-package/hooks/npm-install-hook.sh
@@ -27,7 +27,7 @@ npmInstallHook() {
local -r nodeModulesPath="$packageOut/node_modules"
if [ ! -d "$nodeModulesPath" ]; then
- npm prune --omit dev
+ npm prune --omit dev $npmInstallFlags "${npmInstallFlagsArray[@]}" $npmFlags "${npmFlagsArray[@]}"
find node_modules -maxdepth 1 -type d -empty -delete
cp -r node_modules "$nodeModulesPath"
diff --git a/pkgs/build-support/node/fetch-npm-deps/default.nix b/pkgs/build-support/node/fetch-npm-deps/default.nix
index d6ee0124d285..7d5ea7cbfbe8 100644
--- a/pkgs/build-support/node/fetch-npm-deps/default.nix
+++ b/pkgs/build-support/node/fetch-npm-deps/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenvNoCC, rustPlatform, Security, testers, fetchurl, prefetch-npm-deps, fetchNpmDeps }:
+{ lib, stdenvNoCC, rustPlatform, makeWrapper, Security, gnutar, gzip, testers, fetchurl, prefetch-npm-deps, fetchNpmDeps }:
{
prefetch-npm-deps = rustPlatform.buildRustPackage {
@@ -16,8 +16,13 @@
cargoLock.lockFile = ./Cargo.lock;
+ nativeBuildInputs = [ makeWrapper ];
buildInputs = lib.optional stdenvNoCC.isDarwin Security;
+ postInstall = ''
+ wrapProgram "$out/bin/prefetch-npm-deps" --prefix PATH : ${lib.makeBinPath [ gnutar gzip ]}
+ '';
+
passthru.tests =
let
makeTestSrc = { name, src }: stdenvNoCC.mkDerivation {
@@ -46,7 +51,7 @@
hash = "sha256-uQmc+S+V1co1Rfc4d82PpeXjmd1UqdsG492ADQFcZGA=";
};
- hash = "sha256-fk7L9vn8EHJsGJNMAjYZg9h0PT6dAwiahdiEeXVrMB8=";
+ hash = "sha256-wca1QvxUw3OrLStfYN9Co6oVBR1LbfcNUKlDqvObps4=";
};
lockfileV2 = makeTest {
@@ -57,7 +62,7 @@
hash = "sha256-qS29tq5QPnGxV+PU40VgMAtdwVLtLyyhG2z9GMeYtC4=";
};
- hash = "sha256-s8SpZY/1tKZVd3vt7sA9vsqHvEaNORQBMrSyhWpj048=";
+ hash = "sha256-tuEfyePwlOy2/mOPdXbqJskO6IowvAP4DWg8xSZwbJw=";
};
hashPrecedence = makeTest {
@@ -68,7 +73,7 @@
hash = "sha256-1+0AQw9EmbHiMPA/H8OP8XenhrkhLRYBRhmd1cNPFjk=";
};
- hash = "sha256-KRxwrEij3bpZ5hbQhX67KYpnY2cRS7u2EVZIWO1FBPM=";
+ hash = "sha256-oItUls7AXcCECuyA+crQO6B0kv4toIr8pBubNwB7kAM=";
};
hostedGitDeps = makeTest {
@@ -79,7 +84,30 @@
hash = "sha256-X9mCwPqV5yP0S2GonNvpYnLSLJMd/SUIked+hMRxDpA=";
};
- hash = "sha256-oIM05TGHstX1D4k2K4TJ+SHB7H/tNKzxzssqf0GJwvY=";
+ hash = "sha256-5Mg7KDJLMM5e/7BCHGinGAnBRft2ySQzvKW06p3u/0o=";
+ };
+
+ linkDependencies = makeTest {
+ name = "link-dependencies";
+
+ src = fetchurl {
+ url = "https://raw.githubusercontent.com/evcc-io/evcc/0.106.3/package-lock.json";
+ hash = "sha256-6ZTBMyuyPP/63gpQugggHhKVup6OB4hZ2rmSvPJ0yEs=";
+ };
+
+ hash = "sha256-VzQhArHoznYSXUT7l9HkJV4yoSOmoP8eYTLel1QwmB4=";
+ };
+
+ # This package contains both hosted Git shorthand, and a bundled dependency that happens to override an existing one.
+ etherpadLite1818 = makeTest {
+ name = "etherpad-lite-1.8.18";
+
+ src = fetchurl {
+ url = "https://raw.githubusercontent.com/ether/etherpad-lite/1.8.18/src/package-lock.json";
+ hash = "sha256-1fGNxYJi1I4cXK/jinNG+Y6tPEOhP3QAqWOBEQttS9E=";
+ };
+
+ hash = "sha256-8xF8F74nHwL9KPN2QLsxnfvsk0rNCKOZniYJQCD5u/I=";
};
};
diff --git a/pkgs/build-support/node/fetch-npm-deps/src/cacache.rs b/pkgs/build-support/node/fetch-npm-deps/src/cacache.rs
index 865a320954b5..715e115e7235 100644
--- a/pkgs/build-support/node/fetch-npm-deps/src/cacache.rs
+++ b/pkgs/build-support/node/fetch-npm-deps/src/cacache.rs
@@ -109,7 +109,7 @@ impl Cache {
let mut file = File::options().append(true).create(true).open(index_path)?;
- write!(file, "\n{:x}\t{data}", Sha1::new().chain(&data).finalize())?;
+ write!(file, "{:x}\t{data}", Sha1::new().chain(&data).finalize())?;
Ok(())
}
diff --git a/pkgs/build-support/node/fetch-npm-deps/src/main.rs b/pkgs/build-support/node/fetch-npm-deps/src/main.rs
index 097148fef82a..cf9651d42d64 100644
--- a/pkgs/build-support/node/fetch-npm-deps/src/main.rs
+++ b/pkgs/build-support/node/fetch-npm-deps/src/main.rs
@@ -1,19 +1,22 @@
#![warn(clippy::pedantic)]
use crate::cacache::Cache;
-use anyhow::anyhow;
+use anyhow::{anyhow, Context};
use rayon::prelude::*;
use serde::Deserialize;
+use serde_json::{Map, Value};
use std::{
- collections::HashMap,
- env, fs,
+ collections::{HashMap, HashSet},
+ env, fmt, fs, io,
path::Path,
- process::{self, Command},
+ process::{self, Command, Stdio},
};
use tempfile::tempdir;
use url::Url;
mod cacache;
+#[cfg(test)]
+mod tests;
#[derive(Deserialize)]
struct PackageLock {
@@ -25,38 +28,93 @@ struct PackageLock {
#[derive(Deserialize)]
struct OldPackage {
- version: String,
- resolved: Option,
+ version: UrlOrString,
+ #[serde(default)]
+ bundled: bool,
+ resolved: Option,
integrity: Option,
dependencies: Option>,
}
-#[derive(Deserialize)]
+#[derive(Debug, Deserialize, PartialEq, Eq)]
struct Package {
- resolved: Option,
+ resolved: Option,
integrity: Option,
}
+#[derive(Debug, Deserialize, PartialEq, Eq)]
+#[serde(untagged)]
+enum UrlOrString {
+ Url(Url),
+ String(String),
+}
+
+impl fmt::Display for UrlOrString {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ match self {
+ UrlOrString::Url(url) => url.fmt(f),
+ UrlOrString::String(string) => string.fmt(f),
+ }
+ }
+}
+
+#[allow(clippy::case_sensitive_file_extension_comparisons)]
fn to_new_packages(
old_packages: HashMap,
+ initial_url: &Url,
) -> anyhow::Result> {
let mut new = HashMap::new();
- for (name, package) in old_packages {
+ for (name, mut package) in old_packages {
+ // In some cases, a bundled dependency happens to have the same version as a non-bundled one, causing
+ // the bundled one without a URL to override the entry for the non-bundled instance, which prevents the
+ // dependency from being downloaded.
+ if package.bundled {
+ continue;
+ }
+
+ if let UrlOrString::Url(v) = &package.version {
+ for (scheme, host) in [
+ ("github", "github.com"),
+ ("bitbucket", "bitbucket.org"),
+ ("gitlab", "gitlab.com"),
+ ] {
+ if v.scheme() == scheme {
+ package.version = {
+ let mut new_url = initial_url.clone();
+
+ new_url.set_host(Some(host))?;
+
+ if v.path().ends_with(".git") {
+ new_url.set_path(v.path());
+ } else {
+ new_url.set_path(&format!("{}.git", v.path()));
+ }
+
+ new_url.set_fragment(v.fragment());
+
+ UrlOrString::Url(new_url)
+ };
+
+ break;
+ }
+ }
+ }
+
new.insert(
format!("{name}-{}", package.version),
Package {
- resolved: if let Ok(url) = Url::parse(&package.version) {
- Some(url)
+ resolved: if matches!(package.version, UrlOrString::Url(_)) {
+ Some(package.version)
} else {
- package.resolved.as_deref().map(Url::parse).transpose()?
+ package.resolved
},
integrity: package.integrity,
},
);
if let Some(dependencies) = package.dependencies {
- new.extend(to_new_packages(dependencies)?);
+ new.extend(to_new_packages(dependencies, initial_url)?);
}
}
@@ -184,6 +242,59 @@ fn get_ideal_hash(integrity: &str) -> anyhow::Result<&str> {
}
}
+fn get_initial_url() -> anyhow::Result {
+ Url::parse("git+ssh://git@a.b").context("initial url should be valid")
+}
+
+/// `fixup_lockfile` removes the `integrity` field from Git dependencies.
+///
+/// Git dependencies from specific providers can be retrieved from those providers' automatic tarball features.
+/// When these dependencies are specified with a commit identifier, npm generates a tarball, and inserts the integrity hash of that
+/// tarball into the lockfile.
+///
+/// Thus, we remove this hash, to replace it with our own determinstic copies of dependencies from hosted Git providers.
+fn fixup_lockfile(mut lock: Map) -> anyhow::Result