mirror of
https://github.com/CHN-beta/nixpkgs.git
synced 2026-01-12 02:40:31 +08:00
nixos/modules: cosmic: init
This commit is contained in:
committed by
Masum Reza
parent
cd85a8a827
commit
cd795fd3f0
142
nixos/modules/services/desktop-managers/cosmic.nix
Normal file
142
nixos/modules/services/desktop-managers/cosmic.nix
Normal file
@@ -0,0 +1,142 @@
|
||||
# SPDX-License-Identifier: MIT
|
||||
# SPDX-FileCopyrightText: Lily Foster <lily@lily.flowers>
|
||||
# Portions of this code are adapted from nixos-cosmic
|
||||
# https://github.com/lilyinstarlight/nixos-cosmic
|
||||
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
utils,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.services.desktopManager.cosmic;
|
||||
in
|
||||
{
|
||||
meta.maintainers = with lib.maintainers; [
|
||||
thefossguy
|
||||
HeitorAugustoLN
|
||||
nyabinary
|
||||
ahoneybun
|
||||
];
|
||||
|
||||
options = {
|
||||
services.desktopManager.cosmic = {
|
||||
enable = lib.mkEnableOption "Enable the COSMIC desktop environment";
|
||||
|
||||
xwayland.enable = lib.mkEnableOption "Xwayland support for the COSMIC compositor" // {
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# Environment packages
|
||||
environment.pathsToLink = [
|
||||
"/share/backgrounds"
|
||||
"/share/cosmic"
|
||||
];
|
||||
environment.systemPackages =
|
||||
with pkgs;
|
||||
[
|
||||
adwaita-icon-theme
|
||||
alsa-utils
|
||||
cosmic-applets
|
||||
cosmic-applibrary
|
||||
cosmic-bg
|
||||
(cosmic-comp.override { useXWayland = false; })
|
||||
cosmic-edit
|
||||
cosmic-files
|
||||
config.services.displayManager.cosmic-greeter.package
|
||||
cosmic-icons
|
||||
cosmic-idle
|
||||
cosmic-launcher
|
||||
cosmic-notifications
|
||||
cosmic-osd
|
||||
cosmic-panel
|
||||
cosmic-player
|
||||
cosmic-randr
|
||||
cosmic-screenshot
|
||||
cosmic-session
|
||||
cosmic-settings
|
||||
cosmic-settings-daemon
|
||||
cosmic-term
|
||||
cosmic-wallpapers
|
||||
cosmic-workspaces-epoch
|
||||
hicolor-icon-theme
|
||||
playerctl
|
||||
pop-icon-theme
|
||||
pop-launcher
|
||||
xdg-user-dirs
|
||||
]
|
||||
++ lib.optionals cfg.xwayland.enable [
|
||||
xwayland
|
||||
]
|
||||
++ lib.optionals config.services.flatpak.enable [
|
||||
cosmic-store
|
||||
];
|
||||
|
||||
# Distro-wide defaults for graphical sessions
|
||||
services.graphical-desktop.enable = true;
|
||||
|
||||
xdg = {
|
||||
icons.fallbackCursorThemes = lib.mkDefault [ "Cosmic" ];
|
||||
|
||||
portal = {
|
||||
enable = true;
|
||||
extraPortals = with pkgs; [
|
||||
xdg-desktop-portal-cosmic
|
||||
xdg-desktop-portal-gtk
|
||||
];
|
||||
configPackages = lib.mkDefault [ pkgs.xdg-desktop-portal-cosmic ];
|
||||
};
|
||||
};
|
||||
|
||||
systemd = {
|
||||
packages = [ pkgs.cosmic-session ];
|
||||
user.targets = {
|
||||
cosmic-session = {
|
||||
wants = [ "xdg-desktop-autostart.target" ];
|
||||
before = [ "xdg-desktop-autostart.target" ];
|
||||
};
|
||||
tray = {
|
||||
description = "Cosmic Tray Target";
|
||||
requires = [ "graphical-session-pre.target" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
fonts.packages = with pkgs; [
|
||||
fira
|
||||
noto-fonts
|
||||
open-sans
|
||||
];
|
||||
|
||||
# Required options for the COSMIC DE
|
||||
environment.sessionVariables.X11_BASE_RULES_XML = "${config.services.xserver.xkb.dir}/rules/base.xml";
|
||||
environment.sessionVariables.X11_EXTRA_RULES_XML = "${config.services.xserver.xkb.dir}/rules/base.extras.xml";
|
||||
programs.dconf.enable = true;
|
||||
programs.dconf.packages = [ pkgs.cosmic-session ];
|
||||
security.polkit.enable = true;
|
||||
security.rtkit.enable = true;
|
||||
services.accounts-daemon.enable = true;
|
||||
services.displayManager.sessionPackages = [ pkgs.cosmic-session ];
|
||||
services.libinput.enable = true;
|
||||
services.upower.enable = true;
|
||||
# Setup PAM authentication for the `cosmic-greeter` user
|
||||
security.pam.services.cosmic-greeter = { };
|
||||
|
||||
# Good to have defaults
|
||||
hardware.bluetooth.enable = lib.mkDefault true;
|
||||
networking.networkmanager.enable = lib.mkDefault true;
|
||||
services.acpid.enable = lib.mkDefault true;
|
||||
services.avahi.enable = lib.mkDefault true;
|
||||
services.gnome.gnome-keyring.enable = lib.mkDefault true;
|
||||
services.gvfs.enable = lib.mkDefault true;
|
||||
services.power-profiles-daemon.enable = lib.mkDefault (
|
||||
!config.hardware.system76.power-daemon.enable
|
||||
);
|
||||
};
|
||||
}
|
||||
@@ -21,6 +21,7 @@ in
|
||||
./lxqt.nix ./enlightenment.nix ./gnome.nix ./retroarch.nix ./kodi.nix
|
||||
./mate.nix ./pantheon.nix ./surf-display.nix ./cde.nix
|
||||
./cinnamon.nix ./budgie.nix ./deepin.nix ../../desktop-managers/lomiri.nix
|
||||
../../desktop-managers/cosmic.nix
|
||||
];
|
||||
|
||||
options = {
|
||||
|
||||
Reference in New Issue
Block a user