obelisk
obelisk copied to clipboard
ob run fails to find GHC
Running ob run on macOS results in the following error:
ob: dieVerbatim: user error (ob: Cannot find the program 'ghc'. User-specified path
'/Users/stevenleiva/Downloads/tmp' does not refer to an executable and the
program is not on the system path.
)
There are GHC binaries locally ~/.stack/./programs/x86_64-osx/ghc-8.10.4/lib/ghc-8.10.4/bin/ghc, but I am guessing adding that directory to the $PATH environmental variable is not what we are supposed to be doing.
OS: macOS Monterey 12.2.1 nix: nix-env (Nix) 2.6.1
nix config:
build-users-group = nixbld
binary-caches = https://cache.nixos.org https://nixcache.reflex-frp.org
binary-cache-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= ryantrinkle.com-1:JJiAKaRv9mWgpVAz8dwewnZe0AzzEAzPkagE9SP5NWI=
binary-caches-parallel-connections = 40
sandbox = false
Thank you for the report. Please copy the output of running the command ob run -v and paste it here.
I get this
% ob run -v
Starting Obelisk </nix/store/0fyds15bldld2xxypi9mll7lhc7fxf5g-obelisk-command-0.9.0.1/bin/.ob-wrapped> args=["run","-v"] logging-level=Debug
Thunk specification git-v5 did not match "./.obelisk/impl": ReadThunkError_UnrecognizedPaths ("./.obelisk/impl/github.json" :| [])
Thunk specification github-v5 matched "./.obelisk/impl"
./.obelisk/impl: command not cached, building ...
Creating process: nix-build ./.obelisk/impl -A command --out-link ./.obelisk/impl/.attr-cache/command.out
✔ Built on ./.obelisk/impl [command]
Handing off to ./.obelisk/impl/.attr-cache/command.out/bin/ob
Starting Obelisk </nix/store/0fyds15bldld2xxypi9mll7lhc7fxf5g-obelisk-command-0.9.0.1/bin/.ob-wrapped> args=["--no-handoff","run","-v"] logging-level=Debug
Finding packages with root "." and interpret paths:
└─ /
└─ Users
└─ gaze
└─ my
└─ ob
└─ first [Interpret]
Creating process: /nix/store/prlvgsa39vh3rip3grjqpjsgc5fp4w2c-findutils-4.7.0/bin/find -L . -name .obelisk -type d
Excluding obelisk packages:
Creating process: /nix/store/prlvgsa39vh3rip3grjqpjsgc5fp4w2c-findutils-4.7.0/bin/find -L /Users/gaze/my/ob/first $'(' -name $'*.cabal' -o -name package.yaml $')' -a -type f -not -path $'*/.attr-cache/*' -not -path $'*/lib/asset/manifest/*'
Creating process: /nix/store/3z930f3dak9is5rib4nmzfiflq0mcr1m-nix-2.3.11/bin/nix eval $'(let a = import ./. {}; in toString (a.reflex.nixpkgs.lib.isDerivation a.passthru.staticFilesImpure))' --raw
Creating process: /nix/store/3z930f3dak9is5rib4nmzfiflq0mcr1m-nix-2.3.11/bin/nix eval -f . passthru.staticFilesImpure --raw
Creating process: /nix/store/a9cxqs48r2dsdb3fa5kdvwiv6rdyxmg8-coreutils-8.31/bin/ln -sfT /Users/gaze/my/ob/first/static ./static.out
Creating process: /nix/store/3z930f3dak9is5rib4nmzfiflq0mcr1m-nix-2.3.11/bin/nix-build --no-out-link -E $'(let a = import ./. {}; in a.passthru.processedStatic.haskellManifest)'
Assets impurely loaded from: /Users/gaze/my/ob/first/static
Creating process: /nix/store/3z930f3dak9is5rib4nmzfiflq0mcr1m-nix-2.3.11/bin/nix eval $'(import .obelisk/impl {}).nixpkgs.path'
Creating process: /nix/store/3z930f3dak9is5rib4nmzfiflq0mcr1m-nix-2.3.11/bin/nix-shell -E $'{root, pkgs, shell}: ((import root {}).passthru.__unstable__.self.extend (_: _: {shellPackages = builtins.fromJSON pkgs;})).project.shells.${shell}' --arg root ./. --argstr pkgs $'{"backend":"/Users/gaze/my/ob/first/backend","common":"/Users/gaze/my/ob/first/common","frontend":"/Users/gaze/my/ob/first/frontend","obelisk-generated-static":"/nix/store/dykrj4a0vqryk2nf6r3w81kk0rmwm5dk-asset-manifest-haskellManifest"}' --argstr shell ghc --run $'export $\'NIX_PATH=nixpkgs=/nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source\' ; bash -c \'type -p ghc\''
warning: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I), at (string):1:9; will use bash from your environment
these derivations will be built:
/nix/store/5cw7rlmr00z4xjmjfixbxrhn3x56rf1h-ghc-8.6.5-with-packages.drv
/nix/store/viwf5m7w0bf52jhfz3x6q4wdvb18r7pi-cctools-binutils-darwin-wrapper-927.0.2/nix-support/setup-hook: line 134: ${cmd^^}${role_post}=${cmd}: bad substitution
Creating process: /nix/store/3z930f3dak9is5rib4nmzfiflq0mcr1m-nix-2.3.11/bin/nix eval $'(import .obelisk/impl {}).nixpkgs.path'
Creating process: /nix/store/3z930f3dak9is5rib4nmzfiflq0mcr1m-nix-2.3.11/bin/nix-shell -E $'{root, pkgs, shell}: ((import root {}).passthru.__unstable__.self.extend (_: _: {shellPackages = builtins.fromJSON pkgs;})).project.shells.${shell}' --arg root ./. --argstr pkgs $'{"backend":"/Users/gaze/my/ob/first/backend","common":"/Users/gaze/my/ob/first/common","frontend":"/Users/gaze/my/ob/first/frontend","obelisk-generated-static":"/nix/store/dykrj4a0vqryk2nf6r3w81kk0rmwm5dk-asset-manifest-haskellManifest"}' --argstr shell ghc --run $'export $\'NIX_PATH=nixpkgs=/nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source\' ; bash -c \'type -p ghc-pkg\''
warning: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I), at (string):1:9; will use bash from your environment
/nix/store/viwf5m7w0bf52jhfz3x6q4wdvb18r7pi-cctools-binutils-darwin-wrapper-927.0.2/nix-support/setup-hook: line 134: ${cmd^^}${role_post}=${cmd}: bad substitution
ob: dieVerbatim: user error (ob: Cannot find the program 'ghc'. User-specified path
'/Users/gaze/my/ob/first' does not refer to an executable and the program is
not on the system path.
)
Can you paste the response for the command below?
nix-channel --list
I have the same issue as the two reporters above, also on MacOS (v12.6).
▶︎▶︎ nix-env --version
nix-env (Nix) 2.11.1
▶︎▶︎ cat /etc/nix/nix.conf
build-users-group = nixbld
binary-caches = https://cache.nixos.org https://nixcache.reflex-frp.org
binary-cache-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= ryantrinkle.com-1:JJiAKaRv9mWgpVAz8dwewnZe0AzzEAzPkagE9SP5NWI=
binary-caches-parallel-connections = 40
sandbox = false
▶︎▶︎ nix-channel --add https://nixos.org/channels/nixos-22.05 nixos
▶︎▶︎ nix-channel --update
▶︎▶︎ nix-channel --list
nixos https://nixos.org/channels/nixos-22.05
▶︎▶︎ nix-env -i ghc
▶︎▶︎ which ghc
/Users/whittle/.nix-profile/bin/ghc
▶︎▶︎ nix-env -f https://github.com/obsidiansystems/obelisk/archive/master.tar.gz -iA command
installing 'obelisk-command-0.9.0.1'
building '/nix/store/g5nnpyjdjs1v5769l073k92qlyrn97ax-user-environment.drv'...
▶︎▶︎ ob run -v
Starting Obelisk </nix/store/0fyds15bldld2xxypi9mll7lhc7fxf5g-obelisk-command-0.9.0.1/bin/.ob-wrapped> args=["run","-v"] logging-level=Debug
Thunk specification git-v5 did not match "./.obelisk/impl": ReadThunkError_UnrecognizedPaths ("./.obelisk/impl/github.json" :| [])
Thunk specification github-v5 matched "./.obelisk/impl"
./.obelisk/impl: command not cached, building ...
Creating process: nix-build ./.obelisk/impl -A command --out-link ./.obelisk/impl/.attr-cache/command.out
✔ Built on ./.obelisk/impl [command]
Handing off to ./.obelisk/impl/.attr-cache/command.out/bin/ob
Starting Obelisk </nix/store/0fyds15bldld2xxypi9mll7lhc7fxf5g-obelisk-command-0.9.0.1/bin/.ob-wrapped> args=["--no-handoff","run","-v"] logging-level=Debug
Finding packages with root "." and interpret paths:
└─ /
└─ Users
└─ whittle
└─ Code
└─ power-deck [Interpret]
Creating process: /nix/store/prlvgsa39vh3rip3grjqpjsgc5fp4w2c-findutils-4.7.0/bin/find -L . -name .obelisk -type d
Excluding obelisk packages: /Users/whittle/Code/power-deck/.obelisk
Creating process: /nix/store/prlvgsa39vh3rip3grjqpjsgc5fp4w2c-findutils-4.7.0/bin/find -L /Users/whittle/Code/power-deck $'(' -name $'*.cabal' -o -name package.yaml $')' -a -type f -not -path $'*/.attr-cache/*' -not -path $'*/lib/asset/manifest/*' -not -path $'/Users/whittle/Code/power-deck/.obelisk/*'
Creating process: /nix/store/3z930f3dak9is5rib4nmzfiflq0mcr1m-nix-2.3.11/bin/nix eval $'(let a = import ./. {}; in toString (a.reflex.nixpkgs.lib.isDerivation a.passthru.staticFilesImpure))' --raw
Creating process: /nix/store/3z930f3dak9is5rib4nmzfiflq0mcr1m-nix-2.3.11/bin/nix eval -f . passthru.staticFilesImpure --raw
Creating process: /nix/store/a9cxqs48r2dsdb3fa5kdvwiv6rdyxmg8-coreutils-8.31/bin/ln -sfT /Users/whittle/Code/power-deck/static ./static.out
Creating process: /nix/store/3z930f3dak9is5rib4nmzfiflq0mcr1m-nix-2.3.11/bin/nix-build --no-out-link -E $'(let a = import ./. {}; in a.passthru.processedStatic.haskellManifest)'
Assets impurely loaded from: /Users/whittle/Code/power-deck/static
Creating process: /nix/store/3z930f3dak9is5rib4nmzfiflq0mcr1m-nix-2.3.11/bin/nix eval $'(import .obelisk/impl {}).nixpkgs.path'
Creating process: /nix/store/3z930f3dak9is5rib4nmzfiflq0mcr1m-nix-2.3.11/bin/nix-shell -E $'{root, pkgs, shell}: ((import root {}).passthru.__unstable__.self.extend (_: _: {shellPackages = builtins.fromJSON pkgs;})).project.shells.${shell}' --arg root ./. --argstr pkgs $'{"backend":"/Users/whittle/Code/power-deck/backend","common":"/Users/whittle/Code/power-deck/common","frontend":"/Users/whittle/Code/power-deck/frontend","obelisk-generated-static":"/nix/store/dykrj4a0vqryk2nf6r3w81kk0rmwm5dk-asset-manifest-haskellManifest"}' --argstr shell ghc --run $'export $\'NIX_PATH=nixpkgs=/nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source\' ; bash -c \'type -p ghc\''
warning: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I), at (string):1:9; will use bash from your environment
/nix/store/viwf5m7w0bf52jhfz3x6q4wdvb18r7pi-cctools-binutils-darwin-wrapper-927.0.2/nix-support/setup-hook: line 134: ${cmd^^}${role_post}=${cmd}: bad substitution
Creating process: /nix/store/3z930f3dak9is5rib4nmzfiflq0mcr1m-nix-2.3.11/bin/nix eval $'(import .obelisk/impl {}).nixpkgs.path'
Creating process: /nix/store/3z930f3dak9is5rib4nmzfiflq0mcr1m-nix-2.3.11/bin/nix-shell -E $'{root, pkgs, shell}: ((import root {}).passthru.__unstable__.self.extend (_: _: {shellPackages = builtins.fromJSON pkgs;})).project.shells.${shell}' --arg root ./. --argstr pkgs $'{"backend":"/Users/whittle/Code/power-deck/backend","common":"/Users/whittle/Code/power-deck/common","frontend":"/Users/whittle/Code/power-deck/frontend","obelisk-generated-static":"/nix/store/dykrj4a0vqryk2nf6r3w81kk0rmwm5dk-asset-manifest-haskellManifest"}' --argstr shell ghc --run $'export $\'NIX_PATH=nixpkgs=/nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source\' ; bash -c \'type -p ghc-pkg\''
warning: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I), at (string):1:9; will use bash from your environment
/nix/store/viwf5m7w0bf52jhfz3x6q4wdvb18r7pi-cctools-binutils-darwin-wrapper-927.0.2/nix-support/setup-hook: line 134: ${cmd^^}${role_post}=${cmd}: bad substitution
ob: dieVerbatim: user error (ob: Cannot find the program 'ghc'. User-specified path
'/Users/whittle/Code/power-deck' does not refer to an executable and the
program is not on the system path.
)
Is there any additional information that would be useful?
@whittle This is due to the use of diamond paths (<nixpkgs>) within Obelisk combined with the environment variable NIX_PATH not being set. We've resolved it on the develop branch and using that branch should help with this issue, though it is still being worked on so there may be other issues.
We're working on the next release and it should be hitting master soon !
I found something that worked for me. I’ll leave it here for anyone who encounters it in the future:
NIX_PATH="nixpkgs=$(nix-instantiate --eval -E '<nixpkgs>')" ob run -v
N.B. My understanding of how this works is that recent versions of nix try to default to a sane value for NIX_PATH when it’s unset in the environment. This means that nix-instantiate resolves <nixpkgs> as if it were in NIX_PATH. Once ob knows where to find nixpkgs, it’s able to install ghc itself.