on iko/ghcjs-patch-master help sign in
Don't reference scripts directly in materialization messages (#945)

Instead, give a hint as to how to get the appropriate scripts as attributes. Fixes #456, #877.

commit1dce3ffcb33da9e58e3685162bf9f5fd3d5f8a90 authorMichael Peyton Jones <michael.peyton-jones@iohk.io> dateThu 26 Nov 2020, 11:33 (6 years ago) parentc0931c9
3 files changed+7−2
lib/call-cabal-project-to-nix.nix+1 lib/call-stack-to-nix.nix+1 lib/materialize.nix+5−2
lib/call-cabal-project-to-nix.nix+1
@@ -369,6 +369,7 @@ let
369369 inherit materialized;
370370 sha256 = plan-sha256;
371371 sha256Arg = "plan-sha256";
372+ this = "project.plan-nix" + (if name != null then " for ${name}" else "");
372373 # Before pinning stuff down we need an index state to use
373374 reasonNotSafe =
374375 if !index-state-pinned
lib/call-stack-to-nix.nix+1
@@ -34,6 +34,7 @@ let
3434 sha256 = stack-sha256;
3535 sha256Arg = "stack-sha256";
3636 reasonNotSafe = null;
37+ this = "project.stack-nix" + (if name != null then " for ${name}" else "");
3738 } // pkgs.lib.optionalAttrs (checkMaterialization != null) {
3839 inherit checkMaterialization;
3940 }) (runCommand (if name == null then "stack-to-nix-pkgs" else name + "-stack-to-nix-pkgs") {
lib/materialize.nix+5−2
@@ -7,6 +7,9 @@
77 # the output. If this is set but does not exist
88 # the derivation will fail but with a message
99 # advising how to populate it.
10+, this ? "this"
11+ # A name to use when referring to the thing currently being
12+ # materialized. Clients can pass in an attribute name or similar.
1013, reasonNotSafe ? null
1114 # Some times there a reasont the derivation will
1215 # not produce output that can be safely materialized.
@@ -35,8 +38,8 @@ let
3538
3639 unchecked =
3740 let
38− sha256message = "To make this a fixed-output derivation but not materialized, set `${sha256Arg}` to the output of ${calculateMaterializedSha}";
39− materializeMessage = "To materialize the output entirely, pass a writable path as the `materialized` argument and pass that path to ${generateMaterialized}";
41+ sha256message = "To make ${this} a fixed-output derivation but not materialized, set `${sha256Arg}` to the output of the 'calculateMaterializedSha' script in 'passthru'.";
42+ materializeMessage = "To materialize ${this} entirely, pass a writable path as the `materialized` argument and run the 'updateMaterialized' script in 'passthru'.";
4043 in if reasonNotSafe != null
4144 then
4245 # Warn the user if they tried to pin stuff down when it is not safe