aboutsummaryrefslogtreecommitdiff
path: root/flakes/mypackages/overlays/morph/dry-run.patch
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2023-10-04 01:35:06 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2023-10-04 02:11:48 +0200
commit1a64deeb894dc95e2645a75771732c6cc53a79ad (patch)
tree1b9df4838f894577a09b9b260151756272efeb53 /flakes/mypackages/overlays/morph/dry-run.patch
parentfa25ffd4583cc362075cd5e1b4130f33306103f0 (diff)
downloadNix-1a64deeb894dc95e2645a75771732c6cc53a79ad.tar.gz
Nix-1a64deeb894dc95e2645a75771732c6cc53a79ad.tar.zst
Nix-1a64deeb894dc95e2645a75771732c6cc53a79ad.zip
Squash changes containing private information
There were a lot of changes since the previous commit, but a lot of them contained personnal information about users. All thos changes got stashed into a single commit (history is kept in a different place) and private information was moved in a separate private repository
Diffstat (limited to 'flakes/mypackages/overlays/morph/dry-run.patch')
-rw-r--r--flakes/mypackages/overlays/morph/dry-run.patch59
1 files changed, 59 insertions, 0 deletions
diff --git a/flakes/mypackages/overlays/morph/dry-run.patch b/flakes/mypackages/overlays/morph/dry-run.patch
new file mode 100644
index 0000000..2ff099e
--- /dev/null
+++ b/flakes/mypackages/overlays/morph/dry-run.patch
@@ -0,0 +1,59 @@
1diff --git a/morph.go b/morph.go
2index a88414b..e5894df 100644
3--- a/morph.go
4+++ b/morph.go
5@@ -542,6 +542,7 @@ func getNixContext() *nix.NixContext {
6 return &nix.NixContext{
7 EvalMachines: filepath.Join(assetRoot, assets.Friendly, "eval-machines.nix"),
8 ShowTrace: showTrace,
9+ DryRun: *dryRun,
10 KeepGCRoot: *keepGCRoot,
11 AllowBuildShell: *allowBuildShell,
12 }
13@@ -574,8 +575,10 @@ func buildHosts(hosts []nix.Host) (resultPath string, err error) {
14 return
15 }
16
17- fmt.Fprintln(os.Stderr, "nix result path: ")
18- fmt.Println(resultPath)
19+ if resultPath != "" {
20+ fmt.Fprintln(os.Stderr, "nix result path: ")
21+ fmt.Println(resultPath)
22+ }
23 return
24 }
25
26diff --git a/nix/nix.go b/nix/nix.go
27index 6a9cfd5..0f7884b 100644
28--- a/nix/nix.go
29+++ b/nix/nix.go
30@@ -49,6 +49,7 @@ type Deployment struct {
31 type NixContext struct {
32 EvalMachines string
33 ShowTrace bool
34+ DryRun bool
35 KeepGCRoot bool
36 AllowBuildShell bool
37 }
38@@ -269,6 +270,10 @@ func (ctx *NixContext) BuildMachines(deploymentPath string, hosts []Host, nixArg
39 args = append(args, "--show-trace")
40 }
41
42+ if ctx.DryRun {
43+ args = append(args, "--dry-run")
44+ }
45+
46 if nixBuildTargets != "" {
47 args = append(args,
48 "--arg", "buildTargets", nixBuildTargets)
49@@ -308,6 +313,10 @@ func (ctx *NixContext) BuildMachines(deploymentPath string, hosts []Host, nixArg
50 return resultPath, errors.New(errorMessage)
51 }
52
53+ if ctx.DryRun {
54+ return "", err
55+ }
56+
57 resultPath, err = os.Readlink(resultLinkPath)
58 if err != nil {
59 return "", err