diff --git a/home/apps/gtk.nix b/home/apps/gtk.nix index c46b6b2..8549cf0 100644 --- a/home/apps/gtk.nix +++ b/home/apps/gtk.nix @@ -23,12 +23,8 @@ in { }; }; theme = { - name = "Catppuccin-Mocha-Compact-Pink-Dark"; - package = pkgs.catppuccin-gtk.override { - accents = ["pink"]; - variant = "mocha"; - size = "compact"; - }; + name = "Catppuccin-Compact-Pink"; + package = pkgs.callPackage ../../pkgs/catppuccin-gtk.nix {}; }; gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; gtk2.extraConfig = '' diff --git a/home/apps/sway.nix b/home/apps/sway.nix index 2560e4c..b274534 100644 --- a/home/apps/sway.nix +++ b/home/apps/sway.nix @@ -1,7 +1,8 @@ { config, - lib, flakePath, + lib, + osConfig, pkgs, ... }: let @@ -20,7 +21,7 @@ lat = 48.210033; lng = 16.363449; in { - config = lib.mkIf (config.isGraphical && pkgs.stdenv.isLinux) { + config = lib.mkIf (config.isGraphical && pkgs.stdenv.isLinux && (osConfig.dotfiles.desktop == "sway")) { fonts.fontconfig.enable = true; home = { diff --git a/machines/common/linux/default.nix b/machines/common/linux/default.nix index 6e7f60f..13d381a 100644 --- a/machines/common/linux/default.nix +++ b/machines/common/linux/default.nix @@ -1,11 +1,12 @@ {pkgs, ...}: { imports = [ ./boot.nix + ./gnome.nix ./greeter.nix ./input.nix ./network.nix - ./session.nix ./sound.nix + ./sway.nix ]; console.colors = [ @@ -39,4 +40,10 @@ environment.systemPackages = [pkgs.xdg-utils]; system.stateVersion = "22.11"; + + # enable yubikey u2f support + security.pam.u2f = { + enable = true; + cue = true; + }; } diff --git a/machines/common/linux/gnome.nix b/machines/common/linux/gnome.nix new file mode 100644 index 0000000..4ec2dd3 --- /dev/null +++ b/machines/common/linux/gnome.nix @@ -0,0 +1,44 @@ +{ + config, + lib, + pkgs, + ... +}: { + config = lib.mkIf (config.dotfiles.desktop == "gnome") { + services.xserver = { + enable = true; + displayManager.gdm.enable = true; + desktopManager.gnome.enable = true; + }; + + environment.systemPackages = with pkgs; [gnomeExtensions.appindicator]; + + hardware.pulseaudio.enable = false; + + # https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/modules/services/x11/desktop-managers/gnome.nix#L467 + environment.gnome.excludePackages = with pkgs.gnome; [ + # baobab + epiphany + # gnome-calculator + gnome-calendar + gnome-characters + gnome-clocks + gnome-contacts + gnome-font-viewer + gnome-logs + gnome-maps + gnome-music + gnome-system-monitor + gnome-weather + # nautilus + pkgs.gnome-connections + # pkgs.gnome-console + pkgs.gnome-text-editor + pkgs.loupe + # pkgs.snapshot + simple-scan + totem + yelp + ]; + }; +} diff --git a/machines/common/linux/greeter.nix b/machines/common/linux/greeter.nix index 09bec4c..ebc018a 100644 --- a/machines/common/linux/greeter.nix +++ b/machines/common/linux/greeter.nix @@ -4,48 +4,44 @@ pkgs, ... }: { - services.greetd = { - enable = true; - settings.default_session = { - command = lib.concatStringsSep " " [ - "${pkgs.greetd.tuigreet}/bin/tuigreet" - "--remember" - "--remember-user-session" - "--sessions=${config.programs.sway.package}/share/wayland-sessions" - ]; - user = "greeter"; - }; - }; - - services.gnome.gnome-keyring.enable = true; - - security.pam = { - u2f = { - enable = true; - cue = true; - }; + config = lib.mkIf (config.dotfiles.desktop == "sway") { services.greetd = { + enable = true; + settings.default_session = { + command = lib.concatStringsSep " " [ + "${pkgs.greetd.tuigreet}/bin/tuigreet" + "--remember" + "--remember-user-session" + "--sessions=${config.programs.sway.package}/share/wayland-sessions" + ]; + user = "greeter"; + }; + }; + + services.gnome.gnome-keyring.enable = true; + security.pam.services.greetd = { enableGnomeKeyring = true; u2fAuth = true; }; - }; - security.polkit.enable = true; + security.polkit.enable = true; - systemd = { - packages = [pkgs.polkit_gnome]; - user.services.polkit-gnome-authentication-agent-1 = { - unitConfig = { - Description = "polkit-gnome-authentication-agent-1"; - Wants = ["graphical-session.target"]; - WantedBy = ["graphical-session.target"]; - After = ["graphical-session.target"]; - }; - serviceConfig = { - Type = "simple"; - ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; - Restart = "on-failure"; - RestartSec = 1; - TimeoutStopSec = 10; + # start a keyring daemon for sway + systemd = { + packages = [pkgs.polkit_gnome]; + user.services.polkit-gnome-authentication-agent-1 = { + unitConfig = { + Description = "polkit-gnome-authentication-agent-1"; + Wants = ["graphical-session.target"]; + WantedBy = ["graphical-session.target"]; + After = ["graphical-session.target"]; + }; + serviceConfig = { + Type = "simple"; + ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; + Restart = "on-failure"; + RestartSec = 1; + TimeoutStopSec = 10; + }; }; }; }; diff --git a/machines/common/linux/session.nix b/machines/common/linux/session.nix deleted file mode 100644 index 64aed99..0000000 --- a/machines/common/linux/session.nix +++ /dev/null @@ -1,67 +0,0 @@ -{pkgs, ...}: { - environment.systemPackages = with pkgs; [ - # file management - p7zip - unzip - zip - gnome.file-roller - gnome.nautilus - gnome.sushi - - # thumbnails - webp-pixbuf-loader - ffmpegthumbnailer - ]; - programs = { - dconf.enable = true; - noisetorch.enable = true; - }; - - programs.sway = { - enable = true; - extraPackages = with pkgs; [ - foot - swaylock-effects - swayidle - ]; - extraSessionCommands = '' - # session - export XDG_SESSION_TYPE=wayland - export XDG_SESSION_DESKTOP=sway - export XDG_CURRENT_DESKTOP=sway - # wayland - export NIXOS_OZONE_WL=1 - export MOZ_ENABLE_WAYLAND=1 - export QT_QPA_PLATFORM=wayland - export SDL_VIDEODRIVER=wayland - export _JAVA_AWT_WM_NONREPARENTING=1 - ''; - wrapperFeatures = { - base = true; - gtk = true; - }; - }; - - services.dbus.packages = with pkgs; [ - darkman - # gcr needed for gnome3 pinentry, managed in Home-Manager - gcr - gnome.sushi - ]; - xdg.portal.enable = true; - xdg.portal.wlr.enable = true; - xdg.portal.extraPortals = with pkgs; [ - darkman - xdg-desktop-portal-gtk - ]; - - services = { - # mounting - gvfs.enable = true; - udisks2.enable = true; - devmon.enable = true; - - # thumbnails - tumbler.enable = true; - }; -} diff --git a/machines/common/linux/sound.nix b/machines/common/linux/sound.nix index 1dde499..a1cb0e6 100644 --- a/machines/common/linux/sound.nix +++ b/machines/common/linux/sound.nix @@ -1,7 +1,6 @@ { - security = { - rtkit.enable = true; - }; + programs.noisetorch.enable = true; + security.rtkit.enable = true; services = { pipewire = { enable = true; diff --git a/machines/common/linux/sway.nix b/machines/common/linux/sway.nix new file mode 100644 index 0000000..8c71207 --- /dev/null +++ b/machines/common/linux/sway.nix @@ -0,0 +1,76 @@ +{ + config, + lib, + pkgs, + ... +}: { + config = lib.mkIf (config.dotfiles.desktop == "sway") { + environment.systemPackages = with pkgs; [ + # file management + p7zip + unzip + zip + gnome.file-roller + gnome.nautilus + gnome.nautilus-python + gnome.sushi + nautilus-open-any-terminal + + # thumbnails + webp-pixbuf-loader + ffmpegthumbnailer + ]; + programs.dconf.enable = true; + + environment.pathsToLink = ["/share/nautilus-python/extensions"]; + environment.sessionVariables.NAUTILUS_4_EXTENSION_DIR = "${config.system.path}/lib/nautilus/extensions-4"; + + programs.sway = { + enable = true; + extraPackages = with pkgs; [ + foot + swaylock-effects + swayidle + ]; + extraSessionCommands = '' + # session + export XDG_SESSION_TYPE=wayland + export XDG_SESSION_DESKTOP=sway + export XDG_CURRENT_DESKTOP=sway + # wayland + export NIXOS_OZONE_WL=1 + export MOZ_ENABLE_WAYLAND=1 + export QT_QPA_PLATFORM=wayland + export SDL_VIDEODRIVER=wayland + export _JAVA_AWT_WM_NONREPARENTING=1 + ''; + wrapperFeatures = { + base = true; + gtk = true; + }; + }; + + services.dbus.packages = with pkgs; [ + darkman + nautilus-open-any-terminal + # gcr needed for gnome3 pinentry, managed in Home-Manager + gcr + ]; + xdg.portal.enable = true; + xdg.portal.wlr.enable = true; + xdg.portal.extraPortals = with pkgs; [ + darkman + xdg-desktop-portal-gtk + ]; + + services = { + # mounting + gvfs.enable = true; + udisks2.enable = true; + devmon.enable = true; + + # thumbnails + tumbler.enable = true; + }; + }; +} diff --git a/machines/common/shared/user.nix b/machines/common/shared/user.nix index 82d1693..3b0dd63 100644 --- a/machines/common/shared/user.nix +++ b/machines/common/shared/user.nix @@ -11,9 +11,9 @@ then "/home" else throw "Unsupported OS"; in { - users.users."${config.lib.dotfiles.username}" = + users.users."${config.dotfiles.username}" = { - home = "${homeRoot}/${config.lib.dotfiles.username}"; + home = "${homeRoot}/${config.dotfiles.username}"; openssh.authorizedKeys.keys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILm0O46zW/XfVOSwz0okRWYeOAg+wCVkCtCAoVTpZsOh"]; shell = pkgs.zsh; } diff --git a/machines/futomaki/default.nix b/machines/futomaki/default.nix index 9c3a1e2..f8ef49b 100644 --- a/machines/futomaki/default.nix +++ b/machines/futomaki/default.nix @@ -25,7 +25,7 @@ virtualisation.podman.enable = true; virtualisation.libvirtd.enable = true; - users.users."${config.lib.dotfiles.username}".extraGroups = ["libvirtd" "transmission"]; + users.users."${config.dotfiles.username}".extraGroups = ["libvirtd" "transmission"]; environment.systemPackages = with pkgs; [ cabextract diff --git a/machines/lib.nix b/machines/lib.nix index 0e09315..a341465 100644 --- a/machines/lib.nix +++ b/machines/lib.nix @@ -47,11 +47,26 @@ modules = with inputs; [ { - config.lib.dotfiles = {inherit username;}; - options.isGraphical = pkgs.lib.mkOption { - type = pkgs.lib.types.bool; - default = isGraphical; - description = "Whether the system is a isGraphical target"; + options = let + inherit (pkgs) lib; + in { + dotfiles = { + username = lib.mkOption { + type = lib.types.str; + default = username; + description = "The username of the user"; + }; + desktop = lib.mkOption { + type = lib.types.enum ["gnome" "sway"]; + default = "sway"; + description = "The desktop environment to use"; + }; + }; + isGraphical = lib.mkOption { + type = lib.types.bool; + default = isGraphical; + description = "Whether the system is a isGraphical target"; + }; }; } ./common/shared diff --git a/pkgs/catppuccin-gtk.nix b/pkgs/catppuccin-gtk.nix new file mode 100644 index 0000000..7c5d573 --- /dev/null +++ b/pkgs/catppuccin-gtk.nix @@ -0,0 +1,33 @@ +{ + pkgs ? import {}, + accents ? ["pink"], + size ? "compact", + lightFlavor ? "latte", + darkFlavor ? "mocha", +}: let + capitalize = s: (pkgs.lib.toUpper (builtins.substring 0 1 s)) + (builtins.substring 1 (builtins.stringLength s) s); + darkName = capitalize darkFlavor; + lightName = capitalize lightFlavor; +in + pkgs.symlinkJoin { + name = "Catppuccin-Compact-Pink"; + paths = [ + (pkgs.catppuccin-gtk.override { + inherit accents size; + variant = darkFlavor; + }) + (pkgs.catppuccin-gtk.override { + inherit accents size; + variant = lightFlavor; + }) + ]; + postBuild = '' + cd $out/share/themes + mv -v Catppuccin-${lightName}-Compact-Pink-Light Catppuccin-Compact-Pink + mv -v Catppuccin-${lightName}-Compact-Pink-Light-hdpi Catppuccin-Compact-Pink-hdpi + mv -v Catppuccin-${lightName}-Compact-Pink-Light-xhdpi Catppuccin-Compact-Pink-xhdpi + mv -v Catppuccin-${darkName}-Compact-Pink-Dark Catppuccin-Compact-Pink-dark + mv -v Catppuccin-${darkName}-Compact-Pink-Dark-hdpi Catppuccin-Compact-Pink-hdpi-dark + mv -v Catppuccin-${darkName}-Compact-Pink-Dark-xhdpi Catppuccin-Compact-Pink-xhdpi-dark + ''; + }