golem icon indicating copy to clipboard operation
golem copied to clipboard

Nixfying

Open countoren opened this issue 1 year ago • 12 comments

countoren avatar May 27 '24 18:05 countoren

Thanks @countoren for nixifying 👍

I am testing your branch right now, but bumping into some errors.


nix-shell
error:
       … while calling a functor (an attribute set with a '__functor' attribute)

         at /Users/afsalthaj/github/nix/golem/default.nix:9:1:

            8| }:
            9| pkgs.rustPlatform.buildRustPackage {
             | ^
           10|   pname = "golem-cli";

       error: assertion '((cargoVendorDir == null) -> (! ((cargoSha256 == "") && (cargoHash == ""))))' failed

       at /nix/store/01sqyyi3b57wh47aax0mzyidyzg08qsk-nixpkgs-21.05pre273666.d1257435332/nixpkgs/pkgs/build-support/rust/default.nix:58:1:

           57|
           58| assert cargoVendorDir == null -> !(cargoSha256 == "" && cargoHash == "");
             | ^
           59| assert buildType == "release" || buildType == "debug";

afsalthaj avatar May 29 '24 10:05 afsalthaj

Any updates on this @countoren ? We would like to get this in, just that I was having trouble testing this branch. https://github.com/golemcloud/golem/pull/536#issuecomment-2137092258

afsalthaj avatar Sep 06 '24 04:09 afsalthaj

Hi @afsalthaj,

I missed the first comment, did you try:

nix develop

instead of nix-shell

countoren avatar Sep 06 '24 11:09 countoren

I think i was able to replicate the issue I will try to fix it this weekend.

countoren avatar Sep 07 '24 13:09 countoren

image i was able to nix-build on my end but I had an issue with nix build (flake) this might mean that your local nixpkgs might refer to a set that is not compatible I will try to fix the nix build flake one to have it on a "locked" packages as well from your side.

countoren avatar Sep 07 '24 13:09 countoren

Just add missing explicit import tested it here on a fresh cloned repo. test now if you can :

nix build

to get the a result with golem cli and

nix develop

to jump into the dev shell

countoren avatar Sep 08 '24 14:09 countoren

@countoren Thank you for this. I will try nix soon and if works, we will get it merged.

afsalthaj avatar Sep 09 '24 10:09 afsalthaj

It hasn't worked for me. I have not been following nix for more than a year. That said, it's going to be harder for developers and maintain this, as it seems it may work in 1 machine and not in the other.


error: flake 'git+file:///..../nixed/golem' does not provide attribute 'devShells.x86_64-darwin.default', 'devShell.x86_64-darwin', 'packages.x86_64-darwin.default' or 'defaultPackage.x86_64-darwin'
       Did you mean devShells?

afsalthaj avatar Sep 18 '24 14:09 afsalthaj

@countoren Nix-shell worked for me

'/nix/store/ma6za5vicwdys9jr5qbfpfc3m88z0j9w-wasmtime-c2e97ff/crates/wasi-common/WASI/tools/witx/src/ast.rs' -> '/nix/store/bdsf6ihs4yqfq5zyrikf2hjf7mdvyyc1-witx-0.9.1/src/ast.rs'
'/nix/store/ma6za5vicwdys9jr5qbfpfc3m88z0j9w-wasmtime-c2e97ff/crates/wasi-common/WASI/tools/witx/src/validate.rs' -> '/nix/store/bdsf6ihs4yqfq5zyrikf2hjf7mdvyyc1-witx-0.9.1/src/validate.rs'
'/nix/store/ma6za5vicwdys9jr5qbfpfc3m88z0j9w-wasmtime-c2e97ff/crates/wasi-common/WASI/tools/witx/src/parser.rs' -> '/nix/store/bdsf6ihs4yqfq5zyrikf2hjf7mdvyyc1-witx-0.9.1/src/parser.rs'
'/nix/store/ma6za5vicwdys9jr5qbfpfc3m88z0j9w-wasmtime-c2e97ff/crates/wasi-common/WASI/tools/witx/src/phases.rs' -> '/nix/store/bdsf6ihs4yqfq5zyrikf2hjf7mdvyyc1-witx-0.9.1/src/phases.rs'
building '/nix/store/k0g60rs0b0vc68fakhbjnaz3a19cw3vl-cargo-vendor-dir.drv'...

[nix-shell:~/projects/nixed/golem]$

afsalthaj avatar Sep 18 '24 15:09 afsalthaj

[nix-shell:~/projects/hello/nixed/golem]$ which cargo
/nix/store/xggv43lp8l2nq5qhgpzihiwf1dsw9nl0-auditable-cargo-1.80.1/bin/cargo

Not sure rustup is still pointing to my own installation.

So in short, nix-shell finally worked for me, and not nix-develop

afsalthaj avatar Sep 18 '24 15:09 afsalthaj

It hasn't worked for me. I have not been following nix for more than a year. That said, it's going to be harder for developers and maintain this, as it seems it may work in 1 machine and not in the other.


error: flake 'git+file:///..../nixed/golem' does not provide attribute 'devShells.x86_64-darwin.default', 'devShell.x86_64-darwin', 'packages.x86_64-darwin.default' or 'defaultPackage.x86_64-darwin'
       Did you mean devShells?

it was seatching for devShell did you try nix build?

countoren avatar Sep 20 '24 10:09 countoren

@countoren @vigoo I have been packaging golem not being aware of this branch and I have proposed some changes to upstream golem-wasm-rpc and golem-examples to allow specifying the paths through an environment variable.

The package expression can be found here https://github.com/NixOS/nixpkgs/pull/344289

Having golem in nixpkgs would also not require you to maintain Nix inside of this repository

marijanp avatar Sep 24 '24 20:09 marijanp