Okay, I read a couple of sources about overlays + posted on here, but still have no idea how overlays work.
Here is my nixos configuration folder structure
├── flake.lock
├── flake.nix
├── home
│ ├── default.nix
│ ├── overlays
│ │ ├── default.nix
│ │ └── steam.nix
│ └── programs
│ ├── common.nix
│ ├── default.nix
│ ├── texlive.nix
│ └── tmux.nix
├── hosts
│ └── my-host
│ ├── default.nix
│ ├── hardware-configuration.nix
│ └── power.nix
└── modules
├── awesome.nix
└── system.nix
I tried, for the sake of understanding, to implement the steam overlay from Overlays | NixOS & Flakes Book. Here’s how I did it:
- this is the content of the file
home/overlays/default.nix
{ config, pkgs, lib, ... }:
{
nixpkgs.overlays = [
# Overlay: Define overlays in other files
# The content of ./overlays/overlay3/default.nix is the same as above:
# `(final: prev: { xxx = prev.xxx.override { ... }; })`
(import ./steam.nix)
];
}
- this is the content of
home/overlays/steam.nix
(taken from Overlays | NixOS & Flakes Book)
(final: prev: {
steam-over = prev.steam.override {
pname = "steam-over";
extraPkgs = pkgs: with pkgs; [
keyutils
libkrb5
libpng
libpulseaudio
libvorbis
stdenv.cc.cc.lib
xorg.libXcursor
xorg.libXi
xorg.libXinerama
xorg.libXScrnSaver
];
extraProfile = "export GDK_SCALE=2";
};
})
- I let home-manager know the include the overlays, via imports in
home/default.nix
{ config, pkgs, ...}:
{
imports = [
./programs
./overlays
];
home = {
username = "some-username";
homeDirectory = "/home/some-username";
stateVersion = "23.05";
};
# workaround to fix manpages not building propertly
manual.manpages.enable = false;
# Let home-manager manage itself
programs.home-manager.enable = true;
}
- then I try to install the new overlay, which i names steam-over via including it in the file
home/programs/common.nix
{ pkgs, ...} : {
home.packages = with pkgs; [
steam-over
];
}
However, when I try to rebuild and switch, I get an error:
error:
… while calling the 'head' builtin
at /nix/store/18v62ywqkpymp7asswy8d3239zii9pcd-source/lib/attrsets.nix:922:11:
921| || pred here (elemAt values 1) (head values) then
922| head values
| ^
923| else
… while evaluating the attribute 'value'
at /nix/store/18v62ywqkpymp7asswy8d3239zii9pcd-source/lib/modules.nix:807:9:
806| in warnDeprecation opt //
807| { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
808| inherit (res.defsFinal') highestPrio;
(stack trace truncated; use '--show-trace' to show the full trace)
error: undefined variable 'steam-over'
at /nix/store/64lj8f9zmkshrznk66lfbsk9lkxfwsxp-source/home/programs/common.nix:103:5:
103| steam-over
| ^
104|