I’m new to NixOS, I normally use Arch and Debian so I’ve been having difficulty with the learning curve. I installed 24.05 + Plasma 6 on a spare laptop to try, hoping to eventually replace Arch on my main workstation. I got home-manager working as a module in my configuration.nix, and I want to be able to configure my AC and battery settings in powerdevil - from what I’ve been able to figure out, it looks like I need plasma-manager to do this. I’m trying to follow the basic example here, I ran sudo nix-channel --add https://github.com/nix-community/plasma-manager/archive/trunk.tar.gz plasma-manager
and sudo nix-channel --update plasma-manager
, but when I add <plasma-manager/modules>
to my imports list in configuration.nix and run sudo nixos-rebuild switch
, I get three identical errors like below, even before adding any settings that use it. I don’t understand why it’s complaining about okular, I don’t even have that installed.
error:
… while evaluating the attribute 'config'
at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:322:9:
321| options = checked options;
322| config = checked (removeAttrs config [ "_module" ]);
| ^
323| _module = checked (config._module);
… while calling the 'seq' builtin
at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:322:18:
321| options = checked options;
322| config = checked (removeAttrs config [ "_module" ]);
| ^
323| _module = checked (config._module);
(stack trace truncated; use '--show-trace' to show the full trace)
error: The option `home' does not exist. Definition values:
- In `/nix/var/nix/profiles/per-user/root/channels/plasma-manager/modules/apps/okular.nix':
{
packages = {
_type = "if";
condition = false;
content = [
...
What am I doing wrong? I’ve been frustrated trying to get random things working with very little documentation I can find that I’m about to just give up on the whole NixOS thing altogether.
TL;DR: plasma-manager is for Home Manager, not NixOS.
See the home manager docs to install home manager, and import plasma-manager like this (ignore the references to flakes).
You’re importing plasma-manager as a NixOS module, but it’s a home manager module.
The home
option exists in home-manager, but not NixOS.
The reason you see this error with doing any is (in my opinion, and maybe other’s) a bad implementation in the okular module:
config = {
home.packages = lib.mkIf (cfg.enable) [ cfg.package ];
};
Even if you configure nothing, just importing the module means home.packages
get defined as something, possibly null
.
For reference, this is a better way, that the NixOS module system uses:
config = lib.mkIf cfg.enable {
home.packages = [ cfg.package ];
# Other stuff
};
You need to set up home manager, and include something like this (ignore the references to flakes).
Thanks! This is exactly what I needed to put the puzzle together. For anyone else Googling this like I was, my configuration.nix looks like this:
{ config, pkgs, ... }:
{
imports = [
./hardware-configuration.nix
<home-manager/nixos>
];
boot.loader = {
grub = {
enable = true;
efiSupport = true;
default = "saved";
device = "nodev";
# GRUB will load menu entries for dual boot from /boot/grub/custom.cfg
extraConfig = ''
if [ -f ''${config_directory}/custom.cfg ]; then
source ''${config_directory}/custom.cfg
elif [ -z "''${config_directory}" -a -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg
fi
'';
};
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot";
};
};
console.font = "Lat2-Terminus16";
nix.settings.experimental-features = [ "nix-command" "flakes" ];
networking.hostName = "laptop"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "America/New_York";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
# Enable the X11 windowing system.
# You can disable this if you're only using the Wayland session.
# services.xserver.enable = true;
# Enable the KDE Plasma Desktop Environment.
services.displayManager.sddm.enable = true;
services.displayManager.sddm.wayland.enable = true;
services.desktopManager.plasma6.enable = true;
# Configure keymap in X11
services.xserver.xkb = {
layout = "us";
variant = "";
};
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable sound with pipewire.
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
# Enable touchpad support (enabled default in most desktopManager).
# services.libinput.enable = true;
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.matt = {
isNormalUser = true;
description = "Matt";
extraGroups = [ "networkmanager" "wheel" ];
};
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.sharedModules = [ <plasma-manager/modules> ];
home-manager.users.matt = { pkgs, ... }: {
programs.plasma = {
enable = true;
kwin.effects.blur.enable = true;
kscreenlocker.autoLock = false;
powerdevil = {
AC = {
powerButtonAction = "sleep";
autoSuspend = {
action = "nothing";
# idleTimeout = null;
};
whenSleepingEnter = "standby";
whenLaptopLidClosed = "sleep";
inhibitLidActionWhenExternalMonitorConnected = true;
turnOffDisplay = {
idleTimeout = "never";
# idleTimeoutWhenLocked = 600;
};
dimDisplay = {
enable = true;
idleTimeout = 600;
};
};
battery = {
powerButtonAction = "sleep";
autoSuspend = {
action = "sleep";
idleTimeout = 900;
};
whenSleepingEnter = "standby";
whenLaptopLidClosed = "sleep";
inhibitLidActionWhenExternalMonitorConnected = true;
turnOffDisplay = {
idleTimeout = 600;
idleTimeoutWhenLocked = 30;
};
dimDisplay = {
enable = true;
idleTimeout = 300;
};
};
};
};
programs.bash.enable = true;
home.stateVersion = "24.05";
};
# Enable automatic login for the user.
services.displayManager.autoLogin.enable = true;
services.displayManager.autoLogin.user = "matt";
# Install firefox.
programs.firefox.enable = true;
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
btop
git
kdePackages.filelight
kdePackages.kate
kdePackages.sddm-kcm
libnfs
libreoffice
nfs-utils
sshfs
vlc
vscodium
wget
];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
system.stateVersion = "24.05";
}