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

@@ -89,14 +89,6 @@
./users/kopatz ./users/kopatz
./modules ./modules
./modules/ecryptfs.nix ./modules/ecryptfs.nix
./modules/graphical/audio.nix
./modules/graphical/code.nix
./modules/graphical/emulators.nix
./modules/graphical/gamemode.nix
./modules/graphical/games.nix
./modules/graphical/hyprland.nix
./modules/graphical/ime.nix
./modules/graphical/shared.nix
./modules/services/syncthing.nix ./modules/services/syncthing.nix
./modules/fh/scanning.nix ./modules/fh/scanning.nix
./modules/nix/ld.nix ./modules/nix/ld.nix

View File

@@ -37,5 +37,17 @@
ssd.enable = true; ssd.enable = true;
wooting.enable = true; wooting.enable = true;
}; };
graphical = {
audio.enable = true;
code.enable = true;
emulators.enable = true;
gamemode.enable = true;
games.enable = true;
ime.enable = true;
obs.enable = true;
openrgb.enable = true;
plasma.enable = true;
shared.enable = true;
};
}; };
} }

View File

@@ -1,5 +1,8 @@
{pkgs, config, ...}: {pkgs, config, ...}:
{ {
imports = [
../graphical/hyprland.nix # TODO
];
kop = { kop = {
cli-tools.enable = true; cli-tools.enable = true;
tmpfs.enable = true; tmpfs.enable = true;
@@ -9,5 +12,14 @@
firmware.enable = true; firmware.enable = true;
ssd.enable = true; ssd.enable = true;
}; };
graphical = {
audio.enable = true;
code.enable = true;
emulators.enable = true;
gamemode.enable = true;
games.enable = true;
ime.enable = true;
shared.enable = true;
};
}; };
} }

View File

@@ -1,14 +1,24 @@
{ pkgs, ...} : {config, lib, pkgs, ...} :
with lib;
let
cfg = config.kop.graphical.audio;
in
{ {
# Enable sound with pipewire. options.kop.graphical.audio = {
sound.enable = false; enable = mkEnableOption "Enables audio";
hardware.pulseaudio.enable = false; };
security.rtkit.enable = true;
config = mkIf cfg.enable {
services.pipewire = { # Enable sound with pipewire.
enable = true; sound.enable = false;
alsa.enable = true; hardware.pulseaudio.enable = false;
alsa.support32Bit = true; security.rtkit.enable = true;
pulse.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, ... }: { config, pkgs, inputs, lib, ... }:
with lib;
let
cfg = config.kop.graphical.code;
in
{ {
environment.systemPackages = with pkgs; [ options.kop.graphical.code = {
kate enable = mkEnableOption "Enables code";
jetbrains.idea-ultimate };
insomnia
]; config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
#environment.sessionVariables = { kate
# DOTNET_ROOT = "${pkgs.dotnet-sdk_7}"; jetbrains.idea-ultimate
#}; insomnia
];
#environment.sessionVariables = {
# DOTNET_ROOT = "${pkgs.dotnet-sdk_7}";
#};
};
} }

View File

@@ -1,6 +1,17 @@
{ pkgs, config, ...}: { pkgs, config, ...}:
{ {
imports = [ 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 @@
{lib, config, pkgs, inputs, ... }:
{ config, pkgs, inputs, ... }: with lib;
let
cfg = config.kop.graphical.emulators;
in
{ {
environment.systemPackages = with pkgs; [ options.kop.graphical.emulators = {
snes9x enable = mkEnableOption "Enables emulators";
]; };
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
snes9x
];
};
} }

View File

@@ -1,11 +1,20 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with lib;
let
cfg = config.kop.graphical.gamemode;
in
{ {
programs.gamemode = { options.kop.graphical.gamemode = {
enable = true; enable = mkEnableOption "Enables gamemode";
settings.custom = { };
start = "${pkgs.libnotify}/bin/notify-send 'GameMode started'";
end = "${pkgs.libnotify}/bin/notify-send 'GameMode ended'"; 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 = { options.kop.graphical.games = {
enable = true; enable = mkEnableOption "Enables games";
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; 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 = { options.kop.graphical.gnome = {
layout = mainUser.layout; enable = mkEnableOption "Enables gnome";
xkbVariant = mainUser.variant; };
enable = true;
displayManager.gdm.enable = true; config = mkIf cfg.enable {
desktopManager.gnome.enable = true; 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, ... }: { config, lib, pkgs, ... }:
with lib;
let
cfg = config.kop.graphical.ime;
in
{ {
i18n.inputMethod.enabled = "fcitx5"; options.kop.graphical.ime = {
i18n.inputMethod.fcitx5.addons = [ pkgs.fcitx5-mozc ]; 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 = { options.kop.graphical.lxqt = {
xkb.layout = config.mainUser.layout; enable = mkEnableOption "Enables lxqt";
xkb.variant = config.mainUser.variant; };
enable = true;
displayManager.sddm.enable = true; config = mkIf cfg.enable {
desktopManager.lxqt.enable = true; 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 options.kop.graphical.obs = {
#boot = { enable = mkEnableOption "Enables obs";
# kernelModules = ["v4l2loopback"]; # Autostart kernel modules on boot };
# extraModulePackages = with config.boot.kernelPackages; [v4l2loopback]; # loopback module to make OBS virtual camera work
#}; config = mkIf cfg.enable {
# borked in unstable branch
environment.systemPackages = with pkgs; [ #boot = {
(wrapOBS { # kernelModules = ["v4l2loopback"]; # Autostart kernel modules on boot
plugins = with obs-studio-plugins; [ # extraModulePackages = with config.boot.kernelPackages; [v4l2loopback]; # loopback module to make OBS virtual camera work
obs-pipewire-audio-capture #};
];
}) 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; options.kop.graphical.openrgb = {
services.hardware.openrgb.package = pkgs.openrgb-with-all-plugins; 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 = { options.kop.graphical.plasma = {
enable = true; enable = mkEnableOption "Enables plasma";
xkb.layout = config.mainUser.layout; };
xkb.variant = config.mainUser.variant;
displayManager.sddm.enable = true; config = mkIf cfg.enable {
displayManager.sddm.settings.Wayland.SessionDir = "${pkgs.plasma5Packages.plasma-workspace}/share/wayland-sessions"; services.xserver = {
#displayManager.sddm.wayland.enable = true;
libinput = {
enable = true; enable = true;
xkb.layout = config.mainUser.layout;
# disabling mouse acceleration xkb.variant = config.mainUser.variant;
mouse = { displayManager.sddm.enable = true;
accelProfile = "flat"; 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;
services.desktopManager.plasma6.enable = true; environment.plasma6.excludePackages = with pkgs.kdePackages; [ ocean-sound-theme spectacle ];
environment.plasma6.excludePackages = with pkgs.kdePackages; [ ocean-sound-theme spectacle ];
environment.sessionVariables = {
environment.sessionVariables = { MOZ_ENABLE_WAYLAND = "1";
MOZ_ENABLE_WAYLAND = "1"; NIXOS_OZONE_WL = "1";
NIXOS_OZONE_WL = "1";
};
xdg = {
portal = {
enable = true;
extraPortals = with pkgs; [
xdg-desktop-portal-wlr
#xdg-desktop-portal-gtk
];
}; };
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, ... }: { config, pkgs, inputs, lib, ... }:
with lib;
let let
screenshot = pkgs.writeShellScriptBin "screenshot.sh" '' cfg = config.kop.graphical.shared;
${pkgs.scrot}/bin/scrot -fs - | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png -i
'';
in in
{ {
programs.dconf.enable = true; options.kop.graphical.shared = {
programs.kdeconnect.enable = true; enable = mkEnableOption "Enables shared";
};
fonts.fontDir.enable = true;
fonts.packages = with pkgs; [ config = let
uw-ttyp0 screenshot = pkgs.writeShellScriptBin "screenshot.sh" ''
corefonts ${pkgs.scrot}/bin/scrot -fs - | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png -i
nerdfonts '';
noto-fonts in mkIf cfg.enable {
noto-fonts-emoji programs.dconf.enable = true;
noto-fonts-cjk programs.kdeconnect.enable = true;
];
fonts.fontDir.enable = true;
networking.firewall = { fonts.packages = with pkgs; [
enable = true; uw-ttyp0
allowedTCPPorts = [ 53317 ]; #localsend corefonts
allowedUDPPorts = [ 1194 53317 ]; #openvpn, localsend nerdfonts
allowedTCPPortRanges = [ noto-fonts
{ from = 1714; to = 1764; } # KDE Connect 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
];
} }

View File

@@ -8,9 +8,7 @@ in
enable = mkEnableOption "Enables vfio"; enable = mkEnableOption "Enables vfio";
}; };
config = mkIf cfg.enable { config = mkIf (cfg.enable && config.virtualisation.libvirtd.enable) {
config = lib.mkIf config.virtualisation.libvirtd.enable { boot.kernelParams = [ "amd_iommu=on" ];
boot.kernelParams = [ "amd_iommu=on" ];
};
}; };
} }