I’ve been trying to style my system using stylix but decided to remove it because it’s not correctly styling the browser (it somehow chose a colour not defined in the base16 scheme).
Initially when I added stylix, I got the error that home-manager-username.service
failed to start, and the suggested solution was to set home-manager.backFileExtension
which I added and was able to install stylix without issues.
After removing stylix, I could still build new generations without issues. I was previously trying to fix the inconsistent cursor size where the cursor is tiny everywhere else except when I hover over waybar (which stylix somehow fixed). After removing stylix I noticed that the cursor is tiny even on waybar now (it’s consistent at least, this is because home-manager failed to start) so I went back to an earlier generation to check (generation 9 or something) and swapped back to the current generation (140+). But I noticed that home-manager failed to start and rebuilding gives me the same error I got when installing stylix
activating the configuration...
setting up /etc...
reloading user units for username...
restarting sysinit-reactivation.target
the following new units were started: sysinit-reactivation.target, systemd-tmpfiles-resetup.service
warning: the following units failed: home-manager-username.service
× home-manager-username.service - Home Manager environment for username
Loaded: loaded (/etc/systemd/system/home-manager-username.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Wed 2024-07-24 11:17:52 AWST; 40ms ago
Process: 7749 ExecStart=/nix/store/qznyj3wda5rqh2j67g6xhgnf9b1wgijw-hm-setup-env /nix/store/qhvd83q89vs38b5kvl5klgv7rcbbcyh8-home-manager-generation (code=exited, status=1/FAILURE)
Main PID: 7749 (code=exited, status=1/FAILURE)
IP: 0B in, 0B out
CPU: 88ms
Jul 24 11:17:52 rotom hm-activate-username[7837]: Please do one of the following:
Jul 24 11:17:52 rotom hm-activate-username[7837]: - Move or remove the above files and try again.
Jul 24 11:17:52 rotom hm-activate-username[7837]: - In standalone mode, use 'home-manager switch -b backup' to back up
Jul 24 11:17:52 rotom hm-activate-username[7837]: files automatically.
Jul 24 11:17:52 rotom hm-activate-username[7837]: - When used as a NixOS or nix-darwin module, set
Jul 24 11:17:52 rotom hm-activate-username[7837]: 'home-manager.backupFileExtension'
Jul 24 11:17:52 rotom hm-activate-username[7837]: to, for example, 'backup' and rebuild.
Jul 24 11:17:52 rotom systemd[1]: home-manager-username.service: Main process exited, code=exited, status=1/FAILURE
Jul 24 11:17:52 rotom systemd[1]: home-manager-username.service: Failed with result 'exit-code'.
Jul 24 11:17:52 rotom systemd[1]: Failed to start Home Manager environment for username.
warning: error(s) occurred while switching to the new configuration
backupFileExtension
was still set to "backup"
(I didn’t change it back), removing it also doesn’t do anything. I’m really not sure why it’s failing. My config files are below with most comments stripped.
flake.nix
{
description = "Nixos config flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
hardware.url = "github:NixOS/nixos-hardware/master";
systems.url = "github:nix-systems/default-linux";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs"; # force HM to use same nixpkgs version as flake
};
hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1";
hyprland-plugins = {
url = "git+https://github.com/hyprwm/hyprland-plugins";
inputs.hyprland.follows = "hyprland";
};
};
outputs = {
self,
nixpkgs,
home-manager,
systems,
...
} @ inputs: let
inherit (self) outputs;
lib = nixpkgs.lib // home-manager.lib;
forEachSystem = f: lib.genAttrs (import systems) (system: f pkgsFor.${system});
pkgsFor = lib.genAttrs (import systems) (
system:
import nixpkgs {
inherit system;
config.allowUnfree = true;
}
);
in {
inherit lib;
devShells = forEachSystem (pkgs: import ./shell.nix {inherit pkgs;});
nixosConfigurations = {
rotom = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;};
modules = [
./hosts/rotom/configuration.nix
inputs.home-manager.nixosModules.default
];
};
};
};
}
configuration.nix
{
config,
pkgs,
inputs,
home-manager,
lib,
...
}: {
imports = [
./hardware-configuration.nix
inputs.hardware.nixosModules.framework-16-7040-amd
];
system.stateVersion = "24.05"; # DO NOT CHANGE
nix = let
flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs;
in {
settings = {
experimental-features = [
"nix-command"
"flakes"
];
# Opinionated: disable global registry
flake-registry = "";
# Workaround for https://github.com/NixOS/nix/issues/9574
nix-path = config.nix.nixPath;
};
# Opinated: disable channels
channel.enable = false;
# Opinionated: make flake registry and nix path match flake inputs
registry = lib.mapAttrs (_: flake: {inherit flake;}) flakeInputs;
nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs;
# Garbage collector
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 14d";
};
# Perodic optimisation
optimise.automatic = true;
optimise.dates = ["09:00"];
};
system.autoUpgrade = {
enable = true;
flake = inputs.self.outPath;
flags = [
"--update-input"
"nixpkgs"
"-L" # Print build logs
];
dates = "09:00"; # Update at this time
randomizedDelaySec = "45min"; # random delay, reduce load if multiple system scheduled update
};
home-manager = {
extraSpecialArgs = {inherit inputs;};
users = {
"username" = import ../../home/username/rotom.nix; # use home.nix only for "username"
};
useGlobalPkgs = true;
};
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "rotom"; # Define your hostname.
# Enable networking
networking.networkmanager = {
enable = true;
wifi.backend = "iwd";
};
networking.wireless.iwd = {
enable = true;
settings = {
IPv6 = {
Enabled = true;
};
Settings = {
AutoConnect = true;
};
};
};
# Set your time zone.
time.timeZone = "Australia/Perth";
# Select internationalisation properties.
i18n.defaultLocale = "en_GB.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_AU.UTF-8";
LC_IDENTIFICATION = "en_AU.UTF-8";
LC_MEASUREMENT = "en_AU.UTF-8";
LC_MONETARY = "en_AU.UTF-8";
LC_NAME = "en_AU.UTF-8";
LC_NUMERIC = "en_AU.UTF-8";
LC_PAPER = "en_AU.UTF-8";
LC_TELEPHONE = "en_AU.UTF-8";
LC_TIME = "en_AU.UTF-8";
};
# Disable the X11 windowing system, only use Wayland.
services.xserver.enable = false;
services.displayManager.sddm.wayland.enable = true;
services.displayManager.sddm.enable = true;
# Enable the KDE Plasma Desktop Environment.
services.desktopManager.plasma6.enable = true;
programs.hyprland = {
enable = true;
xwayland.enable = true;
package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
};
# Enable CUPS to print documents.
services.printing.enable = true;
hardware.bluetooth = {
enable = true;
powerOnBoot = true; # powers up default Bluetooth controller
};
services.udisks2.enable = true; # For USB support
services.gvfs.enable = true; # USB
services.fwupd.enable = true;
services.fstrim.enable = true;
services.auto-cpufreq.enable = true;
services.power-profiles-daemon.enable = false; # Conflict with auto-cpufreq
# 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;
};
users.users.username = {
isNormalUser = true;
description = "username";
extraGroups = ["networkmanager" "wheel" "docker"];
packages = with pkgs; [
kdePackages.kate
# thunderbird
];
shell = pkgs.zsh;
openssh.authorizedKeys.keys = [
];
};
environment.plasma6.excludePackages = with pkgs.kdePackages; [
konsole
spectacle
];
nixpkgs = {
overlays = [
];
config = {
allowUnfree = true;
};
};
programs.zsh.enable = true;
programs.zsh.interactiveShellInit = ''eval "$(direnv hook zsh)" && neofetch'';
# Desktop portal, handles program interaction, screensharing, file opening etc
xdg = {
portal = {
enable = true;
xdgOpenUsePortal = true;
};
};
virtualisation.docker.enable = true;
environment.systemPackages = with pkgs; [
wget
alejandra # Nix formatter
kitty
xwayland
ntfs3g # For mounting USB drives
exfat # USB?
networkmanagerapplet
(
waybar.overrideAttrs (oldAttrs: {
mesonFlags = oldAttrs.mesonFlags ++ ["-Dexperimental=true"];
})
)
wlsunset
brightnessctl
hyprpicker # Colour picker
libnotify # used by notification daemons
wl-clipboard # system clipbloard
playerctl # Controlling audio playback, pause, start etc
rofi-wayland # App launcher, wayland-compatible version of rofi
wpaperd
hyprcursor # Hyprland cursor format, library and utilities
];
}
home.nix
{
config,
lib,
pkgs,
inputs,
...
}:
{
home.stateVersion = "24.05"; # DON'T CHANGE
home.username = "username";
home.homeDirectory = "/home/username";
nixpkgs.config = {
allowUnfree = true;
# Workaround for https://github.com/nix-community/home-manager/issues/2942
allowUnfreePredicate = _: true;
};
# Nicely reload system units when changing configs
systemd.user.startServices = "sd-switch";
home.file = {
};
home.sessionVariables = {
NIXOS_OZONE_WL = "1"; # For using VS Code and Brave under Wayland
};
imports = [
];
wayland.windowManager.hyprland = import ./../../modules/hyprland.nix;
services = {
swaync = {
enable = true;
};
playerctld.enable = true;
};
programs.wpaperd = {
enable = true;
settings = {
default = {
path = "/home/username/Pictures/Wallpaper/";
duration = "30m";
mode = "center";
};
};
};
home.packages = with pkgs; [
okular
vlc
blender
obsidian
teams-for-linux
vesktop # discord with screen sharing etc
zotero
docker
devbox # Isolated development environment
neofetch # I use nixos btw
xwayland
clipse # Clip board manager
grim # Grab images from compositor
slurp # select region in compositor and print to stdout
];
programs = {
# Let Home Manager install and manage itself.
home-manager.enable = true;
kitty.enable = true;
vscode = import ./../../modules/vscode.nix pkgs;
zsh = {
enable = true;
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
history = {
size = 10000;
path = "${config.xdg.dataHome}/zsh/history";
};
};
neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
};
git = {
enable = true;
};
direnv = {
enable = true;
nix-direnv.enable = true;
};
chromium = {
enable = true;
package = pkgs.brave.overrideAttrs (oldAttrs: {
commandLineArgs = [
"--disable-features=WebRtcAllowInputVolumeAdjustment --enable-features=UseOzonePlatform --ozone-platform-hint=auto"
];
});
};
};
}
Any help is greatly appreciated…
Edit: I narrowed this behaviour down to generation 93 and 94. But the only differences between the two generations are
- removing in
home.nix
xdg.configFile."hypr/hyprland.conf".text = '' bash -c
"swww init & hello!
swww img /home/username/Pictures/Wallpaper/2023-06-10_20-23_1.png &
nm-applet --indicator &
waybar &
dunst"
'';
- Adding in
home.nix
under hyprland
exec-once = "bash -c 'swww init & swww img /home/username/Pictures/Wallpaper/2023-06-10_20-23_1.png & nm-applet --indicator & waybar & dunst'";
which shouldn’t be relevant at all, but home-manager starts in 94 but not 93??