itsfarseen / solana-flake

Nix flake for Solana development
8 stars 4 forks source link

Step by step usage instructions? #1

Open kathodler opened 2 years ago

kathodler commented 2 years ago

Hi just new to NixOS so was wondering if you might be able to share some detailed instructions on how to set this up as a newb? I am really not sure where to begin with flakes. I have a basic nixos installation and am familiar with nix syntax but step by step instructions would really help from the perspective of someone who wants to do solana development in nixos.

itsfarseen commented 2 years ago

Here's a simpified version of what I use:

{
  description = "Solana dev flake example";
  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.05";
  inputs.solana.url = "github:itsfarseen/solana-flake";

  outputs = { self, nixpkgs, solana }: 
  with import nixpkgs {
    system = "x86_64-linux";
  }; {
    devShells.${system}.default = pkgs.mkShell {
      packages = with pkgs; [
        solana.packages.${system}.default
      ];
    };
  };
}
itsfarseen commented 2 years ago

Put the above code in a file named flake.nix in the root folder of your project and run nix develop to get into the dev shell.

bossvip commented 1 week ago

Hi @itsfarseen. I'm getting an error with your code above. How to fix?

error:
       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:34:12:
           33|
           34|   strict = derivationStrict drvAttrs;
             |            ^
           35|

       … while evaluating derivation 'nix-shell'
         whose name attribute is located at /nix/store/8drxi4s8n69hdv4mp4jiqsi71yaxv8i6-source/pkgs/stdenv/generic/make-derivation.nix:278:7

       … while evaluating attribute 'nativeBuildInputs' of derivation 'nix-shell'
         at /nix/store/8drxi4s8n69hdv4mp4jiqsi71yaxv8i6-source/pkgs/stdenv/generic/make-derivation.nix:319:7:
          318|       depsBuildBuild              = lib.elemAt (lib.elemAt dependencies 0) 0;
          319|       nativeBuildInputs           = lib.elemAt (lib.elemAt dependencies 0) 1;
             |       ^
          320|       depsBuildTarget             = lib.elemAt (lib.elemAt dependencies 0) 2;

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: cannot fetch input 'path:./solana-cli?lastModified=1&narHash=sha256-aNu9tapxV6F7n2NvNcTr%2BHAfOygbdeKj99Qy8Zjch%2BA%3D' because it uses a relative path