aboutsummaryrefslogtreecommitdiff
path: root/src/nix-collect-garbage
AgeCommit message (Collapse)Author
2024-07-09Fix dry-run flag for nix-collect-garbageQuantum Jump
`nix-collect-garbage --dry-run` previously elided the entire garbage collection check, meaning that it would just exit the script without printing anything. This change makes the dry run flag instead set the GC action to `gcReturnDead` rather than `gcDeleteDead`, and then continue with the script. So if you set `--dry-run`, it will print the paths it *would* have garbage collected, but not actually delete them. I filed a bug for this: https://git.lix.systems/lix-project/lix/issues/432 but then realised I could give fixing it a go myself. Change-Id: I062dbf1a80bbab192b5fd0b3a453a0b555ad16f2
2024-05-29util.{hh,cc}: Split out file-system.{hh,cc}Tom Hubrecht
Change-Id: Ifa89a529e7e34e7291eca87d802d2f569cf2493e
2024-03-11util.hh: split out signals stuffJade Lovelace
Copies part of the changes of ac89bb064aeea85a62b82a6daf0ecca7190a28b7 Change-Id: I9ce601875cd6d4db5eb1132d7835c5bab9f126d8
2023-06-19Clean up a few things related to profiles (#8526)John Ericson
- Greatly expand API docs - Clean up code in misc ways - Instead of a complicated single loop on generations, do different operations in successive subsequent steps. - Avoid `ref` in one place where `&` is fine - Just return path instead of mutating an argument in `makeName` Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2023-05-15Make `nix-collect-garbage -d` look into more placesThéophane Hufschmitt
Make it look into the new-style profiles dir, the old-style one, and the target of `~/.nix-profile` to be sure that we don't miss anything
2023-03-07Fix `nix-collect-garbage -d` with the new profile locationThéophane Hufschmitt
Low-hanging fix for https://github.com/NixOS/nix/pull/5226#issuecomment-1454669399
2023-03-02Remove FormatOrString and remaining uses of format()Eelco Dolstra
2022-06-10Add missing rethrows in conditional exception handlersAnders Kaseorg
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2022-03-11Deduplicate the Store downcasting with a templateJohn Ericson
2022-03-11Rename `requireGcStore` to `GcStore::require`John Ericson
I should have done this to begin with. This will be nicer once more Store sub-interfaces exist too, to illustrate the pattern.
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-02-25Remove std::string alias (for real this time)Eelco Dolstra
Also use std::string_view in a few more places.
2021-02-24Initialize plugins after handling initial command line flagsShea Levy
This is technically a breaking change, since attempting to set plugin files after the first non-flag argument will now throw an error. This is acceptable given the relative lack of stability in a plugin interface and the need to tie the knot somewhere once plugins can actually define new subcommands.
2021-01-26Move command plugin interface to libnixcmdShea Levy
2020-10-06Remove static variable name clashesEelco Dolstra
This was useful for an experiment with building Nix as a single compilation unit. It's not very useful otherwise but also doesn't hurt...
2020-07-30unsigned long long -> uint64_tEelco Dolstra
2020-03-30Remove global -I flagsEelco Dolstra
(cherry picked from commit 2c692a3b144523bca68dd6de618124ba6c9bb332)
2018-10-26Merge all nix-* binaries into nixEelco Dolstra
These are all symlinks to 'nix' now, reducing the installed size by about ~1.7 MiB.
2018-02-08Add plugins to make Nix more extensible.Shea Levy
All plugins in plugin-files will be dlopened, allowing them to statically construct instances of the various Register* types Nix supports.
2016-09-21printMsg(lvlError, ...) -> printError(...) etc.Eelco Dolstra
2016-02-24Eliminate reserveSpace flagEelco Dolstra
2016-02-04Eliminate the "store" global variableEelco Dolstra
Also, move a few free-standing functions into StoreAPI and Derivation. Also, introduce a non-nullable smart pointer, ref<T>, which is just a wrapper around std::shared_ptr ensuring that the pointer is never null. (For reference-counted values, this is better than passing a "T&", because the latter doesn't maintain the refcount. Usually, the caller will have a shared_ptr keeping the value alive, but that's not always the case, e.g., when passing a reference to a std::thread via std::bind.)
2015-10-18Fix compilation error due to missing ENOENT on cygwinSander van der Burg
2015-08-21nix-collect-garbage: Revive --max-freedEelco Dolstra
Fixes #609.
2015-07-17nix-collect-garbage: Handle ENOENTEelco Dolstra
Don't barf trying to read a link that just got deleted. Fixes #575.
2015-05-22Remove dead codeEelco Dolstra
2015-05-21nix-collect-garbage: Don't call nix-envEelco Dolstra
Also, make sure --delete-older-than doesn't delete the current generation.
2015-05-21nix-collect-garbage: Call collectGarbage() internallyEelco Dolstra
2015-05-21nix-collect-garbage: Don't barf on unreadable directoriesEelco Dolstra
And don't try to delete generations from unwritable directories.
2015-05-21nix-collect-garbage: Remove redundant call to getFileTypeEelco Dolstra
2015-05-06nix-collect-garbage: Do not pass an empty argument. Closes #530Luca Bruno
2015-05-06nix-collect-garbage: Fix deleting old generationsWilliam A. Kennington III
The call to nix-env expects a string which represents how old the derivations are or just "old" which means any generations other than the current one in use. Currently nix-collect-garbage passes an empty string to nix-env when using the -d option. This patch corrects the call to nix-env such that it follows the old behavior.
2015-04-22nix-collect-garbage: translate to C++Luca Bruno