Jump to content

COSMIC

From NixOS Wiki
Revision as of 11:57, 9 July 2025 by Kajusnau (talk | contribs) (Minor adjustment to installation section, added new Configuration and Tips and tricks sections)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

COSMIC is a desktop environment developed in the Rust programming language, using the iced cross platform GUI library for Rust, and Smithay as building blocks for its compositor, cosmic-comp. Cosmic-comp is comparable to smithay's own anvil compositor demonstration, just like the Wayland project uses Weston as demo compositor.

COSMIC was primarily developed for use in the Pop!_OS distribution.

Installation (starting with NixOS 25.05)

COSMIC support in nixpkgs is still in development. You can follow progress via the tracking issue.

You can enable COSMIC on your NixOS system by setting the following configuration options:

{
  # Enable the COSMIC login manager
  services.displayManager.cosmic-greeter.enable = true;

  # Enable the COSMIC desktop environment
  services.desktopManager.cosmic.enable = true;
}

Support for automatic logins is present when using the `cosmic-greeter` login manager. All you need is the following configuration:

{
  services.displayManager.autoLogin = {
    enable = true;
    # Replace `yourUserName` with the actual username of user who should be automatically logged in
    user = "yourUserName";
  };
}

Alternatively, there is a flake to setup COSMIC on NixOS.

Configuration

COSMIC stores its configuration in Rusty Object Notation (RON) files. By default, the system-wide configuration is used unless user-specific files are present. Currently, NixOS does not provide declarative options for configuring COSMIC through the NixOS module system.

System-wide configuration

If no user configuration exists, COSMIC falls back to system-wide defaults. These configuration files are bundled with each cosmic package and are located in their respective [package]/share/cosmic/ directories.

When COSMIC is enabled using the NixOS option services.desktopManager.cosmic.enable = true;, the /share/cosmic directories from the relevant packages are symlinked into /run/current-system/sw.

This allows COSMIC to locate and apply the default configurations at runtime.

User configuration

User configuration files are located in ~/.config/cosmic/.

They override the system defaults when present, and are automatically created or updated when using the COSMIC Settings application.

Component-specific configuration

Each COSMIC component maintains its own configuration files. For example, the COSMIC Panel reads and stores its configuration at ~/.config/cosmic/com.system76.CosmicPanel.Panel Components can be configured by modifying these files directly. For instance, to place the Time and Notifications applets in the center of the COSMIC panel, create the following file:

≡︎ ~/.config/cosmic/com.system76.CosmicPanel.Panel/v1/plugins_center
Some([
    "com.system76.CosmicAppletTime",
    "com.system76.CosmicAppletNotifications",
])

Most configuration changes are applied immediately without needing to restart the session.

Tips and tricks

Excluding COSMIC applications

To exclude certain applications that are installed by default with COSMIC, set the environment.cosmic.excludePackages module option (only available in 25.11):

❄︎ /etc/nixos/configuration.nix
  environment.cosmic.excludePackages = with pkgs; [
    cosmic-edit
  ];