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
./modules
./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/fh/scanning.nix
./modules/nix/ld.nix

View File

@@ -37,5 +37,17 @@
ssd.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, ...}:
{
imports = [
../graphical/hyprland.nix # TODO
];
kop = {
cli-tools.enable = true;
tmpfs.enable = true;
@@ -9,5 +12,14 @@
firmware.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,5 +1,14 @@
{ pkgs, ...} :
{config, lib, pkgs, ...} :
with lib;
let
cfg = config.kop.graphical.audio;
in
{
options.kop.graphical.audio = {
enable = mkEnableOption "Enables audio";
};
config = mkIf cfg.enable {
# Enable sound with pipewire.
sound.enable = false;
hardware.pulseaudio.enable = false;
@@ -11,4 +20,5 @@
alsa.support32Bit = true;
pulse.enable = true;
};
};
}

View File

@@ -1,5 +1,14 @@
{ config, pkgs, inputs, lib, ... }:
with lib;
let
cfg = config.kop.graphical.code;
in
{
options.kop.graphical.code = {
enable = mkEnableOption "Enables code";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
kate
jetbrains.idea-ultimate
@@ -9,6 +18,6 @@
#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
{
options.kop.graphical.emulators = {
enable = mkEnableOption "Enables emulators";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
snes9x
];
};
}

View File

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

View File

@@ -1,5 +1,14 @@
{ pkgs, ...}:
{config, lib, pkgs, ...}:
with lib;
let
cfg = config.kop.graphical.games;
in
{
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
@@ -17,4 +26,5 @@
prismlauncher
#libs
];
};
}

View File

@@ -1,6 +1,14 @@
{ config, pkgs, mainUser, ... }:
{lib, config, pkgs, mainUser, ... }:
with lib;
let
cfg = config.kop.graphical.gnome;
in
{
options.kop.graphical.gnome = {
enable = mkEnableOption "Enables gnome";
};
config = mkIf cfg.enable {
services.xserver = {
layout = mainUser.layout;
xkbVariant = mainUser.variant;
@@ -57,4 +65,6 @@
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
{
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,5 +1,14 @@
{ config, pkgs, ...}:
{lib, config, pkgs, ...}:
with lib;
let
cfg = config.kop.graphical.lxqt;
in
{
options.kop.graphical.lxqt = {
enable = mkEnableOption "Enables lxqt";
};
config = mkIf cfg.enable {
services.xserver = {
xkb.layout = config.mainUser.layout;
xkb.variant = config.mainUser.variant;
@@ -7,4 +16,5 @@
displayManager.sddm.enable = true;
desktopManager.lxqt.enable = true;
};
};
}

View File

@@ -1,5 +1,14 @@
{ config, pkgs, ...}:
{lib, config, pkgs, ...}:
with lib;
let
cfg = config.kop.graphical.obs;
in
{
options.kop.graphical.obs = {
enable = mkEnableOption "Enables obs";
};
config = mkIf cfg.enable {
# borked in unstable branch
#boot = {
# kernelModules = ["v4l2loopback"]; # Autostart kernel modules on boot
@@ -13,4 +22,5 @@
];
})
];
};
}

View File

@@ -1,5 +1,15 @@
{ pkgs, ...}:
{config, lib, pkgs, ...}:
with lib;
let
cfg = config.kop.graphical.openrgb;
in
{
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,6 +1,14 @@
{ config, pkgs, ... }:
{lib, config, pkgs, ... }:
with lib;
let
cfg = config.kop.graphical.plasma;
in
{
options.kop.graphical.plasma = {
enable = mkEnableOption "Enables plasma";
};
config = mkIf cfg.enable {
services.xserver = {
enable = true;
xkb.layout = config.mainUser.layout;
@@ -40,4 +48,5 @@
environment.systemPackages = with pkgs; [
wayland-utils
];
};
}

View File

@@ -1,11 +1,18 @@
{ config, pkgs, inputs, lib, ... }:
with lib;
let
cfg = config.kop.graphical.shared;
in
{
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
{
in mkIf cfg.enable {
programs.dconf.enable = true;
programs.kdeconnect.enable = true;
@@ -59,4 +66,5 @@ in
libsForQt5.kcalc
syncthingtray
];
};
}

View File

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