Unsure how to configure nixpkgs-wayland without flakes

I’m still new to NixOS and I’ve been avoiding flakes so far because I like the idea of keeping everything in as few files as possible. I’ve slightly modified the example given on the nixpkgs-wayland github page, based on a working configuration using the nixpkgs-xr overlay.

My reason for using the nixpkgs-wayland overlay is that I want access to the newest versions of the included packages for window capture.

I’m not sure why the error indicates the issue is in bluetooth.nix, AFAIK I haven’t changed any settings related to Bluetooth.

Here is my source file which is imported into my configuration.nix.

{ config, lib, pkgs, ... }:
let
  rev = "master"; # 'rev' could be a git rev, to pin the overlay.
  url = "https://github.com/nix-community/nixpkgs-wayland/archive/${rev}.tar.gz";
  waylandOverlay = (import "${builtins.fetchTarball url}/overlay.nix");
in
  {
    nixpkgs.overlays = [ waylandOverlay.overlays.default ];
    # ...
  }

When I run nixos-rebuild I get the following result:

❯ sudo nixos-rebuild switch
error:
       … while evaluating the attribute 'config'
         at /nix/store/k7lxv12srafdbj7qwr89yhfwg0c7c1yq-nixos-25.11/nixos/lib/modules.nix:361:9:
          360|         options = checked options;
          361|         config = checked (removeAttrs config [ "_module" ]);
             |         ^
          362|         _module = checked (config._module);

       … while calling the 'seq' builtin
         at /nix/store/k7lxv12srafdbj7qwr89yhfwg0c7c1yq-nixos-25.11/nixos/lib/modules.nix:361:18:
          360|         options = checked options;
          361|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          362|         _module = checked (config._module);

       … while evaluating the module argument `pkgs' in "/nix/store/k7lxv12srafdbj7qwr89yhfwg0c7c1yq-nixos-25.11/nixos/nixos/modules/services/hardware/bluetooth.nix":

       … noting that argument `pkgs` is not externally provided, so querying `_module.args` instead, requiring `config`

       … while evaluating the option `nixpkgs.overlays':

       … while evaluating definitions from `/etc/nixos/wayland.nix':

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

       error: expected a set but found a function: «lambda waylandOverlay @ /nix/store/p0ss1ch9ffkrynybmp49m05hs5lgd8li-source/flake.nix:31:9»
Command 'nix-build '<nixpkgs/nixos>' --attr config.system.build.nixos-rebuild --no-out-link' returned non-zero exit status 1.

I can provide the full trace if it would be helpful.

Any help would be appreciated.

I wouldn’t recommend this. For one, not specifying a hash with fetch functions means that nix will download a new copy of the file every hour or so. This means your expression is not reproducible, and will keep being very slow.

Secondly, once you do start specifying hashes, updating will become a pain, because you’ll have to go in manually and change them.

Bite the bullet and do multi-file things, if you don’t like flakes, there’s npins which is is much more transparent; it just does what you’re trying to do, except correctly and with automation.

2 Likes

Fair enough, thanks for the pointers.