convert graphical folder to modules

This commit is contained in:
Kopatz
2024-04-16 21:43:24 +02:00
parent 9d79d01c5e
commit 409d684b17
17 changed files with 375 additions and 236 deletions

View File

@@ -1,14 +1,24 @@
{ pkgs, ...} :
{config, lib, pkgs, ...} :
with lib;
let
cfg = config.kop.graphical.audio;
in
{
# Enable sound with pipewire.
sound.enable = false;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
options.kop.graphical.audio = {
enable = mkEnableOption "Enables audio";
};
config = mkIf cfg.enable {
# Enable sound with pipewire.
sound.enable = false;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
};
}

View File

@@ -1,14 +1,23 @@
{ config, pkgs, inputs, lib, ... }:
with lib;
let
cfg = config.kop.graphical.code;
in
{
environment.systemPackages = with pkgs; [
kate
jetbrains.idea-ultimate
insomnia
];
#environment.sessionVariables = {
# DOTNET_ROOT = "${pkgs.dotnet-sdk_7}";
#};
options.kop.graphical.code = {
enable = mkEnableOption "Enables code";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
kate
jetbrains.idea-ultimate
insomnia
];
#environment.sessionVariables = {
# DOTNET_ROOT = "${pkgs.dotnet-sdk_7}";
#};
};
}

View File

@@ -1,6 +1,17 @@
{ pkgs, config, ...}:
{
imports = [
./audio.nix
./code.nix
./emulators.nix
./gamemode.nix
./games.nix
./gnome.nix
./ime.nix
./lxqt.nix
./obs.nix
./openrgb.nix
./plasma.nix
./shared.nix
];
}

View File

@@ -1,7 +1,16 @@
{ config, pkgs, inputs, ... }:
{lib, config, pkgs, inputs, ... }:
with lib;
let
cfg = config.kop.graphical.emulators;
in
{
environment.systemPackages = with pkgs; [
snes9x
];
options.kop.graphical.emulators = {
enable = mkEnableOption "Enables emulators";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
snes9x
];
};
}

View File

@@ -1,11 +1,20 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.kop.graphical.gamemode;
in
{
programs.gamemode = {
enable = true;
settings.custom = {
start = "${pkgs.libnotify}/bin/notify-send 'GameMode started'";
end = "${pkgs.libnotify}/bin/notify-send 'GameMode ended'";
options.kop.graphical.gamemode = {
enable = mkEnableOption "Enables gamemode";
};
config = mkIf cfg.enable {
programs.gamemode = {
enable = true;
settings.custom = {
start = "${pkgs.libnotify}/bin/notify-send 'GameMode started'";
end = "${pkgs.libnotify}/bin/notify-send 'GameMode ended'";
};
};
};
}

View File

@@ -1,20 +1,30 @@
{ pkgs, ...}:
{config, lib, pkgs, ...}:
with lib;
let
cfg = config.kop.graphical.games;
in
{
programs.steam = {
enable = true;
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
gamescopeSession.enable = true;
options.kop.graphical.games = {
enable = mkEnableOption "Enables games";
};
config = mkIf cfg.enable {
programs.steam = {
enable = true;
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
gamescopeSession.enable = true;
};
environment.systemPackages = with pkgs; [
taisei
tetrio
osu-lazer-bin
wineWowPackages.unstableFull
winetricks
lutris
mangohud
prismlauncher
#libs
];
};
environment.systemPackages = with pkgs; [
taisei
tetrio
osu-lazer-bin
wineWowPackages.unstableFull
winetricks
lutris
mangohud
prismlauncher
#libs
];
}

View File

@@ -1,60 +1,70 @@
{ config, pkgs, mainUser, ... }:
{lib, config, pkgs, mainUser, ... }:
with lib;
let
cfg = config.kop.graphical.gnome;
in
{
services.xserver = {
layout = mainUser.layout;
xkbVariant = mainUser.variant;
enable = true;
displayManager.gdm.enable = true;
desktopManager.gnome.enable = true;
options.kop.graphical.gnome = {
enable = mkEnableOption "Enables gnome";
};
config = mkIf cfg.enable {
services.xserver = {
layout = mainUser.layout;
xkbVariant = mainUser.variant;
enable = true;
displayManager.gdm.enable = true;
desktopManager.gnome.enable = true;
};
# Workaround for GNOME autologin: https://github.com/NixOS/nixpkgs/issues/103746#issuecomment-945091229
systemd.services."getty@tty1".enable = false;
systemd.services."autovt@tty1".enable = false;
services.gnome.gnome-keyring.enable = true;
environment.sessionVariables.NIXOS_OZONE_WL = "1";
environment.gnome.excludePackages = (with pkgs; [
gnome-photos
gnome-tour
]) ++ (with pkgs.gnome; [
cheese # webcam tool
gnome-music
gnome-terminal
gedit # text editor
epiphany # web browser
#geary # email reader
evince # document viewer
gnome-characters
totem # video player
tali # poker game
iagno # go game
hitori # sudoku game
atomix # puzzle game
]);
environment.systemPackages = with pkgs; [
wmctrl
gnome.mutter
gnome.adwaita-icon-theme
gnome.gnome-settings-daemon
gnome.gnome-tweaks
gnome.dconf-editor
gruvbox-gtk-theme
colloid-icon-theme
gnomeExtensions.appindicator
gnomeExtensions.just-perfection
gnomeExtensions.system-monitor
gnomeExtensions.dash2dock-lite
gnomeExtensions.dash-to-dock
gnomeExtensions.vitals
gnomeExtensions.rounded-window-corners
gnomeExtensions.wallpaper-switcher
gnomeExtensions.backslide
gnomeExtensions.nextcloud-folder
gnomeExtensions.tray-icons-reloaded
gnomeExtensions.blur-my-shell
];
};
# Workaround for GNOME autologin: https://github.com/NixOS/nixpkgs/issues/103746#issuecomment-945091229
systemd.services."getty@tty1".enable = false;
systemd.services."autovt@tty1".enable = false;
services.gnome.gnome-keyring.enable = true;
environment.sessionVariables.NIXOS_OZONE_WL = "1";
environment.gnome.excludePackages = (with pkgs; [
gnome-photos
gnome-tour
]) ++ (with pkgs.gnome; [
cheese # webcam tool
gnome-music
gnome-terminal
gedit # text editor
epiphany # web browser
#geary # email reader
evince # document viewer
gnome-characters
totem # video player
tali # poker game
iagno # go game
hitori # sudoku game
atomix # puzzle game
]);
environment.systemPackages = with pkgs; [
wmctrl
gnome.mutter
gnome.adwaita-icon-theme
gnome.gnome-settings-daemon
gnome.gnome-tweaks
gnome.dconf-editor
gruvbox-gtk-theme
colloid-icon-theme
gnomeExtensions.appindicator
gnomeExtensions.just-perfection
gnomeExtensions.system-monitor
gnomeExtensions.dash2dock-lite
gnomeExtensions.dash-to-dock
gnomeExtensions.vitals
gnomeExtensions.rounded-window-corners
gnomeExtensions.wallpaper-switcher
gnomeExtensions.backslide
gnomeExtensions.nextcloud-folder
gnomeExtensions.tray-icons-reloaded
gnomeExtensions.blur-my-shell
];
}

View File

@@ -1,5 +1,15 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.kop.graphical.ime;
in
{
i18n.inputMethod.enabled = "fcitx5";
i18n.inputMethod.fcitx5.addons = [ pkgs.fcitx5-mozc ];
options.kop.graphical.ime = {
enable = mkEnableOption "Enables ime";
};
config = mkIf cfg.enable {
i18n.inputMethod.enabled = "fcitx5";
i18n.inputMethod.fcitx5.addons = [ pkgs.fcitx5-mozc ];
};
}

View File

@@ -1,10 +1,20 @@
{ config, pkgs, ...}:
{lib, config, pkgs, ...}:
with lib;
let
cfg = config.kop.graphical.lxqt;
in
{
services.xserver = {
xkb.layout = config.mainUser.layout;
xkb.variant = config.mainUser.variant;
enable = true;
displayManager.sddm.enable = true;
desktopManager.lxqt.enable = true;
options.kop.graphical.lxqt = {
enable = mkEnableOption "Enables lxqt";
};
config = mkIf cfg.enable {
services.xserver = {
xkb.layout = config.mainUser.layout;
xkb.variant = config.mainUser.variant;
enable = true;
displayManager.sddm.enable = true;
desktopManager.lxqt.enable = true;
};
};
}

View File

@@ -1,16 +1,26 @@
{ config, pkgs, ...}:
{lib, config, pkgs, ...}:
with lib;
let
cfg = config.kop.graphical.obs;
in
{
# borked in unstable branch
#boot = {
# kernelModules = ["v4l2loopback"]; # Autostart kernel modules on boot
# extraModulePackages = with config.boot.kernelPackages; [v4l2loopback]; # loopback module to make OBS virtual camera work
#};
environment.systemPackages = with pkgs; [
(wrapOBS {
plugins = with obs-studio-plugins; [
obs-pipewire-audio-capture
];
})
];
options.kop.graphical.obs = {
enable = mkEnableOption "Enables obs";
};
config = mkIf cfg.enable {
# borked in unstable branch
#boot = {
# kernelModules = ["v4l2loopback"]; # Autostart kernel modules on boot
# extraModulePackages = with config.boot.kernelPackages; [v4l2loopback]; # loopback module to make OBS virtual camera work
#};
environment.systemPackages = with pkgs; [
(wrapOBS {
plugins = with obs-studio-plugins; [
obs-pipewire-audio-capture
];
})
];
};
}

View File

@@ -1,5 +1,15 @@
{ pkgs, ...}:
{config, lib, pkgs, ...}:
with lib;
let
cfg = config.kop.graphical.openrgb;
in
{
services.hardware.openrgb.enable = true;
services.hardware.openrgb.package = pkgs.openrgb-with-all-plugins;
options.kop.graphical.openrgb = {
enable = mkEnableOption "Enables openrgb";
};
config = mkIf cfg.enable {
services.hardware.openrgb.enable = true;
services.hardware.openrgb.package = pkgs.openrgb-with-all-plugins;
};
}

View File

@@ -1,43 +1,52 @@
{ config, pkgs, ... }:
{lib, config, pkgs, ... }:
with lib;
let
cfg = config.kop.graphical.plasma;
in
{
services.xserver = {
enable = true;
xkb.layout = config.mainUser.layout;
xkb.variant = config.mainUser.variant;
displayManager.sddm.enable = true;
displayManager.sddm.settings.Wayland.SessionDir = "${pkgs.plasma5Packages.plasma-workspace}/share/wayland-sessions";
#displayManager.sddm.wayland.enable = true;
libinput = {
options.kop.graphical.plasma = {
enable = mkEnableOption "Enables plasma";
};
config = mkIf cfg.enable {
services.xserver = {
enable = true;
# disabling mouse acceleration
mouse = {
accelProfile = "flat";
xkb.layout = config.mainUser.layout;
xkb.variant = config.mainUser.variant;
displayManager.sddm.enable = true;
displayManager.sddm.settings.Wayland.SessionDir = "${pkgs.plasma5Packages.plasma-workspace}/share/wayland-sessions";
#displayManager.sddm.wayland.enable = true;
libinput = {
enable = true;
# disabling mouse acceleration
mouse = {
accelProfile = "flat";
};
};
};
};
services.desktopManager.plasma6.enable = true;
environment.plasma6.excludePackages = with pkgs.kdePackages; [ ocean-sound-theme spectacle ];
environment.sessionVariables = {
MOZ_ENABLE_WAYLAND = "1";
NIXOS_OZONE_WL = "1";
};
xdg = {
portal = {
enable = true;
extraPortals = with pkgs; [
xdg-desktop-portal-wlr
#xdg-desktop-portal-gtk
];
services.desktopManager.plasma6.enable = true;
environment.plasma6.excludePackages = with pkgs.kdePackages; [ ocean-sound-theme spectacle ];
environment.sessionVariables = {
MOZ_ENABLE_WAYLAND = "1";
NIXOS_OZONE_WL = "1";
};
xdg = {
portal = {
enable = true;
extraPortals = with pkgs; [
xdg-desktop-portal-wlr
#xdg-desktop-portal-gtk
];
};
};
environment.systemPackages = with pkgs; [
wayland-utils
];
};
environment.systemPackages = with pkgs; [
wayland-utils
];
}

View File

@@ -1,62 +1,70 @@
{ config, pkgs, inputs, lib, ... }:
with lib;
let
screenshot = pkgs.writeShellScriptBin "screenshot.sh" ''
${pkgs.scrot}/bin/scrot -fs - | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png -i
'';
cfg = config.kop.graphical.shared;
in
{
programs.dconf.enable = true;
programs.kdeconnect.enable = true;
fonts.fontDir.enable = true;
fonts.packages = with pkgs; [
uw-ttyp0
corefonts
nerdfonts
noto-fonts
noto-fonts-emoji
noto-fonts-cjk
];
networking.firewall = {
enable = true;
allowedTCPPorts = [ 53317 ]; #localsend
allowedUDPPorts = [ 1194 53317 ]; #openvpn, localsend
allowedTCPPortRanges = [
{ from = 1714; to = 1764; } # KDE Connect
options.kop.graphical.shared = {
enable = mkEnableOption "Enables shared";
};
config = let
screenshot = pkgs.writeShellScriptBin "screenshot.sh" ''
${pkgs.scrot}/bin/scrot -fs - | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png -i
'';
in mkIf cfg.enable {
programs.dconf.enable = true;
programs.kdeconnect.enable = true;
fonts.fontDir.enable = true;
fonts.packages = with pkgs; [
uw-ttyp0
corefonts
nerdfonts
noto-fonts
noto-fonts-emoji
noto-fonts-cjk
];
allowedUDPPortRanges = [
{ from = 1714; to = 1764; } # KDE Connect
networking.firewall = {
enable = true;
allowedTCPPorts = [ 53317 ]; #localsend
allowedUDPPorts = [ 1194 53317 ]; #openvpn, localsend
allowedTCPPortRanges = [
{ from = 1714; to = 1764; } # KDE Connect
];
allowedUDPPortRanges = [
{ from = 1714; to = 1764; } # KDE Connect
];
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
services.xserver.wacom.enable = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
keepassxc
xfce.thunar
remmina
thunderbird
rofi
localsend
#element-desktop
krita
libreoffice-fresh
screenshot
anki
mpv
p7zip
qbittorrent
brightnessctl
wacomtablet
wl-clipboard
libsForQt5.kolourpaint
libsForQt5.kcalc
syncthingtray
];
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
services.xserver.wacom.enable = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
keepassxc
xfce.thunar
remmina
thunderbird
rofi
localsend
#element-desktop
krita
libreoffice-fresh
screenshot
anki
mpv
p7zip
qbittorrent
brightnessctl
wacomtablet
wl-clipboard
libsForQt5.kolourpaint
libsForQt5.kcalc
syncthingtray
];
}