aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/profiles.cc
AgeCommit message (Collapse)Author
2024-05-29util.{hh,cc}: Split out users.{hh,cc}Tom Hubrecht
Change-Id: I1bd92479a2cb7e5c2c2e1541b80474adb05ea0df
2024-03-04Merge pull request #9041 from trofi/profiles-signeldritch horrors
src/libstore/profiles.cc: fix comparison of sign difference (cherry picked from commit 1da1642527f73089947b7bd2de46147a44700ac8) Change-Id: I8f23d32ad66b797ff58eb2bd15b2f7741f47cd99
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-03-23Factor out the generation of the profile/channel directoryThéophane Hufschmitt
Make sure that all the code paths use the same one, and that the backwards-compatibility measures are probably in place when needed
2023-03-02Remove FormatOrString and remaining uses of format()Eelco Dolstra
2023-02-10A setting to follow XDG Base Directory standardAlexander Bantyev
XDG Base Directory is a standard for locations for storing various files. Nix has a few files which seem to fit in the standard, but currently use a custom location directly in the user's ~, polluting it: - ~/.nix-profile - ~/.nix-defexpr - ~/.nix-channels This commit adds a config option (use-xdg-base-directories) to follow the XDG spec and instead use the following locations: - $XDG_STATE_HOME/nix/profile - $XDG_STATE_HOME/nix/defexpr - $XDG_STATE_HOME/nix/channels If $XDG_STATE_HOME is not set, it is assumed to be ~/.local/state. Co-authored-by: Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com> Co-authored-by: Tim Fenney <kodekata@gmail.com> Co-authored-by: pasqui23 <pasqui23@users.noreply.github.com> Co-authored-by: Artturin <Artturin@artturin.com> Co-authored-by: John Ericson <Ericson2314@Yahoo.com>
2023-01-17Keep the default profile the sameThéophane Hufschmitt
It's used as the “system” profile in a bunch of places, so better not touch it. Besides, it doesn't hurt to keep it since it's owned by root any way, so it doesn't have the `chown` problem that the user profiles had and that led to wanting to move them on the client-side.
2023-01-17Don't try to migrate existing profilesThéophane Hufschmitt
Doing so would be more dangerous than useful, better leave them as-is if they already exist
2023-01-17Migrate the old profiles to the new locationThéophane Hufschmitt
Make sure that we don’t just create the new profiles directory, but that we also migrate every existing profile to it.
2023-01-17Move the default profiles to the user’s homeThéophane Hufschmitt
Rather than using `/nix/var/nix/{profiles,gcroots}/per-user/`, put the user profiles and gcroots under `$XDG_DATA_DIR/nix/{profiles,gcroots}`. This means that the daemon no longer needs to manage these paths itself (they are fully handled client-side). In particular, it doesn’t have to `chown` them anymore (removing one need for root). This does change the layout of the gc-roots created by nix-env, and is likely to break some stuff, so I’m not sure how to properly handle that.
2022-02-25Remove std::string alias (for real this time)Eelco Dolstra
Also use std::string_view in a few more places.
2021-09-14Add 'nix profile wipe-history' commandEelco Dolstra
2021-09-14Generations -> profile versionsEelco Dolstra
2021-09-14Add "nix profile rollback" commandEelco Dolstra
2021-07-12Error -> UsageErrorEelco Dolstra
2021-07-11Throw on unexpected input for --delete-older-thanNiels Egberts
'--delete-older-than 10' deletes the generations older than a single day, and '--delete-older-than 12m' deletes all generations older than 12 days. This changes makes it throw on those invalid inputs, and gives an example of a valid input.
2021-01-08string2Int(): Return std::optionalEelco Dolstra
2020-10-09Split out `local-fs-store.hh`John Ericson
This matches the already-existing `local-fs-store.cc`.
2020-09-23lstat() cleanupEelco Dolstra
2020-09-03addPermRoot(): Remove indirect flagEelco Dolstra
2020-09-03createGeneration(): Always create an indirect rootEelco Dolstra
This means profiles outside of /nix/var/nix/profiles don't get garbage-collected. It also means we don't need to scan /nix/var/nix/profiles for GC roots anymore, except for compatibility with previously existing generations.
2020-09-03createGeneration(): Take a StorePathEelco Dolstra
2020-07-16Generations API cleanupEelco Dolstra
2020-04-21remove 'format' from Error constructor callsBen Burdette
2020-03-24Misc changes from the flakes branchEelco Dolstra
2019-12-10Make the Store API more type-safeEelco Dolstra
Most functions now take a StorePath argument rather than a Path (which is just an alias for std::string). The StorePath constructor ensures that the path is syntactically correct (i.e. it looks like <store-dir>/<base32-hash>-<name>). Similarly, functions like buildPaths() now take a StorePathWithOutputs, rather than abusing Path by adding a '!<outputs>' suffix. Note that the StorePath type is implemented in Rust. This involves some hackery to allow Rust values to be used directly in C++, via a helper type whose destructor calls the Rust type's drop() function. The main issue is the dynamic nature of C++ move semantics: after we have moved a Rust value, we should not call the drop function on the original value. So when we move a value, we set the original value to bitwise zero, and the destructor only calls drop() if the value is not bitwise zero. This should be sufficient for most types. Also lots of minor cleanups to the C++ API to make it more modern (e.g. using std::optional and std::string_view in some places).
2018-03-01only delete things older than current gen and update logic in doc asMatthew O'Gorman
well
2018-03-01remove unused variable and make sure to check that the currentMatthew O'Gorman
generation is not the one we are deleting
2018-03-01this updates issues that were addressed by people in prMatthew O'Gorman
2018-03-01Implement --delete-generations + flag for keeping last N number of generationsMatthew O'Gorman
2017-07-30Replace Unicode quotes in user-facing strings by ASCIIJörg Thalheim
Relevant RFC: NixOS/rfcs#4 $ ag -l | xargs sed -i -e "/\"/s/’/'/g;/\"/s/‘/'/g"
2016-11-26Revert "Get rid of unicode quotes (#1140)"Eelco Dolstra
This reverts commit f78126bfd6b6c8477fcdbc09b2f98772dbe9a1e7. There really is no need for such a massive change...
2016-11-25Get rid of unicode quotes (#1140)Guillaume Maudoux
2016-09-21printMsg(lvlError, ...) -> printError(...) etc.Eelco Dolstra
2016-06-02Allow setting the state directory as a store parameterEelco Dolstra
E.g. "local?store=/tmp/store&state=/tmp/var".
2016-05-04Cleanup: Remove singleton()Eelco Dolstra
2016-02-11Move addPermRoot into StoreEelco Dolstra
2016-02-04StoreAPI -> StoreEelco Dolstra
Calling a class an API is a bit redundant...
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-05-21nix-collect-garbage: Don't call nix-envEelco Dolstra
Also, make sure --delete-older-than doesn't delete the current generation.
2015-05-21Move profiles.{cc,hh} to libstoreEelco Dolstra