Help using unstable packages with home manager and overlays

I just started using nixos and have a basic understanding of how the nix language works. I have been using Misterio nixos config with home manager

In my flake.nix, I was able to use the neovim nightly overlay, I define the URL where the flake is on github, and use the inputs inside overlays. This allows me to define the neovim package and it gives me the neovim inside the neovim-nightly repository version.

I am trying to do the same thing for the devenv package, it is only available in unstable and inside the devenv repository there is a flake.

I am unable to define inputs.devenv.overlay. I am still confused to why this does not work, if there is something inside flake.nix that lets it become an overlay? or if I am doing this wrong or if there is a better way.

flake.nix

{
  description = "Your new nix config";

  inputs = {
    # Nixpkgs
    nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
    # You can access packages and modules from different nixpkgs revs
    # at the same time. Here's an working example:
    nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
    # Also see the 'unstable-packages' overlay at 'overlays/default.nix'.

    # Home manager
    home-manager.url = "github:nix-community/home-manager/release-23.11";
    home-manager.inputs.nixpkgs.follows = "nixpkgs";

    # TODO: Add any other flake you might need
    hardware.url = "github:nixos/nixos-hardware";
    neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
    devenv.url = "github:cachix/devenv"; 

    # Shameless plug: looking for a way to nixify your themes and make
    # everything match nicely? Try nix-colors!
    # nix-colors.url = "github:misterio77/nix-colors";
  };

......

    # Standalone home-manager configuration entrypoint
    # Available through 'home-manager --flake .#your-username@your-hostname'
    homeConfigurations = {
      "me@asus" = home-manager.lib.homeManagerConfiguration {
        pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
        extraSpecialArgs = {inherit inputs outputs;};
        modules = [
          # > Our main home-manager configuration file <
          ./home-manager/home.nix
        ];
      };
    };
  };
}

home.nix

{
  inputs,
  outputs,
  lib,
  config,
  pkgs,
  ...
}: {
  # You can import other home-manager modules here
  imports = [
    # If you want to use modules your own flake exports (from modules/home-manager):
    # outputs.homeManagerModules.example

    # Or modules exported from other flakes (such as nix-colors):
    # inputs.nix-colors.homeManagerModules.default

    # You can also split up your configuration and import pieces of it here:
    # ./nvim.nix
  ];



  nixpkgs = {
    # You can add overlays here
    overlays = [
      # Add overlays your own flake exports (from overlays and pkgs dir):
      outputs.overlays.additions
      outputs.overlays.modifications
      outputs.overlays.unstable-packages

      # You can also add overlays exported from other flakes:
      inputs.neovim-nightly-overlay.overlay
      # inputs.devenv.overlay <--- problem is here

      # Or define it inline, for example:
      # (final: prev: {
      #   hi = final.hello.overrideAttrs (oldAttrs: {
      #     patches = [ ./change-hello-to-hi.patch ];
      #   });
      # })
    ];
    # Configure your nixpkgs instance
    config = {
      # Disable if you don't want unfree packages
      allowUnfree = true;
      # Workaround for https://github.com/nix-community/home-manager/issues/2942
      allowUnfreePredicate = _: true;
      permittedInsecurePackages = [
        "electron-25.9.0"
      ];
    };
  };



  home = {
    username = "me";
    homeDirectory = "/home/me";
    packages = with pkgs; [
      
      # browsers
      firefox
      
      neovim
      #devenv 

    ];
  };

  # Nicely reload system units when changing configs
  systemd.user.startServices = "sd-switch";

  # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
  home.stateVersion = "23.11";
}

The flake output schema does not enforce how overlays are defined at the moment, so everyone’s doing it differently.

To find out what’s exposed in a flake, you can either look at the outputs or run a command as follows:

$ nix flake show github:cachix/devenv
github:cachix/devenv/a18e86ab317a82c2e7d626d28ba1b3a9eb11d23b
├───flakeModule: unknown
├───hasTmpDir: unknown
├───lib: unknown
├───modules: unknown
├───overlays
│   └───default: Nixpkgs overlay

You can see it’s actually named overlays.default: devenv/flake.nix at a18e86ab317a82c2e7d626d28ba1b3a9eb11d23b · cachix/devenv · GitHub

To use that overlay, you need to replace nixpkgs.legacyPackages.x86_64-linux; as follows:

{
  pkgs = import inputs.nixpkgs {
     system = "x86_64-linux"; # modify accordingly
     overlays = [ inputs.devenv.overlays.default ];
  };
}

Hope that helps!

I’m just noticing this bit. You can change that for overlays.default and it should work.

I see! Thank you, this helps. I am not on my computer with nixos right now, but I did not know the flake output schema was not enforced.

nix flake show github:cachix/devenv
would output overlays.default

and the way the neovim-nightly is enforced only needs .overlay

I believe I might have tried inputs.devenv.overlays.default, but it ended up building for a few hours which doesn’t make any sense. This doesn’t happen when I uncomment it out

Is there where neovim-nightly enforces their overlay? Here is only says .overlay

It’s using the flake-parts library, so it’s not immediately obvious, but you can always do:

$ nix flake show github:nix-community/neovim-nightly-overlay
github:nix-community/neovim-nightly-overlay/09024a489682a921a76c0e881cccd7a3d91e854a
├───defaultPackage
│   ├───aarch64-darwin omitted (use '--all-systems' to show)
│   ├───aarch64-linux omitted (use '--all-systems' to show)
│   ├───x86_64-darwin omitted (use '--all-systems' to show)
│   └───x86_64-linux: package 'neovim-unwrapped-feaab21'
├───herculesCI: unknown
├───overlay: Nixpkgs overlay
├───overlays
│   └───default: Nixpkgs overlay
└───packages

As you can see, overlay is just an alias for overlays.default.