diff --git a/devices/pc/default.nix b/devices/pc/default.nix index 2a74b1b0..a819f49d 100644 --- a/devices/pc/default.nix +++ b/devices/pc/default.nix @@ -116,6 +116,5 @@ inputs: ''; # 解决有时蓝牙不能使用的问题 boot.kernelParams = [ "mt7925e.disable_aspm=1" ]; - specialisation.kde.configuration.nixos.system.gui.implementation = "kde"; }; } diff --git a/flake.lock b/flake.lock index 761abd99..55e66abe 100644 --- a/flake.lock +++ b/flake.lock @@ -1137,29 +1137,6 @@ "type": "github" } }, - "plasma-manager": { - "inputs": { - "home-manager": [ - "home-manager" - ], - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1762784320, - "narHash": "sha256-odsk96Erywk5hs0dhArF38zb7Oe0q6LZ70gXbxAPKno=", - "owner": "pjones", - "repo": "plasma-manager", - "rev": "7911a0f8a44c7e8b29d031be3149ee8943144321", - "type": "github" - }, - "original": { - "owner": "pjones", - "repo": "plasma-manager", - "type": "github" - } - }, "pocketfft": { "flake": false, "locked": { @@ -1275,7 +1252,6 @@ "nur-xddxdd": "nur-xddxdd", "openxlsx": "openxlsx", "phono3py": "phono3py", - "plasma-manager": "plasma-manager", "pocketfft": "pocketfft", "py4vasp": "py4vasp", "pybinding": "pybinding", diff --git a/flake.nix b/flake.nix index 03d26744..90698627 100644 --- a/flake.nix +++ b/flake.nix @@ -13,11 +13,6 @@ nix-index-database = { url = "github:Mic92/nix-index-database"; inputs.nixpkgs.follows = "nixpkgs"; }; nur-xddxdd = { url = "github:xddxdd/nur-packages"; inputs.nixpkgs.follows = "nixpkgs"; }; impermanence.url = "github:CHN-beta/impermanence"; - plasma-manager = - { - url = "github:pjones/plasma-manager"; - inputs = { nixpkgs.follows = "nixpkgs"; home-manager.follows = "home-manager"; }; - }; nur-linyinfeng = { url = "github:linyinfeng/nur-packages"; inputs.nixpkgs.follows = "nixpkgs"; }; nix-flatpak.url = "github:gmodena/nix-flatpak"; chaotic = diff --git a/modules/default.nix b/modules/default.nix index 6d042bbb..0e19b259 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -16,7 +16,6 @@ inputs: let inherit (inputs) topInputs; in { config.niri-flake.cache.enable = false; } { config.home-manager.sharedModules = [ - topInputs.plasma-manager.homeModules.plasma-manager topInputs.catppuccin.homeModules.catppuccin topInputs.dankmaterialshell.homeModules.dankMaterialShell.default topInputs.dankmaterialshell.homeModules.dankMaterialShell.niri diff --git a/modules/packages/desktop.nix b/modules/packages/desktop.nix index 7ebfa581..9e6703f7 100644 --- a/modules/packages/desktop.nix +++ b/modules/packages/desktop.nix @@ -16,7 +16,7 @@ inputs: # system management # TODO: module should add yubikey-touch-detector into path gparted wayland-utils clinfo mesa-demos vulkan-tools dracut yubikey-touch-detector btrfs-assistant snapper-gui - kdePackages.qtstyleplugin-kvantum cpu-x wl-mirror geekbench xpra + cpu-x wl-mirror geekbench xpra ( writeShellScriptBin "xclip" '' @@ -69,13 +69,7 @@ inputs: openai-whisper # daily management activitywatch super-productivity - ] - ++ (builtins.filter - (p: (inputs.lib.isDerivation p) && !(p.meta.broken or false) - && !(builtins.elem p.pname or null [ "falkon" "kalzium" "calligra" "kamoso" ])) - (builtins.attrValues kdePackages.kdeGear)) - ++ (inputs.lib.optionals (inputs.config.nixos.system.gui.implementation == "kde") - [ inputs.topInputs.plasma-manager.packages.${inputs.pkgs.system}.rc2nix ]); + ]; _pythonPackages = [(pythonPackages: with pythonPackages; [ phonopy scipy scikit-learn jupyterlab autograd inputs.pkgs.localPackages.phono3py numpy ])]; }; @@ -83,46 +77,10 @@ inputs: [{ config = { - programs = + programs.obs-studio = { - plasma = inputs.lib.mkIf (inputs.config.nixos.system.gui.implementation == "kde") - { - enable = true; - configFile = - { - plasma-localerc = { Formats.LANG.value = "en_US.UTF-8"; Translations.LANGUAGE.value = "zh_CN"; }; - baloofilerc."Basic Settings".Indexing-Enabled.value = false; - plasmarc.Wallpapers.usersWallpapers.value = - let - inherit (inputs.topInputs) nixos-wallpaper; - isPicture = f: builtins.elem (inputs.lib.last (inputs.lib.splitString "." f)) - [ "png" "jpg" "jpeg" "webp" ]; - listDirRecursive = - let listDir = dir: - if dir.value == "directory" then builtins.concatLists - (builtins.map (f: listDir f) (inputs.localLib.attrsToList (builtins.readDir dir.name))) - else [ dir ]; - in dir: listDir { name = dir; value = "directory"; }; - in builtins.concatStringsSep "," (builtins.map (f: "${nixos-wallpaper}/${f.name}") - (builtins.filter (f: (isPicture f.name) && (f.value == "regular")) - (listDirRecursive nixos-wallpaper))); - }; - powerdevil = - let config = - { - autoSuspend.action = "nothing"; - dimDisplay.enable = false; - powerButtonAction = "turnOffScreen"; - turnOffDisplay.idleTimeout = "never"; - whenLaptopLidClosed = "turnOffScreen"; - }; - in { AC = config; battery = config; lowBattery = config; }; - }; - obs-studio = - { - enable = true; - plugins = with inputs.pkgs.obs-studio-plugins; [ wlrobs obs-vaapi droidcam-obs obs-vkcapture ]; - }; + enable = true; + plugins = with inputs.pkgs.obs-studio-plugins; [ wlrobs obs-vaapi droidcam-obs obs-vkcapture ]; }; xdg.configFile."typora-flags.conf".text = "--ozone-platform-hint=auto --enable-wayland-ime --wayland-text-input-version=3"; @@ -135,7 +93,6 @@ inputs: wireshark = { enable = true; package = inputs.pkgs.wireshark; }; yubikey-touch-detector.enable = true; kdeconnect.enable = true; - kde-pim.enable = false; alvr = { enable = true; openFirewall = true; }; localsend.enable = true; thunderbird.enable = true; diff --git a/modules/packages/firefox.nix b/modules/packages/firefox.nix index 52cfd3fd..7cf2d629 100644 --- a/modules/packages/firefox.nix +++ b/modules/packages/firefox.nix @@ -12,7 +12,7 @@ inputs: { enable = true; languagePacks = [ "zh-CN" "en-US" ]; - nativeMessagingHosts.packages = with inputs.pkgs; [ uget-integrator ]; + nativeMessagingHosts.packages = [ inputs.pkgs.uget-integrator ]; }; nixos = { @@ -23,12 +23,7 @@ inputs: programs.firefox = { enable = true; - nativeMessagingHosts = with inputs.pkgs; - ( - [ uget-integrator ] - ++ (inputs.lib.optionals (inputs.config.nixos.system.gui.implementation == "kde") - [ kdePackages.plasma-browser-integration ]) - ); + nativeMessagingHosts = [ inputs.pkgs.uget-integrator ]; # TODO: use fixed-version of plugins policies.DefaultDownloadDirectory = "\${home}/Downloads"; profiles.default = @@ -38,8 +33,7 @@ inputs: tampermonkey bitwarden cookies-txt dualsub firefox-color i-dont-care-about-cookies metamask pakkujs rsshub-radar rsspreview tabliss tree-style-tab ublock-origin wappalyzer grammarly zotero-connector smartproxy kiss-translator - ] ++ (inputs.lib.optionals (inputs.config.nixos.system.gui.implementation == "kde") - [ plasma-integration ]); + ]; search = { default = "google"; force = true; }; userChrome = builtins.readFile "${inputs.topInputs.lepton}/userChrome.css"; userContent = builtins.readFile "${inputs.topInputs.lepton}/userContent.css"; diff --git a/modules/system/gui.nix b/modules/system/gui.nix index ffb3deb6..faa87c8f 100644 --- a/modules/system/gui.nix +++ b/modules/system/gui.nix @@ -1,74 +1,69 @@ inputs: { - options.nixos.system.gui = let inherit (inputs.lib) mkOption types; in + config = inputs.lib.mkIf (inputs.config.nixos.model.type == "desktop") { - implementation = mkOption { type = types.enum [ "kde" "niri" ]; default = "niri"; }; - }; - config = let inherit (inputs.config.nixos.system) gui; in inputs.lib.mkMerge - [ - # enable gui - (inputs.lib.mkIf (inputs.config.nixos.model.type == "desktop") + services = { - services = - { - desktopManager.plasma6.enable = inputs.lib.mkIf (gui.implementation == "kde") true; - greetd = - { - enable = true; - settings.default_session.command = - let sessionData = "${inputs.config.services.displayManager.sessionData.desktops}/share"; - in builtins.concatStringsSep " " - [ - "${inputs.pkgs.tuigreet}/bin/tuigreet" - "--sessions ${sessionData}/wayland-sessions --xsessions ${sessionData}/xsessions" - "--time --asterisks --remember --remember-user-session" - (inputs.lib.optionalString (gui.implementation == "kde") "--cmd startplasma-wayland") - ]; - }; - }; - environment = - { - sessionVariables.GTK_USE_PORTAL = "1"; - persistence."/nix/persistent".directories = - [{ directory = "/var/cache/tuigreet"; user = "greeter"; group = "greeter"; mode = "0700"; }]; - }; - xdg.portal.extraPortals = (builtins.map (p: inputs.pkgs."xdg-desktop-portal-${p}") [ "gtk" "wlr" "gnome" ]) - ++ [ inputs.pkgs.kdePackages.xdg-desktop-portal-kde ]; - i18n.inputMethod = + greetd = { enable = true; - type = "fcitx5"; - fcitx5.addons = with inputs.pkgs; - [ qt6Packages.fcitx5-chinese-addons fcitx5-mozc fcitx5-material-color fcitx5-gtk ]; + settings.default_session.command = + let sessionData = "${inputs.config.services.displayManager.sessionData.desktops}/share"; + in builtins.concatStringsSep " " + [ + "${inputs.pkgs.tuigreet}/bin/tuigreet" + "--sessions ${sessionData}/wayland-sessions --xsessions ${sessionData}/xsessions" + "--time --asterisks --remember --remember-user-session" + ]; }; - programs.dconf.enable = true; - nixos.user.sharedModules = [(hmInputs: - { - config = - { - gtk = - { - enable = true; - theme.name = "Breeze"; - gtk2 = - { - extraConfig = ''gtk-im-module="fcitx"''; - configLocation = "${hmInputs.config.xdg.configHome}/gtk-2.0/gtkrc"; - force = true; - }; - gtk3.extraConfig.gtk-im-module = "fcitx"; - gtk4.extraConfig.gtk-im-module = "fcitx"; - }; - }; - })]; - }) - # niri - (inputs.lib.mkIf (inputs.config.nixos.model.type == "desktop" && gui.implementation == "niri") + # niri module will auto enable this, disable it to avoid conflict with system ssh-agent + gnome.gcr-ssh-agent.enable = false; + }; + environment = { - programs.niri.enable = true; - nixos.user.sharedModules = [(hmInputs: + sessionVariables = { - config.programs = + GTK_USE_PORTAL = "1"; + # let electron use gnome keyring https://github.com/electron/electron/issues/39789#issuecomment-3433810585 + GNOME_DESKTOP_SESSION_ID = "this-is-deprecated"; + }; + persistence."/nix/persistent".directories = + [{ directory = "/var/cache/tuigreet"; user = "greeter"; group = "greeter"; mode = "0700"; }]; + systemPackages = + [ + # nautilus is needed before we use implementation from nixpkgs + inputs.pkgs.nautilus + # needed for xwayland + inputs.pkgs.xwayland-satellite + ]; + }; + xdg.portal.extraPortals = (builtins.map (p: inputs.pkgs."xdg-desktop-portal-${p}") [ "gtk" "wlr" "gnome" ]); + i18n.inputMethod = + { + enable = true; + type = "fcitx5"; + fcitx5.addons = with inputs.pkgs; + [ qt6Packages.fcitx5-chinese-addons fcitx5-mozc fcitx5-material-color fcitx5-gtk ]; + }; + programs = { dconf.enable = true; niri.enable = true; }; + nixos.user.sharedModules = [(hmInputs: + { + config = + { + gtk = + { + enable = true; + theme.name = "Breeze"; + gtk2 = + { + extraConfig = ''gtk-im-module="fcitx"''; + configLocation = "${hmInputs.config.xdg.configHome}/gtk-2.0/gtkrc"; + force = true; + }; + gtk3.extraConfig.gtk-im-module = "fcitx"; + gtk4.extraConfig.gtk-im-module = "fcitx"; + }; + programs = { dankMaterialShell = { @@ -95,23 +90,9 @@ inputs: input.touchpad.dwt = true; }; }; - })]; - # niri module will auto enable this, disable it to avoid conflict with system ssh-agent - services.gnome.gcr-ssh-agent.enable = false; - # use polkit from dms - systemd.user.services.niri-flake-polkit.enable = false; - environment = - { - # let electron use gnome keyring https://github.com/electron/electron/issues/39789#issuecomment-3433810585 - sessionVariables.GNOME_DESKTOP_SESSION_ID = "this-is-deprecated"; - systemPackages = - [ - # nautilus is needed before we use implementation from nixpkgs - inputs.pkgs.nautilus - # needed for xwayland - inputs.pkgs.xwayland-satellite - ]; }; - }) - ]; + })]; + # use polkit from dms + systemd.user.services.niri-flake-polkit.enable = false; + }; } diff --git a/modules/user/chn/chromium.nix b/modules/user/chn/chromium.nix index a9be0546..e0e660cd 100644 --- a/modules/user/chn/chromium.nix +++ b/modules/user/chn/chromium.nix @@ -13,7 +13,6 @@ inputs: { id = "nngceckbapebfimnlniiiahkandclblb"; } # Bitwarden { id = "kbfnbcaeplbcioakkpcpgfkobkghlhen"; } # Grammarly { id = "ihnfpdchjnmlehnoeffgcbakfmdjcckn"; } # Pixiv Fanbox Downloader - { id = "cimiefiiaegbelhefglklhhakcgmhkai"; } # Plasma Integration { id = "dkndmhgdcmjdmkdonmbgjpijejdcilfh"; } # Powerful Pixiv Downloader { id = "padekgcemlokbadohgkifijomclgjgif"; } # Proxy SwitchyOmega { id = "kefjpfngnndepjbopdmoebkipbgkggaa"; } # RSSHub Radar diff --git a/modules/user/chn/plasma/autostart.nix b/modules/user/chn/plasma/autostart.nix deleted file mode 100644 index abbaeef2..00000000 --- a/modules/user/chn/plasma/autostart.nix +++ /dev/null @@ -1,7 +0,0 @@ -inputs: -{ - config = inputs.lib.mkIf (inputs.config.nixos.model.type == "desktop") - { - environment.persistence."/nix/rootfs/current".users.chn.directories = [ ".config/autostart" ]; - }; -} diff --git a/modules/user/chn/plasma/default.nix b/modules/user/chn/plasma/default.nix deleted file mode 100644 index 95a020fd..00000000 --- a/modules/user/chn/plasma/default.nix +++ /dev/null @@ -1,98 +0,0 @@ -inputs: -{ - imports = inputs.localLib.findModules ./.; - config = inputs.lib.mkIf - (inputs.config.nixos.packages.desktop != null && inputs.config.nixos.system.gui.implementation == "kde") - { - home-manager.users.chn.config.programs.plasma = inputs.lib.mkMerge - [ - # TODO: panel, discard user changed settings - # kwin - { - kwin = - { - titlebarButtons = - { - right = [ "help" "keep-below-windows" "keep-above-windows" "minimize" "maximize" "close" ]; - left = [ "more-window-actions" ]; - }; - virtualDesktops = inputs.lib.mkIf (inputs.config.nixos.model.hostname == "pc") { rows = 2; number = 6; }; - effects = { shakeCursor.enable = true; desktopSwitching.animation = "slide"; }; - }; - windows.allowWindowsToRememberPositions = false; - configFile = - { - plasmanotifyrc.Notifications.PopupPosition.value = "BottomRight"; - kwinrc = - { - Tiling.padding.value = 4; - Wayland.InputMethod.value = "/run/current-system/sw/share/applications/fcitx5-wayland-launcher.desktop"; - Windows.RollOverDesktops.value = true; - Compositing = { AllowTearing.value = false; WindowsBlockCompositing.value = false; }; - }; - }; - } - # dolphin and file chooser - { - configFile = - { - dolphinrc = - { - General = { ShowFullPath.value = true; FilterBar.value = true; RememberOpenedTabs.value = false; }; - PreviewSettings.Plugins.value = builtins.concatStringsSep "," - [ - "blenderthumbnail" - "comicbookthumbnail" - "djvuthumbnail" - "ebookthumbnail" - "exrthumbnail" - "marble_thumbnail_geojson" - "marble_thumbnail_gpx" - "jpegthumbnail" - "marble_thumbnail_kmz" - "marble_thumbnail_kml" - "kraorathumbnail" - "windowsimagethumbnail" - "windowsexethumbnail" - "mltpreview" - "mobithumbnail" - "opendocumentthumbnail" - "marble_thumbnail_osm" - "palathumbcreator" - "gsthumbnail" - "rawthumbnail" - "svgthumbnail" - "imagethumbnail" - "fontthumbnail" - "directorythumbnail" - "textthumbnail" - "webarchivethumbnail" - "ffmpegthumbs" - "audiothumbnail" - ]; - }; - kdeglobals."KFileDialog Settings" = - { - "Allow Expansion".value = true; - "Automatically select filename extension".value = true; - "Show Bookmarks".value = true; - "Show Full Path".value = true; - "Show Inline Previews".value = true; - "Show Preview".value = true; - "Show Speedbar".value = true; - "Show hidden files".value = true; - "Sort by".value = "Name"; - "Sort directories first".value = true; - "Sort hidden files last".value = true; - "View Style".value = "DetailTree"; - }; - }; - workspace.clickItemTo = "open"; - } - # krunner - { configFile.krunnerrc = { General.FreeFloating.value = true; Plugins.baloosearchEnabled.value = false; }; } - # lock screen - { configFile.kscreenlockerrc.Daemon.Autolock.value = false; } - ]; - }; -} diff --git a/modules/user/chn/plasma/shortcuts.nix b/modules/user/chn/plasma/shortcuts.nix deleted file mode 100644 index cff8cc3e..00000000 --- a/modules/user/chn/plasma/shortcuts.nix +++ /dev/null @@ -1,99 +0,0 @@ -inputs: -{ - config = inputs.lib.mkIf - (inputs.config.nixos.model.type == "desktop" && inputs.config.nixos.system.gui.implementation == "kde") - { - home-manager.users.chn.config.programs.plasma = - { - overrideConfig = true; - resetFiles = [ "kglobalshortcutsrc" "khotkeysrc" ]; - spectacle.shortcuts.captureRectangularRegion = "Print"; - shortcuts = inputs.lib.mkMerge - [ - # firefox - { "firefox.desktop"._launch = "Meta+B"; } - # crow translate - { "io.crow_translate.CrowTranslate.desktop".TranslateSelectedText = "Ctrl+Alt+E"; } - # display - { - kded5.display = [ "Display" "Meta+P" ]; - kwin = { view_actual_size = "Meta+0"; view_zoom_in = [ "Meta++" "Meta+=" ]; view_zoom_out = "Meta+-"; }; - org_kde_powerdevil = - { - "Decrease Screen Brightness" = "Monitor Brightness Down"; - "Increase Screen Brightness" = "Monitor Brightness Up"; - }; - } - # volume - { - kmix = - { - decrease_volume = "Volume Down"; - increase_volume = "Volume Up"; - mic_mute = [ "Meta+Volume Mute" ]; - mute = "Volume Mute"; - }; - } - # session - { - ksmserver = { "Lock Session" = [ "Meta+L" "Screensaver" ]; "Log Out" = "Ctrl+Alt+Del"; }; - org_kde_powerdevil."Turn Off Screen" = "Meta+Ctrl+L"; - } - # window - { - kwin = - { - ExposeAll = "Meta+Tab"; - "Show Desktop" = "Meta+D"; - "Suspend Compositing" = "Alt+Shift+F12"; - "Walk Through Windows" = "Alt+Tab"; - "Walk Through Windows (Reverse)" = "Alt+Shift+Backtab"; - "Window Above Other Windows" = "Meta+Shift+Up"; - "Window Below Other Windows" = "Meta+Shift+Down"; - "Window Close" = "Alt+F4"; - "Window Maximize" = "Meta+Ctrl+Up"; - "Window Minimize" = "Meta+Ctrl+Down"; - "Window Operations Menu" = "Alt+F3"; - "Window Quick Tile Bottom" = "Meta+Down"; - "Window Quick Tile Left" = "Meta+Left"; - "Window Quick Tile Right" = "Meta+Right"; - "Window Quick Tile Top" = "Meta+Up"; - }; - } - # virtual desktop - { - kwin = - { - "Switch to Previous Desktop" = [ "Ctrl+PgUp" "Ctrl+Num+PgUp" ]; - "Switch to Next Desktop" = [ "Ctrl+PgDown" "Ctrl+Num+PgDown" ]; - "Window to Previous Desktop" = [ "Meta+Ctrl+PgUp" "Meta+Ctrl+Num+PgUp" ]; - "Window to Next Desktop" = [ "Meta+Ctrl+PgDown" "Meta+Ctrl+Num+PgDown" ]; - }; - } - # media - { - mediacontrol = - { - nextmedia = "Media Next"; - pausemedia = "Media Pause"; - playpausemedia = [ "Pause" "Media Play" ]; - previousmedia = "Media Previous"; - stopmedia = "Media Stop"; - }; - } - # dolphin - { "org.kde.dolphin.desktop"._launch = "Meta+E"; } - # konsole - { "org.kde.konsole.desktop"._launch = "Ctrl+Alt+T"; } - # krunner - { "org.kde.krunner.desktop"._launch = "Alt+Space"; } - # settings - { "systemsettings.desktop"._launch = "Meta+I"; } - # virt-manager - { "virt-manager.desktop"._launch = "Meta+V"; } - # system monitor - { "org.kde.plasma-systemmonitor.desktop"._launch = "Meta+Esc"; } - ]; - }; - }; -} diff --git a/modules/user/chn/plasma/wallpaper.nix b/modules/user/chn/plasma/wallpaper.nix deleted file mode 100644 index b2878f41..00000000 --- a/modules/user/chn/plasma/wallpaper.nix +++ /dev/null @@ -1,7 +0,0 @@ -inputs: -{ - config = inputs.lib.mkIf (inputs.config.nixos.system.gui.implementation == "kde") - { - home-manager.users.chn.config.programs.plasma.configFile.kdeglobals.General.accentColorFromWallpaper.value = true; - }; -}