diff --git a/home-manager/modules/_list.nix b/home-manager/modules/_list.nix index 24eb912..bf5dcdf 100644 --- a/home-manager/modules/_list.nix +++ b/home-manager/modules/_list.nix @@ -1,7 +1,7 @@ { home-manager.modules = { common = ./common.nix; - gui = ./gui.nix; + gui = ./gui; deploy-rs = ./deploy-rs.nix; }; } diff --git a/home-manager/modules/gui.nix b/home-manager/modules/gui.nix deleted file mode 100644 index 2395932..0000000 --- a/home-manager/modules/gui.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ lib, pkgs, config, ... }: -let - inherit (lib) mkIf mkDefault mkMerge; - inherit (lib.my) mkBoolOpt'; - - cfg = config.my.gui; -in -{ - options.my.gui = { - enable = mkBoolOpt' true "Enable settings and packages meant for graphical systems"; - }; - - config = mkMerge [ - (mkIf cfg.enable { - home = { - packages = with pkgs; [ - (nerdfonts.override { - fonts = [ "DroidSansMono" "SourceCodePro" ]; - }) - ]; - }; - }) - ]; -} diff --git a/home-manager/modules/gui/default.nix b/home-manager/modules/gui/default.nix new file mode 100644 index 0000000..00c4d23 --- /dev/null +++ b/home-manager/modules/gui/default.nix @@ -0,0 +1,140 @@ +{ lib, pkgs, config, ... }: +let + inherit (lib) mkIf mkDefault mkMerge mkForce; + inherit (lib.my) mkBoolOpt'; + + cfg = config.my.gui; +in +{ + options.my.gui = { + enable = mkBoolOpt' true "Enable settings and packages meant for graphical systems"; + standalone = mkBoolOpt' false "Enable settings for fully Nix managed systems"; + }; + + config = mkIf cfg.enable (mkMerge [ + { + home = { + packages = with pkgs; [ + (nerdfonts.override { + fonts = [ "DroidSansMono" "SourceCodePro" ]; + }) + pavucontrol + ]; + }; + + programs = { + alacritty = { + enable = true; + settings = { + font.normal.family = "SauceCodePro Nerd Font Mono"; + }; + }; + }; + } + (mkIf cfg.standalone { + xdg = { + userDirs = { + enable = true; + createDirectories = true; + desktop = "$HOME/desktop"; + documents = "$HOME/documents"; + download = "$HOME/downloads"; + music = "$HOME/music"; + pictures = "$HOME/pictures"; + publicShare = "$HOME/public"; + templates = "$HOME/templates"; + videos = "$HOME/videos"; + }; + }; + + home = { + pointerCursor = { + package = pkgs.vanilla-dmz; + name = "Vanilla-DMZ"; + gtk.enable = true; + }; + }; + + fonts.fontconfig.enable = true; + + wayland = { + windowManager = { + sway = { + enable = true; + xwayland = true; + config = { + input = { + "type:touchpad" = { + tap = "enabled"; + natural_scroll = "enable"; + }; + }; + output = { + "*".bg = "${./stop-nixos.png} stretch"; + }; + + modifier = "Mod4"; + terminal = "alacritty"; + keybindings = + let + cfg = config.wayland.windowManager.sway.config; + mod = cfg.modifier; + in + lib.mkOptionDefault { + "${mod}+d" = null; + "${mod}+x" = "exec ${cfg.menu}"; + "${mod}+q" = "kill"; + "${mod}+Shift+q" = "exec swaynag -t warning -m 'bruh you really wanna kill sway?' -b 'ye' 'swaymsg exit'"; + }; + + menu = "rofi -show run"; + bars = mkForce [ ]; + }; + + swaynag = { + enable = true; + }; + }; + }; + }; + + programs = { + git = { + enable = true; + diff-so-fancy.enable = true; + userEmail = "jackos1998@gmail.com"; + userName = "Jack O'Sullivan"; + }; + + waybar = import ./waybar.nix { inherit lib pkgs config; }; + rofi = { + enable = true; + font = "SauceCodePro Nerd Font Mono"; + plugins = with pkgs; [ + rofi-calc + rofi-emoji + ]; + extraConfig = { + modes = "window,run,ssh,filebrowser,calc,emoji"; + }; + }; + + chromium = { + enable = true; + package = (pkgs.chromium.override { enableWideVine = true; }).overrideAttrs (old: { + buildCommand = '' + ${old.buildCommand} + + # Re-activate Google sync + wrapProgram "$out"/bin/chromium \ + --set NIXOS_OZONE_WL 1 \ + --set GOOGLE_DEFAULT_CLIENT_ID "77185425430.apps.googleusercontent.com" \ + --set GOOGLE_DEFAULT_CLIENT_SECRET "OTJgUOQcT7lO7GsGZq2G4IlT" + ''; + }); + }; + }; + }) + ] + ); +} diff --git a/home-manager/modules/gui/stop-nixos.png b/home-manager/modules/gui/stop-nixos.png new file mode 100644 index 0000000..75e573b Binary files /dev/null and b/home-manager/modules/gui/stop-nixos.png differ diff --git a/home-manager/modules/gui/waybar.nix b/home-manager/modules/gui/waybar.nix new file mode 100644 index 0000000..6b2a536 --- /dev/null +++ b/home-manager/modules/gui/waybar.nix @@ -0,0 +1,215 @@ +{ lib, pkgs, config, ... }: +let + inherit (lib) mkIf mkDefault mkMerge mkForce; + + cfg = config.my.gui; + pkg = pkgs.waybar.override { withMediaPlayer = true; }; +in +{ + enable = true; + package = pkg; + systemd.enable = true; + settings = { + mainBar = { + height = 30; + spacing = 4; + modules-left = [ "sway/workspaces" "sway/mode" "custom/media" ]; + modules-center = [ "sway/window" ]; + modules-right = [ + "idle_inhibitor" "pulseaudio" "network" "cpu" "memory" "temperature" "backlight" + "keyboard-state" "sway/language" "battery" "clock" "tray" + ]; + # Modules configuration + # "sway/workspaces": { + # "disable-scroll": true, + # "all-outputs": true, + # "format": "{name}: {icon}", + # "format-icons": { + # "1": "", + # "2": "", + # "3": "", + # "4": "", + # "5": "", + # "urgent": "", + # "focused": "", + # "default": "" + # } + # }, + keyboard-state = { + numlock = true; + capslock = true; + format = "{name} {icon}"; + format-icons = { + locked = ""; + unlocked = ""; + }; + }; + "sway/mode".format = "{}"; + idle_inhibitor = { + format = "{icon}"; + format-icons = { + activated = ""; + deactivated = ""; + }; + }; + tray = { + # "icon-size": 21, + spacing = 10; + }; + clock = { + # "timezone": "America/New_York", + tooltip-format = "{:%Y %B}\n{calendar}"; + format-alt = "{:%Y-%m-%d}"; + }; + cpu = { + format = "{usage}% "; + tooltip = false; + }; + memory.format = "{}% "; + temperature = { + # "thermal-zone": 2, + # "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input", + critical-threshold = 80; + # "format-critical": "{temperatureC}°C {icon}", + format = "{temperatureC}°C {icon}"; + format-icons = [ "" "" "" ]; + }; + backlight = { + # "device": "acpi_video1", + format = "{percent}% {icon}"; + format-icons = [ "" "" "" "" "" "" "" "" "" ]; + }; + battery = { + states = { + # "good": 95, + warning = 30; + critical = 15; + }; + format = "{capacity}% {icon}"; + format-charging = "{capacity}% "; + format-plugged = "{capacity}% "; + format-alt = "{time} {icon}"; + # "format-good": "", // An empty format will hide the module + # "format-full": "", + format-icons = [ "" "" "" "" "" ]; + }; + network = { + # "interface": "wlp2*", // (Optional) To force the use of this interface + format-wifi = "{essid} ({signalStrength}%) "; + format-ethernet = "{ipaddr}/{cidr} "; + tooltip-format = "{ifname} via {gwaddr} "; + format-linked = "{ifname} (No IP) "; + format-disconnected = "Disconnected ⚠"; + format-alt = "{ifname}: {ipaddr}/{cidr}"; + }; + pulseaudio = { + # "scroll-step": 1, // %, can be a float + format = "{volume}% {icon} {format_source}"; + format-bluetooth = "{volume}% {icon} {format_source}"; + format-bluetooth-muted = " {icon} {format_source}"; + format-muted = " {format_source}"; + format-source = "{volume}% "; + format-source-muted = ""; + format-icons = { + headphone = ""; + hands-free = ""; + headset = ""; + phone = ""; + portable = ""; + car = ""; + default = [ "" "" "" ]; + }; + on-click = "${pkgs.pavucontrol}/bin/pavucontrol"; + }; + "custom/media" = { + format = "{icon} {}"; + return-type = "json"; + max-length = 40; + format-icons = { + spotify = ""; + default = "🎜"; + }; + escape = true; + exec = ''${pkg}/bin/waybar-mediaplayer.py 2> /dev/null''; + # "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name + }; + }; + }; + style = '' + * { + font-size: 14px; + font-family: SauceCodePro Nerd Font Mono; + /*font-family: monospace;*/ + } + + window#waybar { + background: #292b2e; + color: #fdf6e3; + } + + #custom-right-arrow-dark, + #custom-left-arrow-dark { + color: #1a1a1a; + } + #custom-right-arrow-light, + #custom-left-arrow-light { + color: #292b2e; + background: #1a1a1a; + } + + #workspaces, + #clock.1, + #clock.2, + #clock.3, + #pulseaudio, + #memory, + #cpu, + #battery, + #disk, + #tray { + background: #1a1a1a; + } + + #workspaces button { + padding: 0 2px; + color: #fdf6e3; + } + #workspaces button.focused { + color: #268bd2; + } + #workspaces button:hover { + box-shadow: inherit; + text-shadow: inherit; + } + #workspaces button:hover { + background: #1a1a1a; + border: #1a1a1a; + padding: 0 3px; + } + + #pulseaudio { + color: #268bd2; + } + #memory { + color: #2aa198; + } + #cpu { + color: #6c71c4; + } + #battery { + color: #859900; + } + #disk { + color: #b58900; + } + + #clock, + #pulseaudio, + #memory, + #cpu, + #battery, + #disk { + padding: 0 10px; + } + ''; +} diff --git a/nixos/boxes/tower/default.nix b/nixos/boxes/tower/default.nix index 2020711..cf9ff85 100644 --- a/nixos/boxes/tower/default.nix +++ b/nixos/boxes/tower/default.nix @@ -14,6 +14,9 @@ cpu = { intel.updateMicrocode = true; }; + opengl.extraPackages = with pkgs; [ + intel-media-driver + ]; }; boot = { @@ -75,6 +78,9 @@ enable = true; extraConfig = mkForce ""; }; + + fprintd.enable = true; + blueman.enable = true; }; networking = { @@ -101,6 +107,10 @@ ]; systemd = { + services = { + systemd-networkd-wait-online.enable = false; + }; + network = { links = { "10-wifi" = { @@ -114,6 +124,32 @@ my = { user = { tmphome = false; + homeConfig = { + services = { + network-manager-applet.enable = true; + }; + + home = { + packages = with pkgs; [ + spotify + ]; + }; + + services = { + blueman-applet.enable = true; + }; + + wayland.windowManager.sway = { + config = { + input."1:1:AT_Translated_Set_2_keyboard".xkb_layout = "ie"; + output.eDP-1.scale = "1"; + }; + }; + + my = { + gui.standalone = true; + }; + }; }; #deploy.generate.system.mode = "boot"; @@ -124,6 +160,8 @@ firewall = { enable = true; }; + + gui.enable = true; }; }; }; diff --git a/nixos/modules/_list.nix b/nixos/modules/_list.nix index 083b836..fc859d2 100644 --- a/nixos/modules/_list.nix +++ b/nixos/modules/_list.nix @@ -14,5 +14,6 @@ network = ./network.nix; pdns = ./pdns.nix; nginx-sso = ./nginx-sso.nix; + gui = ./gui.nix; }; } diff --git a/nixos/modules/gui.nix b/nixos/modules/gui.nix new file mode 100644 index 0000000..319b004 --- /dev/null +++ b/nixos/modules/gui.nix @@ -0,0 +1,27 @@ +{ lib, pkgs, config, ... }: +let + inherit (lib) optional mkIf mkDefault mkMerge; + inherit (lib.my) mkBoolOpt'; + + cfg = config.my.gui; +in +{ + options.my.gui = with lib.types; { + enable = mkBoolOpt' true "Whether to enable GUI system options."; + }; + + config = mkIf cfg.enable { + hardware = { + opengl.enable = mkDefault true; + }; + + services = { + pipewire = { + enable = true; + alsa.enable = true; + pulse.enable = true; + jack.enable = true; + }; + }; + }; +} diff --git a/nixos/modules/tmproot.nix b/nixos/modules/tmproot.nix index dcbff08..2889c47 100644 --- a/nixos/modules/tmproot.nix +++ b/nixos/modules/tmproot.nix @@ -338,7 +338,18 @@ in ]; }) (mkIf config.networking.networkmanager.enable { - my.tmproot.persistence.config.directories = [ "/var/lib/NetworkManager" ]; + my.tmproot.persistence.config.directories = [ + "/var/lib/NetworkManager" + "/etc/NetworkManager/system-connections" + ]; + }) + (mkIf config.services.fprintd.enable { + my.tmproot.persistence.config.directories = [ + { + directory = "/var/lib/fprint"; + mode = "700"; + } + ]; }) (mkIf config.my.build.isDevVM { fileSystems = mkVMOverride { diff --git a/nixos/modules/user.nix b/nixos/modules/user.nix index 64dcfef..8989f9c 100644 --- a/nixos/modules/user.nix +++ b/nixos/modules/user.nix @@ -1,6 +1,6 @@ { lib, options, config, ... }: let - inherit (lib) mkIf mkDefault mkOption mkMerge mkAliasDefinitions; + inherit (lib) mkIf mkDefault mkOption mkMerge mkAliasDefinitions optional; inherit (lib.my) mkBoolOpt' mkOpt' mkDefault'; cfg = config.my.user; @@ -34,7 +34,9 @@ in name = mkDefault' "dev"; isNormalUser = true; uid = mkDefault 1000; - extraGroups = [ "wheel" "kvm" ]; + extraGroups = + [ "wheel" "kvm" ] ++ + (optional config.networking.networkmanager.enable "networkmanager"); password = mkIf (cfg.passwordSecret == null) (mkDefault "hunter2"); shell = let shell = cfg.homeConfig.my.shell;