From b6b551fe22e2ba24ccfab50f2c8b3c95ef732c8d Mon Sep 17 00:00:00 2001 From: Philip Taron Date: Tue, 31 Dec 2024 14:04:42 -0800 Subject: [PATCH] Revert "treewide/nixos: remove `with lib;` part 12" --- nixos/modules/services/x11/colord.nix | 7 +- .../services/x11/desktop-managers/cde.nix | 13 +- .../x11/desktop-managers/cinnamon.nix | 89 ++++++------ .../services/x11/desktop-managers/deepin.nix | 57 ++++---- .../x11/desktop-managers/enlightenment.nix | 15 +- .../services/x11/desktop-managers/kodi.nix | 11 +- .../services/x11/desktop-managers/lumina.nix | 11 +- .../services/x11/desktop-managers/lxqt.nix | 27 ++-- .../services/x11/desktop-managers/mate.nix | 47 ++++--- .../services/x11/desktop-managers/none.nix | 11 +- .../x11/desktop-managers/pantheon.nix | 103 +++++++------- .../x11/desktop-managers/retroarch.nix | 17 ++- .../x11/desktop-managers/surf-display.nix | 33 +++-- .../services/x11/desktop-managers/xfce.nix | 65 ++++----- .../services/x11/desktop-managers/xterm.nix | 15 +- .../lightdm-greeters/enso-os.nix | 54 ++++---- .../display-managers/lightdm-greeters/gtk.nix | 65 ++++----- .../lightdm-greeters/mini.nix | 19 +-- .../lightdm-greeters/mobile.nix | 8 +- .../lightdm-greeters/pantheon.nix | 11 +- .../lightdm-greeters/slick.nix | 61 ++++---- .../lightdm-greeters/tiny.nix | 25 ++-- .../services/x11/display-managers/lightdm.nix | 59 ++++---- .../services/x11/display-managers/slim.nix | 5 +- .../services/x11/display-managers/startx.nix | 11 +- .../services/x11/display-managers/xpra.nix | 41 +++--- nixos/modules/services/x11/extra-layouts.nix | 39 +++--- nixos/modules/services/x11/fractalart.nix | 19 +-- nixos/modules/services/x11/hardware/cmt.nix | 13 +- .../services/x11/hardware/digimend.nix | 7 +- .../services/x11/hardware/synaptics.nix | 109 ++++++++------- nixos/modules/services/x11/hardware/wacom.nix | 9 +- nixos/modules/services/x11/imwheel.nix | 19 +-- nixos/modules/services/x11/picom.nix | 131 +++++++++--------- nixos/modules/services/x11/redshift.nix | 45 +++--- nixos/modules/services/x11/touchegg.nix | 11 +- .../modules/services/x11/unclutter-xfixes.nix | 25 ++-- nixos/modules/services/x11/unclutter.nix | 39 +++--- nixos/modules/services/x11/urxvtd.nix | 12 +- .../services/x11/window-managers/2bwm.nix | 9 +- .../x11/window-managers/afterstep.nix | 9 +- .../services/x11/window-managers/awesome.nix | 21 +-- .../services/x11/window-managers/berry.nix | 9 +- .../services/x11/window-managers/bspwm.nix | 35 ++--- .../services/x11/window-managers/clfswm.nix | 11 +- .../services/x11/window-managers/cwm.nix | 9 +- .../services/x11/window-managers/dwm.nix | 11 +- .../services/x11/window-managers/e16.nix | 9 +- 48 files changed, 807 insertions(+), 674 deletions(-) diff --git a/nixos/modules/services/x11/colord.nix b/nixos/modules/services/x11/colord.nix index 7b8b1bb48c66e..1a9ade7127392 100644 --- a/nixos/modules/services/x11/colord.nix +++ b/nixos/modules/services/x11/colord.nix @@ -4,6 +4,9 @@ pkgs, ... }: + +with lib; + let cfg = config.services.colord; @@ -14,12 +17,12 @@ in options = { services.colord = { - enable = lib.mkEnableOption "colord, the color management daemon"; + enable = mkEnableOption "colord, the color management daemon"; }; }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { environment.systemPackages = [ pkgs.colord ]; diff --git a/nixos/modules/services/x11/desktop-managers/cde.nix b/nixos/modules/services/x11/desktop-managers/cde.nix index 908431f329efa..8dae3ce0d8862 100644 --- a/nixos/modules/services/x11/desktop-managers/cde.nix +++ b/nixos/modules/services/x11/desktop-managers/cde.nix @@ -4,16 +4,19 @@ pkgs, ... }: + +with lib; + let xcfg = config.services.xserver; cfg = xcfg.desktopManager.cde; in { options.services.xserver.desktopManager.cde = { - enable = lib.mkEnableOption "Common Desktop Environment"; + enable = mkEnableOption "Common Desktop Environment"; - extraPackages = lib.mkOption { - type = with lib.types; listOf package; + extraPackages = mkOption { + type = with types; listOf package; default = with pkgs.xorg; [ xclock bitmap @@ -26,7 +29,7 @@ in xwd xwud ]; - defaultText = lib.literalExpression '' + defaultText = literalExpression '' with pkgs.xorg; [ xclock bitmap xlsfonts xfd xrefresh xload xwininfo xdpyinfo xwd xwud ] @@ -37,7 +40,7 @@ in }; }; - config = lib.mkIf (xcfg.enable && cfg.enable) { + config = mkIf (xcfg.enable && cfg.enable) { environment.systemPackages = cfg.extraPackages; services.rpcbind.enable = true; diff --git a/nixos/modules/services/x11/desktop-managers/cinnamon.nix b/nixos/modules/services/x11/desktop-managers/cinnamon.nix index 43103a6630920..c64c2293a439e 100644 --- a/nixos/modules/services/x11/desktop-managers/cinnamon.nix +++ b/nixos/modules/services/x11/desktop-managers/cinnamon.nix @@ -1,4 +1,7 @@ { config, lib, pkgs, utils, ... }: + +with lib; + let cfg = config.services.xserver.desktopManager.cinnamon; @@ -15,16 +18,16 @@ in { options = { services.cinnamon = { - apps.enable = lib.mkEnableOption "Cinnamon default applications"; + apps.enable = mkEnableOption "Cinnamon default applications"; }; services.xserver.desktopManager.cinnamon = { - enable = lib.mkEnableOption "the cinnamon desktop manager"; + enable = mkEnableOption "the cinnamon desktop manager"; - sessionPath = lib.mkOption { + sessionPath = mkOption { default = []; - type = lib.types.listOf lib.types.package; - example = lib.literalExpression "[ pkgs.gpaste ]"; + type = types.listOf types.package; + example = literalExpression "[ pkgs.gpaste ]"; description = '' Additional list of packages to be added to the session search path. Useful for GSettings-conditional autostart. @@ -33,53 +36,53 @@ in ''; }; - extraGSettingsOverrides = lib.mkOption { + extraGSettingsOverrides = mkOption { default = ""; - type = lib.types.lines; + type = types.lines; description = "Additional gsettings overrides."; }; - extraGSettingsOverridePackages = lib.mkOption { + extraGSettingsOverridePackages = mkOption { default = []; - type = lib.types.listOf lib.types.path; + type = types.listOf types.path; description = "List of packages for which gsettings are overridden."; }; }; - environment.cinnamon.excludePackages = lib.mkOption { + environment.cinnamon.excludePackages = mkOption { default = []; - example = lib.literalExpression "[ pkgs.blueman ]"; - type = lib.types.listOf lib.types.package; + example = literalExpression "[ pkgs.blueman ]"; + type = types.listOf types.package; description = "Which packages cinnamon should exclude from the default environment"; }; }; - config = lib.mkMerge [ - (lib.mkIf cfg.enable { + config = mkMerge [ + (mkIf cfg.enable { services.displayManager.sessionPackages = [ pkgs.cinnamon-common ]; services.xserver.displayManager.lightdm.greeters.slick = { - enable = lib.mkDefault true; + enable = mkDefault true; # Taken from mint-artwork.gschema.override - theme = lib.mkIf (notExcluded pkgs.mint-themes) { - name = lib.mkDefault "Mint-Y-Aqua"; - package = lib.mkDefault pkgs.mint-themes; + theme = mkIf (notExcluded pkgs.mint-themes) { + name = mkDefault "Mint-Y-Aqua"; + package = mkDefault pkgs.mint-themes; }; - iconTheme = lib.mkIf (notExcluded pkgs.mint-y-icons) { - name = lib.mkDefault "Mint-Y-Sand"; - package = lib.mkDefault pkgs.mint-y-icons; + iconTheme = mkIf (notExcluded pkgs.mint-y-icons) { + name = mkDefault "Mint-Y-Sand"; + package = mkDefault pkgs.mint-y-icons; }; - cursorTheme = lib.mkIf (notExcluded pkgs.mint-cursor-themes) { - name = lib.mkDefault "Bibata-Modern-Classic"; - package = lib.mkDefault pkgs.mint-cursor-themes; + cursorTheme = mkIf (notExcluded pkgs.mint-cursor-themes) { + name = mkDefault "Bibata-Modern-Classic"; + package = mkDefault pkgs.mint-cursor-themes; }; }; # Have to take care of GDM + Cinnamon on Wayland users environment.extraInit = '' - ${lib.concatMapStrings (p: '' + ${concatMapStrings (p: '' if [ -d "${p}/share/gsettings-schemas/${p.name}" ]; then export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${p}/share/gsettings-schemas/${p.name} fi @@ -92,30 +95,30 @@ in ''; # Default services - services.blueman.enable = lib.mkDefault (notExcluded pkgs.blueman); - hardware.bluetooth.enable = lib.mkDefault true; + services.blueman.enable = mkDefault (notExcluded pkgs.blueman); + hardware.bluetooth.enable = mkDefault true; security.polkit.enable = true; services.accounts-daemon.enable = true; - services.system-config-printer.enable = (lib.mkIf config.services.printing.enable (lib.mkDefault true)); + services.system-config-printer.enable = (mkIf config.services.printing.enable (mkDefault true)); services.dbus.packages = with pkgs; [ cinnamon-common cinnamon-screensaver nemo-with-extensions xapp ]; - services.cinnamon.apps.enable = lib.mkDefault true; + services.cinnamon.apps.enable = mkDefault true; services.gnome.evolution-data-server.enable = true; services.gnome.glib-networking.enable = true; services.gnome.gnome-keyring.enable = true; services.gvfs.enable = true; - services.power-profiles-daemon.enable = lib.mkDefault true; - services.switcherooControl.enable = lib.mkDefault true; # xapp-gpu-offload-helper - services.touchegg.enable = lib.mkDefault true; + services.power-profiles-daemon.enable = mkDefault true; + services.switcherooControl.enable = mkDefault true; # xapp-gpu-offload-helper + services.touchegg.enable = mkDefault true; services.udisks2.enable = true; - services.upower.enable = lib.mkDefault config.powerManagement.enable; - services.libinput.enable = lib.mkDefault true; + services.upower.enable = mkDefault config.powerManagement.enable; + services.libinput.enable = mkDefault true; services.xserver.updateDbusEnvironment = true; - networking.networkmanager.enable = lib.mkDefault true; + networking.networkmanager.enable = mkDefault true; # Enable colord server services.colord.enable = true; @@ -201,9 +204,9 @@ in pkgs.xdg-desktop-portal-gtk ]; - services.orca.enable = lib.mkDefault (notExcluded pkgs.orca); + services.orca.enable = mkDefault (notExcluded pkgs.orca); - xdg.portal.configPackages = lib.mkDefault [ pkgs.cinnamon-common ]; + xdg.portal.configPackages = mkDefault [ pkgs.cinnamon-common ]; # Override GSettings schemas environment.sessionVariables.NIX_GSETTINGS_OVERRIDES_DIR = "${nixos-gsettings-overrides}/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas"; @@ -214,8 +217,8 @@ in ]; # Shell integration for VTE terminals - programs.bash.vteIntegration = lib.mkDefault true; - programs.zsh.vteIntegration = lib.mkDefault true; + programs.bash.vteIntegration = mkDefault true; + programs.zsh.vteIntegration = mkDefault true; # Default Fonts fonts.packages = with pkgs; [ @@ -224,10 +227,10 @@ in ]; }) - (lib.mkIf serviceCfg.apps.enable { - programs.gnome-disks.enable = lib.mkDefault (notExcluded pkgs.gnome-disk-utility); - programs.gnome-terminal.enable = lib.mkDefault (notExcluded pkgs.gnome-terminal); - programs.file-roller.enable = lib.mkDefault (notExcluded pkgs.file-roller); + (mkIf serviceCfg.apps.enable { + programs.gnome-disks.enable = mkDefault (notExcluded pkgs.gnome-disk-utility); + programs.gnome-terminal.enable = mkDefault (notExcluded pkgs.gnome-terminal); + programs.file-roller.enable = mkDefault (notExcluded pkgs.file-roller); environment.systemPackages = with pkgs; utils.removePackagesByName [ # cinnamon team apps diff --git a/nixos/modules/services/x11/desktop-managers/deepin.nix b/nixos/modules/services/x11/desktop-managers/deepin.nix index 76ffb71bb2a42..ca9fb229df973 100644 --- a/nixos/modules/services/x11/desktop-managers/deepin.nix +++ b/nixos/modules/services/x11/desktop-managers/deepin.nix @@ -5,6 +5,9 @@ utils, ... }: + +with lib; + let xcfg = config.services.xserver; cfg = xcfg.desktopManager.deepin; @@ -18,68 +21,68 @@ in options = { services.xserver.desktopManager.deepin = { - enable = lib.mkEnableOption "Deepin desktop manager"; - extraGSettingsOverrides = lib.mkOption { + enable = mkEnableOption "Deepin desktop manager"; + extraGSettingsOverrides = mkOption { default = ""; - type = lib.types.lines; + type = types.lines; description = "Additional gsettings overrides."; }; - extraGSettingsOverridePackages = lib.mkOption { + extraGSettingsOverridePackages = mkOption { default = [ ]; - type = lib.types.listOf lib.types.path; + type = types.listOf types.path; description = "List of packages for which gsettings are overridden."; }; }; - environment.deepin.excludePackages = lib.mkOption { + environment.deepin.excludePackages = mkOption { default = [ ]; - type = lib.types.listOf lib.types.package; + type = types.listOf types.package; description = "List of default packages to exclude from the configuration"; }; }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { services.displayManager.sessionPackages = [ pkgs.deepin.dde-session ]; - services.displayManager.defaultSession = lib.mkDefault "dde-x11"; + services.displayManager.defaultSession = mkDefault "dde-x11"; # Update the DBus activation environment after launching the desktop manager. services.xserver.displayManager.sessionCommands = '' ${lib.getBin pkgs.dbus}/bin/dbus-update-activation-environment --systemd --all ''; - hardware.bluetooth.enable = lib.mkDefault true; + hardware.bluetooth.enable = mkDefault true; security.polkit.enable = true; - services.deepin.dde-daemon.enable = lib.mkForce true; - services.deepin.dde-api.enable = lib.mkForce true; - services.deepin.app-services.enable = lib.mkForce true; + services.deepin.dde-daemon.enable = mkForce true; + services.deepin.dde-api.enable = mkForce true; + services.deepin.app-services.enable = mkForce true; - services.colord.enable = lib.mkDefault true; - services.accounts-daemon.enable = lib.mkDefault true; - services.gvfs.enable = lib.mkDefault true; - services.gnome.glib-networking.enable = lib.mkDefault true; - services.gnome.gnome-keyring.enable = lib.mkDefault true; - services.bamf.enable = lib.mkDefault true; + services.colord.enable = mkDefault true; + services.accounts-daemon.enable = mkDefault true; + services.gvfs.enable = mkDefault true; + services.gnome.glib-networking.enable = mkDefault true; + services.gnome.gnome-keyring.enable = mkDefault true; + services.bamf.enable = mkDefault true; - services.libinput.enable = lib.mkDefault true; + services.libinput.enable = mkDefault true; services.udisks2.enable = true; - services.upower.enable = lib.mkDefault config.powerManagement.enable; - networking.networkmanager.enable = lib.mkDefault true; - programs.dconf.enable = lib.mkDefault true; - programs.gnupg.agent.pinentryPackage = lib.mkDefault pkgs.pinentry-qt; + services.upower.enable = mkDefault config.powerManagement.enable; + networking.networkmanager.enable = mkDefault true; + programs.dconf.enable = mkDefault true; + programs.gnupg.agent.pinentryPackage = mkDefault pkgs.pinentry-qt; fonts.packages = with pkgs; [ noto-fonts ]; xdg.mime.enable = true; xdg.menus.enable = true; xdg.icons.enable = true; - xdg.portal.enable = lib.mkDefault true; - xdg.portal.extraPortals = lib.mkDefault [ + xdg.portal.enable = mkDefault true; + xdg.portal.extraPortals = mkDefault [ pkgs.xdg-desktop-portal-gtk ]; # https://github.com/NixOS/nixpkgs/pull/247766#issuecomment-1722839259 - xdg.portal.config.deepin.default = lib.mkDefault [ "gtk" ]; + xdg.portal.config.deepin.default = mkDefault [ "gtk" ]; environment.sessionVariables = { NIX_GSETTINGS_OVERRIDES_DIR = "${nixos-gsettings-overrides}/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas"; diff --git a/nixos/modules/services/x11/desktop-managers/enlightenment.nix b/nixos/modules/services/x11/desktop-managers/enlightenment.nix index 8acd66a1bcdc6..05ed81e579927 100644 --- a/nixos/modules/services/x11/desktop-managers/enlightenment.nix +++ b/nixos/modules/services/x11/desktop-managers/enlightenment.nix @@ -4,6 +4,9 @@ lib, ... }: + +with lib; + let e = pkgs.enlightenment; @@ -20,11 +23,11 @@ in { meta = { - maintainers = lib.teams.enlightenment.members; + maintainers = teams.enlightenment.members; }; imports = [ - (lib.mkRenamedOptionModule + (mkRenamedOptionModule [ "services" "xserver" "desktopManager" "e19" "enable" ] [ "services" "xserver" "desktopManager" "enlightenment" "enable" ] ) @@ -32,15 +35,15 @@ in options = { - services.xserver.desktopManager.enlightenment.enable = lib.mkOption { - type = lib.types.bool; + services.xserver.desktopManager.enlightenment.enable = mkOption { + type = types.bool; default = false; description = "Enable the Enlightenment desktop environment."; }; }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ enlightenment.econnman @@ -102,7 +105,7 @@ in services.udisks2.enable = true; services.upower.enable = config.powerManagement.enable; - services.libinput.enable = lib.mkDefault true; + services.libinput.enable = mkDefault true; services.dbus.packages = [ e.efl ]; diff --git a/nixos/modules/services/x11/desktop-managers/kodi.nix b/nixos/modules/services/x11/desktop-managers/kodi.nix index 0330c5b353e13..0dd2f8ffb829e 100644 --- a/nixos/modules/services/x11/desktop-managers/kodi.nix +++ b/nixos/modules/services/x11/desktop-managers/kodi.nix @@ -4,6 +4,9 @@ pkgs, ... }: + +with lib; + let cfg = config.services.xserver.desktopManager.kodi; in @@ -11,19 +14,19 @@ in { options = { services.xserver.desktopManager.kodi = { - enable = lib.mkOption { - type = lib.types.bool; + enable = mkOption { + type = types.bool; default = false; description = "Enable the kodi multimedia center."; }; - package = lib.mkPackageOption pkgs "kodi" { + package = mkPackageOption pkgs "kodi" { example = "kodi.withPackages (p: with p; [ jellyfin pvr-iptvsimple vfs-sftp ])"; }; }; }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { services.xserver.desktopManager.session = [ { name = "kodi"; diff --git a/nixos/modules/services/x11/desktop-managers/lumina.nix b/nixos/modules/services/x11/desktop-managers/lumina.nix index 9931ecffddcbf..74fabced3af3e 100644 --- a/nixos/modules/services/x11/desktop-managers/lumina.nix +++ b/nixos/modules/services/x11/desktop-managers/lumina.nix @@ -4,6 +4,9 @@ pkgs, ... }: + +with lib; + let xcfg = config.services.xserver; @@ -13,20 +16,20 @@ in { meta = { - maintainers = lib.teams.lumina.members; + maintainers = teams.lumina.members; }; options = { - services.xserver.desktopManager.lumina.enable = lib.mkOption { - type = lib.types.bool; + services.xserver.desktopManager.lumina.enable = mkOption { + type = types.bool; default = false; description = "Enable the Lumina desktop manager"; }; }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { services.displayManager.sessionPackages = [ pkgs.lumina.lumina diff --git a/nixos/modules/services/x11/desktop-managers/lxqt.nix b/nixos/modules/services/x11/desktop-managers/lxqt.nix index a5af6fa579302..ac86c385bcc8d 100644 --- a/nixos/modules/services/x11/desktop-managers/lxqt.nix +++ b/nixos/modules/services/x11/desktop-managers/lxqt.nix @@ -1,4 +1,7 @@ { config, lib, pkgs, utils, ... }: + +with lib; + let xcfg = config.services.xserver; cfg = xcfg.desktopManager.lxqt; @@ -7,29 +10,29 @@ in { meta = { - maintainers = lib.teams.lxqt.members; + maintainers = teams.lxqt.members; }; options = { - services.xserver.desktopManager.lxqt.enable = lib.mkOption { - type = lib.types.bool; + services.xserver.desktopManager.lxqt.enable = mkOption { + type = types.bool; default = false; description = "Enable the LXQt desktop manager"; }; - environment.lxqt.excludePackages = lib.mkOption { + environment.lxqt.excludePackages = mkOption { default = []; - example = lib.literalExpression "[ pkgs.lxqt.qterminal ]"; - type = lib.types.listOf lib.types.package; + example = literalExpression "[ pkgs.lxqt.qterminal ]"; + type = types.listOf types.package; description = "Which LXQt packages to exclude from the default environment"; }; }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { - services.xserver.desktopManager.session = lib.singleton { + services.xserver.desktopManager.session = singleton { name = "lxqt"; bgSupport = true; start = '' @@ -59,19 +62,19 @@ in # Link some extra directories in /run/current-system/software/share environment.pathsToLink = [ "/share" ]; - programs.gnupg.agent.pinentryPackage = lib.mkDefault pkgs.pinentry-qt; + programs.gnupg.agent.pinentryPackage = mkDefault pkgs.pinentry-qt; # virtual file systems support for PCManFM-QT services.gvfs.enable = true; services.upower.enable = config.powerManagement.enable; - services.libinput.enable = lib.mkDefault true; + services.libinput.enable = mkDefault true; - xdg.portal.lxqt.enable = lib.mkDefault true; + xdg.portal.lxqt.enable = mkDefault true; # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1050804 - xdg.portal.config.lxqt.default = lib.mkDefault [ "lxqt" "gtk" ]; + xdg.portal.config.lxqt.default = mkDefault [ "lxqt" "gtk" ]; }; } diff --git a/nixos/modules/services/x11/desktop-managers/mate.nix b/nixos/modules/services/x11/desktop-managers/mate.nix index 1f908bbf512ac..e5144bc9d1028 100644 --- a/nixos/modules/services/x11/desktop-managers/mate.nix +++ b/nixos/modules/services/x11/desktop-managers/mate.nix @@ -5,6 +5,9 @@ utils, ... }: + +with lib; + let xcfg = config.services.xserver; @@ -16,48 +19,48 @@ in options = { services.xserver.desktopManager.mate = { - enable = lib.mkOption { - type = lib.types.bool; + enable = mkOption { + type = types.bool; default = false; description = "Enable the MATE desktop environment"; }; - debug = lib.mkEnableOption "mate-session debug messages"; + debug = mkEnableOption "mate-session debug messages"; - extraPanelApplets = lib.mkOption { + extraPanelApplets = mkOption { default = [ ]; - example = lib.literalExpression "with pkgs.mate; [ mate-applets ]"; - type = lib.types.listOf lib.types.package; + example = literalExpression "with pkgs.mate; [ mate-applets ]"; + type = types.listOf types.package; description = "Extra applets to add to mate-panel."; }; - extraCajaExtensions = lib.mkOption { + extraCajaExtensions = mkOption { default = [ ]; example = lib.literalExpression "with pkgs.mate; [ caja-extensions ]"; - type = lib.types.listOf lib.types.package; + type = types.listOf types.package; description = "Extra extensions to add to caja."; }; - enableWaylandSession = lib.mkEnableOption "MATE Wayland session"; + enableWaylandSession = mkEnableOption "MATE Wayland session"; }; - environment.mate.excludePackages = lib.mkOption { + environment.mate.excludePackages = mkOption { default = [ ]; - example = lib.literalExpression "[ pkgs.mate.mate-terminal pkgs.mate.pluma ]"; - type = lib.types.listOf lib.types.package; + example = literalExpression "[ pkgs.mate.mate-terminal pkgs.mate.pluma ]"; + type = types.listOf types.package; description = "Which MATE packages to exclude from the default environment"; }; }; - config = lib.mkMerge [ - (lib.mkIf (cfg.enable || cfg.enableWaylandSession) { + config = mkMerge [ + (mkIf (cfg.enable || cfg.enableWaylandSession) { services.displayManager.sessionPackages = [ pkgs.mate.mate-session-manager ]; # Debugging - environment.sessionVariables.MATE_SESSION_DEBUG = lib.mkIf cfg.debug "1"; + environment.sessionVariables.MATE_SESSION_DEBUG = mkIf cfg.debug "1"; environment.systemPackages = utils.removePackagesByName ( pkgs.mate.basePackages @@ -80,13 +83,11 @@ in programs.dconf.enable = true; # Shell integration for VTE terminals - programs.bash.vteIntegration = lib.mkDefault true; - programs.zsh.vteIntegration = lib.mkDefault true; + programs.bash.vteIntegration = mkDefault true; + programs.zsh.vteIntegration = mkDefault true; # Mate uses this for printing - programs.system-config-printer.enable = ( - lib.mkIf config.services.printing.enable (lib.mkDefault true) - ); + programs.system-config-printer.enable = (mkIf config.services.printing.enable (mkDefault true)); services.gnome.at-spi2-core.enable = true; services.gnome.glib-networking.enable = true; @@ -94,15 +95,15 @@ in services.udev.packages = [ pkgs.mate.mate-settings-daemon ]; services.gvfs.enable = true; services.upower.enable = config.powerManagement.enable; - services.libinput.enable = lib.mkDefault true; + services.libinput.enable = mkDefault true; security.pam.services.mate-screensaver.unixAuth = true; - xdg.portal.configPackages = lib.mkDefault [ pkgs.mate.mate-desktop ]; + xdg.portal.configPackages = mkDefault [ pkgs.mate.mate-desktop ]; environment.pathsToLink = [ "/share" ]; }) - (lib.mkIf cfg.enableWaylandSession { + (mkIf cfg.enableWaylandSession { programs.wayfire.enable = true; programs.wayfire.plugins = [ pkgs.wayfirePlugins.firedecor ]; diff --git a/nixos/modules/services/x11/desktop-managers/none.nix b/nixos/modules/services/x11/desktop-managers/none.nix index 0e5caf37300a0..d4b7e3b392da9 100644 --- a/nixos/modules/services/x11/desktop-managers/none.nix +++ b/nixos/modules/services/x11/desktop-managers/none.nix @@ -4,13 +4,14 @@ pkgs, ... }: +with lib; let runXdgAutostart = config.services.xserver.desktopManager.runXdgAutostartIfNone; in { options = { - services.xserver.desktopManager.runXdgAutostartIfNone = lib.mkOption { - type = lib.types.bool; + services.xserver.desktopManager.runXdgAutostartIfNone = mkOption { + type = types.bool; default = false; description = '' Whether to run XDG autostart files for sessions without a desktop manager @@ -26,18 +27,18 @@ in }; }; - config = lib.mkMerge [ + config = mkMerge [ { services.xserver.desktopManager.session = [ { name = "none"; - start = lib.optionalString runXdgAutostart '' + start = optionalString runXdgAutostart '' /run/current-system/systemd/bin/systemctl --user start xdg-autostart-if-no-desktop-manager.target ''; } ]; } - (lib.mkIf runXdgAutostart { + (mkIf runXdgAutostart { systemd.user.targets.xdg-autostart-if-no-desktop-manager = { description = "Run XDG autostart files"; # From `plasma-workspace`, `share/systemd/user/plasma-workspace@.target`. diff --git a/nixos/modules/services/x11/desktop-managers/pantheon.nix b/nixos/modules/services/x11/desktop-managers/pantheon.nix index ebb6f25c6db6a..14e7e25252de7 100644 --- a/nixos/modules/services/x11/desktop-managers/pantheon.nix +++ b/nixos/modules/services/x11/desktop-managers/pantheon.nix @@ -1,4 +1,7 @@ { config, lib, utils, pkgs, ... }: + +with lib; + let cfg = config.services.xserver.desktopManager.pantheon; @@ -16,7 +19,7 @@ in meta = { doc = ./pantheon.md; - maintainers = lib.teams.pantheon.members; + maintainers = teams.pantheon.members; }; options = { @@ -24,24 +27,24 @@ in services.pantheon = { contractor = { - enable = lib.mkEnableOption "contractor, a desktop-wide extension service used by Pantheon"; + enable = mkEnableOption "contractor, a desktop-wide extension service used by Pantheon"; }; - apps.enable = lib.mkEnableOption "Pantheon default applications"; + apps.enable = mkEnableOption "Pantheon default applications"; }; services.xserver.desktopManager.pantheon = { - enable = lib.mkOption { - type = lib.types.bool; + enable = mkOption { + type = types.bool; default = false; description = "Enable the pantheon desktop manager"; }; - sessionPath = lib.mkOption { + sessionPath = mkOption { default = []; - type = lib.types.listOf lib.types.package; - example = lib.literalExpression "[ pkgs.gpaste ]"; + type = types.listOf types.package; + example = literalExpression "[ pkgs.gpaste ]"; description = '' Additional list of packages to be added to the session search path. Useful for GSettings-conditional autostart. @@ -50,46 +53,46 @@ in ''; }; - extraWingpanelIndicators = lib.mkOption { + extraWingpanelIndicators = mkOption { default = null; - type = with lib.types; nullOr (listOf package); + type = with types; nullOr (listOf package); description = "Indicators to add to Wingpanel."; }; - extraSwitchboardPlugs = lib.mkOption { + extraSwitchboardPlugs = mkOption { default = null; - type = with lib.types; nullOr (listOf package); + type = with types; nullOr (listOf package); description = "Plugs to add to Switchboard."; }; - extraGSettingsOverrides = lib.mkOption { + extraGSettingsOverrides = mkOption { default = ""; - type = lib.types.lines; + type = types.lines; description = "Additional gsettings overrides."; }; - extraGSettingsOverridePackages = lib.mkOption { + extraGSettingsOverridePackages = mkOption { default = []; - type = lib.types.listOf lib.types.path; + type = types.listOf types.path; description = "List of packages for which gsettings are overridden."; }; - debug = lib.mkEnableOption "gnome-session debug messages"; + debug = mkEnableOption "gnome-session debug messages"; }; - environment.pantheon.excludePackages = lib.mkOption { + environment.pantheon.excludePackages = mkOption { default = []; - example = lib.literalExpression "[ pkgs.pantheon.elementary-camera ]"; - type = lib.types.listOf lib.types.package; + example = literalExpression "[ pkgs.pantheon.elementary-camera ]"; + type = types.listOf types.package; description = "Which packages pantheon should exclude from the default environment"; }; }; - config = lib.mkMerge [ - (lib.mkIf cfg.enable { + config = mkMerge [ + (mkIf cfg.enable { services.xserver.desktopManager.pantheon.sessionPath = utils.removePackagesByName [ pkgs.pantheon.pantheon-agent-geoclue2 ] config.environment.pantheon.excludePackages; @@ -98,21 +101,21 @@ in # Ensure lightdm is used when Pantheon is enabled # Without it screen locking will be nonfunctional because of the use of lightlocker - warnings = lib.optional (config.services.xserver.displayManager.lightdm.enable != true) + warnings = optional (config.services.xserver.displayManager.lightdm.enable != true) '' Using Pantheon without LightDM as a displayManager will break screenlocking from the UI. ''; - services.xserver.displayManager.lightdm.greeters.pantheon.enable = lib.mkDefault true; + services.xserver.displayManager.lightdm.greeters.pantheon.enable = mkDefault true; # Without this, elementary LightDM greeter will pre-select non-existent `default` session # https://github.com/elementary/greeter/issues/368 - services.displayManager.defaultSession = lib.mkDefault "pantheon"; + services.displayManager.defaultSession = mkDefault "pantheon"; services.xserver.displayManager.sessionCommands = '' if test "$XDG_CURRENT_DESKTOP" = "Pantheon"; then true - ${lib.concatMapStrings (p: '' + ${concatMapStrings (p: '' if [ -d "${p}/share/gsettings-schemas/${p.name}" ]; then export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${p}/share/gsettings-schemas/${p.name} fi @@ -126,38 +129,38 @@ in ''; # Default services - hardware.bluetooth.enable = lib.mkDefault true; + hardware.bluetooth.enable = mkDefault true; security.polkit.enable = true; services.accounts-daemon.enable = true; services.bamf.enable = true; - services.colord.enable = lib.mkDefault true; - services.fwupd.enable = lib.mkDefault true; + services.colord.enable = mkDefault true; + services.fwupd.enable = mkDefault true; # TODO: Enable once #177946 is resolved # services.packagekit.enable = mkDefault true; - services.power-profiles-daemon.enable = lib.mkDefault true; - services.touchegg.enable = lib.mkDefault true; + services.power-profiles-daemon.enable = mkDefault true; + services.touchegg.enable = mkDefault true; services.touchegg.package = pkgs.pantheon.touchegg; - services.tumbler.enable = lib.mkDefault true; - services.system-config-printer.enable = (lib.mkIf config.services.printing.enable (lib.mkDefault true)); + services.tumbler.enable = mkDefault true; + services.system-config-printer.enable = (mkIf config.services.printing.enable (mkDefault true)); services.dbus.packages = with pkgs.pantheon; [ switchboard-plug-power elementary-default-settings # accountsservice extensions ]; - services.pantheon.apps.enable = lib.mkDefault true; - services.pantheon.contractor.enable = lib.mkDefault true; + services.pantheon.apps.enable = mkDefault true; + services.pantheon.contractor.enable = mkDefault true; services.gnome.at-spi2-core.enable = true; services.gnome.evolution-data-server.enable = true; services.gnome.glib-networking.enable = true; services.gnome.gnome-keyring.enable = true; services.gvfs.enable = true; - services.gnome.rygel.enable = lib.mkDefault true; + services.gnome.rygel.enable = mkDefault true; services.udisks2.enable = true; services.upower.enable = config.powerManagement.enable; - services.libinput.enable = lib.mkDefault true; - services.switcherooControl.enable = lib.mkDefault true; + services.libinput.enable = mkDefault true; + services.switcherooControl.enable = mkDefault true; services.xserver.updateDbusEnvironment = true; - services.zeitgeist.enable = lib.mkDefault true; - services.geoclue2.enable = lib.mkDefault true; + services.zeitgeist.enable = mkDefault true; + services.geoclue2.enable = mkDefault true; # pantheon has pantheon-agent-geoclue2 services.geoclue2.enableDemoAgent = false; services.geoclue2.appConfig."io.elementary.desktop.agent-geoclue2" = { @@ -170,7 +173,7 @@ in # https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1443 pkgs.pantheon.mutter ]; - services.orca.enable = lib.mkDefault (notExcluded pkgs.orca); + services.orca.enable = mkDefault (notExcluded pkgs.orca); systemd.packages = with pkgs; [ gnome-session pantheon.gala @@ -178,7 +181,7 @@ in pantheon.elementary-session-settings ]; programs.dconf.enable = true; - networking.networkmanager.enable = lib.mkDefault true; + networking.networkmanager.enable = mkDefault true; systemd.user.targets."gnome-session-x11-services".wants = [ "org.gnome.SettingsDaemon.XSettings.service" @@ -243,12 +246,12 @@ in xdg-desktop-portal-pantheon ]); - xdg.portal.configPackages = lib.mkDefault [ pkgs.pantheon.elementary-default-settings ]; + xdg.portal.configPackages = mkDefault [ pkgs.pantheon.elementary-default-settings ]; # Override GSettings schemas environment.sessionVariables.NIX_GSETTINGS_OVERRIDES_DIR = "${nixos-gsettings-desktop-schemas}/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas"; - environment.sessionVariables.GNOME_SESSION_DEBUG = lib.mkIf cfg.debug "1"; + environment.sessionVariables.GNOME_SESSION_DEBUG = mkIf cfg.debug "1"; environment.pathsToLink = [ # FIXME: modules should link subdirs of `/share` rather than relying on this @@ -262,8 +265,8 @@ in programs.nm-applet.indicator = false; # Shell integration for VTE terminals - programs.bash.vteIntegration = lib.mkDefault true; - programs.zsh.vteIntegration = lib.mkDefault true; + programs.bash.vteIntegration = mkDefault true; + programs.zsh.vteIntegration = mkDefault true; # Default Fonts fonts.packages = with pkgs; [ @@ -279,9 +282,9 @@ in }; }) - (lib.mkIf serviceCfg.apps.enable { - programs.evince.enable = lib.mkDefault (notExcluded pkgs.evince); - programs.file-roller.enable = lib.mkDefault (notExcluded pkgs.file-roller); + (mkIf serviceCfg.apps.enable { + programs.evince.enable = mkDefault (notExcluded pkgs.evince); + programs.file-roller.enable = mkDefault (notExcluded pkgs.file-roller); environment.systemPackages = utils.removePackagesByName ([ pkgs.gnome-font-viewer @@ -312,7 +315,7 @@ in ]; }) - (lib.mkIf serviceCfg.contractor.enable { + (mkIf serviceCfg.contractor.enable { environment.systemPackages = with pkgs.pantheon; [ contractor file-roller-contract diff --git a/nixos/modules/services/x11/desktop-managers/retroarch.nix b/nixos/modules/services/x11/desktop-managers/retroarch.nix index 9f292087a073f..445de823e03f9 100644 --- a/nixos/modules/services/x11/desktop-managers/retroarch.nix +++ b/nixos/modules/services/x11/desktop-managers/retroarch.nix @@ -4,20 +4,23 @@ pkgs, ... }: + +with lib; + let cfg = config.services.xserver.desktopManager.retroarch; in { options.services.xserver.desktopManager.retroarch = { - enable = lib.mkEnableOption "RetroArch"; + enable = mkEnableOption "RetroArch"; - package = lib.mkPackageOption pkgs "retroarch" { + package = mkPackageOption pkgs "retroarch" { example = "retroarch-full"; }; - extraArgs = lib.mkOption { - type = lib.types.listOf lib.types.str; + extraArgs = mkOption { + type = types.listOf types.str; default = [ ]; example = [ "--verbose" @@ -27,12 +30,12 @@ in }; }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { services.xserver.desktopManager.session = [ { name = "RetroArch"; start = '' - ${cfg.package}/bin/retroarch -f ${lib.escapeShellArgs cfg.extraArgs} & + ${cfg.package}/bin/retroarch -f ${escapeShellArgs cfg.extraArgs} & waitPID=$! ''; } @@ -41,5 +44,5 @@ in environment.systemPackages = [ cfg.package ]; }; - meta.maintainers = with lib.maintainers; [ j0hax ]; + meta.maintainers = with maintainers; [ j0hax ]; } diff --git a/nixos/modules/services/x11/desktop-managers/surf-display.nix b/nixos/modules/services/x11/desktop-managers/surf-display.nix index 7eb088cce11e3..519388cf11a59 100644 --- a/nixos/modules/services/x11/desktop-managers/surf-display.nix +++ b/nixos/modules/services/x11/desktop-managers/surf-display.nix @@ -4,6 +4,9 @@ pkgs, ... }: + +with lib; + let cfg = config.services.xserver.desktopManager.surf-display; @@ -48,18 +51,18 @@ in { options = { services.xserver.desktopManager.surf-display = { - enable = lib.mkEnableOption "surf-display as a kiosk browser session"; + enable = mkEnableOption "surf-display as a kiosk browser session"; - defaultWwwUri = lib.mkOption { - type = lib.types.str; + defaultWwwUri = mkOption { + type = types.str; default = "${pkgs.surf-display}/share/surf-display/empty-page.html"; - defaultText = lib.literalExpression ''"''${pkgs.surf-display}/share/surf-display/empty-page.html"''; + defaultText = literalExpression ''"''${pkgs.surf-display}/share/surf-display/empty-page.html"''; example = "https://www.example.com/"; description = "Default URI to display."; }; - inactivityInterval = lib.mkOption { - type = lib.types.int; + inactivityInterval = mkOption { + type = types.int; default = 300; example = 0; description = '' @@ -72,16 +75,16 @@ in ''; }; - screensaverSettings = lib.mkOption { - type = lib.types.separatedString " "; + screensaverSettings = mkOption { + type = types.separatedString " "; default = ""; description = '' Screensaver settings, see `man 1 xset` for possible options. ''; }; - pointerButtonMap = lib.mkOption { - type = lib.types.str; + pointerButtonMap = mkOption { + type = types.str; default = "1 0 0 4 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"; description = '' Disable right and middle pointer device click in browser sessions @@ -90,15 +93,15 @@ in ''; }; - hideIdlePointer = lib.mkOption { - type = lib.types.str; + hideIdlePointer = mkOption { + type = types.str; default = "yes"; example = "no"; description = "Hide idle mouse pointer."; }; - extraConfig = lib.mkOption { - type = lib.types.lines; + extraConfig = mkOption { + type = types.lines; default = ""; example = '' # Enforce fixed resolution for all displays (default: not set): @@ -121,7 +124,7 @@ in }; }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { services.displayManager.sessionPackages = [ pkgs.surf-display ]; diff --git a/nixos/modules/services/x11/desktop-managers/xfce.nix b/nixos/modules/services/x11/desktop-managers/xfce.nix index 32c41449a2489..e1273aa7b7d16 100644 --- a/nixos/modules/services/x11/desktop-managers/xfce.nix +++ b/nixos/modules/services/x11/desktop-managers/xfce.nix @@ -1,4 +1,7 @@ { config, lib, pkgs, utils, ... }: + +with lib; + let cfg = config.services.xserver.desktopManager.xfce; excludePackages = config.environment.xfce.excludePackages; @@ -6,70 +9,70 @@ let in { meta = { - maintainers = lib.teams.xfce.members; + maintainers = teams.xfce.members; }; imports = [ # added 2019-08-18 # needed to preserve some semblance of UI familarity # with original XFCE module - (lib.mkRenamedOptionModule + (mkRenamedOptionModule [ "services" "xserver" "desktopManager" "xfce4-14" "extraSessionCommands" ] [ "services" "xserver" "displayManager" "sessionCommands" ]) # added 2019-11-04 # xfce4-14 module removed and promoted to xfce. # Needed for configs that used xfce4-14 module to migrate to this one. - (lib.mkRenamedOptionModule + (mkRenamedOptionModule [ "services" "xserver" "desktopManager" "xfce4-14" "enable" ] [ "services" "xserver" "desktopManager" "xfce" "enable" ]) - (lib.mkRenamedOptionModule + (mkRenamedOptionModule [ "services" "xserver" "desktopManager" "xfce4-14" "noDesktop" ] [ "services" "xserver" "desktopManager" "xfce" "noDesktop" ]) - (lib.mkRenamedOptionModule + (mkRenamedOptionModule [ "services" "xserver" "desktopManager" "xfce4-14" "enableXfwm" ] [ "services" "xserver" "desktopManager" "xfce" "enableXfwm" ]) - (lib.mkRenamedOptionModule + (mkRenamedOptionModule [ "services" "xserver" "desktopManager" "xfce" "extraSessionCommands" ] [ "services" "xserver" "displayManager" "sessionCommands" ]) - (lib.mkRemovedOptionModule [ "services" "xserver" "desktopManager" "xfce" "screenLock" ] "") + (mkRemovedOptionModule [ "services" "xserver" "desktopManager" "xfce" "screenLock" ] "") # added 2022-06-26 # thunar has its own module - (lib.mkRenamedOptionModule + (mkRenamedOptionModule [ "services" "xserver" "desktopManager" "xfce" "thunarPlugins" ] [ "programs" "thunar" "plugins" ]) ]; options = { services.xserver.desktopManager.xfce = { - enable = lib.mkOption { - type = lib.types.bool; + enable = mkOption { + type = types.bool; default = false; description = "Enable the Xfce desktop environment."; }; - noDesktop = lib.mkOption { - type = lib.types.bool; + noDesktop = mkOption { + type = types.bool; default = false; description = "Don't install XFCE desktop components (xfdesktop and panel)."; }; - enableXfwm = lib.mkOption { - type = lib.types.bool; + enableXfwm = mkOption { + type = types.bool; default = true; description = "Enable the XFWM (default) window manager."; }; - enableScreensaver = lib.mkOption { - type = lib.types.bool; + enableScreensaver = mkOption { + type = types.bool; default = true; description = "Enable the XFCE screensaver."; }; - enableWaylandSession = lib.mkEnableOption "the experimental Xfce Wayland session"; + enableWaylandSession = mkEnableOption "the experimental Xfce Wayland session"; - waylandSessionCompositor = lib.mkOption { + waylandSessionCompositor = mkOption { type = lib.types.str; default = ""; example = "wayfire"; @@ -84,15 +87,15 @@ in }; }; - environment.xfce.excludePackages = lib.mkOption { + environment.xfce.excludePackages = mkOption { default = []; - example = lib.literalExpression "[ pkgs.xfce.xfce4-volumed-pulse ]"; - type = lib.types.listOf lib.types.package; + example = literalExpression "[ pkgs.xfce.xfce4-volumed-pulse ]"; + type = types.listOf types.package; description = "Which packages XFCE should exclude from the default environment"; }; }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { environment.systemPackages = utils.removePackagesByName (with pkgs; [ glib # for gsettings gtk3.out # gtk-update-icon-cache @@ -144,10 +147,10 @@ in xfce.xfdesktop ] ++ lib.optional cfg.enableScreensaver xfce.xfce4-screensaver) excludePackages; - programs.gnupg.agent.pinentryPackage = lib.mkDefault pkgs.pinentry-gtk2; + programs.gnupg.agent.pinentryPackage = mkDefault pkgs.pinentry-gtk2; programs.xfconf.enable = true; programs.thunar.enable = true; - programs.labwc.enable = lib.mkDefault (cfg.enableWaylandSession && ( + programs.labwc.enable = mkDefault (cfg.enableWaylandSession && ( cfg.waylandSessionCompositor == "" || lib.substring 0 5 cfg.waylandSessionCompositor == "labwc")); environment.pathsToLink = [ @@ -170,7 +173,7 @@ in # Copied from https://gitlab.xfce.org/xfce/xfce4-session/-/blob/xfce4-session-4.19.2/xfce-wayland.desktop.in # to maintain consistent l10n state with X11 session file and to support the waylandSessionCompositor option. - services.displayManager.sessionPackages = lib.optionals cfg.enableWaylandSession [ + services.displayManager.sessionPackages = optionals cfg.enableWaylandSession [ ((pkgs.writeTextDir "share/wayland-sessions/xfce-wayland.desktop" '' [Desktop Entry] Version=1.0 @@ -195,16 +198,16 @@ in services.gnome.glib-networking.enable = true; services.gvfs.enable = true; services.tumbler.enable = true; - services.system-config-printer.enable = (lib.mkIf config.services.printing.enable (lib.mkDefault true)); - services.libinput.enable = lib.mkDefault true; # used in xfce4-settings-manager - services.colord.enable = lib.mkDefault true; + services.system-config-printer.enable = (mkIf config.services.printing.enable (mkDefault true)); + services.libinput.enable = mkDefault true; # used in xfce4-settings-manager + services.colord.enable = mkDefault true; # Enable default programs programs.dconf.enable = true; # Shell integration for VTE terminals - programs.bash.vteIntegration = lib.mkDefault true; - programs.zsh.vteIntegration = lib.mkDefault true; + programs.bash.vteIntegration = mkDefault true; + programs.zsh.vteIntegration = mkDefault true; # Systemd services systemd.packages = utils.removePackagesByName (with pkgs.xfce; [ @@ -213,6 +216,6 @@ in security.pam.services.xfce4-screensaver.unixAuth = cfg.enableScreensaver; - xdg.portal.configPackages = lib.mkDefault [ pkgs.xfce.xfce4-session ]; + xdg.portal.configPackages = mkDefault [ pkgs.xfce.xfce4-session ]; }; } diff --git a/nixos/modules/services/x11/desktop-managers/xterm.nix b/nixos/modules/services/x11/desktop-managers/xterm.nix index 562401c9d0570..c4db014db796c 100644 --- a/nixos/modules/services/x11/desktop-managers/xterm.nix +++ b/nixos/modules/services/x11/desktop-managers/xterm.nix @@ -4,6 +4,9 @@ pkgs, ... }: + +with lib; + let cfg = config.services.xserver.desktopManager.xterm; @@ -14,18 +17,18 @@ in { options = { - services.xserver.desktopManager.xterm.enable = lib.mkOption { - type = lib.types.bool; - default = lib.versionOlder config.system.stateVersion "19.09" && xSessionEnabled; - defaultText = lib.literalExpression ''versionOlder config.system.stateVersion "19.09" && config.services.xserver.enable;''; + services.xserver.desktopManager.xterm.enable = mkOption { + type = types.bool; + default = versionOlder config.system.stateVersion "19.09" && xSessionEnabled; + defaultText = literalExpression ''versionOlder config.system.stateVersion "19.09" && config.services.xserver.enable;''; description = "Enable a xterm terminal as a desktop manager."; }; }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { - services.xserver.desktopManager.session = lib.singleton { + services.xserver.desktopManager.session = singleton { name = "xterm"; start = '' ${pkgs.xterm}/bin/xterm -ls & diff --git a/nixos/modules/services/x11/display-managers/lightdm-greeters/enso-os.nix b/nixos/modules/services/x11/display-managers/lightdm-greeters/enso-os.nix index 797294397447e..85de2ce628497 100644 --- a/nixos/modules/services/x11/display-managers/lightdm-greeters/enso-os.nix +++ b/nixos/modules/services/x11/display-managers/lightdm-greeters/enso-os.nix @@ -4,6 +4,8 @@ pkgs, ... }: + +with lib; let dmcfg = config.services.xserver.displayManager; ldmcfg = dmcfg.lightdm; @@ -27,8 +29,8 @@ in { options = { services.xserver.displayManager.lightdm.greeters.enso = { - enable = lib.mkOption { - type = lib.types.bool; + enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable enso-os-greeter as the lightdm greeter @@ -36,17 +38,17 @@ in }; theme = { - package = lib.mkOption { - type = lib.types.package; + package = mkOption { + type = types.package; default = pkgs.gnome-themes-extra; - defaultText = lib.literalExpression "pkgs.gnome-themes-extra"; + defaultText = literalExpression "pkgs.gnome-themes-extra"; description = '' The package path that contains the theme given in the name option. ''; }; - name = lib.mkOption { - type = lib.types.str; + name = mkOption { + type = types.str; default = "Adwaita"; description = '' Name of the theme to use for the lightdm-enso-os-greeter @@ -55,17 +57,17 @@ in }; iconTheme = { - package = lib.mkOption { - type = lib.types.package; + package = mkOption { + type = types.package; default = pkgs.papirus-icon-theme; - defaultText = lib.literalExpression "pkgs.papirus-icon-theme"; + defaultText = literalExpression "pkgs.papirus-icon-theme"; description = '' The package path that contains the icon theme given in the name option. ''; }; - name = lib.mkOption { - type = lib.types.str; + name = mkOption { + type = types.str; default = "ePapirus"; description = '' Name of the icon theme to use for the lightdm-enso-os-greeter @@ -74,17 +76,17 @@ in }; cursorTheme = { - package = lib.mkOption { - type = lib.types.package; + package = mkOption { + type = types.package; default = pkgs.capitaine-cursors; - defaultText = lib.literalExpression "pkgs.capitaine-cursors"; + defaultText = literalExpression "pkgs.capitaine-cursors"; description = '' The package path that contains the cursor theme given in the name option. ''; }; - name = lib.mkOption { - type = lib.types.str; + name = mkOption { + type = types.str; default = "capitane-cursors"; description = '' Name of the cursor theme to use for the lightdm-enso-os-greeter @@ -92,24 +94,24 @@ in }; }; - blur = lib.mkOption { - type = lib.types.bool; + blur = mkOption { + type = types.bool; default = false; description = '' Whether or not to enable blur ''; }; - brightness = lib.mkOption { - type = lib.types.int; + brightness = mkOption { + type = types.int; default = 7; description = '' Brightness ''; }; - extraConfig = lib.mkOption { - type = lib.types.lines; + extraConfig = mkOption { + type = types.lines; default = ""; description = '' Extra configuration that should be put in the greeter.conf @@ -119,7 +121,7 @@ in }; }; - config = lib.mkIf (ldmcfg.enable && cfg.enable) { + config = mkIf (ldmcfg.enable && cfg.enable) { environment.etc."lightdm/greeter.conf".source = ensoGreeterConf; environment.systemPackages = [ @@ -129,14 +131,14 @@ in ]; services.xserver.displayManager.lightdm = { - greeter = lib.mkDefault { + greeter = mkDefault { package = pkgs.lightdm-enso-os-greeter.xgreeters; name = "pantheon-greeter"; }; greeters = { gtk = { - enable = lib.mkDefault false; + enable = mkDefault false; }; }; }; diff --git a/nixos/modules/services/x11/display-managers/lightdm-greeters/gtk.nix b/nixos/modules/services/x11/display-managers/lightdm-greeters/gtk.nix index e903efea28d8e..468ab09c66a56 100644 --- a/nixos/modules/services/x11/display-managers/lightdm-greeters/gtk.nix +++ b/nixos/modules/services/x11/display-managers/lightdm-greeters/gtk.nix @@ -4,6 +4,9 @@ pkgs, ... }: + +with lib; + let dmcfg = config.services.xserver.displayManager; @@ -24,11 +27,9 @@ let cursor-theme-name = ${cfg.cursorTheme.name} cursor-theme-size = ${toString cfg.cursorTheme.size} background = ${ldmcfg.background} - ${lib.optionalString (cfg.clock-format != null) "clock-format = ${cfg.clock-format}"} - ${lib.optionalString ( - cfg.indicators != null - ) "indicators = ${lib.concatStringsSep ";" cfg.indicators}"} - ${lib.optionalString (xcfg.dpi != null) "xft-dpi=${toString xcfg.dpi}"} + ${optionalString (cfg.clock-format != null) "clock-format = ${cfg.clock-format}"} + ${optionalString (cfg.indicators != null) "indicators = ${concatStringsSep ";" cfg.indicators}"} + ${optionalString (xcfg.dpi != null) "xft-dpi=${toString xcfg.dpi}"} ${cfg.extraConfig} ''; @@ -38,8 +39,8 @@ in services.xserver.displayManager.lightdm.greeters.gtk = { - enable = lib.mkOption { - type = lib.types.bool; + enable = mkOption { + type = types.bool; default = true; description = '' Whether to enable lightdm-gtk-greeter as the lightdm greeter. @@ -48,17 +49,17 @@ in theme = { - package = lib.mkOption { - type = lib.types.package; + package = mkOption { + type = types.package; default = pkgs.gnome-themes-extra; - defaultText = lib.literalExpression "pkgs.gnome-themes-extra"; + defaultText = literalExpression "pkgs.gnome-themes-extra"; description = '' The package path that contains the theme given in the name option. ''; }; - name = lib.mkOption { - type = lib.types.str; + name = mkOption { + type = types.str; default = "Adwaita"; description = '' Name of the theme to use for the lightdm-gtk-greeter. @@ -69,17 +70,17 @@ in iconTheme = { - package = lib.mkOption { - type = lib.types.package; + package = mkOption { + type = types.package; default = pkgs.adwaita-icon-theme; - defaultText = lib.literalExpression "pkgs.adwaita-icon-theme"; + defaultText = literalExpression "pkgs.adwaita-icon-theme"; description = '' The package path that contains the icon theme given in the name option. ''; }; - name = lib.mkOption { - type = lib.types.str; + name = mkOption { + type = types.str; default = "Adwaita"; description = '' Name of the icon theme to use for the lightdm-gtk-greeter. @@ -90,25 +91,25 @@ in cursorTheme = { - package = lib.mkOption { - type = lib.types.package; + package = mkOption { + type = types.package; default = pkgs.adwaita-icon-theme; - defaultText = lib.literalExpression "pkgs.adwaita-icon-theme"; + defaultText = literalExpression "pkgs.adwaita-icon-theme"; description = '' The package path that contains the cursor theme given in the name option. ''; }; - name = lib.mkOption { - type = lib.types.str; + name = mkOption { + type = types.str; default = "Adwaita"; description = '' Name of the cursor theme to use for the lightdm-gtk-greeter. ''; }; - size = lib.mkOption { - type = lib.types.int; + size = mkOption { + type = types.int; default = 16; description = '' Size of the cursor theme to use for the lightdm-gtk-greeter. @@ -116,8 +117,8 @@ in }; }; - clock-format = lib.mkOption { - type = lib.types.nullOr lib.types.str; + clock-format = mkOption { + type = types.nullOr types.str; default = null; example = "%F"; description = '' @@ -128,8 +129,8 @@ in ''; }; - indicators = lib.mkOption { - type = lib.types.nullOr (lib.types.listOf lib.types.str); + indicators = mkOption { + type = types.nullOr (types.listOf types.str); default = null; example = [ "~host" @@ -154,8 +155,8 @@ in ''; }; - extraConfig = lib.mkOption { - type = lib.types.lines; + extraConfig = mkOption { + type = types.lines; default = ""; description = '' Extra configuration that should be put in the lightdm-gtk-greeter.conf @@ -167,9 +168,9 @@ in }; - config = lib.mkIf (ldmcfg.enable && cfg.enable) { + config = mkIf (ldmcfg.enable && cfg.enable) { - services.xserver.displayManager.lightdm.greeter = lib.mkDefault { + services.xserver.displayManager.lightdm.greeter = mkDefault { package = pkgs.lightdm-gtk-greeter.xgreeters; name = "lightdm-gtk-greeter"; }; diff --git a/nixos/modules/services/x11/display-managers/lightdm-greeters/mini.nix b/nixos/modules/services/x11/display-managers/lightdm-greeters/mini.nix index f81b711179e63..a3fca737a2b2b 100644 --- a/nixos/modules/services/x11/display-managers/lightdm-greeters/mini.nix +++ b/nixos/modules/services/x11/display-managers/lightdm-greeters/mini.nix @@ -4,6 +4,9 @@ pkgs, ... }: + +with lib; + let dmcfg = config.services.xserver.displayManager; @@ -53,8 +56,8 @@ in services.xserver.displayManager.lightdm.greeters.mini = { - enable = lib.mkOption { - type = lib.types.bool; + enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable lightdm-mini-greeter as the lightdm greeter. @@ -65,16 +68,16 @@ in ''; }; - user = lib.mkOption { - type = lib.types.str; + user = mkOption { + type = types.str; default = "root"; description = '' The user to login as. ''; }; - extraConfig = lib.mkOption { - type = lib.types.lines; + extraConfig = mkOption { + type = types.lines; default = ""; description = '' Extra configuration that should be put in the lightdm-mini-greeter.conf @@ -86,11 +89,11 @@ in }; - config = lib.mkIf (ldmcfg.enable && cfg.enable) { + config = mkIf (ldmcfg.enable && cfg.enable) { services.xserver.displayManager.lightdm.greeters.gtk.enable = false; - services.xserver.displayManager.lightdm.greeter = lib.mkDefault { + services.xserver.displayManager.lightdm.greeter = mkDefault { package = pkgs.lightdm-mini-greeter.xgreeters; name = "lightdm-mini-greeter"; }; diff --git a/nixos/modules/services/x11/display-managers/lightdm-greeters/mobile.nix b/nixos/modules/services/x11/display-managers/lightdm-greeters/mobile.nix index b7c6a9b4ae68a..5d8edbe7c59e6 100644 --- a/nixos/modules/services/x11/display-managers/lightdm-greeters/mobile.nix +++ b/nixos/modules/services/x11/display-managers/lightdm-greeters/mobile.nix @@ -4,6 +4,8 @@ pkgs, ... }: + +with lib; let dmcfg = config.services.xserver.displayManager; ldmcfg = dmcfg.lightdm; @@ -12,14 +14,14 @@ in { options = { services.xserver.displayManager.lightdm.greeters.mobile = { - enable = lib.mkEnableOption "lightdm-mobile-greeter as the lightdm greeter"; + enable = mkEnableOption "lightdm-mobile-greeter as the lightdm greeter"; }; }; - config = lib.mkIf (ldmcfg.enable && cfg.enable) { + config = mkIf (ldmcfg.enable && cfg.enable) { services.xserver.displayManager.lightdm.greeters.gtk.enable = false; - services.xserver.displayManager.lightdm.greeter = lib.mkDefault { + services.xserver.displayManager.lightdm.greeter = mkDefault { package = pkgs.lightdm-mobile-greeter.xgreeters; name = "lightdm-mobile-greeter"; }; diff --git a/nixos/modules/services/x11/display-managers/lightdm-greeters/pantheon.nix b/nixos/modules/services/x11/display-managers/lightdm-greeters/pantheon.nix index 8ad6a108dddf8..f598fd1171a2f 100644 --- a/nixos/modules/services/x11/display-managers/lightdm-greeters/pantheon.nix +++ b/nixos/modules/services/x11/display-managers/lightdm-greeters/pantheon.nix @@ -4,6 +4,9 @@ pkgs, ... }: + +with lib; + let dmcfg = config.services.xserver.displayManager; @@ -20,8 +23,8 @@ in services.xserver.displayManager.lightdm.greeters.pantheon = { - enable = lib.mkOption { - type = lib.types.bool; + enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable elementary-greeter as the lightdm greeter. @@ -32,11 +35,11 @@ in }; - config = lib.mkIf (ldmcfg.enable && cfg.enable) { + config = mkIf (ldmcfg.enable && cfg.enable) { services.xserver.displayManager.lightdm.greeters.gtk.enable = false; - services.xserver.displayManager.lightdm.greeter = lib.mkDefault { + services.xserver.displayManager.lightdm.greeter = mkDefault { package = pkgs.pantheon.elementary-greeter.xgreeters; name = "io.elementary.greeter"; }; diff --git a/nixos/modules/services/x11/display-managers/lightdm-greeters/slick.nix b/nixos/modules/services/x11/display-managers/lightdm-greeters/slick.nix index f90363d58ac27..e2d83ce5dcb4f 100644 --- a/nixos/modules/services/x11/display-managers/lightdm-greeters/slick.nix +++ b/nixos/modules/services/x11/display-managers/lightdm-greeters/slick.nix @@ -4,6 +4,9 @@ pkgs, ... }: + +with lib; + let ldmcfg = config.services.xserver.displayManager.lightdm; cfg = ldmcfg.greeters.slick; @@ -23,27 +26,27 @@ let font-name=${cfg.font.name} cursor-theme-name=${cfg.cursorTheme.name} cursor-theme-size=${toString cfg.cursorTheme.size} - draw-user-backgrounds=${lib.boolToString cfg.draw-user-backgrounds} + draw-user-backgrounds=${boolToString cfg.draw-user-backgrounds} ${cfg.extraConfig} ''; in { options = { services.xserver.displayManager.lightdm.greeters.slick = { - enable = lib.mkEnableOption "lightdm-slick-greeter as the lightdm greeter"; + enable = mkEnableOption "lightdm-slick-greeter as the lightdm greeter"; theme = { - package = lib.mkOption { - type = lib.types.package; + package = mkOption { + type = types.package; default = pkgs.gnome-themes-extra; - defaultText = lib.literalExpression "pkgs.gnome-themes-extra"; + defaultText = literalExpression "pkgs.gnome-themes-extra"; description = '' The package path that contains the theme given in the name option. ''; }; - name = lib.mkOption { - type = lib.types.str; + name = mkOption { + type = types.str; default = "Adwaita"; description = '' Name of the theme to use for the lightdm-slick-greeter. @@ -52,17 +55,17 @@ in }; iconTheme = { - package = lib.mkOption { - type = lib.types.package; + package = mkOption { + type = types.package; default = pkgs.adwaita-icon-theme; - defaultText = lib.literalExpression "pkgs.adwaita-icon-theme"; + defaultText = literalExpression "pkgs.adwaita-icon-theme"; description = '' The package path that contains the icon theme given in the name option. ''; }; - name = lib.mkOption { - type = lib.types.str; + name = mkOption { + type = types.str; default = "Adwaita"; description = '' Name of the icon theme to use for the lightdm-slick-greeter. @@ -71,17 +74,17 @@ in }; font = { - package = lib.mkOption { - type = lib.types.package; + package = mkOption { + type = types.package; default = pkgs.ubuntu-classic; - defaultText = lib.literalExpression "pkgs.ubuntu-classic"; + defaultText = literalExpression "pkgs.ubuntu-classic"; description = '' The package path that contains the font given in the name option. ''; }; - name = lib.mkOption { - type = lib.types.str; + name = mkOption { + type = types.str; default = "Ubuntu 11"; description = '' Name of the font to use. @@ -90,25 +93,25 @@ in }; cursorTheme = { - package = lib.mkOption { - type = lib.types.package; + package = mkOption { + type = types.package; default = pkgs.adwaita-icon-theme; - defaultText = lib.literalExpression "pkgs.adwaita-icon-theme"; + defaultText = literalExpression "pkgs.adwaita-icon-theme"; description = '' The package path that contains the cursor theme given in the name option. ''; }; - name = lib.mkOption { - type = lib.types.str; + name = mkOption { + type = types.str; default = "Adwaita"; description = '' Name of the cursor theme to use for the lightdm-slick-greeter. ''; }; - size = lib.mkOption { - type = lib.types.int; + size = mkOption { + type = types.int; default = 24; description = '' Size of the cursor theme to use for the lightdm-slick-greeter. @@ -116,10 +119,10 @@ in }; }; - draw-user-backgrounds = lib.mkEnableOption "draw user backgrounds"; + draw-user-backgrounds = mkEnableOption "draw user backgrounds"; - extraConfig = lib.mkOption { - type = lib.types.lines; + extraConfig = mkOption { + type = types.lines; default = ""; description = '' Extra configuration that should be put in the lightdm-slick-greeter.conf @@ -129,10 +132,10 @@ in }; }; - config = lib.mkIf (ldmcfg.enable && cfg.enable) { + config = mkIf (ldmcfg.enable && cfg.enable) { services.xserver.displayManager.lightdm = { greeters.gtk.enable = false; - greeter = lib.mkDefault { + greeter = mkDefault { package = pkgs.lightdm-slick-greeter.xgreeters; name = "lightdm-slick-greeter"; }; diff --git a/nixos/modules/services/x11/display-managers/lightdm-greeters/tiny.nix b/nixos/modules/services/x11/display-managers/lightdm-greeters/tiny.nix index 73e144ddccf98..4780468533de1 100644 --- a/nixos/modules/services/x11/display-managers/lightdm-greeters/tiny.nix +++ b/nixos/modules/services/x11/display-managers/lightdm-greeters/tiny.nix @@ -4,6 +4,9 @@ pkgs, ... }: + +with lib; + let dmcfg = config.services.xserver.displayManager; @@ -16,8 +19,8 @@ in services.xserver.displayManager.lightdm.greeters.tiny = { - enable = lib.mkOption { - type = lib.types.bool; + enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable lightdm-tiny-greeter as the lightdm greeter. @@ -29,16 +32,16 @@ in }; label = { - user = lib.mkOption { - type = lib.types.str; + user = mkOption { + type = types.str; default = "Username"; description = '' The string to represent the user_text label. ''; }; - pass = lib.mkOption { - type = lib.types.str; + pass = mkOption { + type = types.str; default = "Password"; description = '' The string to represent the pass_text label. @@ -46,8 +49,8 @@ in }; }; - extraConfig = lib.mkOption { - type = lib.types.lines; + extraConfig = mkOption { + type = types.lines; default = ""; description = '' Section to describe style and ui. @@ -58,7 +61,7 @@ in }; - config = lib.mkIf (ldmcfg.enable && cfg.enable) { + config = mkIf (ldmcfg.enable && cfg.enable) { services.xserver.displayManager.lightdm.greeters.gtk.enable = false; @@ -70,10 +73,10 @@ in static const char *pass_text = "${cfg.label.pass}"; static const char *session = "${dmcfg.defaultSession}"; ''; - config = lib.optionalString (cfg.extraConfig != "") (configHeader + cfg.extraConfig); + config = optionalString (cfg.extraConfig != "") (configHeader + cfg.extraConfig); package = pkgs.lightdm-tiny-greeter.override { conf = config; }; in - lib.mkDefault { + mkDefault { package = package.xgreeters; name = "lightdm-tiny-greeter"; }; diff --git a/nixos/modules/services/x11/display-managers/lightdm.nix b/nixos/modules/services/x11/display-managers/lightdm.nix index 3ac91f860f6d1..3e964ef53266d 100644 --- a/nixos/modules/services/x11/display-managers/lightdm.nix +++ b/nixos/modules/services/x11/display-managers/lightdm.nix @@ -4,6 +4,9 @@ pkgs, ... }: + +with lib; + let xcfg = config.services.xserver; @@ -19,7 +22,7 @@ let # lightdm runs with clearenv(), but we need a few things in the environment for X to startup xserverWrapper = writeScript "xserver-wrapper" '' #! ${pkgs.bash}/bin/bash - ${lib.concatMapStrings (n: "export ${n}=\"${lib.getAttr n xEnv}\"\n") (lib.attrNames xEnv)} + ${concatMapStrings (n: "export ${n}=\"${getAttr n xEnv}\"\n") (attrNames xEnv)} display=$(echo "$@" | xargs -n 1 | grep -P ^:\\d\$ | head -n 1 | sed s/^://) if [ -z "$display" ] @@ -33,13 +36,13 @@ let usersConf = writeText "users.conf" '' [UserList] minimum-uid=1000 - hidden-users=${lib.concatStringsSep " " dmcfg.hiddenUsers} + hidden-users=${concatStringsSep " " dmcfg.hiddenUsers} hidden-shells=/run/current-system/sw/bin/nologin ''; lightdmConf = writeText "lightdm.conf" '' [LightDM] - ${lib.optionalString cfg.greeter.enable '' + ${optionalString cfg.greeter.enable '' greeter-user = ${config.users.users.lightdm.name} greeters-directory = ${cfg.greeter.package} ''} @@ -49,15 +52,15 @@ let [Seat:*] xserver-command = ${xserverWrapper} session-wrapper = ${dmcfg.sessionData.wrapper} - ${lib.optionalString cfg.greeter.enable '' + ${optionalString cfg.greeter.enable '' greeter-session = ${cfg.greeter.name} ''} - ${lib.optionalString dmcfg.autoLogin.enable '' + ${optionalString dmcfg.autoLogin.enable '' autologin-user = ${dmcfg.autoLogin.user} autologin-user-timeout = ${toString cfg.autoLogin.timeout} autologin-session = ${sessionData.autologinSession} ''} - ${lib.optionalString (xcfg.displayManager.setupCommands != "") '' + ${optionalString (xcfg.displayManager.setupCommands != "") '' display-setup-script=${pkgs.writeScript "lightdm-display-setup" '' #!${pkgs.bash}/bin/bash ${xcfg.displayManager.setupCommands} @@ -84,7 +87,7 @@ in ./lightdm-greeters/tiny.nix ./lightdm-greeters/slick.nix ./lightdm-greeters/mobile.nix - (lib.mkRenamedOptionModule + (mkRenamedOptionModule [ "services" "xserver" "displayManager" "lightdm" "autoLogin" "enable" ] [ "services" @@ -93,7 +96,7 @@ in "enable" ] ) - (lib.mkRenamedOptionModule + (mkRenamedOptionModule [ "services" "xserver" "displayManager" "lightdm" "autoLogin" "user" ] [ "services" @@ -108,8 +111,8 @@ in services.xserver.displayManager.lightdm = { - enable = lib.mkOption { - type = lib.types.bool; + enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable lightdm as the display manager. @@ -117,24 +120,24 @@ in }; greeter = { - enable = lib.mkOption { - type = lib.types.bool; + enable = mkOption { + type = types.bool; default = true; description = '' If set to false, run lightdm in greeterless mode. This only works if autologin is enabled and autoLogin.timeout is zero. ''; }; - package = lib.mkOption { - type = lib.types.package; + package = mkOption { + type = types.package; description = '' The LightDM greeter to login via. The package should be a directory containing a .desktop file matching the name in the 'name' option. ''; }; - name = lib.mkOption { - type = lib.types.str; + name = mkOption { + type = types.str; description = '' The name of a .desktop file in the directory specified in the 'package' option. @@ -142,8 +145,8 @@ in }; }; - extraConfig = lib.mkOption { - type = lib.types.lines; + extraConfig = mkOption { + type = types.lines; default = ""; example = '' user-authority-in-system-dir = true @@ -151,17 +154,17 @@ in description = "Extra lines to append to LightDM section."; }; - background = lib.mkOption { - type = lib.types.either lib.types.path (lib.types.strMatching "^#[0-9]\{6\}$"); + background = mkOption { + type = types.either types.path (types.strMatching "^#[0-9]\{6\}$"); # Manual cannot depend on packages, we are actually setting the default in config below. - defaultText = lib.literalExpression "pkgs.nixos-artwork.wallpapers.simple-dark-gray-bottom.gnomeFilePath"; + defaultText = literalExpression "pkgs.nixos-artwork.wallpapers.simple-dark-gray-bottom.gnomeFilePath"; description = '' The background image or color to use. ''; }; - extraSeatDefaults = lib.mkOption { - type = lib.types.lines; + extraSeatDefaults = mkOption { + type = types.lines; default = ""; example = '' greeter-show-manual-login=true @@ -170,8 +173,8 @@ in }; # Configuration for automatic login specific to LightDM - autoLogin.timeout = lib.mkOption { - type = lib.types.int; + autoLogin.timeout = mkOption { + type = types.int; default = 0; description = '' Show the greeter for this many seconds before automatic login occurs. @@ -181,7 +184,7 @@ in }; }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { assertions = [ { @@ -207,12 +210,12 @@ in # Keep in sync with the defaultText value from the option definition. services.xserver.displayManager.lightdm.background = - lib.mkDefault pkgs.nixos-artwork.wallpapers.simple-dark-gray-bottom.gnomeFilePath; + mkDefault pkgs.nixos-artwork.wallpapers.simple-dark-gray-bottom.gnomeFilePath; # Set default session in session chooser to a specified values – basically ignore session history. # Auto-login is already covered by a config value. services.displayManager.preStart = - lib.optionalString (!dmcfg.autoLogin.enable && dmcfg.defaultSession != null) + optionalString (!dmcfg.autoLogin.enable && dmcfg.defaultSession != null) '' ${setSessionScript}/bin/set-session ${dmcfg.defaultSession} ''; diff --git a/nixos/modules/services/x11/display-managers/slim.nix b/nixos/modules/services/x11/display-managers/slim.nix index 8c522d4a9e933..c5963b0be7ec8 100644 --- a/nixos/modules/services/x11/display-managers/slim.nix +++ b/nixos/modules/services/x11/display-managers/slim.nix @@ -4,10 +4,13 @@ pkgs, ... }: + +with lib; + { # added 2019-11-11 imports = [ - (lib.mkRemovedOptionModule [ "services" "xserver" "displayManager" "slim" ] '' + (mkRemovedOptionModule [ "services" "xserver" "displayManager" "slim" ] '' The SLIM project is abandoned and their last release was in 2013. Because of this it poses a security risk to your system. Other issues include it not fully supporting systemd and logind sessions. diff --git a/nixos/modules/services/x11/display-managers/startx.nix b/nixos/modules/services/x11/display-managers/startx.nix index e6e61318c19f6..a990c9ed5ea53 100644 --- a/nixos/modules/services/x11/display-managers/startx.nix +++ b/nixos/modules/services/x11/display-managers/startx.nix @@ -4,6 +4,9 @@ pkgs, ... }: + +with lib; + let cfg = config.services.xserver.displayManager.startx; @@ -16,8 +19,8 @@ in options = { services.xserver.displayManager.startx = { - enable = lib.mkOption { - type = lib.types.bool; + enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable the dummy "startx" pseudo-display manager, @@ -33,7 +36,7 @@ in ###### implementation - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { services.xserver = { exportConfiguration = true; }; @@ -43,7 +46,7 @@ in # # To send log to Xorg's default log location ($XDG_DATA_HOME/xorg/), we do # not specify a log file when running X - services.xserver.logFile = lib.mkDefault null; + services.xserver.logFile = mkDefault null; # Implement xserverArgs via xinit's system-wide xserverrc environment.etc."X11/xinit/xserverrc".source = pkgs.writeShellScript "xserverrc" '' diff --git a/nixos/modules/services/x11/display-managers/xpra.nix b/nixos/modules/services/x11/display-managers/xpra.nix index c75a293b36543..67b1751ba8ecb 100644 --- a/nixos/modules/services/x11/display-managers/xpra.nix +++ b/nixos/modules/services/x11/display-managers/xpra.nix @@ -1,4 +1,7 @@ { config, lib, pkgs, ... }: + +with lib; + let cfg = config.services.xserver.displayManager.xpra; dmcfg = config.services.xserver.displayManager; @@ -10,46 +13,46 @@ in options = { services.xserver.displayManager.xpra = { - enable = lib.mkOption { - type = lib.types.bool; + enable = mkOption { + type = types.bool; default = false; description = "Whether to enable xpra as display manager."; }; - bindTcp = lib.mkOption { + bindTcp = mkOption { default = "127.0.0.1:10000"; example = "0.0.0.0:10000"; - type = lib.types.nullOr lib.types.str; + type = types.nullOr types.str; description = "Bind xpra to TCP"; }; - desktop = lib.mkOption { - type = lib.types.nullOr lib.types.str; + desktop = mkOption { + type = types.nullOr types.str; default = null; example = "gnome-shell"; description = "Start a desktop environment instead of seamless mode"; }; - auth = lib.mkOption { - type = lib.types.str; + auth = mkOption { + type = types.str; default = "pam"; example = "password:value=mysecret"; description = "Authentication to use when connecting to xpra"; }; - pulseaudio = lib.mkEnableOption "pulseaudio audio streaming"; + pulseaudio = mkEnableOption "pulseaudio audio streaming"; - extraOptions = lib.mkOption { + extraOptions = mkOption { description = "Extra xpra options"; default = []; - type = lib.types.listOf lib.types.str; + type = types.listOf types.str; }; }; }; ###### implementation - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { services.xserver.videoDrivers = ["dummy"]; services.xserver.monitorSection = '' @@ -224,7 +227,7 @@ in ''; services.displayManager.execCmd = '' - ${lib.optionalString (cfg.pulseaudio) + ${optionalString (cfg.pulseaudio) "export PULSE_COOKIE=/run/pulse/.config/pulse/cookie"} exec ${pkgs.xpra}/bin/xpra ${if cfg.desktop == null then "start" else "start-desktop --start=${cfg.desktop}"} \ --daemon=off \ @@ -236,20 +239,20 @@ in --speaker=yes \ --mdns=no \ --pulseaudio=no \ - ${lib.optionalString (cfg.pulseaudio) "--sound-source=pulse"} \ + ${optionalString (cfg.pulseaudio) "--sound-source=pulse"} \ --socket-dirs=/run/xpra \ - --xvfb="xpra_Xdummy ${lib.concatStringsSep " " dmcfg.xserverArgs}" \ - ${lib.optionalString (cfg.bindTcp != null) "--bind-tcp=${cfg.bindTcp}"} \ + --xvfb="xpra_Xdummy ${concatStringsSep " " dmcfg.xserverArgs}" \ + ${optionalString (cfg.bindTcp != null) "--bind-tcp=${cfg.bindTcp}"} \ --auth=${cfg.auth} \ - ${lib.concatStringsSep " " cfg.extraOptions} + ${concatStringsSep " " cfg.extraOptions} ''; services.xserver.terminateOnReset = false; environment.systemPackages = [pkgs.xpra]; - services.pulseaudio.enable = lib.mkDefault cfg.pulseaudio; - services.pulseaudio.systemWide = lib.mkDefault cfg.pulseaudio; + services.pulseaudio.enable = mkDefault cfg.pulseaudio; + services.pulseaudio.systemWide = mkDefault cfg.pulseaudio; }; } diff --git a/nixos/modules/services/x11/extra-layouts.nix b/nixos/modules/services/x11/extra-layouts.nix index e5e294a5c1755..0327609c25cd9 100644 --- a/nixos/modules/services/x11/extra-layouts.nix +++ b/nixos/modules/services/x11/extra-layouts.nix @@ -4,26 +4,29 @@ pkgs, ... }: + +with lib; + let layouts = config.services.xserver.xkb.extraLayouts; layoutOpts = { options = { - description = lib.mkOption { - type = lib.types.str; + description = mkOption { + type = types.str; description = "A short description of the layout."; }; - languages = lib.mkOption { - type = lib.types.listOf lib.types.str; + languages = mkOption { + type = types.listOf types.str; description = '' A list of languages provided by the layout. (Use ISO 639-2 codes, for example: "eng" for english) ''; }; - compatFile = lib.mkOption { - type = lib.types.nullOr lib.types.path; + compatFile = mkOption { + type = types.nullOr types.path; default = null; description = '' The path to the xkb compat file. @@ -33,8 +36,8 @@ let ''; }; - geometryFile = lib.mkOption { - type = lib.types.nullOr lib.types.path; + geometryFile = mkOption { + type = types.nullOr types.path; default = null; description = '' The path to the xkb geometry file. @@ -44,8 +47,8 @@ let ''; }; - keycodesFile = lib.mkOption { - type = lib.types.nullOr lib.types.path; + keycodesFile = mkOption { + type = types.nullOr types.path; default = null; description = '' The path to the xkb keycodes file. @@ -55,8 +58,8 @@ let ''; }; - symbolsFile = lib.mkOption { - type = lib.types.nullOr lib.types.path; + symbolsFile = mkOption { + type = types.nullOr types.path; default = null; description = '' The path to the xkb symbols file. @@ -66,8 +69,8 @@ let ''; }; - typesFile = lib.mkOption { - type = lib.types.nullOr lib.types.path; + typesFile = mkOption { + type = types.nullOr types.path; default = null; description = '' The path to the xkb types file. @@ -108,10 +111,10 @@ in ###### interface options.services.xserver.xkb = { - extraLayouts = lib.mkOption { - type = lib.types.attrsOf (lib.types.submodule layoutOpts); + extraLayouts = mkOption { + type = types.attrsOf (types.submodule layoutOpts); default = { }; - example = lib.literalExpression '' + example = literalExpression '' { mine = { description = "My custom xkb layout."; @@ -133,7 +136,7 @@ in ###### implementation - config = lib.mkIf (layouts != { }) { + config = mkIf (layouts != { }) { environment.sessionVariables = { # runtime override supported by multiple libraries e. g. libxkbcommon diff --git a/nixos/modules/services/x11/fractalart.nix b/nixos/modules/services/x11/fractalart.nix index 1f6f7d9eaccb7..9ec64abc90498 100644 --- a/nixos/modules/services/x11/fractalart.nix +++ b/nixos/modules/services/x11/fractalart.nix @@ -4,38 +4,39 @@ pkgs, ... }: +with lib; let cfg = config.services.fractalart; in { options.services.fractalart = { - enable = lib.mkOption { - type = lib.types.bool; + enable = mkOption { + type = types.bool; default = false; example = true; description = "Enable FractalArt for generating colorful wallpapers on login"; }; - width = lib.mkOption { - type = lib.types.nullOr lib.types.int; + width = mkOption { + type = types.nullOr types.int; default = null; example = 1920; description = "Screen width"; }; - height = lib.mkOption { - type = lib.types.nullOr lib.types.int; + height = mkOption { + type = types.nullOr types.int; default = null; example = 1080; description = "Screen height"; }; }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { environment.systemPackages = [ pkgs.haskellPackages.FractalArt ]; services.xserver.displayManager.sessionCommands = "${pkgs.haskellPackages.FractalArt}/bin/FractalArt --no-bg -f .background-image" - + lib.optionalString (cfg.width != null) " -w ${toString cfg.width}" - + lib.optionalString (cfg.height != null) " -h ${toString cfg.height}"; + + optionalString (cfg.width != null) " -w ${toString cfg.width}" + + optionalString (cfg.height != null) " -h ${toString cfg.height}"; }; } diff --git a/nixos/modules/services/x11/hardware/cmt.nix b/nixos/modules/services/x11/hardware/cmt.nix index 8d037f0386257..23f07e5de06e7 100644 --- a/nixos/modules/services/x11/hardware/cmt.nix +++ b/nixos/modules/services/x11/hardware/cmt.nix @@ -4,6 +4,9 @@ pkgs, ... }: + +with lib; + let cfg = config.services.xserver.cmt; @@ -15,13 +18,13 @@ in options = { services.xserver.cmt = { - enable = lib.mkOption { - type = lib.types.bool; + enable = mkOption { + type = types.bool; default = false; description = "Enable chrome multitouch input (cmt). Touchpad drivers that are configured for chromebooks."; }; - models = lib.mkOption { - type = lib.types.enum [ + models = mkOption { + type = types.enum [ "atlas" "banjo" "candy" @@ -80,7 +83,7 @@ in }; # closes services }; # closes options - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { services.xserver.modules = [ pkgs.xf86_input_cmt ]; diff --git a/nixos/modules/services/x11/hardware/digimend.nix b/nixos/modules/services/x11/hardware/digimend.nix index a8cc2a7f99375..693db5e90720a 100644 --- a/nixos/modules/services/x11/hardware/digimend.nix +++ b/nixos/modules/services/x11/hardware/digimend.nix @@ -4,6 +4,9 @@ pkgs, ... }: + +with lib; + let cfg = config.services.xserver.digimend; @@ -18,13 +21,13 @@ in services.xserver.digimend = { - enable = lib.mkEnableOption "the digimend drivers for Huion/XP-Pen/etc. tablets"; + enable = mkEnableOption "the digimend drivers for Huion/XP-Pen/etc. tablets"; }; }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { # digimend drivers use xsetwacom and wacom X11 drivers services.xserver.wacom.enable = true; diff --git a/nixos/modules/services/x11/hardware/synaptics.nix b/nixos/modules/services/x11/hardware/synaptics.nix index 914f80d2da1fe..f943242f7bae1 100644 --- a/nixos/modules/services/x11/hardware/synaptics.nix +++ b/nixos/modules/services/x11/hardware/synaptics.nix @@ -5,6 +5,9 @@ pkgs, ... }: + +with lib; + let cfg = config.services.xserver.synaptics; opt = options.services.xserver.synaptics; @@ -32,14 +35,14 @@ in services.xserver.synaptics = { - enable = lib.mkOption { - type = lib.types.bool; + enable = mkOption { + type = types.bool; default = false; description = "Whether to enable touchpad support. Deprecated: Consider services.libinput.enable."; }; - dev = lib.mkOption { - type = lib.types.nullOr lib.types.str; + dev = mkOption { + type = types.nullOr types.str; default = null; example = "/dev/input/event0"; description = '' @@ -48,73 +51,73 @@ in ''; }; - accelFactor = lib.mkOption { - type = lib.types.nullOr lib.types.str; + accelFactor = mkOption { + type = types.nullOr types.str; default = "0.001"; description = "Cursor acceleration (how fast speed increases from minSpeed to maxSpeed)."; }; - minSpeed = lib.mkOption { - type = lib.types.nullOr lib.types.str; + minSpeed = mkOption { + type = types.nullOr types.str; default = "0.6"; description = "Cursor speed factor for precision finger motion."; }; - maxSpeed = lib.mkOption { - type = lib.types.nullOr lib.types.str; + maxSpeed = mkOption { + type = types.nullOr types.str; default = "1.0"; description = "Cursor speed factor for highest-speed finger motion."; }; - scrollDelta = lib.mkOption { - type = lib.types.nullOr lib.types.int; + scrollDelta = mkOption { + type = types.nullOr types.int; default = null; example = 75; description = "Move distance of the finger for a scroll event."; }; - twoFingerScroll = lib.mkOption { - type = lib.types.bool; + twoFingerScroll = mkOption { + type = types.bool; default = false; description = "Whether to enable two-finger drag-scrolling. Overridden by horizTwoFingerScroll and vertTwoFingerScroll."; }; - horizTwoFingerScroll = lib.mkOption { - type = lib.types.bool; + horizTwoFingerScroll = mkOption { + type = types.bool; default = cfg.twoFingerScroll; - defaultText = lib.literalExpression "config.${opt.twoFingerScroll}"; + defaultText = literalExpression "config.${opt.twoFingerScroll}"; description = "Whether to enable horizontal two-finger drag-scrolling."; }; - vertTwoFingerScroll = lib.mkOption { - type = lib.types.bool; + vertTwoFingerScroll = mkOption { + type = types.bool; default = cfg.twoFingerScroll; - defaultText = lib.literalExpression "config.${opt.twoFingerScroll}"; + defaultText = literalExpression "config.${opt.twoFingerScroll}"; description = "Whether to enable vertical two-finger drag-scrolling."; }; - horizEdgeScroll = lib.mkOption { - type = lib.types.bool; + horizEdgeScroll = mkOption { + type = types.bool; default = !cfg.horizTwoFingerScroll; - defaultText = lib.literalExpression "! config.${opt.horizTwoFingerScroll}"; + defaultText = literalExpression "! config.${opt.horizTwoFingerScroll}"; description = "Whether to enable horizontal edge drag-scrolling."; }; - vertEdgeScroll = lib.mkOption { - type = lib.types.bool; + vertEdgeScroll = mkOption { + type = types.bool; default = !cfg.vertTwoFingerScroll; - defaultText = lib.literalExpression "! config.${opt.vertTwoFingerScroll}"; + defaultText = literalExpression "! config.${opt.vertTwoFingerScroll}"; description = "Whether to enable vertical edge drag-scrolling."; }; - tapButtons = lib.mkOption { - type = lib.types.bool; + tapButtons = mkOption { + type = types.bool; default = true; description = "Whether to enable tap buttons."; }; - buttonsMap = lib.mkOption { - type = lib.types.listOf lib.types.int; + buttonsMap = mkOption { + type = types.listOf types.int; default = [ 1 2 @@ -129,8 +132,8 @@ in apply = map toString; }; - fingersMap = lib.mkOption { - type = lib.types.listOf lib.types.int; + fingersMap = mkOption { + type = types.listOf types.int; default = [ 1 2 @@ -145,34 +148,34 @@ in apply = map toString; }; - palmDetect = lib.mkOption { - type = lib.types.bool; + palmDetect = mkOption { + type = types.bool; default = false; description = "Whether to enable palm detection (hardware support required)"; }; - palmMinWidth = lib.mkOption { - type = lib.types.nullOr lib.types.int; + palmMinWidth = mkOption { + type = types.nullOr types.int; default = null; example = 5; description = "Minimum finger width at which touch is considered a palm"; }; - palmMinZ = lib.mkOption { - type = lib.types.nullOr lib.types.int; + palmMinZ = mkOption { + type = types.nullOr types.int; default = null; example = 20; description = "Minimum finger pressure at which touch is considered a palm"; }; - horizontalScroll = lib.mkOption { - type = lib.types.bool; + horizontalScroll = mkOption { + type = types.bool; default = true; description = "Whether to enable horizontal scrolling (on touchpad)"; }; - additionalOptions = lib.mkOption { - type = lib.types.str; + additionalOptions = mkOption { + type = types.str; default = ""; example = '' Option "RTCornerButton" "2" @@ -187,7 +190,7 @@ in }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { services.xserver.modules = [ pkg.out ]; @@ -200,12 +203,12 @@ in Section "InputClass" Identifier "synaptics touchpad catchall" MatchIsTouchpad "on" - ${lib.optionalString (cfg.dev != null) ''MatchDevicePath "${cfg.dev}"''} + ${optionalString (cfg.dev != null) ''MatchDevicePath "${cfg.dev}"''} Driver "synaptics" - ${lib.optionalString (cfg.minSpeed != null) ''Option "MinSpeed" "${cfg.minSpeed}"''} - ${lib.optionalString (cfg.maxSpeed != null) ''Option "MaxSpeed" "${cfg.maxSpeed}"''} - ${lib.optionalString (cfg.accelFactor != null) ''Option "AccelFactor" "${cfg.accelFactor}"''} - ${lib.optionalString cfg.tapButtons tapConfig} + ${optionalString (cfg.minSpeed != null) ''Option "MinSpeed" "${cfg.minSpeed}"''} + ${optionalString (cfg.maxSpeed != null) ''Option "MaxSpeed" "${cfg.maxSpeed}"''} + ${optionalString (cfg.accelFactor != null) ''Option "AccelFactor" "${cfg.accelFactor}"''} + ${optionalString cfg.tapButtons tapConfig} Option "ClickFinger1" "${builtins.elemAt cfg.buttonsMap 0}" Option "ClickFinger2" "${builtins.elemAt cfg.buttonsMap 1}" Option "ClickFinger3" "${builtins.elemAt cfg.buttonsMap 2}" @@ -213,19 +216,19 @@ in Option "HorizTwoFingerScroll" "${if cfg.horizTwoFingerScroll then "1" else "0"}" Option "VertEdgeScroll" "${if cfg.vertEdgeScroll then "1" else "0"}" Option "HorizEdgeScroll" "${if cfg.horizEdgeScroll then "1" else "0"}" - ${lib.optionalString cfg.palmDetect ''Option "PalmDetect" "1"''} - ${lib.optionalString ( + ${optionalString cfg.palmDetect ''Option "PalmDetect" "1"''} + ${optionalString ( cfg.palmMinWidth != null ) ''Option "PalmMinWidth" "${toString cfg.palmMinWidth}"''} - ${lib.optionalString (cfg.palmMinZ != null) ''Option "PalmMinZ" "${toString cfg.palmMinZ}"''} - ${lib.optionalString ( + ${optionalString (cfg.palmMinZ != null) ''Option "PalmMinZ" "${toString cfg.palmMinZ}"''} + ${optionalString ( cfg.scrollDelta != null ) ''Option "VertScrollDelta" "${toString cfg.scrollDelta}"''} ${ if !cfg.horizontalScroll then ''Option "HorizScrollDelta" "0"'' else - (lib.optionalString ( + (optionalString ( cfg.scrollDelta != null ) ''Option "HorizScrollDelta" "${toString cfg.scrollDelta}"'') } diff --git a/nixos/modules/services/x11/hardware/wacom.nix b/nixos/modules/services/x11/hardware/wacom.nix index c4e6ed9415837..3707b7f415753 100644 --- a/nixos/modules/services/x11/hardware/wacom.nix +++ b/nixos/modules/services/x11/hardware/wacom.nix @@ -4,6 +4,9 @@ pkgs, ... }: + +with lib; + let cfg = config.services.xserver.wacom; @@ -16,8 +19,8 @@ in services.xserver.wacom = { - enable = lib.mkOption { - type = lib.types.bool; + enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable the Wacom touchscreen/digitizer/tablet. @@ -34,7 +37,7 @@ in }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { environment.systemPackages = [ pkgs.xf86_input_wacom ]; # provides xsetwacom diff --git a/nixos/modules/services/x11/imwheel.nix b/nixos/modules/services/x11/imwheel.nix index c674555a60f3f..2898af201a7e1 100644 --- a/nixos/modules/services/x11/imwheel.nix +++ b/nixos/modules/services/x11/imwheel.nix @@ -4,16 +4,17 @@ pkgs, ... }: +with lib; let cfg = config.services.xserver.imwheel; in { options = { services.xserver.imwheel = { - enable = lib.mkEnableOption "IMWheel service"; + enable = mkEnableOption "IMWheel service"; - extraOptions = lib.mkOption { - type = lib.types.listOf lib.types.str; + extraOptions = mkOption { + type = types.listOf types.str; default = [ "--buttons=45" ]; example = [ "--debug" ]; description = '' @@ -22,10 +23,10 @@ in ''; }; - rules = lib.mkOption { - type = lib.types.attrsOf lib.types.str; + rules = mkOption { + type = types.attrsOf types.str; default = { }; - example = lib.literalExpression '' + example = literalExpression '' { ".*" = ''' None, Up, Button4, 8 @@ -48,11 +49,11 @@ in }; }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { environment.systemPackages = [ pkgs.imwheel ]; environment.etc."X11/imwheel/imwheelrc".source = pkgs.writeText "imwheelrc" ( - lib.concatStringsSep "\n\n" (lib.mapAttrsToList (rule: conf: "\"${rule}\"\n${conf}") cfg.rules) + concatStringsSep "\n\n" (mapAttrsToList (rule: conf: "\"${rule}\"\n${conf}") cfg.rules) ); systemd.user.services.imwheel = { @@ -62,7 +63,7 @@ in serviceConfig = { ExecStart = "${pkgs.imwheel}/bin/imwheel " - + lib.escapeShellArgs ( + + escapeShellArgs ( [ "--detach" "--kill" diff --git a/nixos/modules/services/x11/picom.nix b/nixos/modules/services/x11/picom.nix index 41d2acda063d8..237d78484286f 100644 --- a/nixos/modules/services/x11/picom.nix +++ b/nixos/modules/services/x11/picom.nix @@ -5,6 +5,9 @@ pkgs, ... }: + +with lib; + let cfg = config.services.picom; @@ -12,46 +15,46 @@ let pairOf = x: - with lib.types; + with types; addCheck (listOf x) (y: length y == 2) // { description = "pair of ${x.description}"; }; - mkDefaultAttrs = lib.mapAttrs (n: v: lib.mkDefault v); + mkDefaultAttrs = mapAttrs (n: v: mkDefault v); # Basically a tinkered lib.generators.mkKeyValueDefault # It either serializes a top-level definition "key: { values };" # or an expression "key = { values };" mkAttrsString = top: - lib.mapAttrsToList ( + mapAttrsToList ( k: v: let - sep = if (top && lib.isAttrs v) then ":" else "="; + sep = if (top && isAttrs v) then ":" else "="; in - "${lib.escape [ sep ] k}${sep}${mkValueString v};" + "${escape [ sep ] k}${sep}${mkValueString v};" ); # This serializes a Nix expression to the libconfig format. mkValueString = v: - if lib.types.bool.check v then - lib.boolToString v - else if lib.types.int.check v then + if types.bool.check v then + boolToString v + else if types.int.check v then toString v - else if lib.types.float.check v then + else if types.float.check v then toString v - else if lib.types.str.check v then - "\"${lib.escape [ "\"" ] v}\"" + else if types.str.check v then + "\"${escape [ "\"" ] v}\"" else if builtins.isList v then - "[ ${lib.concatMapStringsSep " , " mkValueString v} ]" - else if lib.types.attrs.check v then - "{ ${lib.concatStringsSep " " (mkAttrsString false v)} }" + "[ ${concatMapStringsSep " , " mkValueString v} ]" + else if types.attrs.check v then + "{ ${concatStringsSep " " (mkAttrsString false v)} }" else throw '' invalid expression used in option services.picom.settings: ${v} ''; - toConf = attrs: lib.concatStringsSep "\n" (mkAttrsString true cfg.settings); + toConf = attrs: concatStringsSep "\n" (mkAttrsString true cfg.settings); configFile = pkgs.writeText "picom.conf" (toConf cfg.settings); @@ -59,38 +62,38 @@ in { imports = [ - (lib.mkAliasOptionModuleMD [ "services" "compton" ] [ "services" "picom" ]) - (lib.mkRemovedOptionModule [ "services" "picom" "refreshRate" ] '' + (mkAliasOptionModuleMD [ "services" "compton" ] [ "services" "picom" ]) + (mkRemovedOptionModule [ "services" "picom" "refreshRate" ] '' This option corresponds to `refresh-rate`, which has been unused since picom v6 and was subsequently removed by upstream. See https://github.com/yshui/picom/commit/bcbc410 '') - (lib.mkRemovedOptionModule [ "services" "picom" "experimentalBackends" ] '' + (mkRemovedOptionModule [ "services" "picom" "experimentalBackends" ] '' This option was removed by upstream since picom v10. '') ]; options.services.picom = { - enable = lib.mkOption { - type = lib.types.bool; + enable = mkOption { + type = types.bool; default = false; description = '' Whether or not to enable Picom as the X.org composite manager. ''; }; - package = lib.mkPackageOption pkgs "picom" { }; + package = mkPackageOption pkgs "picom" { }; - fade = lib.mkOption { - type = lib.types.bool; + fade = mkOption { + type = types.bool; default = false; description = '' Fade windows in and out. ''; }; - fadeDelta = lib.mkOption { - type = lib.types.ints.positive; + fadeDelta = mkOption { + type = types.ints.positive; default = 10; example = 5; description = '' @@ -98,8 +101,8 @@ in ''; }; - fadeSteps = lib.mkOption { - type = pairOf (lib.types.numbers.between 0.01 1); + fadeSteps = mkOption { + type = pairOf (types.numbers.between 0.01 1); default = [ 0.028 0.03 @@ -113,8 +116,8 @@ in ''; }; - fadeExclude = lib.mkOption { - type = lib.types.listOf lib.types.str; + fadeExclude = mkOption { + type = types.listOf types.str; default = [ ]; example = [ "window_type *= 'menu'" @@ -127,16 +130,16 @@ in ''; }; - shadow = lib.mkOption { - type = lib.types.bool; + shadow = mkOption { + type = types.bool; default = false; description = '' Draw window shadows. ''; }; - shadowOffsets = lib.mkOption { - type = pairOf lib.types.int; + shadowOffsets = mkOption { + type = pairOf types.int; default = [ (-15) (-15) @@ -150,8 +153,8 @@ in ''; }; - shadowOpacity = lib.mkOption { - type = lib.types.numbers.between 0 1; + shadowOpacity = mkOption { + type = types.numbers.between 0 1; default = 0.75; example = 0.8; description = '' @@ -159,8 +162,8 @@ in ''; }; - shadowExclude = lib.mkOption { - type = lib.types.listOf lib.types.str; + shadowExclude = mkOption { + type = types.listOf types.str; default = [ ]; example = [ "window_type *= 'menu'" @@ -173,8 +176,8 @@ in ''; }; - activeOpacity = lib.mkOption { - type = lib.types.numbers.between 0 1; + activeOpacity = mkOption { + type = types.numbers.between 0 1; default = 1.0; example = 0.8; description = '' @@ -182,8 +185,8 @@ in ''; }; - inactiveOpacity = lib.mkOption { - type = lib.types.numbers.between 0.1 1; + inactiveOpacity = mkOption { + type = types.numbers.between 0.1 1; default = 1.0; example = 0.8; description = '' @@ -191,8 +194,8 @@ in ''; }; - menuOpacity = lib.mkOption { - type = lib.types.numbers.between 0 1; + menuOpacity = mkOption { + type = types.numbers.between 0 1; default = 1.0; example = 0.8; description = '' @@ -200,8 +203,8 @@ in ''; }; - wintypes = lib.mkOption { - type = lib.types.attrs; + wintypes = mkOption { + type = types.attrs; default = { popup_menu = { opacity = cfg.menuOpacity; @@ -210,7 +213,7 @@ in opacity = cfg.menuOpacity; }; }; - defaultText = lib.literalExpression '' + defaultText = literalExpression '' { popup_menu = { opacity = config.${opt.menuOpacity}; }; dropdown_menu = { opacity = config.${opt.menuOpacity}; }; @@ -222,8 +225,8 @@ in ''; }; - opacityRules = lib.mkOption { - type = lib.types.listOf lib.types.str; + opacityRules = mkOption { + type = types.listOf types.str; default = [ ]; example = [ "95:class_g = 'URxvt' && !_NET_WM_STATE@:32a" @@ -234,8 +237,8 @@ in ''; }; - backend = lib.mkOption { - type = lib.types.enum [ + backend = mkOption { + type = types.enum [ "egl" "glx" "xrender" @@ -247,9 +250,9 @@ in ''; }; - vSync = lib.mkOption { + vSync = mkOption { type = - with lib.types; + with types; either bool (enum [ "none" "drm" @@ -265,9 +268,9 @@ in res = x != "none"; msg = "The type of services.picom.vSync has changed to bool:" - + " interpreting ${x} as ${lib.boolToString res}"; + + " interpreting ${x} as ${boolToString res}"; in - if lib.isBool x then x else lib.warn msg res; + if isBool x then x else warn msg res; description = '' Enable vertical synchronization. Chooses the best method @@ -277,7 +280,7 @@ in }; settings = - with lib.types; + with types; let scalar = oneOf [ @@ -310,10 +313,10 @@ in }; in - lib.mkOption { + mkOption { type = topLevel; default = { }; - example = lib.literalExpression '' + example = literalExpression '' blur = { method = "gaussian"; size = 10; @@ -328,19 +331,19 @@ in }; }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { services.picom.settings = mkDefaultAttrs { # fading fading = cfg.fade; fade-delta = cfg.fadeDelta; - fade-in-step = lib.elemAt cfg.fadeSteps 0; - fade-out-step = lib.elemAt cfg.fadeSteps 1; + fade-in-step = elemAt cfg.fadeSteps 0; + fade-out-step = elemAt cfg.fadeSteps 1; fade-exclude = cfg.fadeExclude; # shadows shadow = cfg.shadow; - shadow-offset-x = lib.elemAt cfg.shadowOffsets 0; - shadow-offset-y = lib.elemAt cfg.shadowOffsets 1; + shadow-offset-x = elemAt cfg.shadowOffsets 0; + shadow-offset-y = elemAt cfg.shadowOffsets 1; shadow-opacity = cfg.shadowOpacity; shadow-exclude = cfg.shadowExclude; @@ -363,12 +366,12 @@ in partOf = [ "graphical-session.target" ]; # Temporarily fixes corrupt colours with Mesa 18 - environment = lib.mkIf (cfg.backend == "glx") { + environment = mkIf (cfg.backend == "glx") { allow_rgb10_configs = "false"; }; serviceConfig = { - ExecStart = "${lib.getExe cfg.package} --config ${configFile}"; + ExecStart = "${getExe cfg.package} --config ${configFile}"; RestartSec = 3; Restart = "always"; }; diff --git a/nixos/modules/services/x11/redshift.nix b/nixos/modules/services/x11/redshift.nix index 849780b53a770..661053c20016c 100644 --- a/nixos/modules/services/x11/redshift.nix +++ b/nixos/modules/services/x11/redshift.nix @@ -4,6 +4,9 @@ pkgs, ... }: + +with lib; + let cfg = config.services.redshift; @@ -13,32 +16,32 @@ in { imports = [ - (lib.mkChangedOptionModule [ "services" "redshift" "latitude" ] [ "location" "latitude" ] ( + (mkChangedOptionModule [ "services" "redshift" "latitude" ] [ "location" "latitude" ] ( config: let - value = lib.getAttrFromPath [ "services" "redshift" "latitude" ] config; + value = getAttrFromPath [ "services" "redshift" "latitude" ] config; in if value == null then throw "services.redshift.latitude is set to null, you can remove this" else builtins.fromJSON value )) - (lib.mkChangedOptionModule [ "services" "redshift" "longitude" ] [ "location" "longitude" ] ( + (mkChangedOptionModule [ "services" "redshift" "longitude" ] [ "location" "longitude" ] ( config: let - value = lib.getAttrFromPath [ "services" "redshift" "longitude" ] config; + value = getAttrFromPath [ "services" "redshift" "longitude" ] config; in if value == null then throw "services.redshift.longitude is set to null, you can remove this" else builtins.fromJSON value )) - (lib.mkRenamedOptionModule [ "services" "redshift" "provider" ] [ "location" "provider" ]) + (mkRenamedOptionModule [ "services" "redshift" "provider" ] [ "location" "provider" ]) ]; options.services.redshift = { - enable = lib.mkOption { - type = lib.types.bool; + enable = mkOption { + type = types.bool; default = false; description = '' Enable Redshift to change your screen's colour temperature depending on @@ -47,16 +50,16 @@ in }; temperature = { - day = lib.mkOption { - type = lib.types.int; + day = mkOption { + type = types.int; default = 5500; description = '' Colour temperature to use during the day, between `1000` and `25000` K. ''; }; - night = lib.mkOption { - type = lib.types.int; + night = mkOption { + type = types.int; default = 3700; description = '' Colour temperature to use at night, between @@ -66,16 +69,16 @@ in }; brightness = { - day = lib.mkOption { - type = lib.types.str; + day = mkOption { + type = types.str; default = "1"; description = '' Screen brightness to apply during the day, between `0.1` and `1.0`. ''; }; - night = lib.mkOption { - type = lib.types.str; + night = mkOption { + type = types.str; default = "1"; description = '' Screen brightness to apply during the night, @@ -84,10 +87,10 @@ in }; }; - package = lib.mkPackageOption pkgs "redshift" { }; + package = mkPackageOption pkgs "redshift" { }; - executable = lib.mkOption { - type = lib.types.str; + executable = mkOption { + type = types.str; default = "/bin/redshift"; example = "/bin/redshift-gtk"; description = '' @@ -95,8 +98,8 @@ in ''; }; - extraOptions = lib.mkOption { - type = lib.types.listOf lib.types.str; + extraOptions = mkOption { + type = types.listOf types.str; default = [ ]; example = [ "-v" @@ -109,7 +112,7 @@ in }; }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { # needed so that .desktop files are installed, which geoclue cares about environment.systemPackages = [ cfg.package ]; diff --git a/nixos/modules/services/x11/touchegg.nix b/nixos/modules/services/x11/touchegg.nix index e641e5cf47271..def3dac738e04 100644 --- a/nixos/modules/services/x11/touchegg.nix +++ b/nixos/modules/services/x11/touchegg.nix @@ -4,24 +4,27 @@ pkgs, ... }: + +with lib; + let cfg = config.services.touchegg; in { meta = { - maintainers = lib.teams.pantheon.members; + maintainers = teams.pantheon.members; }; ###### interface options.services.touchegg = { - enable = lib.mkEnableOption "touchegg, a multi-touch gesture recognizer"; + enable = mkEnableOption "touchegg, a multi-touch gesture recognizer"; - package = lib.mkPackageOption pkgs "touchegg" { }; + package = mkPackageOption pkgs "touchegg" { }; }; ###### implementation - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { systemd.services.touchegg = { description = "Touchegg Daemon"; serviceConfig = { diff --git a/nixos/modules/services/x11/unclutter-xfixes.nix b/nixos/modules/services/x11/unclutter-xfixes.nix index 32ff1577d5a5c..48adb3665f387 100644 --- a/nixos/modules/services/x11/unclutter-xfixes.nix +++ b/nixos/modules/services/x11/unclutter-xfixes.nix @@ -4,6 +4,9 @@ pkgs, ... }: + +with lib; + let cfg = config.services.unclutter-xfixes; @@ -11,29 +14,29 @@ in { options.services.unclutter-xfixes = { - enable = lib.mkOption { + enable = mkOption { description = "Enable unclutter-xfixes to hide your mouse cursor when inactive."; - type = lib.types.bool; + type = types.bool; default = false; }; - package = lib.mkPackageOption pkgs "unclutter-xfixes" { }; + package = mkPackageOption pkgs "unclutter-xfixes" { }; - timeout = lib.mkOption { + timeout = mkOption { description = "Number of seconds before the cursor is marked inactive."; - type = lib.types.int; + type = types.int; default = 1; }; - threshold = lib.mkOption { + threshold = mkOption { description = "Minimum number of pixels considered cursor movement."; - type = lib.types.int; + type = types.int; default = 1; }; - extraOptions = lib.mkOption { + extraOptions = mkOption { description = "More arguments to pass to the unclutter-xfixes command."; - type = lib.types.listOf lib.types.str; + type = types.listOf types.str; default = [ ]; example = [ "exclude-root" @@ -43,7 +46,7 @@ in }; }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { systemd.user.services.unclutter-xfixes = { description = "unclutter-xfixes"; wantedBy = [ "graphical-session.target" ]; @@ -52,7 +55,7 @@ in ${cfg.package}/bin/unclutter \ --timeout ${toString cfg.timeout} \ --jitter ${toString (cfg.threshold - 1)} \ - ${lib.concatMapStrings (x: " --" + x) cfg.extraOptions} \ + ${concatMapStrings (x: " --" + x) cfg.extraOptions} \ ''; serviceConfig.RestartSec = 3; serviceConfig.Restart = "always"; diff --git a/nixos/modules/services/x11/unclutter.nix b/nixos/modules/services/x11/unclutter.nix index 7da1f611373aa..bb11c8639783b 100644 --- a/nixos/modules/services/x11/unclutter.nix +++ b/nixos/modules/services/x11/unclutter.nix @@ -4,6 +4,9 @@ pkgs, ... }: + +with lib; + let cfg = config.services.unclutter; @@ -11,42 +14,42 @@ in { options.services.unclutter = { - enable = lib.mkOption { + enable = mkOption { description = "Enable unclutter to hide your mouse cursor when inactive"; - type = lib.types.bool; + type = types.bool; default = false; }; - package = lib.mkPackageOption pkgs "unclutter" { }; + package = mkPackageOption pkgs "unclutter" { }; - keystroke = lib.mkOption { + keystroke = mkOption { description = "Wait for a keystroke before hiding the cursor"; - type = lib.types.bool; + type = types.bool; default = false; }; - timeout = lib.mkOption { + timeout = mkOption { description = "Number of seconds before the cursor is marked inactive"; - type = lib.types.int; + type = types.int; default = 1; }; - threshold = lib.mkOption { + threshold = mkOption { description = "Minimum number of pixels considered cursor movement"; - type = lib.types.int; + type = types.int; default = 1; }; - excluded = lib.mkOption { + excluded = mkOption { description = "Names of windows where unclutter should not apply"; - type = lib.types.listOf lib.types.str; + type = types.listOf types.str; default = [ ]; example = [ "" ]; }; - extraOptions = lib.mkOption { + extraOptions = mkOption { description = "More arguments to pass to the unclutter command"; - type = lib.types.listOf lib.types.str; + type = types.listOf types.str; default = [ ]; example = [ "noevent" @@ -55,7 +58,7 @@ in }; }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { systemd.user.services.unclutter = { description = "unclutter"; wantedBy = [ "graphical-session.target" ]; @@ -64,9 +67,9 @@ in ${cfg.package}/bin/unclutter \ -idle ${toString cfg.timeout} \ -jitter ${toString (cfg.threshold - 1)} \ - ${lib.optionalString cfg.keystroke "-keystroke"} \ - ${lib.concatMapStrings (x: " -" + x) cfg.extraOptions} \ - -not ${lib.concatStringsSep " " cfg.excluded} \ + ${optionalString cfg.keystroke "-keystroke"} \ + ${concatMapStrings (x: " -" + x) cfg.extraOptions} \ + -not ${concatStringsSep " " cfg.excluded} \ ''; serviceConfig.PassEnvironment = "DISPLAY"; serviceConfig.RestartSec = 3; @@ -75,7 +78,7 @@ in }; imports = [ - (lib.mkRenamedOptionModule + (mkRenamedOptionModule [ "services" "unclutter" "threeshold" ] [ "services" "unclutter" "threshold" ] ) diff --git a/nixos/modules/services/x11/urxvtd.nix b/nixos/modules/services/x11/urxvtd.nix index b015374bfd282..5f8212a3c9ce2 100644 --- a/nixos/modules/services/x11/urxvtd.nix +++ b/nixos/modules/services/x11/urxvtd.nix @@ -4,14 +4,18 @@ pkgs, ... }: + # maintainer: siddharthist + +with lib; + let cfg = config.services.urxvtd; in { options.services.urxvtd = { - enable = lib.mkOption { - type = lib.types.bool; + enable = mkOption { + type = types.bool; default = false; description = '' Enable urxvtd, the urxvt terminal daemon. To use urxvtd, run @@ -19,10 +23,10 @@ in ''; }; - package = lib.mkPackageOption pkgs "rxvt-unicode" { }; + package = mkPackageOption pkgs "rxvt-unicode" { }; }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { systemd.user.services.urxvtd = { description = "urxvt terminal daemon"; wantedBy = [ "graphical-session.target" ]; diff --git a/nixos/modules/services/x11/window-managers/2bwm.nix b/nixos/modules/services/x11/window-managers/2bwm.nix index 0bafdfee3e7b9..ce01fcb17a10e 100644 --- a/nixos/modules/services/x11/window-managers/2bwm.nix +++ b/nixos/modules/services/x11/window-managers/2bwm.nix @@ -4,6 +4,9 @@ pkgs, ... }: + +with lib; + let cfg = config.services.xserver.windowManager."2bwm"; @@ -15,14 +18,14 @@ in ###### interface options = { - services.xserver.windowManager."2bwm".enable = lib.mkEnableOption "2bwm"; + services.xserver.windowManager."2bwm".enable = mkEnableOption "2bwm"; }; ###### implementation - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { - services.xserver.windowManager.session = lib.singleton { + services.xserver.windowManager.session = singleton { name = "2bwm"; start = '' ${pkgs._2bwm}/bin/2bwm & diff --git a/nixos/modules/services/x11/window-managers/afterstep.nix b/nixos/modules/services/x11/window-managers/afterstep.nix index 7ea546442d6ff..d88be7db3757d 100644 --- a/nixos/modules/services/x11/window-managers/afterstep.nix +++ b/nixos/modules/services/x11/window-managers/afterstep.nix @@ -4,18 +4,21 @@ pkgs, ... }: + +with lib; + let cfg = config.services.xserver.windowManager.afterstep; in { ###### interface options = { - services.xserver.windowManager.afterstep.enable = lib.mkEnableOption "afterstep"; + services.xserver.windowManager.afterstep.enable = mkEnableOption "afterstep"; }; ###### implementation - config = lib.mkIf cfg.enable { - services.xserver.windowManager.session = lib.singleton { + config = mkIf cfg.enable { + services.xserver.windowManager.session = singleton { name = "afterstep"; start = '' ${pkgs.afterstep}/bin/afterstep & diff --git a/nixos/modules/services/x11/window-managers/awesome.nix b/nixos/modules/services/x11/window-managers/awesome.nix index ee9e0cbf816e9..8b3d781c4c218 100644 --- a/nixos/modules/services/x11/window-managers/awesome.nix +++ b/nixos/modules/services/x11/window-managers/awesome.nix @@ -4,6 +4,9 @@ pkgs, ... }: + +with lib; + let cfg = config.services.xserver.windowManager.awesome; @@ -22,20 +25,20 @@ in services.xserver.windowManager.awesome = { - enable = lib.mkEnableOption "Awesome window manager"; + enable = mkEnableOption "Awesome window manager"; - luaModules = lib.mkOption { + luaModules = mkOption { default = [ ]; - type = lib.types.listOf lib.types.package; + type = types.listOf types.package; description = "List of lua packages available for being used in the Awesome configuration."; - example = lib.literalExpression "[ pkgs.luaPackages.vicious ]"; + example = literalExpression "[ pkgs.luaPackages.vicious ]"; }; - package = lib.mkPackageOption pkgs "awesome" { }; + package = mkPackageOption pkgs "awesome" { }; - noArgb = lib.mkOption { + noArgb = mkOption { default = false; - type = lib.types.bool; + type = types.bool; description = "Disable client transparency support, which can be greatly detrimental to performance in some setups"; }; }; @@ -44,9 +47,9 @@ in ###### implementation - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { - services.xserver.windowManager.session = lib.singleton { + services.xserver.windowManager.session = singleton { name = "awesome"; start = '' ${awesome}/bin/awesome ${lib.optionalString cfg.noArgb "--no-argb"} ${makeSearchPath cfg.luaModules} & diff --git a/nixos/modules/services/x11/window-managers/berry.nix b/nixos/modules/services/x11/window-managers/berry.nix index 8fdd4e0f79a80..ba094d0e3efcf 100644 --- a/nixos/modules/services/x11/window-managers/berry.nix +++ b/nixos/modules/services/x11/window-managers/berry.nix @@ -4,18 +4,21 @@ pkgs, ... }: + +with lib; + let cfg = config.services.xserver.windowManager.berry; in { ###### interface options = { - services.xserver.windowManager.berry.enable = lib.mkEnableOption "berry"; + services.xserver.windowManager.berry.enable = mkEnableOption "berry"; }; ###### implementation - config = lib.mkIf cfg.enable { - services.xserver.windowManager.session = lib.singleton { + config = mkIf cfg.enable { + services.xserver.windowManager.session = singleton { name = "berry"; start = '' ${pkgs.berry}/bin/berry & diff --git a/nixos/modules/services/x11/window-managers/bspwm.nix b/nixos/modules/services/x11/window-managers/bspwm.nix index 5a173da6b23b5..46201036f05af 100644 --- a/nixos/modules/services/x11/window-managers/bspwm.nix +++ b/nixos/modules/services/x11/window-managers/bspwm.nix @@ -4,6 +4,9 @@ pkgs, ... }: + +with lib; + let cfg = config.services.xserver.windowManager.bspwm; in @@ -11,14 +14,14 @@ in { options = { services.xserver.windowManager.bspwm = { - enable = lib.mkEnableOption "bspwm"; + enable = mkEnableOption "bspwm"; - package = lib.mkPackageOption pkgs "bspwm" { + package = mkPackageOption pkgs "bspwm" { example = "bspwm-unstable"; }; - configFile = lib.mkOption { - type = with lib.types; nullOr path; - example = lib.literalExpression ''"''${pkgs.bspwm}/share/doc/bspwm/examples/bspwmrc"''; + configFile = mkOption { + type = with types; nullOr path; + example = literalExpression ''"''${pkgs.bspwm}/share/doc/bspwm/examples/bspwmrc"''; default = null; description = '' Path to the bspwm configuration file. @@ -27,12 +30,12 @@ in }; sxhkd = { - package = lib.mkPackageOption pkgs "sxhkd" { + package = mkPackageOption pkgs "sxhkd" { example = "sxhkd-unstable"; }; - configFile = lib.mkOption { - type = with lib.types; nullOr path; - example = lib.literalExpression ''"''${pkgs.bspwm}/share/doc/bspwm/examples/sxhkdrc"''; + configFile = mkOption { + type = with types; nullOr path; + example = literalExpression ''"''${pkgs.bspwm}/share/doc/bspwm/examples/sxhkdrc"''; default = null; description = '' Path to the sxhkd configuration file. @@ -43,15 +46,15 @@ in }; }; - config = lib.mkIf cfg.enable { - services.xserver.windowManager.session = lib.singleton { + config = mkIf cfg.enable { + services.xserver.windowManager.session = singleton { name = "bspwm"; start = '' export _JAVA_AWT_WM_NONREPARENTING=1 SXHKD_SHELL=/bin/sh ${cfg.sxhkd.package}/bin/sxhkd ${ - lib.optionalString (cfg.sxhkd.configFile != null) "-c \"${cfg.sxhkd.configFile}\"" + optionalString (cfg.sxhkd.configFile != null) "-c \"${cfg.sxhkd.configFile}\"" } & - ${cfg.package}/bin/bspwm ${lib.optionalString (cfg.configFile != null) "-c \"${cfg.configFile}\""} & + ${cfg.package}/bin/bspwm ${optionalString (cfg.configFile != null) "-c \"${cfg.configFile}\""} & waitPID=$! ''; }; @@ -59,17 +62,17 @@ in }; imports = [ - (lib.mkRemovedOptionModule [ "services" "xserver" "windowManager" "bspwm-unstable" "enable" ] + (mkRemovedOptionModule [ "services" "xserver" "windowManager" "bspwm-unstable" "enable" ] "Use services.xserver.windowManager.bspwm.enable and set services.xserver.windowManager.bspwm.package to pkgs.bspwm-unstable to use the unstable version of bspwm." ) - (lib.mkRemovedOptionModule [ + (mkRemovedOptionModule [ "services" "xserver" "windowManager" "bspwm" "startThroughSession" ] "bspwm package does not provide bspwm-session anymore.") - (lib.mkRemovedOptionModule [ + (mkRemovedOptionModule [ "services" "xserver" "windowManager" diff --git a/nixos/modules/services/x11/window-managers/clfswm.nix b/nixos/modules/services/x11/window-managers/clfswm.nix index 03eaf6e4911e5..b50b60849495b 100644 --- a/nixos/modules/services/x11/window-managers/clfswm.nix +++ b/nixos/modules/services/x11/window-managers/clfswm.nix @@ -4,6 +4,9 @@ pkgs, ... }: + +with lib; + let cfg = config.services.xserver.windowManager.clfswm; in @@ -11,13 +14,13 @@ in { options = { services.xserver.windowManager.clfswm = { - enable = lib.mkEnableOption "clfswm"; - package = lib.mkPackageOption pkgs [ "sbclPackages" "clfswm" ] { }; + enable = mkEnableOption "clfswm"; + package = mkPackageOption pkgs [ "sbclPackages" "clfswm" ] { }; }; }; - config = lib.mkIf cfg.enable { - services.xserver.windowManager.session = lib.singleton { + config = mkIf cfg.enable { + services.xserver.windowManager.session = singleton { name = "clfswm"; start = '' ${cfg.package}/bin/clfswm & diff --git a/nixos/modules/services/x11/window-managers/cwm.nix b/nixos/modules/services/x11/window-managers/cwm.nix index 2f32cc4e74497..d2be487b0d4ca 100644 --- a/nixos/modules/services/x11/window-managers/cwm.nix +++ b/nixos/modules/services/x11/window-managers/cwm.nix @@ -4,15 +4,18 @@ pkgs, ... }: + +with lib; + let cfg = config.services.xserver.windowManager.cwm; in { options = { - services.xserver.windowManager.cwm.enable = lib.mkEnableOption "cwm"; + services.xserver.windowManager.cwm.enable = mkEnableOption "cwm"; }; - config = lib.mkIf cfg.enable { - services.xserver.windowManager.session = lib.singleton { + config = mkIf cfg.enable { + services.xserver.windowManager.session = singleton { name = "cwm"; start = '' cwm & diff --git a/nixos/modules/services/x11/window-managers/dwm.nix b/nixos/modules/services/x11/window-managers/dwm.nix index 1ee79a94016df..c81a834a06796 100644 --- a/nixos/modules/services/x11/window-managers/dwm.nix +++ b/nixos/modules/services/x11/window-managers/dwm.nix @@ -1,4 +1,7 @@ { config, lib, pkgs, ... }: + +with lib; + let cfg = config.services.xserver.windowManager.dwm; @@ -11,8 +14,8 @@ in options = { services.xserver.windowManager.dwm = { - enable = lib.mkEnableOption "dwm"; - package = lib.mkPackageOption pkgs "dwm" { + enable = mkEnableOption "dwm"; + package = mkPackageOption pkgs "dwm" { example = '' pkgs.dwm.overrideAttrs (oldAttrs: rec { patches = [ @@ -30,9 +33,9 @@ in ###### implementation - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { - services.xserver.windowManager.session = lib.singleton + services.xserver.windowManager.session = singleton { name = "dwm"; start = '' diff --git a/nixos/modules/services/x11/window-managers/e16.nix b/nixos/modules/services/x11/window-managers/e16.nix index e7f2f61f38856..b1ed3ea66417e 100644 --- a/nixos/modules/services/x11/window-managers/e16.nix +++ b/nixos/modules/services/x11/window-managers/e16.nix @@ -4,18 +4,21 @@ pkgs, ... }: + +with lib; + let cfg = config.services.xserver.windowManager.e16; in { ###### interface options = { - services.xserver.windowManager.e16.enable = lib.mkEnableOption "e16"; + services.xserver.windowManager.e16.enable = mkEnableOption "e16"; }; ###### implementation - config = lib.mkIf cfg.enable { - services.xserver.windowManager.session = lib.singleton { + config = mkIf cfg.enable { + services.xserver.windowManager.session = singleton { name = "E16"; start = '' ${pkgs.e16}/bin/e16 &