Use overlays in Repl nix config

Hi,

I would like to use this Rust overlay: GitHub - oxalica/rust-overlay: Pure and reproducible nix overlay of binary distributed rust toolchains

But I can’t make it work. It seems that a Repl doesn’t support overlays. Am I wrong?

I also tried this overlay: GitHub - mozilla/nixpkgs-mozilla: Mozilla overlay for Nixpkgs.

And specifically this code in shell.nix:

let
  moz_overlay = import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz);
  nixpkgs = import <nixpkgs> { overlays = [ moz_overlay ]; };
in
  with nixpkgs;
  stdenv.mkDerivation {
    name = "moz_overlay_shell";
    buildInputs = [
      # to use the latest nightly:
      nixpkgs.latest.rustChannels.nightly.rust
      # to use a specific nighly:
      (nixpkgs.rustChannelOf { date = "2018-04-11"; channel = "nightly"; }).rust
      # to use the project's rust-toolchain file:
      (nixpkgs.rustChannelOf { rustToolchain = ./rust-toolchain; }).rust
    ];
  }

But I get this error:

nix error: building nix env: exit status 1
evaluating file '/nix/store/nzp4m3cmm7wawk031byh8jg4cdzjq212-nix-2.3.16/share/nix/corepkgs/derivation.nix'
evaluating file '/home/runner/MultiversX-SC-Development/shell.nix'
evaluating file '/home/runner/.nix-defexpr/channels/nixpkgs-unstable'
error: anonymous function at /nix/store/pdq4jajdm4cx5dxmcwknhz8i5amynigy-nixpkgs-unstable/nixpkgs-unstable/default.nix:1:1 called with unexpected argument 'overlays', at /home/runner/MultiversX-SC-Development/shell.nix:3:13

Any idea why?

I encountered the same issue trying to use GitHub - lopsided98/nix-ros-overlay: ROS overlay for the Nix package manager.
It seems like replit does not have a standard nix package manager version as nix flake is not a valid command in replit… which is rather unfortunate.

Hey @TheoParis and @lcswillems!

Thank you for reporting these issues. We do not currently support Nix overlays or flakes at the moment. We do have plans to update our Nix infrastructure but we do not have an ETA on when that will happen.

2 Likes