aboutsummaryrefslogtreecommitdiff
path: root/src/libutil
AgeCommit message (Collapse)Author
2022-12-23Fix CanonPath::dirOf() returning a string_view of a temporaryEelco Dolstra
https://hydra.nixos.org/build/202837872
2022-12-20Merge pull request #7451 from edolstra/abstract-posEelco Dolstra
Introduce AbstractPos
2022-12-19Merge pull request #7450 from edolstra/canon-pathEelco Dolstra
Add CanonPath wrapper to represent canonicalized paths
2022-12-13Introduce AbstractPosEelco Dolstra
This makes the position object used in exceptions abstract, with a method getSource() to get the source code of the file in which the error originated. This is needed for lazy trees because source files don't necessarily exist in the filesystem, and we don't want to make libutil depend on the InputAccessor type in libfetcher.
2022-12-12Add CanonPath wrapper to represent canonicalized pathsEelco Dolstra
2022-12-12Simplify loop, feedback from @tfc and @Ericson2314Florian Friesdorf
2022-12-12Show stack trace above error messageFlorian Friesdorf
Save developers from scrolling by displaying the error message last, below the stack trace.
2022-12-12Don't reverse stack trace when showingFlorian Friesdorf
When debugging nix expressions the outermost trace tends to be more useful than the innermost. It is therefore printed last to save developers from scrolling.
2022-12-12CleanupEelco Dolstra
2022-12-12Optimize string concatenationEelco Dolstra
Co-authored-by: Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com>
2022-12-07Trivial changes from the lazy-trees branchEelco Dolstra
2022-12-04getMaxCPU: fix cgroup pathJörg Thalheim
Given this typo I am not sure if it has been tested.
2022-12-02getMaxCPU(): Lower verbosity level for ignored exceptionsEelco Dolstra
Fixes #7268.
2022-12-02Clean up cgroup handling in getMaxCPU()Eelco Dolstra
Also, don't assume in LocalDerivationGoal that cgroups are mounted on /sys/fs/cgroup.
2022-12-02Move cgroup.{cc,hh} to libutilEelco Dolstra
2022-11-29Merge pull request #3600 from NixOS/auto-uid-allocationEelco Dolstra
Automatic UID allocation
2022-11-21Merge remote-tracking branch 'origin/master' into auto-uid-allocationEelco Dolstra
2022-11-18Separate cgroup support from auto-uid-allocationEelco Dolstra
The new experimental feature 'cgroups' enables the use of cgroups for all builds. This allows better containment and enables setting resource limits and getting some build stats.
2022-11-18createTempDir(): Use std::atomicEelco Dolstra
2022-11-16Replace src/libutil/json.cc with nlohmann json generationYorick van Pelt
2022-11-10Remove the SystemdCgroup featureEelco Dolstra
2022-11-04Remove stray tabEelco Dolstra
2022-11-03Merge remote-tracking branch 'origin/master' into auto-uid-allocationEelco Dolstra
2022-11-01tarfile: set directory mode to at least 0500, don't extract fflagsYorick van Pelt
We don't need SGID, or any ACL's. We also want to keep every dir +rx.
2022-09-22archive: check close errors when extracting narssqualus
2022-09-19Improve durability of schema version file writessqualus
- call close explicitly in writeFile to prevent the close exception from being ignored - fsync after writing schema file to flush data to disk - fsync schema file parent to flush metadata to disk https://github.com/NixOS/nix/issues/7064
2022-09-13Trim option descriptionsEelco Dolstra
This removes unintended blank lines in Markdown when the description is a multiline string literal.
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-19json: write null on abnormal placeholder destructionNaïm Favier
Avoids leaving dangling attributes like { "foo": } in case of exceptions.
2022-08-17Remove warnLargeDump()Eelco Dolstra
This message was unhelpful (#1184) and probably misleading since memory is O(1) in most cases now.
2022-08-08Merge remote-tracking branch 'upstream/master' into ↵Théophane Hufschmitt
fix-mv-in-different-filesystems
2022-08-08Remove the explicit `c++fs` linkage on darwinThéophane Hufschmitt
Doesn't seem needed on a recent-enough clang anymore (and even seems to break stuff)
2022-08-07Do not spam logs if the owned-homedir check results in a noopDave Nicponski
2022-08-03Fix NIX_COUNT_CALLS=1Eelco Dolstra
Also, make the JSON writer support std::string_view. Fixes #6857.
2022-08-03Make `moveFile` more atomicThéophane Hufschmitt
Rather than directly copying the source to its dest, copy it first to a temporary location, and eventually move that temporary. That way, the move is at least atomic from the point-of-view of the destination
2022-08-03Only use `renameFile` where neededThéophane Hufschmitt
In most places the fallback to copying isn’t needed and can actually be bad, so we’d rather not transparently fallback
2022-08-03moveFile -> renameFileThéophane Hufschmitt
`move` tends to have this `mv` connotation of “I will copy it for you if needs be”
2022-08-03Link against c++fs on darwinThéophane Hufschmitt
Required by the old clang version
2022-08-03Re-implement the recursive directory copyThéophane Hufschmitt
The recursive copy from the stl doesn’t exactly do what we need because 1. It doesn’t delete things as we go 2. It doesn’t keep the mtime, which change the nars So re-implement it ourselves. A bit dull, but that way we have what we want
2022-08-03rename: Fallback to a copy if the filesystems mismatchThéophane Hufschmitt
In `nix::rename`, if the call to `rename` fails with `EXDEV` (failure because the source and the destination are in a different filesystems) switch to copying and removing the source. To avoid having to re-implement the copy manually, I switched the function to use the c++17 `filesystem` library (which has a `copy` function that should do what we want). Fix #6262
2022-08-03Create a wrapper around stdlib’s `rename`Théophane Hufschmitt
Directly takes some c++ strings, and gently throws an exception on error (rather than having to inline this logic everywhere)
2022-08-03Move some fs-related functions to their own fileThéophane Hufschmitt
Unclutter `util.cc` a bit
2022-07-22Merge pull request #6814 from amjoseph-nixpkgs/pr/sandbox-error-messagesThéophane Hufschmitt
local-derivation-goal.cc: improve error messages when sandboxing fails
2022-07-19libstore/globals.cc: Move cgroup detection to libutilAlex Wied
2022-07-19error.hh: add additional constructor with explicit errno argumentAdam Joseph
2022-07-12Merge pull request #6693 from ncfavier/complete-flake-inputsThéophane Hufschmitt
Improve shell completion of flake inputs
2022-07-11Fix flake input completion for `InstallablesCommand`sNaïm Favier
Defers completion of flake inputs until the whole command line is parsed so that we know what flakes we need to complete the inputs of. Previously, `nix build flake --update-input <Tab>` always behaved like `nix build . --update-input <Tab>`.
2022-06-29Merge pull request #6233 from flox/nix-repl-flakesThéophane Hufschmitt
Nix repl flakes
2022-06-23getSelfExe(): Support macOSEelco Dolstra
2022-06-23Fix build-remote in nix-staticEelco Dolstra
'build-remote' is now executed via /proc/self/exe so it always works.