diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2023-11-14 06:01:03 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-14 06:01:03 +0000 |
commit | 6a7c026ba785948e030a72dac66ed3524aa1b271 (patch) | |
tree | 532a8d6b261b1578b62a222b0950ed4f368b6a7e | |
parent | 772c3bbbf56dfe9a6ae720d1d5349573cdaf2300 (diff) | |
parent | 2387a37fa0c686f4541838843d07ae1104e180d7 (diff) |
Merge master into staging-next
-rw-r--r-- | lib/customisation.nix | 18 | ||||
-rw-r--r-- | lib/default.nix | 2 | ||||
-rw-r--r-- | lib/fileset/README.md | 3 | ||||
-rw-r--r-- | lib/fileset/default.nix | 2 | ||||
-rw-r--r-- | lib/trivial.nix | 34 | ||||
-rw-r--r-- | nixos/modules/services/torrent/flexget.nix | 1 | ||||
-rw-r--r-- | pkgs/applications/version-management/jujutsu/default.nix | 6 | ||||
-rw-r--r-- | pkgs/development/interpreters/python/python-packages-base.nix | 4 | ||||
-rw-r--r-- | pkgs/tools/llm/open-interpreter/default.nix | 4 |
9 files changed, 53 insertions, 21 deletions
diff --git a/lib/customisation.nix b/lib/customisation.nix index c7d40339d05f5..08fc5db0614de 100644 --- a/lib/customisation.nix +++ b/lib/customisation.nix @@ -76,19 +76,22 @@ rec { Type: makeOverridable :: (AttrSet -> a) -> AttrSet -> a */ - makeOverridable = f: lib.setFunctionArgs - (origArgs: let + makeOverridable = f: + let + # Creates a functor with the same arguments as f + mirrorArgs = lib.mirrorFunctionArgs f; + in + mirrorArgs (origArgs: + let result = f origArgs; - # Creates a functor with the same arguments as f - copyArgs = g: lib.setFunctionArgs g (lib.functionArgs f); # Changes the original arguments with (potentially a function that returns) a set of new attributes overrideWith = newArgs: origArgs // (if lib.isFunction newArgs then newArgs origArgs else newArgs); # Re-call the function but with different arguments - overrideArgs = copyArgs (newArgs: makeOverridable f (overrideWith newArgs)); + overrideArgs = mirrorArgs (newArgs: makeOverridable f (overrideWith newArgs)); # Change the result of the function call by applying g to it - overrideResult = g: makeOverridable (copyArgs (args: g (f args))) origArgs; + overrideResult = g: makeOverridable (mirrorArgs (args: g (f args))) origArgs; in if builtins.isAttrs result then result // { @@ -102,8 +105,7 @@ rec { lib.setFunctionArgs result (lib.functionArgs result) // { override = overrideArgs; } - else result) - (lib.functionArgs f); + else result); /* Call the package function in the file `fn` with the required diff --git a/lib/default.nix b/lib/default.nix index fe737a125e680..0dac50a08caa0 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -74,7 +74,7 @@ let importJSON importTOML warn warnIf warnIfNot throwIf throwIfNot checkListOfEnum info showWarnings nixpkgsVersion version isInOldestRelease mod compare splitByAndCompare - functionArgs setFunctionArgs isFunction toFunction + functionArgs setFunctionArgs isFunction toFunction mirrorFunctionArgs toHexString toBaseDigits inPureEvalMode; inherit (self.fixedPoints) fix fix' converge extends composeExtensions composeManyExtensions makeExtensible makeExtensibleWithCustomName; diff --git a/lib/fileset/README.md b/lib/fileset/README.md index 8518d88a7d642..91f892a1be951 100644 --- a/lib/fileset/README.md +++ b/lib/fileset/README.md @@ -241,7 +241,4 @@ Arguments: ## To update in the future Here's a list of places in the library that need to be updated in the future: -- > The file set library is currently somewhat limited but is being expanded to include more functions over time. - - in [the manual](../../doc/functions/fileset.section.md) - If/Once a function exists that can optionally include a path depending on whether it exists, the error message for the path not existing in `_coerce` should mention the new function diff --git a/lib/fileset/default.nix b/lib/fileset/default.nix index 372d445269f55..7d5bbeee3bae9 100644 --- a/lib/fileset/default.nix +++ b/lib/fileset/default.nix @@ -188,7 +188,7 @@ in { - Set `root` to ${toString fileset._internalBase} or any directory higher up. This changes the layout of the resulting store path. - Set `fileset` to a file set that cannot contain files outside the `root` (${toString root}). This could change the files included in the result.'' else - builtins.seq sourceFilter + seq sourceFilter cleanSourceWith { name = "source"; src = root; diff --git a/lib/trivial.nix b/lib/trivial.nix index c23fc6070be46..a89c1aa25b1f7 100644 --- a/lib/trivial.nix +++ b/lib/trivial.nix @@ -449,6 +449,40 @@ rec { (f ? __functor && isFunction (f.__functor f)); /* + `mirrorFunctionArgs f g` creates a new function `g'` with the same behavior as `g` (`g' x == g x`) + but its function arguments mirroring `f` (`lib.functionArgs g' == lib.functionArgs f`). + + Type: + mirrorFunctionArgs :: (a -> b) -> (a -> c) -> (a -> c) + + Example: + addab = {a, b}: a + b + addab { a = 2; b = 4; } + => 6 + lib.functionArgs addab + => { a = false; b = false; } + addab1 = attrs: addab attrs + 1 + addab1 { a = 2; b = 4; } + => 7 + lib.functionArgs addab1 + => { } + addab1' = lib.mirrorFunctionArgs addab addab1 + addab1' { a = 2; b = 4; } + => 7 + lib.functionArgs addab1' + => { a = false; b = false; } + */ + mirrorFunctionArgs = + # Function to provide the argument metadata + f: + let + fArgs = functionArgs f; + in + # Function to set the argument metadata to + g: + setFunctionArgs g fArgs; + + /* Turns any non-callable values into constant functions. Returns callable values as is. diff --git a/nixos/modules/services/torrent/flexget.nix b/nixos/modules/services/torrent/flexget.nix index 5cd7ae6ad7db3..58a4b70014977 100644 --- a/nixos/modules/services/torrent/flexget.nix +++ b/nixos/modules/services/torrent/flexget.nix @@ -64,7 +64,6 @@ in { path = [ pkg ]; serviceConfig = { User = cfg.user; - Environment = "TZ=${config.time.timeZone}"; ExecStartPre = "${pkgs.coreutils}/bin/install -m644 ${ymlFile} ${configFile}"; ExecStart = "${pkg}/bin/flexget -c ${configFile} daemon start"; ExecStop = "${pkg}/bin/flexget -c ${configFile} daemon stop"; diff --git a/pkgs/applications/version-management/jujutsu/default.nix b/pkgs/applications/version-management/jujutsu/default.nix index c86cd6e6b303f..a4e68c190ae1b 100644 --- a/pkgs/applications/version-management/jujutsu/default.nix +++ b/pkgs/applications/version-management/jujutsu/default.nix @@ -20,16 +20,16 @@ rustPlatform.buildRustPackage rec { pname = "jujutsu"; - version = "0.10.0"; + version = "0.11.0"; src = fetchFromGitHub { owner = "martinvonz"; repo = "jj"; rev = "v${version}"; - hash = "sha256-LJW4Px3K5cz6RJ4sUbwUXsp2+rzEW5wowi+DALHajYA="; + hash = "sha256-yEW7+0MnJlW0WeZ6UItaCDrihPLA52mLcu15tJwZx9w="; }; - cargoHash = "sha256-fs1cWhBFp2u3HiEx/mMnbwvgwKo97KmftA/sr4dGsiM="; + cargoHash = "sha256-xA9SDq1Kc0u8qFEPFFCic9uwE2Y/BXJzUHBCs1Czxtw="; cargoBuildFlags = [ "--bin" "jj" ]; # don't install the fake editors useNextest = true; # nextest is the upstream integration framework diff --git a/pkgs/development/interpreters/python/python-packages-base.nix b/pkgs/development/interpreters/python/python-packages-base.nix index 91ca84b34b83d..b5afaf34ce618 100644 --- a/pkgs/development/interpreters/python/python-packages-base.nix +++ b/pkgs/development/interpreters/python/python-packages-base.nix @@ -13,7 +13,7 @@ let # Derivations built with `buildPythonPackage` can already be overridden with `override`, `overrideAttrs`, and `overrideDerivation`. # This function introduces `overridePythonAttrs` and it overrides the call to `buildPythonPackage`. - makeOverridablePythonPackage = f: origArgs: + makeOverridablePythonPackage = f: lib.mirrorFunctionArgs f (origArgs: let args = lib.fix (lib.extends (_: previousAttrs: { @@ -30,7 +30,7 @@ let overridePythonAttrs = newArgs: makeOverridablePythonPackage f (overrideWith newArgs); __functor = self: result; } - else result; + else result); mkPythonDerivation = if python.isPy3k then ./mk-python-derivation.nix diff --git a/pkgs/tools/llm/open-interpreter/default.nix b/pkgs/tools/llm/open-interpreter/default.nix index 0b66df79b97d5..b8624fdc48312 100644 --- a/pkgs/tools/llm/open-interpreter/default.nix +++ b/pkgs/tools/llm/open-interpreter/default.nix @@ -4,7 +4,7 @@ , semgrep }: let - version = "0.1.7"; + version = "0.1.11"; in python3.pkgs.buildPythonApplication { pname = "open-interpreter"; @@ -15,7 +15,7 @@ python3.pkgs.buildPythonApplication { owner = "KillianLucas"; repo = "open-interpreter"; rev = "v${version}"; - hash = "sha256-U+GKvlFY9vkjXaPI0H5RsoMFLlLq1+IuSy/cOj/LNSw="; + hash = "sha256-viUMGUBy5UNWag6P8tXE4TcJIx53Q/tASNV3bmCCK0g="; }; nativeBuildInputs = [ |