aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2024-05-30Merge changes from topic "libutil-split" into mainjade
* changes: util.hh: Delete remaining file and clean up headers util.hh: Move nativeSystem to local-derivation-goal.cc util.hh: Move stuff to types.hh util.cc: Delete remaining file util.{hh,cc}: Move ignoreException to error.{hh,cc} util.{hh,cc}: Split out namespaces.{hh,cc} util.{hh,cc}: Split out users.{hh,cc} util.{hh,cc}: Split out strings.{hh,cc} util.{hh,cc}: Split out unix-domain-socket.{hh,cc} util.{hh,cc}: Split out child.{hh,cc} util.{hh,cc}: Split out current-process.{hh,cc} util.{hh,cc}: Split out processes.{hh,cc} util.{hh,cc}: Split out file-descriptor.{hh,cc} util.{hh,cc}: Split out file-system.{hh,cc} util.{hh,cc}: Split out terminal.{hh,cc} util.{hh,cc}: Split out environment-variables.{hh,cc}
2024-05-29libstore: fix http abuses no longer workingeldritch horrors
while refactoring the curl wrapper we inadvertently broken the immutable flake protocol, because the immutable flake protocol accumulates headers across the entire redirect chain instead of using only the headers given in the final response of the chain. this is a problem because Some Known Providers Of Flake Infrastructure set rel=immutable link headers only in the penultimate entry of the redirect chain, and curl does not regard it as worth returning to us via its response header enumeration mechanisms. fixes https://git.lix.systems/lix-project/lix/issues/358 Change-Id: I645c3932b465cde848bd6a3565925a1e3cbcdda0
2024-05-29util.hh: Delete remaining file and clean up headersTom Hubrecht
Change-Id: Ic1f68e6af658e94ef7922841dd3ad4c69551ef56
2024-05-29util.hh: Move nativeSystem to local-derivation-goal.ccTom Hubrecht
Change-Id: I74565fbfd3aeedef8f50465808fac712b84e47ad
2024-05-29util.hh: Move stuff to types.hhTom Hubrecht
Change-Id: Ia852306a4b8aac6856dc42bc69e4b58b53a0d67c
2024-05-29util.cc: Delete remaining fileTom Hubrecht
Change-Id: I2b47848904f2ce7bd78b83738e99a4c9da627751
2024-05-29util.{hh,cc}: Move ignoreException to error.{hh,cc}Tom Hubrecht
Change-Id: Iae6464217a55c313a983e5c651b26a4a1e446706
2024-05-29util.{hh,cc}: Split out namespaces.{hh,cc}Tom Hubrecht
Change-Id: I8fd3f3b50c15ede29d489066b4e8d99c2c4636a6
2024-05-29util.{hh,cc}: Split out users.{hh,cc}Tom Hubrecht
Change-Id: I1bd92479a2cb7e5c2c2e1541b80474adb05ea0df
2024-05-29util.{hh,cc}: Split out strings.{hh,cc}Tom Hubrecht
Change-Id: I4f642d1046d56b5db26f1b0296ee16a0e02d444a
2024-05-29util.{hh,cc}: Split out unix-domain-socket.{hh,cc}Tom Hubrecht
Change-Id: I3f9a628e0f8998b6146f5caa8ae9842361a66b8b
2024-05-29util.{hh,cc}: Split out child.{hh,cc}Tom Hubrecht
Change-Id: Iec4824e071f537b17dd62dbb8c01b8eec14e9783
2024-05-29util.{hh,cc}: Split out current-process.{hh,cc}Tom Hubrecht
Change-Id: I77095b9d37e85310075bada7a076ccd482c28e47
2024-05-29util.{hh,cc}: Split out processes.{hh,cc}Tom Hubrecht
Change-Id: I39280dc40ca3f7f9007bc6c898ffcf760e2238b7
2024-05-29util.{hh,cc}: Split out file-descriptor.{hh,cc}Tom Hubrecht
Change-Id: I0dd0f9a9c2003fb887e076127e7f825fd3289c76
2024-05-29util.{hh,cc}: Split out file-system.{hh,cc}Tom Hubrecht
Change-Id: Ifa89a529e7e34e7291eca87d802d2f569cf2493e
2024-05-29util.{hh,cc}: Split out terminal.{hh,cc}Tom Hubrecht
Change-Id: I9de2296b4012d50f540124001d54d6ca3be4c6da
2024-05-28util.{hh,cc}: Split out environment-variables.{hh,cc}Tom Hubrecht
Change-Id: Icff0aa33fda5147bd5dbe256a0b9d6a6c8a2c3f6
2024-05-27Merge "libfetchers: fix URL logging" into mainQyriad
2024-05-26Merge "Revert "bump the extra --version info from info to notice, -vv -> ↵Qyriad
-v"" into main
2024-05-26worker: process timeouts first, and exclusivelyeldritch horrors
check goals for timeouts first, and their activity fds only if no timeout has occurred. checking for timeouts *after* activity sets us up for assertion failures by running multiple build completion notifiers, the first of which will kill/reap the the goal process and consuming the Pid instance. when the second notifier attempts to do the same it will core dump with an assertion failure in Pid and take down not only the single goal, but the entire daemon and all goals it was building. luckily this is rare in practice since it requires a build to both finish and time out at the same time. writing a test for this is not feasible due to how much it relies on scheduling to actually trigger the underlying bug, but on idle machines it can usually be triggered by running multiple sleeping builds with timeout set to the sleep duration and `--keep-going`: nix-build --timeout 10 --builders '' --keep-going -E ' with import <nixpkgs> {}; builtins.genList (i: runCommand "foo-${toString i}" {} "sleep 10") 100 ' Change-Id: I394d36b2e5ffb909cf8a19977d569bbdb71cb67b
2024-05-26docstrings: NixRepl::getDerivationPath: exceptions directly thrownQyriad
getDerivationPath() directly throws nix::Error for invalid derivations Change-Id: I81ead950060b789794fa683b61c6349fece1690d
2024-05-26Revert "bump the extra --version info from info to notice, -vv -> -v"Qyriad
This reverts commit d003dcd7f4ce6b16c3494398a4edd36e668a1b46. d0390b5cf¹ bumped the default verbosity of nix3 commands, making this change obsolete. [1]: d0390b5cf2d232febaa89aa6d8b07c547513a460 Change-Id: I1ddc36ea4514cd8d2855ff334accf6e98c210879
2024-05-26Merge "git putFile: support flake maximalists" into mainMaximilian Bosch
2024-05-25libfetchers: fix URL loggingQyriad
8c06b7b43¹ made libfetchers log the URL being fetched just before the actual fetch, particularly in case something freezes. This used the base URL, to not include query parameters, as the Nixpkgs lib tests assume that stderr logs will be equal across shallow and non-shallow git fetches (and shallow fetches have the ?shallow=1 query parameter). 8c06b7b43 assumed that the `base` field of ParsedURL would be populated, as the comment simply says "URL without query/fragment"... but apparently it is not populated when the URL being fetched is *already* fetched, which caused libfetchers to log things like fetching gitlab input '' which is. silly. but you know, busted lix be busted. Anyway, with this commit we just remove the query params before printing instead, which seems to do the right thing [1]: 8c06b7b431d73431d8872c28d1ec5009cecd5d03 Change-Id: I9b9988992029aa6abef786f20b66e68c2ebb97d4
2024-05-25libstore: remove duplicate builder variableArtemis Tosini
The `builder` local variable and duplicate `args.push_back` are no longer required since the Darwin sandbox stopped using `sandbox-exec`. The `drv->isBuiltin` check is not required either, as args are not accessed when the builder is builtin. Change-Id: I80b939bbd6f727b01793809921810ff09b579d54
2024-05-25Merge "libstore: parse the buildMode instead of unchecked cast" into mainjade
2024-05-25Merge "libstore/build: always enable seccomp filtering and ↵alois31
no-new-privileges" into main
2024-05-24libstore: parse the buildMode instead of unchecked castJade Lovelace
Change-Id: Icf6af7935e8f139bef36b40ad475e973aa48855c
2024-05-25Merge "nix3-upgrade-nix: fix when there are differing pnames" into mainQyriad
2024-05-25Merge changes I3ab84cc5,Iba34ad42 into mainQyriad
* changes: nix3: always use the same verbosity default (info) libfetchers: log fetches by URL just before they happen
2024-05-25nix3-upgrade-nix: fix when there are differing pnamesQyriad
Change-Id: I19c7e24a4d46137127e76b7bb133e0184d73d1b6
2024-05-24change "evaluating file" logs to debugQyriad
I can't imagine wanting this unless you are debugging something (in which case it's very useful) Change-Id: I90c6f182c18486e9f6b15a59379bbb8e88fb8e7f
2024-05-24libstore/build: always enable seccomp filtering and no-new-privilegesAlois Wohlschlager
Seccomp filtering and the no-new-privileges functionality improve the security of the sandbox, and have been enabled by default for a long time. In https://git.lix.systems/lix-project/lix/issues/265 it was decided that they should be enabled unconditionally. Accordingly, remove the allow-new-privileges (which had weird behavior anyway) and filter-syscall settings, and force the security features on. Syscall filtering can still be enabled at build time to support building on architectures libseccomp doesn't support. Change-Id: Iedbfa18d720ae557dee07a24f69b2520f30119cb
2024-05-24nix3: always use the same verbosity default (info)Qyriad
Change-Id: I3ab84cc583e3e8b1c05a8ae1a7a087204f513d03
2024-05-24libfetchers: log fetches by URL just before they happenQyriad
Addresses but does not close #305, as we still need an indicator for frozen fetches. Change-Id: Iba34ad42dc1c8772f7da249b90fe794b041bbf73
2024-05-23Merge changes I462a8cf0,I3b0bcea3,I2acd56e7,Ifc149764,I9e2ef170 into mainQyriad
* changes: docs: linkify nix3-build mention in nix-build.md build: make internal-api-docs PHONY cleanup lookupFileArg add docstring to lookupFileArg add libcmd test for lookupFileArg
2024-05-23Merge "packaging: rename nixexpr -> lixexpr and so on" into mainjade
2024-05-23packaging: rename nixexpr -> lixexpr and so onJade Lovelace
This breaks downstreams linking to us on purpose to make sure that if someone is linking to Lix they're doing it on purpose and crucially not mixing up Nix and Lix versions in compatibility code. We still need to fix the internal includes to follow the same schema so we can drop the single-level include system entirely. However, this requires a little more effort. This adds pkg-config for libfetchers and config.h. Migration path: expr.hh -> lix/libexpr/expr.hh nix/config.h -> lix/config.h To apply this migration automatically, remove all `<nix/>` from includes, so: `#include <nix/expr.hh>` -> `#include <expr.hh>`. Then, the correct paths will be resolved from the tangled mess, and the clang-tidy automated fix will work. Then run the following for out of tree projects: ``` lix_root=$HOME/lix (cd $lix_root/clang-tidy && nix develop -c 'meson setup build && ninja -C build') run-clang-tidy -checks='-*,lix-fixincludes' -load=$lix_root/clang-tidy/build/liblix-clang-tidy.so -p build/ -fix src ``` Related: https://git.lix.systems/lix-project/nix-eval-jobs/pulls/5 Fixes: https://git.lix.systems/lix-project/lix/issues/279 Change-Id: I7498e903afa6850a731ef8ce77a70da6b2b46966
2024-05-23cleanup lookupFileArgQyriad
Change-Id: I2acd56e7a542b12138f43c95af78fdd50e944619
2024-05-23add docstring to lookupFileArgQyriad
Change-Id: Ifc149764f5a15725d3d630677c6da29def4b0f3e
2024-05-23repl: log errors writing to history fileQyriad
These errors are now logged and explicitly ignored, rather than implicitly ignored. Change-Id: Ia26015466a17f2b11952df5317a4d150d79dc184
2024-05-23Merge "repl: do not crash when tab-completing import errors" into mainPierre Bourdon
2024-05-23Merge "libstore: remove unused copyPath function" into maineldritch horrors
2024-05-23repl: do not crash when tab-completing import errorsPierre Bourdon
File not found while importing causes a SysError, not an EvalError, which is not currently caught by the tab-completion handler. Ignoring all SysErrors might seem "dangerous" but this is the tab-completion handler, any exception being bubbled up from there causes unexpected behavior (causes the whole repl to exit). Fixes #340. Change-Id: I643048a47935e77f582decc539d9e51bdb96c890
2024-05-22fix: enlarge envSize by several times to not be close to nixpkgs sizeJade Lovelace
nixpkgs has 23000 attributes, and our previous limit would be hit if you have more than one nixpkgs in the environment, for example, because `repl-overlays` will load the new stuff from the environment on top of the existing environment. This is not really testable since if we did write such a test, it would just be testing this constant tbh... Fixes: https://git.lix.systems/lix-project/lix/issues/337 Change-Id: I49197bfb4db55b082f914f0d70e84f5f5f110954
2024-05-22Merge "libfetchers: fallback to memory SQLite if fs IO fails" into mainQyriad
2024-05-22release notes: add a bunch of themJade Lovelace
Also fix typos introduced by the commits I read. I have run the addDrvOutputDependencies release note past Ericson since I was confused by what the heck it was doing, and he was saying it was reasonable. Change-Id: Id015353b00938682f7faae7de43df7f991a5237e
2024-05-22libstore: remove unused copyPath functioneldritch horrors
Change-Id: Ibfb0848d8b337bd38947a745c240838865cea401
2024-05-21libfetchers: fallback to memory SQLite if fs IO failsQyriad
nix::fetchers::CacheImpl uses $XDG_CACHE_HOME, or its default based on $HOME, to store its SQLite database. If the current process can't write to that directory for whatever reason, though, any eval-time fetching would fail just initializing the cache. With this change, IO errors initializing the fetcher cache are logged but ignored, and nix::fetchers::CacheImpl falls back to an in-memory¹ database instead. Notably, this will fix any uses eval fetching while Lix itself is being run in a derivation builder (such as during tests), as the derivation builder does not set $XDG_CACHE_HOME, and sets $HOME to the non-existent directory /homeless-shelter. Before: $ env -u XDG_CACHE_HOME HOME=/homeless-shelter nix -Lv eval --impure -E 'fetchTarball "https://git.lix.systems/lix-project/lix/archive/main.tar.gz"' error: … while calling the 'fetchTarball' builtin at «string»:1:1: 1| fetchTarball "https://git.lix.systems/lix-project/lix/archive/main.tar.gz" | ^ error: creating directory '/homeless-shelter': Permission denied After: $ env -u XDG_CACHE_HOME HOME=/homeless-shelter nix -Lv eval --impure -E 'fetchTarball "https://git.lix.systems/lix-project/lix/archive/main.tar.gz"' warning: ignoring error initializing Lix fetcher cache: error: creating directory '/homeless-shelter': Permission denied "/nix/store/s9lxdnn0awp37n560bg4fgr497ah4hvw-source" ¹: https://www.sqlite.org/inmemorydb.html Change-Id: I15c38c9baaf215fc6e192b8a4c70b9692a69bc22