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
dff440aa
Unverified
Commit
dff440aa
authored
7 years ago
by
Eelco Dolstra
Browse files
Options
Downloads
Patches
Plain Diff
nix build: Add --out-link and --no-link options
parent
df4342bc
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/libutil/args.hh
+13
-0
13 additions, 0 deletions
src/libutil/args.hh
src/nix/build.cc
+22
-8
22 additions, 8 deletions
src/nix/build.cc
src/nix/copy.cc
+1
-1
1 addition, 1 deletion
src/nix/copy.cc
src/nix/run.cc
+1
-1
1 addition, 1 deletion
src/nix/run.cc
with
37 additions
and
10 deletions
src/libutil/args.hh
+
13
−
0
View file @
dff440aa
...
...
@@ -80,6 +80,19 @@ public:
FlagMaker
&
arity
(
size_t
arity
)
{
flag
->
arity
=
arity
;
return
*
this
;
};
FlagMaker
&
handler
(
std
::
function
<
void
(
Strings
)
>
handler
)
{
flag
->
handler
=
handler
;
return
*
this
;
};
FlagMaker
&
category
(
const
std
::
string
&
s
)
{
flag
->
category
=
s
;
return
*
this
;
};
FlagMaker
&
dest
(
std
::
string
*
dest
)
{
assert
(
flag
->
arity
==
1
);
flag
->
handler
=
[
=
](
Strings
ss
)
{
*
dest
=
ss
.
front
();
};
return
*
this
;
};
template
<
class
T
>
FlagMaker
&
set
(
T
*
dest
,
const
T
&
val
)
{
assert
(
flag
->
arity
==
0
);
flag
->
handler
=
[
=
](
Strings
ss
)
{
*
dest
=
val
;
};
return
*
this
;
};
};
FlagMaker
mkFlag
();
...
...
This diff is collapsed.
Click to expand it.
src/nix/build.cc
+
22
−
8
View file @
dff440aa
...
...
@@ -7,8 +7,22 @@ using namespace nix;
struct
CmdBuild
:
MixDryRun
,
InstallablesCommand
{
Path
outLink
=
"result"
;
CmdBuild
()
{
mkFlag
()
.
longName
(
"out-link"
)
.
shortName
(
'o'
)
.
description
(
"path of the symlink to the build result"
)
.
arity
(
1
)
.
labels
({
"path"
})
.
dest
(
&
outLink
);
mkFlag
()
.
longName
(
"no-link"
)
.
description
(
"do not create a symlink to the build result"
)
.
set
(
&
outLink
,
Path
(
""
));
}
std
::
string
name
()
override
...
...
@@ -28,14 +42,14 @@ struct CmdBuild : MixDryRun, InstallablesCommand
for
(
size_t
i
=
0
;
i
<
buildables
.
size
();
++
i
)
{
auto
&
b
(
buildables
[
i
]);
for
(
auto
&
output
:
b
.
outputs
)
{
i
f
(
auto
store2
=
store
.
dynamic_pointer_cast
<
LocalFSStore
>
())
{
std
::
string
symlink
=
"result"
;
if
(
i
)
symlink
+
=
fmt
(
"-%d"
,
i
)
;
if
(
output
.
first
!=
"out"
)
symlink
+=
fmt
(
"-%
s
"
,
output
.
first
);
store2
->
addPermRoot
(
output
.
second
,
absPath
(
symlink
),
true
);
}
}
if
(
outLink
!=
""
)
f
or
(
auto
&
output
:
b
.
outputs
)
if
(
auto
store2
=
store
.
dynamic_pointer_cast
<
LocalFSStore
>
())
{
std
::
string
symlink
=
outLink
;
if
(
i
)
symlink
+=
fmt
(
"-%
d
"
,
i
);
if
(
output
.
first
!=
"out"
)
symlink
+=
fmt
(
"-%s"
,
output
.
first
);
store2
->
addPermRoot
(
output
.
second
,
absPath
(
symlink
),
true
);
}
}
}
};
...
...
This diff is collapsed.
Click to expand it.
src/nix/copy.cc
+
1
−
1
View file @
dff440aa
...
...
@@ -22,7 +22,7 @@ struct CmdCopy : StorePathsCommand
mkFlag
()
.
longName
(
"no-check-sigs"
)
.
description
(
"do not require that paths are signed by trusted keys"
)
.
handler
([
&
](
Strings
ss
)
{
checkSigs
=
NoCheckSigs
;
}
);
.
set
(
&
checkSigs
,
NoCheckSigs
);
}
std
::
string
name
()
override
...
...
This diff is collapsed.
Click to expand it.
src/nix/run.cc
+
1
−
1
View file @
dff440aa
...
...
@@ -41,7 +41,7 @@ struct CmdRun : InstallablesCommand
.
longName
(
"ignore-environment"
)
.
shortName
(
'i'
)
.
description
(
"clear the entire environment (except those specified with --keep)"
)
.
handler
([
&
](
Strings
ss
)
{
ignoreEnvironment
=
true
;
}
);
.
set
(
&
ignoreEnvironment
,
true
);
mkFlag
()
.
longName
(
"keep"
)
...
...
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