aboutsummaryrefslogtreecommitdiff
path: root/src/libmain
AgeCommit message (Collapse)Author
2024-03-04Merge pull request #9465 from obsidiansystems/build-direldritch horrors
Use `buildprefix` in a few more places (cherry picked from commit b6a3fde6b7a416929553e6be36fc991680ddf9ef) Change-Id: I2790663fa9f8242ac2db6582b7e421d2fdf42942
2024-03-04Merge pull request #8887 from obsidiansystems/bsd-cross-ciJohn Ericson
Support cross compiling to BSD and CI it (cherry picked from commit 1f3fc08c5994ca69c84c9e745d59ec2bb2fd820a) Change-Id: I415e92952afc661cfb5ef91a76c0637678a04a19
2023-08-11Prevent overriding virtual methods that are called in a destructorYorick van Pelt
Virtual methods are no longer valid once the derived destructor has run. This means the compiler is free to optimize them to be non-virtual. Found using clang-tidy
2023-04-28nix: Support the --repair flagEelco Dolstra
2023-04-07Move initLibUtil() from initNix to initLibStoreRobert Hensing
libutil is a dependency of libstore, so it should always be initialized as such. libutil is also a dependency of libmain. Being explicit about this dependency might be good, but not worth the slight code complexity until the library structure gets more advanced. Part of an effort to make it easier to initialize the right things, by moving code into the appropriate libraries.
2023-04-07libmain: Clarify the lack of initLibExpr()Robert Hensing
Quote Why not initLibExpr()? initGC() is essentially that, but detectStackOverflow is not an instance of the init function concept, as it may have to be invoked more than once per process. Furthermore, renaming initGC to initLibExpr is more trouble than it's worth at this time.
2023-04-07Move macOS TMPDIR hack from initNix to initLibStoreRobert Hensing
This code is bad. We shouldn't unset variables in programs whose children may need them. Fixing one issue at a time, so postponing. See https://github.com/NixOS/nix/issues/7731 Part of an effort to make it easier to initialize the right things, by moving code into the appropriate libraries.
2023-04-07Move preloadNSS() from initNix to initLibStoreRobert Hensing
It is required for the sandbox, which is a libstore responsibility; not just libmain. Part of an effort to make it easier to initialize the right things, by moving code into the appropriate libraries.
2023-04-07Move sodium_init() to initLibStore()Robert Hensing
Part of an effort to make it easier to initialize the right things, by moving code into the appropriate libraries.
2023-04-07Move initLibStore() immediately after initLibUtil()Robert Hensing
Part of an effort to make it easier to initialize the right things, by moving code into the appropriate libraries. The goal of this reordering is to make initLibStore self-sufficient in a following commit.
2023-04-07Move loadConfFile() to initLibStoreRobert Hensing
Part of an effort to make it easier to initialize the right things, by moving code into the appropriate libraries. Using libstore without loading the config file is risky, as sqlite may then be misconfigured. See https://github.com/cachix/cachix/issues/475
2023-04-07Move OpenSSL init to initLibUtilRobert Hensing
Part of an effort to make it easier to initialize the right things, by moving code into the appropriate libraries.
2023-04-07Finish converting existing comments for internal API docs (#8146)John Ericson
* Finish converting existing comments for internal API docs 99% of this was just reformatting existing comments. Only two exceptions: - Expanded upon `BuildResult::status` compat note - Split up file-level `symbol-table.hh` doc comments to get per-definition docs Also fixed a few whitespace goofs, turning leading tabs to spaces and removing trailing spaces. Picking up from #8133 * Fix two things from comments * Use triple-backtick not indent for `dumpPath` * Convert GNU-style `\`..'` quotes to markdown style in API docs This will render correctly.
2023-03-31Ensure all headers have `#pragma once` and are in API docsJohn Ericson
`///@file` makes them show up in the internal API dos. A tiny few were missing `#pragma once`.
2023-03-22Add a test for nix copy over sshAlexander Bantyev
Check that nix copy can copy stuff, refuses to copy unsigned paths by default, and doesn't hide the ssh password prompt.
2023-03-22Logger, ProgressBar: add a way to pause/resumeAlexander Bantyev
Add new virtual methods pause and resume to the Logger class, and implement them in ProgressBar to allow to pause the bar refreshing.
2023-03-07Merge pull request #7889 from sidkshatriya/sorted-fetch-pathsThéophane Hufschmitt
Print the store paths to be fetched sorted by StorePath name()
2023-03-03Print the store paths to be fetched sorted by StorePath name() and not baseNameSidharth Kshatriya
Presently when nix says something like: ``` these 486 paths will be fetched (511.54 MiB download, 6458.64 MiB unpacked): ...path1 ...path2 ...path3 ... ... ...path486 ``` It sorts path1, path2, path3, ..., path486 in lexicographic order of the store path. After this commit, nix will show path1, path2, path3, ..., path486 sorted by StorePath name() (basically everything after the hash) rather than the store path. This makes it easier to review what exactly is being downloaded at a glance, especially when many paths need to be fetched.
2023-03-02Remove FormatOrString and remaining uses of format()Eelco Dolstra
2023-02-10Fix building with GCC 9Eelco Dolstra
Nixpkgs on aarch64-linux is currently stuck on GCC 9 (https://github.com/NixOS/nixpkgs/issues/208412) and using gcc11Stdenv doesn't work either. So use c++2a instead of c++20 for now. Unfortunately this means we can't use some C++20 features for now (like std::span).
2023-02-01Merge pull request #7203 from graham33/feature/cpp20Eelco Dolstra
Proposal: Use C++20
2023-01-19Revert "Revert "Merge pull request #6204 from layus/coerce-string""Guillaume Maudoux
This reverts commit 9b33ef3879a764bed4cc2404a08344c3a697a646.
2023-01-18Revert "Merge pull request #6204 from layus/coerce-string"Robert Hensing
This reverts commit a75b7ba30f1e4f8b15e810fd18e63ee9552e0815, reversing changes made to 9af16c5f742300e831a2cc400e43df1e22f87f31.
2023-01-10Make clear that `StorePathWithOutputs` is a deprecated typeJohn Ericson
- Add a comment - Put `OutputsSpec` in a different header (First part of #6815) - Make a few stray uses of it in new code use `DerivedPath` instead.
2023-01-03nix --version: Print the data directoryEelco Dolstra
2023-01-02Put the --show-trace hint in the logical placeEelco Dolstra
2022-12-24libstore: Make sure that initNix has been calledRobert Hensing
Prevent bugs like https://github.com/cachix/cachix/pull/477
2022-12-12Merge pull request #7421 from edolstra/lazy-trees-trivial-changesEelco Dolstra
Trivial changes from the lazy-trees branch
2022-12-07Trivial changes from the lazy-trees branchEelco Dolstra
2022-12-07Remove repeat and enforce-determinism optionsLinus Heckemann
These only functioned if a very narrow combination of conditions held: - The result path does not yet exist (--check did not result in repeated builds), AND - The result path is not available from any configured substituters, AND - No remote builders that can build the path are available. If any of these do not hold, a derivation would be built 0 or 1 times regardless of the repeat option. Thus, remove it to avoid confusion.
2022-10-28Move savedArgv into libmainJean-François Roche
`savedArgv` is not accessible by plugins when defined in main binary. Moving it into one of the nix lib fix the problem.
2022-10-22Build with C++20Graham Bennett
2022-10-14Merge pull request #7168 from NixOS/rosetta-testEelco Dolstra
Improve Rosetta detection
2022-10-14libmain: Make the entire stack overflow handler pluggableRobert Hensing
2022-10-14libmain: Add extraStackOverflowHandlerRobert Hensing
2022-10-13Fix clang warningsEelco Dolstra
2022-10-12Move some options into a misc categoryEelco Dolstra
This unclutters the per-command options a bit by moving out some global options.
2022-09-13RunPager: Stop the progress barEelco Dolstra
In particular, the progress bar was interfering with 'less' rendering in '--help' (e.g. run 'nix --help' and hit '/' to search).
2022-09-06Remove some signalsMatthew Bauer
2022-09-03Add more signalsMatthew Bauer
2022-09-03Disable SA_RESTART for some signals on macOSMatthew Bauer
Disables the SA_RESTART behavior on macOS which causes: > Restarting of pending calls is requested by setting the SA_RESTART bit > in sa_flags. The affected system calls include read(2), write(2), > sendto(2), recvfrom(2), sendmsg(2) and recvmsg(2) on a communications > channel or a slow device (such as a terminal, but not a regular file) > and during a wait(2) or ioctl(2). From: https://man.openbsd.org/sigaction#SA_RESTART This being set on macOS caused a bug where read() calls to the daemon socket were blocking after a SIGINT was received. As a result, checkInterrupt was never reached even though the signal was received by the signal handler thread. On Linux, SA_RESTART is disabled by default. This probably effects other BSDs but I don’t have the ability to test it there right now.
2022-08-24Fix progress bar flicker with -LEelco Dolstra
This was caused by -L calling setLogFormat() again, which caused the creation of a new progress bar without destroying the old one. So we had two progress bars clobbering each other. We should change 'logger' to be a smart pointer, but I'll do that in a future PR. Fixes #6931.
2022-08-17ProgressBar: Delay before showing a new activityEelco Dolstra
Some activities are numerous but usually very short (e.g. copying a source file to the store) which would cause a lot of flickering. So only show activities that have been running for at least 10 ms.
2022-04-19Avoid `fmt` when constructor already does itJohn Ericson
There is a correctnes issue here, but #3724 will fix that. This is just a cleanup for brevity's sake.
2022-03-03Factor out a `GcStore` interfaceJohn Ericson
Starts progress on #5729. The idea is that we should not have these default methods throwing "unimplemented". This is a small step in that direction. I kept `addTempRoot` because it is a no-op, rather than failure. Also, as a practical matter, it is called all over the place, while doing other tasks, so the downcasting would be annoying. Maybe in the future I could move the "real" `addTempRoot` to `GcStore`, and the existing usecases use a `tryAddTempRoot` wrapper to downcast or do nothing, but I wasn't sure whether that was a good idea so with a bias to less churn I didn't do it yet.
2022-03-02Remove stray debug lineEelco Dolstra
2022-02-25Remove std::string alias (for real this time)Eelco Dolstra
Also use std::string_view in a few more places.
2021-12-13Respect /etc/hostsEelco Dolstra
https://hydra.nixos.org/build/161439329
2021-12-06RunPager: restore stdout upon pager exitAlexander Bantyev
Before this change, stdout was closed after the pager exits. This is fine for non-interactive commands where we want to exit right after the pager exits anyways, but for interactive things (e.g. nix repl) this breaks the output after we quit the pager. Keep the initial stdout fd as part of RunPager, and restore it in RunPager::~RunPager using dup2.
2021-12-01Merge pull request #5599 from fzakaria/faridzakaria/fix-progress-bar-leakThéophane Hufschmitt
Fix heap use after free in progress-bar.cc