Sway broken on my system

I have been attempting to run sway through sddm alongside kde as seperate sessions. What happens is when I switch to the new build and log out, sway appears in sddm but when launched it is just the classic white blinking line in the top left. After awhile it stops blinking. Then, whether I have opened sway or not, upon rebooting sway no longer appears. I’ll drop the config below, it is a little unusual since people have helped me on discord, but the result hasn’t changed.

# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).

{ config, lib, pkgs, ... }:

{

  services.gnome.gnome-keyring.enable = true;
  programs.sway = {
    enable = true;
    wrapperFeatures.gtk = true;
  };

  services.displayManager.sessionPackages = [ pkgs.sway ];
  services.displayManager.sddm.enable = true;
  services.desktopManager.plasma6.enable = true;

  # Network config

  networking.hostName = "nameherenixos"; # Define your hostname.
  # Pick only one of the below networking options.
  # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.
  networking.networkmanager.enable = true;  # Easiest to use and most distros use this by default.

  # Set your time zone.
  # time.timeZone = "Europe/Amsterdam";

  # Configure network proxy if necessary
  # networking.proxy.default = "http://user:password@proxy:port/";
  # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";

  # Select internationalisation properties.
  # i18n.defaultLocale = "en_US.UTF-8";
  # console = {
  #   font = "Lat2-Terminus16";
  #   keyMap = "us";
  #   useXkbConfig = true; # use xkb.options in tty.
  # };

  # 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;

  # Graphics config

  hardware.opengl = {
    enable = true;
  };

  services.xserver = {
    enable = true;
    libinput.enable = true;
  #  displayManager.sddm.enable = true;
  #  desktopManager.plasma6.enable = true;
  };

  nixpkgs.config.allowUnfree = true;
  services.xserver.videoDrivers = [ "nvidia" ];

  hardware.graphics = {
    enable = true;
  };

  hardware.graphics.extraPackages = with pkgs; [
    intel-vaapi-driver
    intel-media-driver];

  hardware.nvidia = {
   modesetting.enable = true;
   powerManagement.enable = false;
   open = false;
   nvidiaSettings = true;
   package = config.boot.kernelPackages.nvidiaPackages.stable;
  };

  boot.kernelParams = ["i915.force_probe=7d55"];

  hardware.nvidia.prime = {
    sync.enable = true;
    nvidiaBusId = "PCI:1:0:0";
    intelBusId = "PCI:0:2:0";
  };

  # Audio config

  #  hardware.pulseaudio.enable = true;
  #  hardware.pulseaudio.support32Bit = true;

  services.pipewire = {
    enable = true;
    pulse.enable  = true;
    alsa.enable = true;
    alsa.support32Bit = true;
  };
  security.rtkit.enable = true;

  # Packages config

  environment.systemPackages = with pkgs; [
    vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
    wget
    fastfetch
    alacritty
    lshw
    pciutils
    nvitop
    brave
    rtkit
    plasma-pa
    whitesur-kde
    #  whitesur-icon-theme
    legcord
    firefox
    spotify
    libreoffice-qt6-fresh
    git
    jdk23
    alacritty-theme
    gnomeExtensions.toggle-alacritty
    neofetch
    vscode
    grim
    slurp
    wl-clipboard
    mako
    tree
  ];

  programs.neovim = {
    enable = true;
    defaultEditor = true;
  };

  programs.steam.enable = true;
  programs.thunderbird.enable = true;

  programs.virt-manager.enable = true;
  users.groups.libvirtd.members = ["francis"];
  virtualisation.libvirtd.enable = true;
  virtualisation.spiceUSBRedirection.enable = true;

  # NixOS version config

  # This option defines the first version of NixOS you have installed on this particular machine,
  # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
  #
  # Most users should NEVER change this value after the initial install, for any reason,
  # even if you've upgraded your system to a new NixOS release.
  #
  # This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
  # so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
  # to actually do that.
  #
  # This value being lower than the current NixOS release does NOT mean your system is
  # out of date, out of support, or vulnerable.
  #
  # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
  # and migrated your data accordingly.
  #
  # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
  system.stateVersion = "24.11"; # Did you read the comment?

  # Boot config

  boot.loader.grub.device = "nodev";
  boot.loader.grub.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;
  boot.loader.grub.useOSProber = true;
  boot.loader.grub.efiSupport = true;
  boot.loader.efi.efiSysMountPoint = "/boot";
  boot.loader.systemd-boot.enable = false;

  # Automatic updating

  system.autoUpgrade.enable = true;
  system.autoUpgrade.dates = "weekly";

  # Automatic build cleanup

  nix.gc.automatic = true;
  nix.gc.dates = "daily";
  nix.gc.options = "--delete-older-than 10d";
  nix.settings.auto-optimise-store = true;

  # Flake config
  nix.settings.experimental-features = ["nix-command" "flakes"];

  users.users.namehere = {
    isNormalUser = true;
    description = "Namehere";
    extraGroups = [ "wheel" ];
    shell = pkgs.bash;
    home = "/home/namehere";
  };

  xdg.portal = {
    enable = true;
    wlr.enable = true;
  };

  swapDevices = [{
    device = "/swapfile";
    size = 16 * 1024;
  }];

  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
    ];

  # Configure x11 keymap
   services.xserver.xkb.layout = "us";

  # services.xserver.xkb.options = "eurosign:e,caps:escape";

  # Enable CUPS to print documents.
  # services.printing.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.namehere = {
  #   isNormalUser = true;
  #   extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
  #   packages = with pkgs; [
  #     tree
  #   ];
  #  };

  # List packages installed in system profile. To search, run:
  # $ nix search 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;
  # };

  # Copy the NixOS configuration file and link it from the resulting system
  # (/run/current-system/configuration.nix). This is useful in case you
  # accidentally delete configuration.nix.
  # system.copySystemConfiguration = true;

  # Set your time zone.
  # time.timeZone = "Europe/Amsterdam";

}

The prime options only work on X11 (though they may affect xwayland, I have not managed to confirm or deny this yet). Wlroots has a different way of managing GPUs: Home · swaywm/sway Wiki · GitHub

This may well interfere with some stuff by itself; at the very least it means your config isn’t doing what you want it to.

In addition:

You want that enabled most of the time; it’s a daemon that saves video memory into main memory just before sleep - without it, most video memory on modern nvidia GPUs (like 7.5GB at least) will be discarded when your system goes to sleep because stuff wasn’t designed for GPUs to have this much memory, causing graphics corruption and other issues on wake.

That should be set to true.

That’s the default, it’s only started showing up in people’s configs after it was necessary to set it to false for about a month after a driver update caused nix builds for it to fail because of a missing dependency. It’s now being cargo culted into everyone’s configs.

It doesn’t hurt of course, but I recommend leaving defaults the way they are if you are ok with them so NixOS module updates can do the right thing for you when stuff changes.


Those things likely won’t fix this, can you, from a fresh boot, log into your system, let it sit on the broken tty, use ctrl+alt+F3 to go to a text tty, log in there and get the output of journalctl --boot and journalctl --user --boot to share?

If you struggle getting into a tty, you can also reboot into a working generation and use --boot -1 instead.

There is no broken tty on a fresh boot because sway doesn’t appear as an option. I made all those changes, and I can access tty from the broken sway but journalctl doesn’t reveal much, just an error saying unable to locate daemon control file as far as I can see

Can you at least share the full message including all the metadata it’s prefixed with, as well as the system logs?

That’d mean that the session’s desktop file is gone. Can you also remove this line:

The sway option does this by default, setting it explicitly shouldn’t get in the way but maybe you’re doing something funky with overlays. And again, sticking to defaults where possible is best practice.

I’d personally start figuring out where sddm gets its sesion files from by inspecting its unit file with systemctl and then digging into where its env vars/cli args etc lead me. Then see if the sway session exists and looks right.

Sorry for the late reply Ive been busy. I can’t find this file anywhere, any command I use returns no such file or directroy and under usr I only have bin which seems to be unlike every other system

It’s defined here:

@frogdog what’s the output of nixos-option services.displayManager.sessionData.desktops?

Correct, do not expect to find anything under /usr on NixOS.

nixos-option services.displayManager.sessionData.desktops
error:
       … while evaluating a branch condition
         at /nix/store/gj6hz9mj23v01yvq1nn5f655jrcky1qq-nixos-option.nix:140:5:
          139|     entry: configEntry:
          140|     if lib.isOption entry then
             |     ^
          141|       renderOption entry configEntry

       … while calling the 'throw' builtin
         at /nix/store/gj6hz9mj23v01yvq1nn5f655jrcky1qq-nixos-option.nix:95:11:
           94|         else if lib.isOption opt then
           95|           throw "Trying to access '${part}' inside ${opt.type.name} option while traversing option path '${lib.showOption path}'"
             |           ^
           96|         else if lib.isAttrs opt && lib.hasAttr part opt then

       error: Trying to access 'desktops' inside unspecified option while traversing option path 'services.displayManager.sessionData.desktops'

As an input to the console? If so I’ve provided the error message in my previous message

I also tried a different command:

nixos-option services.displayManager.sessionPackages
Value:
  [
    <derivation plasma-workspace-6.2.5>
    <derivation sway-1.10>
  ]

Default:
  [ ]

Type:
  list of package with provided sessions

Description:
  A list of packages containing x11 or wayland session files to be passed to the display manager.

Declared by:
  /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/services/display-managers/default.nix

Defined by:
  /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/services/desktop-managers/plasma6.nix
  /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/services/x11/display-managers/default.nix
  /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/programs/wayland/sway.nix