From 361b443ac744df92018928d813611099afd8603a Mon Sep 17 00:00:00 2001 From: Quentin Boyer Date: Wed, 24 Jul 2024 17:35:10 +0200 Subject: [PATCH] gui,personal-gui: Split GUI module in two distinct modules This is mainly for work vs personal computers --- flake.nix | 2 + gui/hm.nix | 87 +++++++++++++++++++ gui/nixos.nix | 55 ++++++++++++ {personal-gui => gui}/wm/default.nix | 0 {personal-gui => gui}/wm/i3.nix | 0 {personal-gui => gui}/wm/i3like-utils.nix | 0 {personal-gui => gui}/wm/i3like.nix | 0 {personal-gui => gui}/wm/sway.nix | 0 {personal-gui => gui}/wm/terminal/default.nix | 0 {personal-gui => gui}/wm/terminal/foot.nix | 0 {personal-gui => gui}/wm/terminal/kitty.nix | 0 {personal-gui => gui}/wm/waybar-khal.py | 0 {personal-gui => gui}/wm/waybar.css | 0 hostconfig/ZeNixComputa/default.nix | 2 + hostconfig/ZeNixLaptop/default.nix | 4 +- hostconfig/laptop/default.nix | 2 + hostconfig/thinkpad-nixos/default.nix | 6 +- personal-gui/hm.nix | 84 +----------------- personal-gui/nixos.nix | 76 +++------------- 19 files changed, 166 insertions(+), 152 deletions(-) create mode 100644 gui/hm.nix create mode 100644 gui/nixos.nix rename {personal-gui => gui}/wm/default.nix (100%) rename {personal-gui => gui}/wm/i3.nix (100%) rename {personal-gui => gui}/wm/i3like-utils.nix (100%) rename {personal-gui => gui}/wm/i3like.nix (100%) rename {personal-gui => gui}/wm/sway.nix (100%) rename {personal-gui => gui}/wm/terminal/default.nix (100%) rename {personal-gui => gui}/wm/terminal/foot.nix (100%) rename {personal-gui => gui}/wm/terminal/kitty.nix (100%) rename {personal-gui => gui}/wm/waybar-khal.py (100%) rename {personal-gui => gui}/wm/waybar.css (100%) diff --git a/flake.nix b/flake.nix index ecc0d35..e967b29 100644 --- a/flake.nix +++ b/flake.nix @@ -179,6 +179,7 @@ flake = self; }; personal-cli = import ./personal-cli/hm.nix; + gui = import ./gui/hm.nix; personal-gui = import ./personal-gui/hm.nix; gaming = import ./gaming/hm.nix; work = import ./hostconfig/thinkpad-nixos/work.nix; @@ -187,6 +188,7 @@ nixosModules = { minimal = import ./minimal/nixos.nix { inherit extraInfo; }; personal-cli = import ./personal-cli/nixos.nix; + gui = import ./gui/nixos.nix; personal-gui = import ./personal-gui/nixos.nix; roaming = import ./roaming/nixos.nix; gaming = import ./gaming/nixos.nix; diff --git a/gui/hm.nix b/gui/hm.nix new file mode 100644 index 0000000..f1de2fa --- /dev/null +++ b/gui/hm.nix @@ -0,0 +1,87 @@ +{ + config, + lib, + pkgs, + ... +}: +{ + imports = [ ./wm ]; + + xdg.portal = { + enable = true; + config = { + sway = { + default = "gtk"; + "org.freedesktop.impl.portal.Screenshot" = "wlr"; + "org.freedesktop.impl.portal.ScreenCast" = "wlr"; + }; + }; + + extraPortals = with pkgs; [ + xdg-desktop-portal-wlr + xdg-desktop-portal-gtk + ]; + }; + + home.packages = with pkgs; [ + # IM + (discord.override { inherit (pkgs) nss; }) + element-desktop + signal-desktop + + # Mail + thunderbird + + # Media + gromit-mpx + krita + pavucontrol + spotify + vlc + + # Libreoffice + hunspell + hunspellDicts.fr-any + hyphen + libreoffice + + # Misc + eog + # Broken as of 15 July + # freecad + wdisplays + wl-clipboard + xdg-utils + fzf + waypipe + ]; + + programs.firefox = { + enable = true; + nativeMessagingHosts = [ pkgs.firefoxpwa ]; + }; + + home.sessionVariables = { + BROWSER = "firefox"; + NIXOS_OZONE_WL = 1; + ANDROID_HOME = "${config.home.sessionVariables.XDG_DATA_HOME}/android"; + }; + + programs.zathura.enable = true; + + programs.rofi = { + enable = true; + theme = "solarized_alternate"; + terminal = "${config.terminal.command}"; + }; + + xdg.desktopEntries.zklist = { + name = "zklist"; + exec = ''${pkgs.foot}/bin/foot nvim "+ZkNotes"''; + }; + + xdg.desktopEntries.zksearch = { + name = "zksearch"; + exec = ''${pkgs.foot}/bin/foot nvim "+ZkNotes { match = { vim.fn.input('Search: ') } }"''; + }; +} diff --git a/gui/nixos.nix b/gui/nixos.nix new file mode 100644 index 0000000..2f37f9b --- /dev/null +++ b/gui/nixos.nix @@ -0,0 +1,55 @@ +{ pkgs, config, ... }: +{ + services.gnome.gnome-keyring.enable = true; + services.flatpak.enable = true; + xdg.portal = { + enable = true; + config = { + sway = { + default = "gtk"; + "org.freedesktop.impl.portal.Screenshot" = "wlr"; + "org.freedesktop.impl.portal.ScreenCast" = "wlr"; + }; + }; + + extraPortals = with pkgs; [ + xdg-desktop-portal-wlr + xdg-desktop-portal-gtk + ]; + }; + + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + programs.noisetorch.enable = true; + + programs.dconf.enable = true; + + security.pam.services.swaylock.text = '' + auth include login + ''; + + services.printing = { + enable = true; + drivers = with pkgs; [ + hplip + gutenprint + cnijfilter2 + ]; + }; + hardware.sane.enable = true; + + hardware.graphics = { + enable = true; + enable32Bit = true; + }; + + users.users."${config.extraInfo.username}".extraGroups = [ + "scanner" + "lp" + ]; +} diff --git a/personal-gui/wm/default.nix b/gui/wm/default.nix similarity index 100% rename from personal-gui/wm/default.nix rename to gui/wm/default.nix diff --git a/personal-gui/wm/i3.nix b/gui/wm/i3.nix similarity index 100% rename from personal-gui/wm/i3.nix rename to gui/wm/i3.nix diff --git a/personal-gui/wm/i3like-utils.nix b/gui/wm/i3like-utils.nix similarity index 100% rename from personal-gui/wm/i3like-utils.nix rename to gui/wm/i3like-utils.nix diff --git a/personal-gui/wm/i3like.nix b/gui/wm/i3like.nix similarity index 100% rename from personal-gui/wm/i3like.nix rename to gui/wm/i3like.nix diff --git a/personal-gui/wm/sway.nix b/gui/wm/sway.nix similarity index 100% rename from personal-gui/wm/sway.nix rename to gui/wm/sway.nix diff --git a/personal-gui/wm/terminal/default.nix b/gui/wm/terminal/default.nix similarity index 100% rename from personal-gui/wm/terminal/default.nix rename to gui/wm/terminal/default.nix diff --git a/personal-gui/wm/terminal/foot.nix b/gui/wm/terminal/foot.nix similarity index 100% rename from personal-gui/wm/terminal/foot.nix rename to gui/wm/terminal/foot.nix diff --git a/personal-gui/wm/terminal/kitty.nix b/gui/wm/terminal/kitty.nix similarity index 100% rename from personal-gui/wm/terminal/kitty.nix rename to gui/wm/terminal/kitty.nix diff --git a/personal-gui/wm/waybar-khal.py b/gui/wm/waybar-khal.py similarity index 100% rename from personal-gui/wm/waybar-khal.py rename to gui/wm/waybar-khal.py diff --git a/personal-gui/wm/waybar.css b/gui/wm/waybar.css similarity index 100% rename from personal-gui/wm/waybar.css rename to gui/wm/waybar.css diff --git a/hostconfig/ZeNixComputa/default.nix b/hostconfig/ZeNixComputa/default.nix index 1f92c0d..0f5f3fa 100644 --- a/hostconfig/ZeNixComputa/default.nix +++ b/hostconfig/ZeNixComputa/default.nix @@ -9,6 +9,7 @@ ./nixos.nix minimal personal-cli + gui personal-gui gaming ]; @@ -17,6 +18,7 @@ ./hm.nix minimal personal-cli + gui personal-gui gaming ]; diff --git a/hostconfig/ZeNixLaptop/default.nix b/hostconfig/ZeNixLaptop/default.nix index 1a4df6f..1b2191d 100644 --- a/hostconfig/ZeNixLaptop/default.nix +++ b/hostconfig/ZeNixLaptop/default.nix @@ -8,7 +8,7 @@ ./nixos.nix minimal personal-cli - personal-gui + gui gaming ]; hmModules = with self.hmModules; [ @@ -16,7 +16,7 @@ ./hm.nix minimal personal-cli - personal-gui + gui gaming ]; }; diff --git a/hostconfig/laptop/default.nix b/hostconfig/laptop/default.nix index 9d6e8ad..adfd0d3 100644 --- a/hostconfig/laptop/default.nix +++ b/hostconfig/laptop/default.nix @@ -9,6 +9,7 @@ ./hardware-configuration.nix minimal personal-cli + gui personal-gui ]; hmModules = with self.hmModules; [ @@ -16,6 +17,7 @@ ./hm.nix minimal personal-cli + gui personal-gui ]; unfreePackages = [ diff --git a/hostconfig/thinkpad-nixos/default.nix b/hostconfig/thinkpad-nixos/default.nix index a0bdf2e..881dbe7 100644 --- a/hostconfig/thinkpad-nixos/default.nix +++ b/hostconfig/thinkpad-nixos/default.nix @@ -17,14 +17,14 @@ ./nixos.nix minimal personal-cli - personal-gui + gui ]; hmModules = with self.hmModules; [ ./extra_info.nix ./hm.nix minimal personal-cli - personal-gui + gui ]; }; @@ -34,7 +34,7 @@ minimal work personal-cli - personal-gui + gui ]) ++ [ ./extra_info.nix diff --git a/personal-gui/hm.nix b/personal-gui/hm.nix index 08cc468..b3c87ac 100644 --- a/personal-gui/hm.nix +++ b/personal-gui/hm.nix @@ -1,89 +1,7 @@ +{ pkgs, ... }: { - config, - lib, - pkgs, - ... -}: -{ - imports = [ ./wm ]; - - xdg.portal = { - enable = true; - config = { - sway = { - default = "gtk"; - "org.freedesktop.impl.portal.Screenshot" = "wlr"; - "org.freedesktop.impl.portal.ScreenCast" = "wlr"; - }; - }; - - extraPortals = with pkgs; [ - xdg-desktop-portal-wlr - xdg-desktop-portal-gtk - ]; - }; - home.packages = with pkgs; [ - # IM - (discord.override { inherit (pkgs) nss; }) - element-desktop - signal-desktop - - # Mail - thunderbird - - # Media - gromit-mpx - krita - pavucontrol - spotify - vlc - - # Libreoffice - hunspell - hunspellDicts.fr-any - hyphen - libreoffice - - # Misc - eog - # Broken as of 15 July - # freecad plasma5Packages.kdeconnect-kde - wdisplays - wl-clipboard - xdg-utils - fzf - waypipe glaurung ]; - - programs.firefox = { - enable = true; - nativeMessagingHosts = [ pkgs.firefoxpwa ]; - }; - - home.sessionVariables = { - BROWSER = "firefox"; - NIXOS_OZONE_WL = 1; - ANDROID_HOME = "${config.home.sessionVariables.XDG_DATA_HOME}/android"; - }; - - programs.zathura.enable = true; - - programs.rofi = { - enable = true; - theme = "solarized_alternate"; - terminal = "${config.terminal.command}"; - }; - - xdg.desktopEntries.zklist = { - name = "zklist"; - exec = ''${pkgs.foot}/bin/foot nvim "+ZkNotes"''; - }; - - xdg.desktopEntries.zksearch = { - name = "zksearch"; - exec = ''${pkgs.foot}/bin/foot nvim "+ZkNotes { match = { vim.fn.input('Search: ') } }"''; - }; } diff --git a/personal-gui/nixos.nix b/personal-gui/nixos.nix index d2e49b7..2255434 100644 --- a/personal-gui/nixos.nix +++ b/personal-gui/nixos.nix @@ -1,94 +1,42 @@ -{ - pkgs, - config, - lib, - ... -}: +{ pkgs, config, ... }: { networking.firewall = { enable = true; allowedTCPPortRanges = [ { + # KDE connect from = 1714; to = 1764; - } # KDE Connect + } ]; allowedUDPPortRanges = [ { + # KDE connect from = 1714; to = 1764; - } # KDE Connect + } ]; }; - services.gnome.gnome-keyring.enable = true; - services.flatpak.enable = true; - xdg.portal = { - enable = true; - config = { - sway = { - default = "gtk"; - "org.freedesktop.impl.portal.Screenshot" = "wlr"; - "org.freedesktop.impl.portal.ScreenCast" = "wlr"; - }; - }; - - extraPortals = with pkgs; [ - xdg-desktop-portal-wlr - xdg-desktop-portal-gtk - ]; - }; - - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - }; - programs.noisetorch.enable = true; - programs.adb.enable = true; - programs.dconf.enable = true; - - virtualisation.waydroid.enable = true; - - hardware.opentabletdriver.enable = true; - hardware.bluetooth.enable = true; security.pam.yubico = { enable = true; debug = false; - mode = "challenge-response"; + module = "challenge-response"; }; services.udev.packages = with pkgs; [ yubikey-personalization ]; - security.pam.services.swaylock.text = '' - auth include login - ''; + virtualisation.waydroid.enable = true; + + hardware.opentabletdriver.enable = true; + + hardware.bluetooth.enable = true; - services.printing = { - enable = true; - drivers = with pkgs; [ - hplip - gutenprint - cnijfilter2 - ]; - }; - hardware.sane.enable = true; services.avahi = { nssmdns4 = true; enable = true; }; - hardware.graphics = { - enable = true; - enable32Bit = true; - }; - - users.users."${config.extraInfo.username}".extraGroups = [ - "adbusers" - "scanner" - "lp" - ]; + users.users.${config.extraInfo.username}.extraGroups = [ "adbusers" ]; }