Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
Nix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nora Puchreiner
Nix
Commits
a1c1bf3a
Commit
a1c1bf3a
authored
9 years ago
by
Eelco Dolstra
Browse files
Options
Downloads
Plain Diff
Merge branch 'submit/sparse-generation-symlinks' of
https://github.com/ctheune/nix
parents
1529db70
12a88889
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/nix-env/profiles.cc
+19
-1
19 additions, 1 deletion
src/nix-env/profiles.cc
tests/user-envs.sh
+10
-0
10 additions, 0 deletions
tests/user-envs.sh
with
29 additions
and
1 deletion
src/nix-env/profiles.cc
+
19
−
1
View file @
a1c1bf3a
...
...
@@ -80,7 +80,25 @@ Path createGeneration(Path profile, Path outPath)
previous ones. */
int
dummy
;
Generations
gens
=
findGenerations
(
profile
,
dummy
);
unsigned
int
num
=
gens
.
size
()
>
0
?
gens
.
back
().
number
:
0
;
unsigned
int
num
;
if
(
gens
.
size
()
>
0
)
{
Generation
last
=
gens
.
back
();
if
(
readLink
(
last
.
path
)
==
outPath
)
{
/* We only create a new generation symlink if it differs
from the last one.
This helps keeping gratuitous installs/rebuilds from piling
up uncontrolled numbers of generations, cluttering up the
UI like grub. */
return
last
.
path
;
}
num
=
gens
.
back
().
number
;
}
else
{
num
=
0
;
}
/* Create the new generation. Note that addPermRoot() blocks if
the garbage collector is running to prevent the stuff we've
...
...
This diff is collapsed.
Click to expand it.
tests/user-envs.sh
+
10
−
0
View file @
a1c1bf3a
...
...
@@ -99,6 +99,16 @@ if nix-env -q '*' | grep -q bar; then false; fi
nix-env
--list-generations
test
"
$(
nix-env
--list-generations
|
wc
-l
)
"
-eq
7
# Doing the same operation twice results in the same generation, which triggers
# "lazy" behaviour and does not create a new symlink.
nix-env
-i
foo
nix-env
-i
foo
# Count generations.
nix-env
--list-generations
test
"
$(
nix-env
--list-generations
|
wc
-l
)
"
-eq
8
# Switch to a specified generation.
nix-env
--switch-generation
7
[
"
$(
nix-store
-q
--resolve
$profiles
/test
)
"
=
"
$oldGen
"
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment