feat: big refactor

This commit is contained in:
Jacob Bachmann 2024-09-07 15:10:22 +02:00
parent 2c09c21833
commit ebedec9768
No known key found for this signature in database
GPG key ID: 7753026D577922A6
159 changed files with 1927 additions and 2222 deletions

View file

@ -0,0 +1,39 @@
{
config,
lib,
pkgs,
...
}:
lib.mkIf config.bchmnn.gui.enable {
environment.systemPackages =
lib.optionals (config.bchmnn.collections.cli-utils.enable) [
pkgs.libnotify # a library that sends desktop notifications to a notification daemon
pkgs.xdg-utils # a set of command line tools that assist applications with a variety of desktop integration tasks
]
++ lib.optionals (config.bchmnn.collections.development.enable) [
pkgs.ghidra-bin
pkgs.mongodb-compass
]
++ lib.optionals (lib.elem "sway" config.bchmnn.gui.flavour) [
pkgs.qt5.qtwayland
pkgs.qt6.qtwayland
pkgs.wineWowPackages.waylandFull
];
programs = {
kdeconnect.enable = true;
ausweisapp = {
enable = true;
openFirewall = true;
};
wireshark.enable = config.bchmnn.collections.development.enable;
virt-manager.enable = config.bchmnn.collections.virtualisation.enable;
};
services.ratbagd.enable = true;
# needed for udiskie
services.udisks2.enable = true;
# enable gvfs to mount android devices
services.gvfs.enable = true;
}

132
modules/desktop/default.nix Normal file
View file

@ -0,0 +1,132 @@
{
config,
lib,
pkgs,
...
}:
{
imports = [
./applications.nix
./fonts.nix
./games.nix
./nautilus.nix
];
options.bchmnn = {
gui = {
enable = lib.mkEnableOption "gui";
greeter = {
enable = lib.mkEnableOption "greeter";
};
flavour = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ "sway" ];
example = [
"sway"
"i3"
];
description = ''
The flavour (WM) for your system to use
'';
};
};
};
config = lib.mkIf (config.bchmnn.gui.enable && config.bchmnn.gui.flavour != [ ]) {
environment.pathsToLink = [ "/libexec" ]; # links /libexec from derivations to /run/current-system/sw
programs.sway.enable = builtins.elem "sway" config.bchmnn.gui.flavour;
services.xserver.windowManager.i3.enable = builtins.elem "i3" config.bchmnn.gui.flavour;
services.libinput.enable = true;
services.xserver = {
enable = (
builtins.elem "i3" config.bchmnn.gui.flavour || builtins.elem "gnome" config.bchmnn.gui.flavour
);
desktopManager.gnome.enable = builtins.elem "gnome" config.bchmnn.gui.flavour;
displayManager = {
gdm.enable = builtins.elem "gnome" config.bchmnn.gui.flavour;
startx.enable = builtins.elem "i3" config.bchmnn.gui.flavour;
};
};
environment.systemPackages = [
(pkgs.writeShellScriptBin "sway-run" ''
export WLR_NO_HARDWARE_CURSORS=1
exec ${pkgs.sway}/bin/sway "$@"
'')
];
environment = {
etc = {
"greetd/environments".text = (lib.strings.concatLines config.bchmnn.gui.flavour);
"greetd/kanshi-config".text = ''
profile nomad {
output "LVDS-1" enable
}
profile iroh {
output "DP-3" enable mode 2560x1440 position 0,0
output "DP-2" enable mode 2560x1440 position 2560,0
output "DP-1" enable mode 2560x1440 position 5120,0
}
profile station {
output "LVDS-1" disable
output "Dell Inc. DELL U2515H 9X2VY5490XUL" enable mode 1920x1080 position 0,0
output "Dell Inc. DELL U2515H 9X2VY5C7138L" enable mode 1920x1080 position 1920,0
output "HJW VGA TO HDMI 0x00000100" enable mode 1920x1080 position 3840,0
}
'';
"greetd/sway-config".text = ''
exec "${pkgs.kanshi}/bin/kanshi --config /etc/greetd/kanshi-config"
exec "${pkgs.greetd.gtkgreet}/bin/gtkgreet -l; swaymsg exit"
bindsym Mod4+shift+e exec swaynag \
-t warning \
-m 'What do you want to do?' \
-b 'Poweroff' 'systemctl poweroff' \
-b 'Reboot' 'systemctl reboot'
include /etc/sway/config.d/*
'';
};
};
services.greetd = {
enable = config.bchmnn.gui.greeter.enable;
settings = {
default_session = {
command =
"sway-run --config /etc/greetd/sway-config"
+ lib.optionalString config.bchmnn.nvidia.enable " --unsupported-gpu";
};
};
};
# TODO workaround to get swaylock accepting pw
# https://github.com/NixOS/nixpkgs/issues/158025
security.pam.services = lib.mkIf (lib.elem "sway" config.bchmnn.gui.flavour) { swaylock = { }; };
xdg.portal = {
enable = true;
wlr.enable = true;
config.common.default = "*";
extraPortals = lib.optionals (lib.elem "sway" config.bchmnn.gui.flavour) [
pkgs.xdg-desktop-portal-wlr
];
};
environment.sessionVariables.GST_PLUGIN_SYSTEM_PATH_1_0 =
lib.makeSearchPathOutput "lib" "lib/gstreamer-1.0"
(
with pkgs.gst_all_1;
[
gst-plugins-base
gst-plugins-good
gst-plugins-bad
gst-plugins-ugly
]
);
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
environment.variables =
lib.mkIf (builtins.elem pkgs.intel-media-driver config.hardware.opengl.extraPackages)
{ LIBVA_DRIVER_NAME = "iHD"; };
};
}

17
modules/desktop/fonts.nix Normal file
View file

@ -0,0 +1,17 @@
{
pkgs,
lib,
config,
...
}:
lib.mkIf (config.bchmnn.gui.enable) {
# Add fonts
fonts = {
enableDefaultPackages = true;
packages = with pkgs; [
(nerdfonts.override { fonts = [ "DejaVuSansMono" ]; })
comic-relief
iglesia-light
];
};
}

16
modules/desktop/games.nix Normal file
View file

@ -0,0 +1,16 @@
{
pkgs,
config,
lib,
...
}:
lib.mkIf config.bchmnn.collections.games.enable {
programs.steam = {
enable = true;
};
environment.systemPackages = [
pkgs.mangohud
pkgs.gamemode
];
}

View file

@ -0,0 +1,22 @@
{
pkgs,
lib,
config,
...
}:
lib.mkIf (config.bchmnn.gui.enable && config.bchmnn.gui.flavour != [ ]) {
programs.nautilus-open-any-terminal = {
enable = true;
terminal = "kitty";
};
environment = {
sessionVariables.NAUTILUS_4_EXTENSION_DIR = "${pkgs.gnome.nautilus-python}/lib/nautilus/extensions-4";
pathsToLink = [ "/share/nautilus-python/extensions" ];
systemPackages = with pkgs; [
gnome.nautilus
gnome.nautilus-python
];
};
}