Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'ob run' fails to run freshly initialized project #1010

Open
Shoadi opened this issue Dec 9, 2022 · 7 comments
Open

'ob run' fails to run freshly initialized project #1010

Shoadi opened this issue Dec 9, 2022 · 7 comments

Comments

@Shoadi
Copy link

Shoadi commented Dec 9, 2022

Hello everyone,

after successfully initializing my new obelisk project I am trying to run it - unfortunately unsuccessfully:

[user@OS:~/prj/ob]$ ob run --verbose
Starting Obelisk </nix/store/ndgqr350z5rnr58wd70nwkzjg9847nxq-obelisk-command-0.9.0.1/bin/.ob-wrapped> args=["run","--verbose"] 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/ndgqr350z5rnr58wd70nwkzjg9847nxq-obelisk-command-0.9.0.1/bin/.ob-wrapped> args=["--no-handoff","run","--verbose"] logging-level=Debug
Finding packages with root "." and interpret paths:
└─ /
   └─ home
      └─ user
         └─ prj
            └─ ob [Interpret]
Creating process: /nix/store/ax8vv1ds6l81jx8cmflx3fvcl9jdxd2w-findutils-4.7.0/bin/find -L . -name .obelisk -type d
Excluding obelisk packages:
Creating process: /nix/store/ax8vv1ds6l81jx8cmflx3fvcl9jdxd2w-findutils-4.7.0/bin/find -L /home/user/prj/ob $'(' -name $'*.cabal' -o -name package.yaml $')' -a -type f -not -path $'*/.attr-cache/*' -not -path $'*/lib/asset/manifest/*'
Creating process: /nix/store/4z4336r8yhyznz3fiscvz53wgdj43kjb-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/4z4336r8yhyznz3fiscvz53wgdj43kjb-nix-2.3.11/bin/nix eval -f . passthru.staticFilesImpure --raw
Creating process: /nix/store/vr96j3cxj75xsczl8pzrgsv1k57hcxyp-coreutils-8.31/bin/ln -sfT /home/user/prj/ob/static ./static.out
Creating process: /nix/store/4z4336r8yhyznz3fiscvz53wgdj43kjb-nix-2.3.11/bin/nix-build --no-out-link -E $'(let a = import ./. {}; in a.passthru.processedStatic.haskellManifest)'
Assets impurely loaded from: /home/user/prj/ob/static
Creating process: /nix/store/4z4336r8yhyznz3fiscvz53wgdj43kjb-nix-2.3.11/bin/nix eval $'(import .obelisk/impl {}).nixpkgs.path'
Creating process: /nix/store/4z4336r8yhyznz3fiscvz53wgdj43kjb-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":"/home/user/prj/ob/backend","common":"/home/user/prj/ob/common","frontend":"/home/user/prj/ob/frontend","obelisk-generated-static":"/nix/store/0r34z6nywaikj6dmsdv856v0d5ylar1m-asset-manifest-haskellManifest"}' --argstr shell ghc --run $'export $\'NIX_PATH=nixpkgs=/nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source\' ; bash -c \'type -p ghc\''
unpacking 'https://github.com/obsidiansystems/nixpkgs/archive/e6e5ff9cb3529b6de75e5d217222086de17e093a.tar.gz'...

gzip: stdin: unexpected end of file
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now
error: program 'tar' failed with exit code 2
(use '--show-trace' to show detailed location information)
Process exited with code 1; /nix/store/4z4336r8yhyznz3fiscvz53wgdj43kjb-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":"/home/user/prj/ob/backend","common":"/home/user/prj/ob/common","frontend":"/home/user/prj/ob/frontend","obelisk-generated-static":"/nix/store/0r34z6nywaikj6dmsdv856v0d5ylar1m-asset-manifest-haskellManifest"}' --argstr shell ghc --run $'export $\'NIX_PATH=nixpkgs=/nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source\' ; bash -c \'type -p ghc\''

It seems like a package that was downloaded was corrupt - but even trying the command another time and re-downloading it doesn't really change anything.

I am running on NixOS 22.11.

@ali-abrar
Copy link
Member

What version/branch of obelisk are you using?

@Shoadi
Copy link
Author

Shoadi commented Dec 9, 2022

Based on the first line of debugging-messages I assume its version 0.9.0.1
Starting Obelisk </nix/store/ndgqr350z5rnr58wd70nwkzjg9847nxq-obelisk-command-0.9.0.1/bin/.ob-wrapped> args=["run","--verbose"] logging-level=Debug
It is however the version that gets installed when following the guide for NixOS at:
https://github.com/obsidiansystems/obelisk

@ali-abrar
Copy link
Member

Could you post the contents of cat .obelisk/impl/github.json? That'll tell us the exact hash of this project's obelisk checkout.

@Max0nyshchenko
Copy link

Max0nyshchenko commented Dec 17, 2023

I am having an issue with running a freshly initialized project as well. Here's the log:

ob run -v 
Starting Obelisk </nix/store/5qhw99ipn683vik513frrqraz8c3p07j-obelisk-command-0.9.0.1/bin/.ob-wrapped> args=["run","-v"] logging-level=Debug
Thunk specification git-v7 did not match "./.obelisk/impl": ReadThunkError_UnrecognizedPaths ("./.obelisk/impl/github.json" :| [])
Thunk specification github-v8 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
DONE Built on ./.obelisk/impl [command]
Handing off to ./.obelisk/impl/.attr-cache/command.out/bin/ob
Starting Obelisk </nix/store/5qhw99ipn683vik513frrqraz8c3p07j-obelisk-command-0.9.0.1/bin/.ob-wrapped> args=["--no-handoff","run","-v"] logging-level=Debug
Finding packages with root "." and interpret paths:
?? /
   ?? home
      ?? max
         ?? Public
            ?? dodjo
               ?? studying
                  ?? learn-you-a-haskell
                     ?? obelisk-test [Interpret]
Creating process: /nix/store/k0kpf3r2k1d8p9h0gmx23msw3qrybkfk-findutils-4.9.0/bin/find -L . -name .obelisk -type d
Excluding obelisk packages: 
Creating process: /nix/store/k0kpf3r2k1d8p9h0gmx23msw3qrybkfk-findutils-4.9.0/bin/find -L /home/max/Public/dodjo/studying/learn-you-a-haskell/obelisk-test $'(' -name $'*.cabal' -o -name package.yaml $')' -a -type f -not -path $'*/.attr-cache/*' -not -path $'*/lib/asset/manifest/*'
Creating process: /nix/store/7wfnj6hg24p9v212qfx81a16f6rnaqzy-nix-2.11.0/bin/nix eval --impure --expr $'(let a = import ./. {}; in toString (a.reflex.nixpkgs.lib.isDerivation a.passthru.staticFilesImpure))' --raw
error: experimental Nix feature 'nix-command' is disabled; use '--extra-experimental-features nix-command' to override
Process exited with code 1; /nix/store/7wfnj6hg24p9v212qfx81a16f6rnaqzy-nix-2.11.0/bin/nix eval --impure --expr $'(let a = import ./. {};
 in toString (a.reflex.nixpkgs.lib.isDerivation a.passthru.staticFilesImpure))' --raw

Nix version : 2.18.1
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 = true

my cat .obelisk/impl/github.json:

{
  "owner": "obsidiansystems",
  "repo": "obelisk",
  "branch": "master",
  "private": false,
  "rev": "58c04270d606c061e7ffd2f16345e0f451eba600",
  "sha256": "167h4qkkc7rvhwlfbv3fdj3gd8jn5svdawh2vzpi04j9xlsw3jlf"
}

Could somebody help me, please?

@alexfmpe
Copy link
Contributor

@Max0nyshchenko you need experimental-features = nix-command in your nix.conf, see https://nixos.wiki/wiki/Nix_command

@ali-abrar should obelisk use nix-instantiate --eval instead to avoid this issue until nix-command is no longer experimental? If not the readme probably should warn about it, given we rely on it thrice.

$ git grep -n '"eval"' 
lib/command/src/Obelisk/Command/Project.hs:308:    proc nixExePath ["eval", "(import .obelisk/impl {}).nixpkgs.path"]
lib/command/src/Obelisk/Command/Project.hs:402:      [ "eval"
lib/command/src/Obelisk/Command/Project.hs:417:        proc nixExePath ["eval", "-f", ".", "passthru.staticFilesImpure", "--raw"]

@Max0nyshchenko
Copy link

Thanks, working now

@alexfmpe
Copy link
Contributor

alexfmpe commented Apr 8, 2024

@ali-abrar should obelisk use nix-instantiate --eval instead to avoid this issue until nix-command is no longer experimental? If not the readme probably should warn about it, given we rely on it thrice.

Welp

, "--raw"
-- `--raw` is not available with old nix-instantiate. It drops quotation
-- marks and trailing newline, so is very convenient for shelling out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants