Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
profiles.hh
Go to the documentation of this file.
1#pragma once
9
10#include <filesystem>
11#include <optional>
12#include <time.h>
13
14#include "nix/util/types.hh"
16
17namespace nix {
18
19class StorePath;
20
27typedef uint64_t GenerationNumber;
28
36{
53 std::filesystem::path path;
54
61};
62
66typedef std::list<Generation> Generations;
67
85std::pair<Generations, std::optional<GenerationNumber>> findGenerations(std::filesystem::path profile);
86
87struct LocalFSStore;
88
100std::filesystem::path createGeneration(LocalFSStore & store, std::filesystem::path profile, StorePath outPath);
101
115void deleteGeneration(const std::filesystem::path & profile, GenerationNumber gen);
116
133 const std::filesystem::path & profile, const std::set<GenerationNumber> & gensToDelete, bool dryRun);
134
147void deleteGenerationsGreaterThan(const std::filesystem::path & profile, GenerationNumber max, bool dryRun);
148
158void deleteOldGenerations(const std::filesystem::path & profile, bool dryRun);
159
170void deleteGenerationsOlderThan(const std::filesystem::path & profile, time_t t, bool dryRun);
171
177time_t parseOlderThanTimeSpec(std::string_view timeSpec);
178
185void switchLink(std::filesystem::path link, std::filesystem::path target);
186
191void switchGeneration(const std::filesystem::path & profile, std::optional<GenerationNumber> dstGen, bool dryRun);
192
197void lockProfile(PathLocks & lock, const std::filesystem::path & profile);
198
210std::string optimisticLockProfile(const std::filesystem::path & profile);
211
212struct ProfileDirsOptions
213{
214 const std::filesystem::path & nixStateDir;
215 bool useXDGBaseDirectories;
216};
217
222std::filesystem::path profilesDir(ProfileDirsOptions opts);
223
227std::filesystem::path rootProfilesDir(ProfileDirsOptions opts);
228
232std::filesystem::path defaultChannelsDir(ProfileDirsOptions opts);
233
237std::filesystem::path rootChannelsDir(ProfileDirsOptions opts);
238
244std::filesystem::path getDefaultProfile(ProfileDirsOptions opts);
245
246} // namespace nix
Definition pathlocks.hh:27
Definition path.hh:33
void deleteGenerations(const std::filesystem::path &profile, const std::set< GenerationNumber > &gensToDelete, bool dryRun)
Definition profiles.cc:123
void deleteOldGenerations(const std::filesystem::path &profile, bool dryRun)
Definition profiles.cc:175
void switchGeneration(const std::filesystem::path &profile, std::optional< GenerationNumber > dstGen, bool dryRun)
Definition profiles.cc:252
void deleteGeneration(const std::filesystem::path &profile, GenerationNumber gen)
Definition profiles.cc:98
void lockProfile(PathLocks &lock, const std::filesystem::path &profile)
Definition profiles.cc:279
void deleteGenerationsOlderThan(const std::filesystem::path &profile, time_t t, bool dryRun)
Definition profiles.cc:187
std::pair< Generations, std::optional< GenerationNumber > > findGenerations(std::filesystem::path profile)
std::list< Generation > Generations
Definition profiles.hh:66
uint64_t GenerationNumber
Definition profiles.hh:27
void switchLink(std::filesystem::path link, std::filesystem::path target)
Definition profiles.cc:243
void deleteGenerationsGreaterThan(const std::filesystem::path &profile, GenerationNumber max, bool dryRun)
Definition profiles.cc:150
time_t parseOlderThanTimeSpec(std::string_view timeSpec)
Definition profiles.cc:228
std::filesystem::path createGeneration(LocalFSStore &store, std::filesystem::path profile, StorePath outPath)
Definition profiles.cc:61
Definition profiles.hh:36
std::filesystem::path path
Definition profiles.hh:53
time_t creationTime
Definition profiles.hh:60
GenerationNumber number
Definition profiles.hh:41
Definition local-fs-store.hh:91