From 125f9a5eaba528ceba24c8f6bbdcdfa2fa077892 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Mon, 8 Jul 2024 15:23:58 +0700 Subject: [PATCH] Move window manager exclusive to wm module --- {modules => environments}/gnome/default.nix | 7 +-- {modules => environments}/gnome/home.nix | 3 +- {modules => environments}/gnome/wallpaper.sh | 0 {modules => environments}/none/default.nix | 0 {modules => environments}/none/home.nix | 0 environments/river/default.nix | 41 ++++++++++++++ {modules => environments}/river/home.nix | 3 +- {modules => environments}/server/default.nix | 0 {modules => environments}/server/guesspath.sh | 0 {modules => environments}/server/home.nix | 0 {modules => environments}/server/smartrss.sh | 0 {modules => environments}/wsl/default.nix | 0 {modules => environments}/wsl/home.nix | 2 +- flake.lock | 18 ------ flake.nix | 2 - modules/gui/{apps.nix => default.nix} | 18 +----- modules/home/fcitx5/default.nix | 55 ------------------- modules/{gui => wm}/ags/.editorconfig | 0 modules/{gui => wm}/ags/.gitignore | 0 modules/{gui => wm}/ags/config.js | 0 modules/{gui => wm}/ags/covercolors.py | 0 modules/{gui => wm}/ags/default.nix | 6 +- modules/{gui => wm}/ags/layouts/bar.js | 0 .../{gui => wm}/ags/layouts/notifications.js | 0 modules/{gui => wm}/ags/layouts/osd.js | 0 .../{gui => wm}/ags/layouts/quicksettings.js | 0 modules/{gui => wm}/ags/misc/menu.js | 0 modules/{gui => wm}/ags/misc/popup.js | 0 modules/{gui => wm}/ags/misc/utils.js | 0 modules/{gui => wm}/ags/modules/audio.js | 0 modules/{gui => wm}/ags/modules/battery.js | 0 modules/{gui => wm}/ags/modules/bluetooth.js | 0 modules/{gui => wm}/ags/modules/brightness.js | 0 modules/{gui => wm}/ags/modules/clock.js | 0 modules/{gui => wm}/ags/modules/darkmode.js | 0 modules/{gui => wm}/ags/modules/dwl.js | 0 modules/{gui => wm}/ags/modules/mpris.js | 0 modules/{gui => wm}/ags/modules/network.js | 0 .../{gui => wm}/ags/modules/notifications.js | 0 .../{gui => wm}/ags/modules/powerprofile.js | 0 modules/{gui => wm}/ags/modules/systray.js | 0 .../{gui => wm}/ags/services/brightness.js | 0 modules/{gui => wm}/ags/services/dwl.js | 0 modules/{gui => wm}/ags/shell.nix | 0 modules/{gui => wm}/ags/style.css | 0 modules/{gui => wm}/ags/tsconfig.json | 4 +- modules/{gui => wm}/ags/types | 0 modules/{river => wm}/default.nix | 31 ----------- modules/wm/home.nix | 19 +++++++ modules/{gui => wm}/rofi/colors.rasi | 0 modules/{gui => wm}/rofi/config.rasi | 0 modules/{gui => wm}/rofi/default.nix | 0 52 files changed, 70 insertions(+), 139 deletions(-) rename {modules => environments}/gnome/default.nix (95%) rename {modules => environments}/gnome/home.nix (99%) rename {modules => environments}/gnome/wallpaper.sh (100%) rename {modules => environments}/none/default.nix (100%) rename {modules => environments}/none/home.nix (100%) create mode 100644 environments/river/default.nix rename {modules => environments}/river/home.nix (99%) rename {modules => environments}/server/default.nix (100%) rename {modules => environments}/server/guesspath.sh (100%) rename {modules => environments}/server/home.nix (100%) rename {modules => environments}/server/smartrss.sh (100%) rename {modules => environments}/wsl/default.nix (100%) rename {modules => environments}/wsl/home.nix (93%) rename modules/gui/{apps.nix => default.nix} (91%) delete mode 100644 modules/home/fcitx5/default.nix rename modules/{gui => wm}/ags/.editorconfig (100%) rename modules/{gui => wm}/ags/.gitignore (100%) rename modules/{gui => wm}/ags/config.js (100%) rename modules/{gui => wm}/ags/covercolors.py (100%) rename modules/{gui => wm}/ags/default.nix (97%) rename modules/{gui => wm}/ags/layouts/bar.js (100%) rename modules/{gui => wm}/ags/layouts/notifications.js (100%) rename modules/{gui => wm}/ags/layouts/osd.js (100%) rename modules/{gui => wm}/ags/layouts/quicksettings.js (100%) rename modules/{gui => wm}/ags/misc/menu.js (100%) rename modules/{gui => wm}/ags/misc/popup.js (100%) rename modules/{gui => wm}/ags/misc/utils.js (100%) rename modules/{gui => wm}/ags/modules/audio.js (100%) rename modules/{gui => wm}/ags/modules/battery.js (100%) rename modules/{gui => wm}/ags/modules/bluetooth.js (100%) rename modules/{gui => wm}/ags/modules/brightness.js (100%) rename modules/{gui => wm}/ags/modules/clock.js (100%) rename modules/{gui => wm}/ags/modules/darkmode.js (100%) rename modules/{gui => wm}/ags/modules/dwl.js (100%) rename modules/{gui => wm}/ags/modules/mpris.js (100%) rename modules/{gui => wm}/ags/modules/network.js (100%) rename modules/{gui => wm}/ags/modules/notifications.js (100%) rename modules/{gui => wm}/ags/modules/powerprofile.js (100%) rename modules/{gui => wm}/ags/modules/systray.js (100%) rename modules/{gui => wm}/ags/services/brightness.js (100%) rename modules/{gui => wm}/ags/services/dwl.js (100%) rename modules/{gui => wm}/ags/shell.nix (100%) rename modules/{gui => wm}/ags/style.css (100%) rename modules/{gui => wm}/ags/tsconfig.json (80%) rename modules/{gui => wm}/ags/types (100%) rename modules/{river => wm}/default.nix (56%) create mode 100644 modules/wm/home.nix rename modules/{gui => wm}/rofi/colors.rasi (100%) rename modules/{gui => wm}/rofi/config.rasi (100%) rename modules/{gui => wm}/rofi/default.nix (100%) diff --git a/modules/gnome/default.nix b/environments/gnome/default.nix similarity index 95% rename from modules/gnome/default.nix rename to environments/gnome/default.nix index 1f45e48..2c7bd88 100644 --- a/modules/gnome/default.nix +++ b/environments/gnome/default.nix @@ -1,11 +1,8 @@ { - config, lib, pkgs, - inputs, ... -}: -{ +}: { services.xserver = { enable = true; displayManager = { @@ -31,7 +28,7 @@ fileSystems."/home/zoriya/.local/share/gnome-shell/extensions/fairy@zoriya.dev" = { device = "/home/zoriya/projects/fairy/"; fsType = "none"; - options = [ "bind" ]; + options = ["bind"]; }; environment.systemPackages = with pkgs; [gnome3.gnome-tweaks]; diff --git a/modules/gnome/home.nix b/environments/gnome/home.nix similarity index 99% rename from modules/gnome/home.nix rename to environments/gnome/home.nix index 43425ec..225d235 100644 --- a/modules/gnome/home.nix +++ b/environments/gnome/home.nix @@ -1,5 +1,4 @@ { - config, lib, pkgs, ... @@ -199,7 +198,7 @@ in { show-indicator = false; }; - "org/gnome/shell/extensions/fairy" = { + "org/gnome/shell/extensions/fairy" = { tag-names = ["一" "二" "三" " 四" "五" "六" "七" "八" "九"]; }; diff --git a/modules/gnome/wallpaper.sh b/environments/gnome/wallpaper.sh similarity index 100% rename from modules/gnome/wallpaper.sh rename to environments/gnome/wallpaper.sh diff --git a/modules/none/default.nix b/environments/none/default.nix similarity index 100% rename from modules/none/default.nix rename to environments/none/default.nix diff --git a/modules/none/home.nix b/environments/none/home.nix similarity index 100% rename from modules/none/home.nix rename to environments/none/home.nix diff --git a/environments/river/default.nix b/environments/river/default.nix new file mode 100644 index 0000000..8b2deae --- /dev/null +++ b/environments/river/default.nix @@ -0,0 +1,41 @@ +{pkgs, ...}: { + imports = [ + ../../modules/wm + ]; + + services.greetd = { + enable = true; + settings = { + default_session = { + command = "agreety --cmd /bin/sh"; + user = "greeter"; + }; + initial_session = { + # TODO: Start river in locked mode or exit if locker crashes. + # zsh -c is to give river access to profile variables + command = "zsh -c river"; + user = "zoriya"; + }; + }; + }; + + xdg.portal = { + enable = true; + wlr.enable = true; + # gtk portal needed to make gtk apps happy + extraPortals = [pkgs.xdg-desktop-portal-gtk]; + config.common.default = "*"; + }; + + environment.systemPackages = with pkgs; [ + wineWowPackages.stable + wineWowPackages.waylandFull + winetricks + ]; + hardware.steam-hardware.enable = true; + programs.gamescope.enable = true; + services.flatpak.enable = true; + + virtualisation.libvirtd.enable = true; + programs.virt-manager.enable = true; +} diff --git a/modules/river/home.nix b/environments/river/home.nix similarity index 99% rename from modules/river/home.nix rename to environments/river/home.nix index 67e1158..230fb58 100644 --- a/modules/river/home.nix +++ b/environments/river/home.nix @@ -21,7 +21,8 @@ }; in { imports = [ - ../gui/apps.nix + ../../modules/gui + ../../modules/wm/home.nix ]; services.cliphist.enable = true; diff --git a/modules/server/default.nix b/environments/server/default.nix similarity index 100% rename from modules/server/default.nix rename to environments/server/default.nix diff --git a/modules/server/guesspath.sh b/environments/server/guesspath.sh similarity index 100% rename from modules/server/guesspath.sh rename to environments/server/guesspath.sh diff --git a/modules/server/home.nix b/environments/server/home.nix similarity index 100% rename from modules/server/home.nix rename to environments/server/home.nix diff --git a/modules/server/smartrss.sh b/environments/server/smartrss.sh similarity index 100% rename from modules/server/smartrss.sh rename to environments/server/smartrss.sh diff --git a/modules/wsl/default.nix b/environments/wsl/default.nix similarity index 100% rename from modules/wsl/default.nix rename to environments/wsl/default.nix diff --git a/modules/wsl/home.nix b/environments/wsl/home.nix similarity index 93% rename from modules/wsl/home.nix rename to environments/wsl/home.nix index 11d5758..f1e5e3a 100644 --- a/modules/wsl/home.nix +++ b/environments/wsl/home.nix @@ -1,7 +1,7 @@ {lib, ...}: { imports = [ # Install apps that I open with wslg (and tools like wl-clipboard which works) - ../gui/apps.nix + ../../modules/gui ]; gtk.enable = lib.mkForce false; diff --git a/flake.lock b/flake.lock index af0ea98..fb2ab65 100644 --- a/flake.lock +++ b/flake.lock @@ -1,22 +1,5 @@ { "nodes": { - "dwl-source": { - "flake": false, - "locked": { - "lastModified": 1694364153, - "narHash": "sha256-dzSct9JfjeE65tdL4ny5VZhrhkWYX4hRQvjxJrfSXqU=", - "owner": "djpohly", - "repo": "dwl", - "rev": "755fcae2afbed51f38c167bdc56a5437cda8137a", - "type": "github" - }, - "original": { - "owner": "djpohly", - "ref": "755fcae2afbed51f38c167bdc56a5437cda8137a", - "repo": "dwl", - "type": "github" - } - }, "flake-compat": { "flake": false, "locked": { @@ -520,7 +503,6 @@ }, "root": { "inputs": { - "dwl-source": "dwl-source", "flood": "flood", "ghostty": "ghostty", "home-manager": "home-manager", diff --git a/flake.nix b/flake.nix index e90c097..6c25831 100644 --- a/flake.nix +++ b/flake.nix @@ -102,8 +102,6 @@ wally-cli ghostty.packages.x86_64-linux.default ]; - - programs.gamescope.enable = true; }) ]; diff --git a/modules/gui/apps.nix b/modules/gui/default.nix similarity index 91% rename from modules/gui/apps.nix rename to modules/gui/default.nix index bb7d6df..bb2bd06 100644 --- a/modules/gui/apps.nix +++ b/modules/gui/default.nix @@ -1,36 +1,21 @@ { - lib, config, pkgs, ... -}: -with lib; let +}: let # When editing this, don't forget to edit home.sessionVariables. browser = "firefox.desktop"; editor = "nvim.desktop"; pdf = "org.pwmt.zathura.desktop"; player = "mpv.desktop"; - - wallpaper = pkgs.writeShellScriptBin "wallpaper" '' - WALLPAPERS=~/wallpapers/ - - WP=$(find $WALLPAPERS -type f | shuf -n 1) - ln -fs "$WP" ~/.cache/current-wallpaper - - ${pkgs.wbg}/bin/wbg "$WP" > /dev/null 2> /dev/null & disown - echo "$WP" - ''; in { imports = [ ./ghostty.nix ./kitty.nix ./gtk.nix - ./rofi - ./ags ]; home.packages = with pkgs; [ - wallpaper google-chrome discord firefox @@ -39,7 +24,6 @@ in { zathura libreoffice qbittorrent - xdg-utils youtube-music wl-clipboard wlr-randr diff --git a/modules/home/fcitx5/default.nix b/modules/home/fcitx5/default.nix deleted file mode 100644 index 0e5881b..0000000 --- a/modules/home/fcitx5/default.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ - lib, - config, - pkgs, - ... -}: -with lib; let - cfg = config.modules.fcitx5; -in { - options.modules.fcitx5 = {enable = mkEnableOption "fcitx5";}; - - config = mkIf cfg.enable { - i18n = { - inputMethod = { - enabled = "fcitx5"; - fcitx5.addons = with pkgs; [ - fcitx5-mozc - ]; - }; - }; - - xdg.configFile."fcitx5/config" = { - force = true; - text = '' - [Hotkey/TriggerKeys] - 0=Shift+Super+L - - [Behavior] - ShowInputMethodInformation=False - CompactInputMethodInformation=False - ShowFirstInputMethodInformation=False - ''; - }; - xdg.configFile."fcitx5/profile" = { - force = true; - text = '' - [Groups/0] - Name=Default - Default Layout=us - DefaultIM=mozc - - [Groups/0/Items/0] - Name=keyboard-us - Layout= - - [Groups/0/Items/1] - Name=mozc - Layout= - - [GroupOrder] - 0=Default - ''; - }; - }; -} diff --git a/modules/gui/ags/.editorconfig b/modules/wm/ags/.editorconfig similarity index 100% rename from modules/gui/ags/.editorconfig rename to modules/wm/ags/.editorconfig diff --git a/modules/gui/ags/.gitignore b/modules/wm/ags/.gitignore similarity index 100% rename from modules/gui/ags/.gitignore rename to modules/wm/ags/.gitignore diff --git a/modules/gui/ags/config.js b/modules/wm/ags/config.js similarity index 100% rename from modules/gui/ags/config.js rename to modules/wm/ags/config.js diff --git a/modules/gui/ags/covercolors.py b/modules/wm/ags/covercolors.py similarity index 100% rename from modules/gui/ags/covercolors.py rename to modules/wm/ags/covercolors.py diff --git a/modules/gui/ags/default.nix b/modules/wm/ags/default.nix similarity index 97% rename from modules/gui/ags/default.nix rename to modules/wm/ags/default.nix index 98a6967..0bf6467 100644 --- a/modules/gui/ags/default.nix +++ b/modules/wm/ags/default.nix @@ -1,8 +1,4 @@ -{ - pkgs, - lib, - ... -}: let +{pkgs, ...}: let covercolors = pkgs.stdenv.mkDerivation { name = "covercolors"; dontUnpack = true; diff --git a/modules/gui/ags/layouts/bar.js b/modules/wm/ags/layouts/bar.js similarity index 100% rename from modules/gui/ags/layouts/bar.js rename to modules/wm/ags/layouts/bar.js diff --git a/modules/gui/ags/layouts/notifications.js b/modules/wm/ags/layouts/notifications.js similarity index 100% rename from modules/gui/ags/layouts/notifications.js rename to modules/wm/ags/layouts/notifications.js diff --git a/modules/gui/ags/layouts/osd.js b/modules/wm/ags/layouts/osd.js similarity index 100% rename from modules/gui/ags/layouts/osd.js rename to modules/wm/ags/layouts/osd.js diff --git a/modules/gui/ags/layouts/quicksettings.js b/modules/wm/ags/layouts/quicksettings.js similarity index 100% rename from modules/gui/ags/layouts/quicksettings.js rename to modules/wm/ags/layouts/quicksettings.js diff --git a/modules/gui/ags/misc/menu.js b/modules/wm/ags/misc/menu.js similarity index 100% rename from modules/gui/ags/misc/menu.js rename to modules/wm/ags/misc/menu.js diff --git a/modules/gui/ags/misc/popup.js b/modules/wm/ags/misc/popup.js similarity index 100% rename from modules/gui/ags/misc/popup.js rename to modules/wm/ags/misc/popup.js diff --git a/modules/gui/ags/misc/utils.js b/modules/wm/ags/misc/utils.js similarity index 100% rename from modules/gui/ags/misc/utils.js rename to modules/wm/ags/misc/utils.js diff --git a/modules/gui/ags/modules/audio.js b/modules/wm/ags/modules/audio.js similarity index 100% rename from modules/gui/ags/modules/audio.js rename to modules/wm/ags/modules/audio.js diff --git a/modules/gui/ags/modules/battery.js b/modules/wm/ags/modules/battery.js similarity index 100% rename from modules/gui/ags/modules/battery.js rename to modules/wm/ags/modules/battery.js diff --git a/modules/gui/ags/modules/bluetooth.js b/modules/wm/ags/modules/bluetooth.js similarity index 100% rename from modules/gui/ags/modules/bluetooth.js rename to modules/wm/ags/modules/bluetooth.js diff --git a/modules/gui/ags/modules/brightness.js b/modules/wm/ags/modules/brightness.js similarity index 100% rename from modules/gui/ags/modules/brightness.js rename to modules/wm/ags/modules/brightness.js diff --git a/modules/gui/ags/modules/clock.js b/modules/wm/ags/modules/clock.js similarity index 100% rename from modules/gui/ags/modules/clock.js rename to modules/wm/ags/modules/clock.js diff --git a/modules/gui/ags/modules/darkmode.js b/modules/wm/ags/modules/darkmode.js similarity index 100% rename from modules/gui/ags/modules/darkmode.js rename to modules/wm/ags/modules/darkmode.js diff --git a/modules/gui/ags/modules/dwl.js b/modules/wm/ags/modules/dwl.js similarity index 100% rename from modules/gui/ags/modules/dwl.js rename to modules/wm/ags/modules/dwl.js diff --git a/modules/gui/ags/modules/mpris.js b/modules/wm/ags/modules/mpris.js similarity index 100% rename from modules/gui/ags/modules/mpris.js rename to modules/wm/ags/modules/mpris.js diff --git a/modules/gui/ags/modules/network.js b/modules/wm/ags/modules/network.js similarity index 100% rename from modules/gui/ags/modules/network.js rename to modules/wm/ags/modules/network.js diff --git a/modules/gui/ags/modules/notifications.js b/modules/wm/ags/modules/notifications.js similarity index 100% rename from modules/gui/ags/modules/notifications.js rename to modules/wm/ags/modules/notifications.js diff --git a/modules/gui/ags/modules/powerprofile.js b/modules/wm/ags/modules/powerprofile.js similarity index 100% rename from modules/gui/ags/modules/powerprofile.js rename to modules/wm/ags/modules/powerprofile.js diff --git a/modules/gui/ags/modules/systray.js b/modules/wm/ags/modules/systray.js similarity index 100% rename from modules/gui/ags/modules/systray.js rename to modules/wm/ags/modules/systray.js diff --git a/modules/gui/ags/services/brightness.js b/modules/wm/ags/services/brightness.js similarity index 100% rename from modules/gui/ags/services/brightness.js rename to modules/wm/ags/services/brightness.js diff --git a/modules/gui/ags/services/dwl.js b/modules/wm/ags/services/dwl.js similarity index 100% rename from modules/gui/ags/services/dwl.js rename to modules/wm/ags/services/dwl.js diff --git a/modules/gui/ags/shell.nix b/modules/wm/ags/shell.nix similarity index 100% rename from modules/gui/ags/shell.nix rename to modules/wm/ags/shell.nix diff --git a/modules/gui/ags/style.css b/modules/wm/ags/style.css similarity index 100% rename from modules/gui/ags/style.css rename to modules/wm/ags/style.css diff --git a/modules/gui/ags/tsconfig.json b/modules/wm/ags/tsconfig.json similarity index 80% rename from modules/gui/ags/tsconfig.json rename to modules/wm/ags/tsconfig.json index e564957..6860767 100644 --- a/modules/gui/ags/tsconfig.json +++ b/modules/wm/ags/tsconfig.json @@ -9,9 +9,9 @@ "checkJs": true, "strict": true, "noImplicitAny": false, - "baseUrl": "../../gui/ags", + "baseUrl": ".", "typeRoots": [ - "../../gui/ags/types" + "./types" ], "skipLibCheck": true } diff --git a/modules/gui/ags/types b/modules/wm/ags/types similarity index 100% rename from modules/gui/ags/types rename to modules/wm/ags/types diff --git a/modules/river/default.nix b/modules/wm/default.nix similarity index 56% rename from modules/river/default.nix rename to modules/wm/default.nix index 0ecb151..0e5e0de 100644 --- a/modules/river/default.nix +++ b/modules/wm/default.nix @@ -1,20 +1,4 @@ {pkgs, ...}: { - services.greetd = { - enable = true; - settings = { - default_session = { - command = "agreety --cmd /bin/sh"; - user = "greeter"; - }; - initial_session = { - # TODO: Start river in locked mode or exit if locker crashes. - # zsh -c is to give river access to profile variables - command = "zsh -c river"; - user = "zoriya"; - }; - }; - }; - networking.networkmanager.enable = true; hardware.pulseaudio.enable = false; hardware.bluetooth = { @@ -50,24 +34,9 @@ programs.dconf.enable = true; services.dbus.enable = true; - xdg.portal = { - enable = true; - wlr.enable = true; - # gtk portal needed to make gtk apps happy - extraPortals = [pkgs.xdg-desktop-portal-gtk]; - config.common.default = "*"; - }; environment.systemPackages = with pkgs; [ gnome.gnome-bluetooth polkit_gnome - wineWowPackages.stable - wineWowPackages.waylandFull - winetricks ]; - hardware.steam-hardware.enable = true; - services.flatpak.enable = true; - - virtualisation.libvirtd.enable = true; - programs.virt-manager.enable = true; } diff --git a/modules/wm/home.nix b/modules/wm/home.nix new file mode 100644 index 0000000..9152491 --- /dev/null +++ b/modules/wm/home.nix @@ -0,0 +1,19 @@ +{pkgs, ...}: let + wallpaper = pkgs.writeShellScriptBin "wallpaper" '' + WALLPAPERS=~/wallpapers/ + + WP=$(find $WALLPAPERS -type f | shuf -n 1) + ln -fs "$WP" ~/.cache/current-wallpaper + + ${pkgs.wbg}/bin/wbg "$WP" > /dev/null 2> /dev/null & disown + echo "$WP" + ''; +in { + imports = [ + ./rofi + ./ags + ]; + home.packages = [ + wallpaper + ]; +} diff --git a/modules/gui/rofi/colors.rasi b/modules/wm/rofi/colors.rasi similarity index 100% rename from modules/gui/rofi/colors.rasi rename to modules/wm/rofi/colors.rasi diff --git a/modules/gui/rofi/config.rasi b/modules/wm/rofi/config.rasi similarity index 100% rename from modules/gui/rofi/config.rasi rename to modules/wm/rofi/config.rasi diff --git a/modules/gui/rofi/default.nix b/modules/wm/rofi/default.nix similarity index 100% rename from modules/gui/rofi/default.nix rename to modules/wm/rofi/default.nix