Use a package from another repository with flakes

Hey there,

i am in need of your expertise.

In my current config i am using llvm15 from rrbutani via:
llvm15 = import (builtins.fetchTarball "") { config = config.nixpkgs.config; };

now i am trying to put my config into a flake and i get an error message
error: in pure evaluation mode, 'fetchTarball' requires a 'sha256' argument

i am using this for overriding my mesa packages with
hardware.opengl.package = (pkgs.mesa.override { llvmPackages = llvm15.llvmPackages_15; enableOpenCL = false; }).drivers;

how can i achieve that via flakes ?

As the message says, you need to specify a hash. You can specify a bad hash (I think "" works), and nix will tell you what hash it actually got when it errors out. Then you use that.

However if this is an input that will update with time, better to use a flake input instead.


this worked, thank you very much … now it seems i have to use --impure for the rebuild … it is because of i am fetching a tarball in my configuration.nix ?

No. If the hash as been specified, that’s pure. Why do you say you need to use --impure?

because i am getting this now:

building the system configuration...
error: attribute 'currentSystem' missing

       at /nix/store/icnzf03j35lkl6nv2h655vg6bhr6y3ja-source/pkgs/top-level/impure.nix:17:43:

           16|   # (build, in GNU Autotools parlance) platform.
           17|   localSystem ? { system = args.system or builtins.currentSystem; }
             |                                           ^
(use '--show-trace' to show detailed location information)

You’re importing nixpkgs somewhere without specifying a system value, apparently. Specify it and that should go away. --show-trace may help you find where you’re doing so.

1 Like

i got it


  llvm15 = import (builtins.fetchTarball {
    url = "";
    sha256 = "sha256:0dp2jakn0rpdvcsxzbpg37ifqh2lzcbdm2ycsqrs8sjdfrl7bj2m";
  }) { config = config.nixpkgs.config;  };

turned to this

  llvm15 = import (builtins.fetchTarball {
    url = "";
    sha256 = "sha256:0dp2jakn0rpdvcsxzbpg37ifqh2lzcbdm2ycsqrs8sjdfrl7bj2m";
  }) { config = config.nixpkgs.config; system = "x86_64-linux"; };

thank you very much … hopefully llvm15 gets into “unstable” soon together with mesa 23 when it is released