Skip to content

Instantly share code, notes, and snippets.

@corpix
Last active August 7, 2019 23:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save corpix/03215752fa7e1a7df8e7ab1cc70d1a67 to your computer and use it in GitHub Desktop.
Save corpix/03215752fa7e1a7df8e7ab1cc70d1a67 to your computer and use it in GitHub Desktop.

We have nixpkgs= and nixpkgs-overlays= in NIX_PATH:

$ echo $NIX_PATH | sed 's/:/\n/g'
nixpkgs=/nix/store/5mvvx7k39vz95il4vsxli8dlaivkvwma-nixpkgs
nixpkgs-overlays=/nix/store/r6sh2454inzkmw9sc5vqizf46nvdv359-overlay
/home/user/projects/src/local/deploy

It works pretty well with nix repl:

$ nix repl '<nixpkgs>'
Welcome to Nix version 2.2.2. Type :? for help.

nix-repl> pkgs.overlays
[ «lambda @ /nix/store/r6sh2454inzkmw9sc5vqizf46nvdv359-overlay/default.nix:1:1» ]

But it not working for system configuration which could be nix-instantiate'ed:

if replace pkgs.overlays with (import <nixpkgs> {}).pkgs.overlays it prints a list of lambdas, this proves that overlays exists and this is not a nix-instantiate problem, but this is not a solution

# $ cat machine.nix 
let nixos = {
  system = "x86_64-linux";
  configuration = { config, pkgs, ... }: {
    networking.hostName = builtins.trace pkgs.overlays "overlays-are-gone";
  };
}; in (import <nixpkgs/nixos> nixos).system

pkgs.overlays is empty:

$ nix-instantiate ./machine.nix 
trace: [ ]
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment