|
34 | 34 | ]; |
35 | 35 |
|
36 | 36 | buildPhase = '' |
| 37 | + # Overrides $HOME as well. Great for building, not great for devShells |
37 | 38 | source ${my-clojure-nix-locker.shellEnv} |
38 | 39 |
|
39 | 40 | # Now compile as in https://clojure.org/guides/tools_build#_compiled_uberjar_application_build |
|
58 | 59 | # Trace all Bash executions |
59 | 60 | set -o xtrace |
60 | 61 |
|
61 | | - source ${my-clojure-nix-locker.shellEnv} |
62 | | -
|
63 | 62 | echo "Current locked classpath:" |
64 | | - ${pkgs.clojure}/bin/clojure -Spath |
| 63 | +
|
| 64 | + # This will work, but, $HOME will be read-only which is probably not what you want in a devShell |
| 65 | + #source ${my-clojure-nix-locker.shellEnv} |
| 66 | + #${pkgs.clojure}/bin/clojure -Spath |
| 67 | +
|
| 68 | + # Using the provided lockedClojure will do what you want |
| 69 | + # And if pkgs.clojure is referenced anywhere, it may override it |
| 70 | + ${my-clojure-nix-locker.lockedClojure}/bin/clojure -Spath |
65 | 71 |
|
66 | 72 | set +o xtrace |
67 | 73 |
|
68 | 74 | echo |
69 | | - echo "Note that \$HOME is overridden and read-only: $HOME" |
| 75 | + echo "Note that \$HOME will be overriden if you sourced my-clojure-nix-locker.shellEnv: $HOME" |
| 76 | + echo "If you used my-clojure-nix-locker.lockedClojure, it will be left alone and only the clojure and clj commands are overridden and locked" |
| 77 | + echo |
| 78 | + echo "This command should be locked in this shell:" |
| 79 | + echo "clojure -Spath" |
70 | 80 | echo |
71 | 81 | ''; |
72 | 82 | inputsFrom = [ |
73 | | - packages.uberjar |
| 83 | + # Will pull in pkgs.clojure, and we want my-clojure-nix-locker.lockedClojure |
| 84 | + #packages.uberjar |
74 | 85 | ]; |
75 | 86 | buildInputs = with pkgs; [ |
76 | 87 | openjdk |
77 | 88 | cacert # for maven and tools.gitlibs |
78 | | - clojure |
79 | 89 | clj-kondo |
80 | 90 | coreutils |
81 | 91 | # This provides the standalone `clojure-nix-locker` script in the shell |
82 | 92 | # You can use it, or `nix run .#locker` |
83 | 93 | # Both does the same |
84 | 94 | my-clojure-nix-locker.locker |
| 95 | + # Use the locked clojure |
| 96 | + # A pkgs.clojure reference could override it |
| 97 | + my-clojure-nix-locker.lockedClojure |
85 | 98 | ]; |
86 | 99 | }; |
87 | 100 | }); |
|
0 commit comments