diff --git a/flake.lock b/flake.lock index 3660037..f59cec3 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1693399033, - "narHash": "sha256-yXhiMo8MnE86sGtPIHAKaLHhmhe8v9tqGGotlUgKJvY=", + "lastModified": 1702203126, + "narHash": "sha256-4BhN2Vji19MzRC7SUfPZGmtZ2WZydQeUk/ogfRBIZMs=", "owner": "nix-community", "repo": "home-manager", - "rev": "f5c15668f9842dd4d5430787d6aa8a28a07f7c10", + "rev": "defbb9c5857e157703e8fc7cf3c2ceb01cb95883", "type": "github" }, "original": { @@ -22,11 +22,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1693377291, - "narHash": "sha256-vYGY9bnqEeIncNarDZYhm6KdLKgXMS+HA2mTRaWEc80=", + "lastModified": 1702151865, + "narHash": "sha256-9VAt19t6yQa7pHZLDbil/QctAgVsA66DLnzdRGqDisg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e7f38be3775bab9659575f192ece011c033655f0", + "rev": "666fc80e7b2afb570462423cb0e1cf1a3a34fedd", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index fd97432..d1edccb 100644 --- a/flake.nix +++ b/flake.nix @@ -21,8 +21,8 @@ specialArgs = inputs; modules = [ - ./hosts/W530 ./modules + ./hosts/W530 home-manager.nixosModules.home-manager diff --git a/hosts/W530/default.nix b/hosts/W530/default.nix index 4c24c4a..883189e 100644 --- a/hosts/W530/default.nix +++ b/hosts/W530/default.nix @@ -1,5 +1,24 @@ { ... }: { + imports = [ ./hardware.nix ]; networking.hostName = "W530"; # Define your hostname. + + bchmnn = { + + gui = { + enable = true; + flavour = [ "sway" "i3" ]; + }; + nvidia.enable = false; + audio.enable = true; + bluetooth.enable = true; + vpn.enable = true; + + devenv.enable = true; + virtualisation.enable = true; + games.enable = true; + + }; + } diff --git a/hosts/W530/hardware.nix b/hosts/W530/hardware.nix index 6d5960f..67f67b6 100644 --- a/hosts/W530/hardware.nix +++ b/hosts/W530/hardware.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, modulesPath, ... }: +{ config, lib, modulesPath, ... }: { imports = diff --git a/modules/aliases.nix b/modules/aliases.nix index 1907efc..4fc92b6 100644 --- a/modules/aliases.nix +++ b/modules/aliases.nix @@ -15,4 +15,6 @@ nec = "sudo -E nvim -u $HOME/.config/nvim/init.lua --cmd 'cd /etc/nixos'"; ncc = "sudo nixos-rebuild switch --upgrade-all --flake /etc/nixos"; nup = "sudo nix-channel --update && sudo nixos-rebuild switch --upgrade-all --flake /etc/nixos"; + nuf = "sudo nix flake update --nix-path /etc/nixos && sudo nixos-rebuild switch --upgrade-all --flake /etc/nixos"; + wip = "curl -s 'https://nordvpn.com/wp-admin/admin-ajax.php?action=get_user_info_data' | jq"; } diff --git a/modules/audio.nix b/modules/audio.nix index 11b3989..e48ae11 100644 --- a/modules/audio.nix +++ b/modules/audio.nix @@ -1,4 +1,4 @@ -{ ... }: { +{ config, lib, ... }: lib.mkIf config.bchmnn.audio.enable { # Enable pipewire - audio services.pipewire = { enable = true; diff --git a/modules/bluetooth.nix b/modules/bluetooth.nix index 558d8ff..49e0579 100644 --- a/modules/bluetooth.nix +++ b/modules/bluetooth.nix @@ -1,4 +1,4 @@ -{ ... }: { +{ config, lib, ... }: lib.mkIf config.bchmnn.bluetooth.enable { hardware.bluetooth = { enable = true; powerOnBoot = true; diff --git a/modules/default.nix b/modules/default.nix index b008b4d..33aa3ab 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,4 +1,50 @@ -{ +{ lib, ... }: { + + # options affecting multiple modules + options.bchmnn = with lib; { + + gui = { + enable = mkEnableOption "gui"; + flavour = mkOption { + type = types.listOf types.str; + default = [ "sway" ]; + example = [ "sway" "i3" ]; + description = '' + The flavour (WM) for your system to use + ''; + }; + }; + + nvidia = { + enable = mkEnableOption "nvidia"; + }; + + audio = { + enable = mkEnableOption "audio"; + }; + + bluetooth = { + enable = mkEnableOption "bluetooth"; + }; + + vpn = { + enable = mkEnableOption "vpn"; + }; + + devenv = { + enable = mkEnableOption "devenv"; + }; + + virtualisation = { + enable = mkEnableOption "virtualisation"; + }; + + games = { + enable = mkEnableOption "games"; + }; + + }; + imports = [ ./audio.nix ./bluetooth.nix @@ -6,19 +52,24 @@ ./dbus.nix ./fonts.nix ./i18n.nix + ./kdeconnect.nix ./keyd.nix + ./mozillavpn.nix ./network.nix ./nix.nix ./nvidia.nix ./opengl.nix + ./openssh.nix ./power.nix ./packages.nix ./printing.nix ./security.nix ./shell.nix + ./steam.nix ./udisks2.nix ./unfree.nix ./virtualisation.nix ./xdg-portal.nix + ./xorg.nix ]; } diff --git a/modules/kdeconnect.nix b/modules/kdeconnect.nix new file mode 100644 index 0000000..4f9370e --- /dev/null +++ b/modules/kdeconnect.nix @@ -0,0 +1,3 @@ +{ config, ... }: { + programs.kdeconnect.enable = config.bchmnn.gui.enable; +} diff --git a/modules/keyd.nix b/modules/keyd.nix index bc2dbad..8dd4848 100644 --- a/modules/keyd.nix +++ b/modules/keyd.nix @@ -1,27 +1,61 @@ -{ ... }: { +{ ... }: let + nav = { + h = "left"; + j = "down"; + k = "up"; + l = "right"; + "0" = "home"; + "4" = "end"; + u = "pageup"; + d = "pagedown"; + }; + alt = { + a = ""; + o = ""; + u = ""; + s = ""; + e = ""; + }; + altShift = { + a = ""; + o = ""; + u = ""; + }; +in { # Enable keyd and remap keys services.keyd = { enable = true; - keyboards.default.settings = { - main = { - leftalt = "layer(meta)"; - leftmeta = "layer(alt)"; - altgr = "layer(control)"; - rightalt = "layer(control)"; - capslock = "layer(nav)"; + keyboards.default = { + ids = [ "*" "-04fe:0020" ]; + settings = { + main = { + leftalt = "layer(meta)"; + leftmeta = "layer(alt)"; + altgr = "layer(control)"; + rightalt = "layer(control)"; + capslock = "layer(nav)"; + }; + alt = alt; + "alt+shift" = altShift; + meta = { + capslock = "overload(nav, capslock)"; + }; + nav = nav; }; - meta = { - capslock = "overload(nav, capslock)"; - }; - nav = { - h = "left"; - j = "down"; - k = "up"; - l = "right"; - "0" = "home"; - "4" = "end"; - u = "pageup"; - d = "pagedown"; + }; + keyboards.hhkb = { + ids = [ "04fe:0020" ]; + settings = { + main = { + rightmeta = "layer(control)"; + leftcontrol = "layer(nav)"; + }; + alt = alt; + "alt+shift" = altShift; + meta = { + leftcontrol = "overload(nav, capslock)"; + }; + nav = nav; }; }; }; diff --git a/modules/mozillavpn.nix b/modules/mozillavpn.nix new file mode 100644 index 0000000..551a4b2 --- /dev/null +++ b/modules/mozillavpn.nix @@ -0,0 +1,11 @@ +{ config, lib, pkgs, ... }: lib.mkIf config.bchmnn.vpn.enable { + + environment.systemPackages = with pkgs; [ + mozillavpn + ]; + + services.mozillavpn = { + enable = true; + }; + +} diff --git a/modules/nvidia.nix b/modules/nvidia.nix index 7948f0f..3d1097b 100644 --- a/modules/nvidia.nix +++ b/modules/nvidia.nix @@ -1,8 +1,8 @@ -{ config, ... }: { +{ config, lib, pkgs, ... }: lib.mkIf config.bchmnn.nvidia.enable { - # services.xserver.videoDrivers = [ "nouveau" ]; + services.xserver.videoDrivers = [ "nouveau" ]; - services.xserver.videoDrivers = [ "nvidia" ]; + # services.xserver.videoDrivers = [ "nvidia" ]; hardware.nvidia = { # Modesetting is needed for most Wayland compositors diff --git a/modules/openssh.nix b/modules/openssh.nix new file mode 100644 index 0000000..3b294bc --- /dev/null +++ b/modules/openssh.nix @@ -0,0 +1,8 @@ +{ ... }: { + + services.openssh = { + enable = true; + openFirewall = true; + }; + +} diff --git a/modules/packages.nix b/modules/packages.nix index f93b0cf..5db8589 100644 --- a/modules/packages.nix +++ b/modules/packages.nix @@ -1,10 +1,7 @@ -{ pkgs, ... }: { - environment.systemPackages = with pkgs; [ +{ lib, pkgs, config, ... }: { + environment.systemPackages = with pkgs; with config.bchmnn; [ pciutils - qt5.qtwayland - qt6.qtwayland - xdg-utils # for opening default programs - glib # gsettings + usbutils git mercurial # contains 'hg' wget @@ -12,8 +9,8 @@ lsd ripgrep expect # contains 'unbuffer' - # libs - libnotify + jq # parse json + ] ++ lib.optionals (devenv.enable) [ # languages gcc13 go @@ -22,5 +19,14 @@ gradle_7 python312 nodenv + rustc + cargo + ] ++ lib.optionals (gui.enable) [ + libnotify + glib # gsettings + xdg-utils # for opening default programs + ] ++ lib.optionals (gui.enable && lib.elem "sway" gui.flavour) [ + qt5.qtwayland + qt6.qtwayland ]; } diff --git a/modules/security.nix b/modules/security.nix index b99a68e..2b01384 100644 --- a/modules/security.nix +++ b/modules/security.nix @@ -1,11 +1,13 @@ -{ ... }: { +{ config, lib, ... }: { security.polkit.enable = true; # rtkit is optional but recommended security.rtkit.enable = true; +} // (lib.mkIf (lib.elem "sway" config.bchmnn.gui.flavour) { + # TODO workaround to get swaylock accepting pw # https://github.com/NixOS/nixpkgs/issues/158025 - security.pam.services.swaylock = {}; + security.pam.services.swaylock = { }; -} +}) diff --git a/modules/steam.nix b/modules/steam.nix new file mode 100644 index 0000000..458d5ae --- /dev/null +++ b/modules/steam.nix @@ -0,0 +1,5 @@ +{ config, lib, ... }: lib.mkIf config.bchmnn.games.enable { + programs.steam = { + enable = true; + }; +} diff --git a/modules/virtualisation.nix b/modules/virtualisation.nix index 0515dff..3648bc6 100644 --- a/modules/virtualisation.nix +++ b/modules/virtualisation.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{ config, lib, pkgs, ... }: lib.mkIf config.bchmnn.virtualisation.enable { # virt-manager virtualisation.libvirtd.enable = true; diff --git a/modules/xdg-portal.nix b/modules/xdg-portal.nix index 014bfee..ac1ad0c 100644 --- a/modules/xdg-portal.nix +++ b/modules/xdg-portal.nix @@ -1,8 +1,10 @@ -{ pkgs, ... }: { +{ lib, config, ... }: lib.mkIf config.bchmnn.gui.enable { xdg.portal = { enable = true; wlr.enable = true; # gtk portal needed to make gtk apps happy - extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + # extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + # upper has been replaced by following + config.common.default = "*"; }; } diff --git a/modules/xorg.nix b/modules/xorg.nix new file mode 100644 index 0000000..73e5363 --- /dev/null +++ b/modules/xorg.nix @@ -0,0 +1,12 @@ +{ lib, config, ... }: with config.bchmnn; lib.mkIf (gui.enable && lib.elem "i3" gui.flavour) { + + environment.pathsToLink = [ "/libexec" ]; # links /libexec from derivations to /run/current-system/sw + + services.xserver = { + enable = true; + displayManager.startx.enable = true; + libinput.enable = true; + }; + +} + diff --git a/users/gandalf/default.nix b/users/gandalf/default.nix index 78d46aa..a48c0de 100644 --- a/users/gandalf/default.nix +++ b/users/gandalf/default.nix @@ -27,5 +27,4 @@ in }; }; - # programs.home-manager.enable = true; } diff --git a/users/gandalf/modules/dconf.nix b/users/gandalf/modules/dconf.nix index 0714dc4..d5c1c19 100644 --- a/users/gandalf/modules/dconf.nix +++ b/users/gandalf/modules/dconf.nix @@ -1,6 +1,6 @@ -{ ... }: { +{ lib, nixosConfig, ... }: { - dconf.settings = { + dconf.settings = lib.mkIf nixosConfig.bchmnn.virtualisation.enable { "org/virt-manager/virt-manager/connections" = { autoconnect = ["qemu:///system"]; uris = ["qemu:///system"]; diff --git a/users/gandalf/modules/default.nix b/users/gandalf/modules/default.nix index d3c7214..524fdf0 100644 --- a/users/gandalf/modules/default.nix +++ b/users/gandalf/modules/default.nix @@ -1,25 +1,15 @@ { imports = [ - ./alacritty.nix - ./chromium.nix ./dconf.nix ./fzf.nix + ./gui ./git.nix ./gnupg.nix - ./kanshi.nix - ./keyring.nix ./neovim.nix - ./obs.nix ./packages.nix - ./playerctl.nix ./ssh.nix - ./sway.nix - ./swaync ./tmux.nix ./udiskie.nix - ./vscode.nix - ./waybar.nix - ./wofi.nix ./zsh.nix ]; } diff --git a/users/gandalf/modules/flameshot/default.nix b/users/gandalf/modules/flameshot/default.nix deleted file mode 100644 index 845b128..0000000 --- a/users/gandalf/modules/flameshot/default.nix +++ /dev/null @@ -1 +0,0 @@ -import ./flameshot.nix diff --git a/users/gandalf/modules/common.nix b/users/gandalf/modules/gui/common.nix similarity index 64% rename from users/gandalf/modules/common.nix rename to users/gandalf/modules/gui/common.nix index d4716cb..4ed133d 100644 --- a/users/gandalf/modules/common.nix +++ b/users/gandalf/modules/gui/common.nix @@ -1,4 +1,4 @@ -{ +{ pkgs, lib, ... }: { colorschemes = rec { custom = { black = "#000000"; @@ -18,4 +18,10 @@ font = "DejaVuSansM Nerd Font"; font-size = "14"; gtk = "Adwaita"; + + wallpaper = pkgs.fetchurl { + url = "https://live.staticflickr.com/65535/52797919139_2444712a38_o_d.png"; + sha256 = "1a9148d8911fa25afa82d3b843ee620173955a7ca705d525f3e9d00e00696308"; + meta.licenses = lib.licenses.cc0; + }; } diff --git a/users/gandalf/modules/gui/default.nix b/users/gandalf/modules/gui/default.nix new file mode 100644 index 0000000..fb03162 --- /dev/null +++ b/users/gandalf/modules/gui/default.nix @@ -0,0 +1,12 @@ +{ lib, nixosConfig, ... }: { + + imports = with lib; with nixosConfig.bchmnn; + optionals gui.enable [ + ./programs + ] ++ optionals (gui.enable && elem "sway" gui.flavour) [ + ./sway + ] ++ optionals (gui.enable && elem "i3" gui.flavour) [ + ./i3 + ]; + +} diff --git a/users/gandalf/modules/gui/i3/autorandr.nix b/users/gandalf/modules/gui/i3/autorandr.nix new file mode 100644 index 0000000..8c158da --- /dev/null +++ b/users/gandalf/modules/gui/i3/autorandr.nix @@ -0,0 +1,42 @@ +{ ... }: { + + programs.autorandr = { + enable = true; + + profiles = { + + nomad = { + config = { + "LVDS-1" = { + enable = true; + }; + }; + }; + + station = { + + config = { + "LVDS-1" = { + enable = false; + }; + "DP-1-3" = { + enable = true; + mode = "1920x1080"; + position = "0x0"; + }; + "DP-1-2" = { + enable = true; + mode = "1920x1080"; + position = "1920x0"; + }; + "VGA-1-2" = { + enable = true; + mode = "1920x1080"; + position = "3840x0"; + }; + }; + }; + }; + }; + +} diff --git a/users/gandalf/modules/gui/i3/default.nix b/users/gandalf/modules/gui/i3/default.nix new file mode 100644 index 0000000..a19cc29 --- /dev/null +++ b/users/gandalf/modules/gui/i3/default.nix @@ -0,0 +1,187 @@ +{ pkgs, lib, config, ... }: +let + + cfg = config.xsession.windowManager.i3.config; + # common = (import ../common.nix) { pkgs = pkgs; lib = lib; }; + common = (import ../common.nix) { inherit pkgs; inherit lib; }; + +in { + + imports = [ + ./autorandr.nix + ]; + + home.packages = with pkgs; [ + alacritty + dmenu + wireplumber + feh # lightweight image viewer (also sets wallpaper) + brightnessctl # control screen brightness + pavucontrol # control audio + playerctl # control player + networkmanagerapplet # control network + blueman # control bluetooth + nextcloud-client # nextcloud client to connect to any instance + plasma5Packages.kdeconnect-kde # sync phone and pc + ]; + + xsession.windowManager.i3 = { + enable = true; + config = { + modifier = "Mod4"; + terminal = "${pkgs.alacritty}/bin/alacritty"; + menu = "${pkgs.dmenu}/bin/dmenu_run"; + startup = with pkgs; [ + { command = "${feh}/bin/feh --bg-fill ${common.wallpaper}"; } + { command = "${networkmanagerapplet}/bin/nm-applet"; } + { command = "${blueman}/bin/blueman-applet"; } + { command = "${nextcloud-client}/bin/nextcloud"; } + { command = "${plasma5Packages.kdeconnect-kde}/bin/kdeconnect-indicator"; } + ]; + fonts = { + names = [ common.font ]; + style = "Bold"; + size = 12.0; + }; + window = { + titlebar = false; + border = 4; + }; + gaps = { + inner = 5; + }; + colors = { + focused = { + border = common.colorschemes.default.active; + background = common.colorschemes.default.active; + text = common.colorschemes.default.black; + indicator = common.colorschemes.default.activeDark; + childBorder = common.colorschemes.default.active; + }; + focusedInactive = { + border = common.colorschemes.default.inactive; + background = common.colorschemes.default.inactive; + text = common.colorschemes.default.white; + indicator = common.colorschemes.default.inactive; + childBorder = common.colorschemes.default.inactive; + }; + unfocused = { + border = common.colorschemes.default.inactiveDark; + background = common.colorschemes.default.inactiveDark; + text = common.colorschemes.default.white; + indicator = common.colorschemes.default.inactiveDark; + childBorder = common.colorschemes.default.inactiveDark; + }; + urgent = { + border = common.colorschemes.default.alert; + background = common.colorschemes.default.alert; + text = common.colorschemes.default.white; + indicator = common.colorschemes.default.black; + childBorder = common.colorschemes.default.alert; + }; + placeholder = { + border = common.colorschemes.default.active; + background = common.colorschemes.default.active; + text = common.colorschemes.default.black; + indicator = common.colorschemes.default.activeDark; + childBorder = common.colorschemes.default.active; + }; + }; + keybindings = { + # Basics + "${cfg.modifier}+Return" = "exec ${cfg.terminal}"; + "${cfg.modifier}+q" = "kill"; + "${cfg.modifier}+i" = "exec ${cfg.menu}"; + "${cfg.modifier}+space" = "exec ${cfg.menu}"; + "${cfg.modifier}+Shift+c" = "reload"; + "${cfg.modifier}+Shift+q" = "exec i3-nagbar -t warning -m 'Do you want to exit i3?' -b 'Yes' 'i3-msg exit'"; + "${cfg.modifier}+Shift+r" = "restart"; + + # Focus + "${cfg.modifier}+h" = "focus left"; + "${cfg.modifier}+j" = "focus down"; + "${cfg.modifier}+k" = "focus up"; + "${cfg.modifier}+l" = "focus right"; + + "${cfg.modifier}+p" = "focus output left"; + "${cfg.modifier}+n" = "focus output right"; + + # Moving + "${cfg.modifier}+Shift+h" = "move left"; + "${cfg.modifier}+Shift+j" = "move down"; + "${cfg.modifier}+Shift+k" = "move up"; + "${cfg.modifier}+Shift+l" = "move right"; + + # Workspaces + "${cfg.modifier}+1" = "workspace number 1"; + "${cfg.modifier}+2" = "workspace number 2"; + "${cfg.modifier}+3" = "workspace number 3"; + "${cfg.modifier}+4" = "workspace number 4"; + "${cfg.modifier}+5" = "workspace number 5"; + "${cfg.modifier}+6" = "workspace number 6"; + "${cfg.modifier}+7" = "workspace number 7"; + "${cfg.modifier}+8" = "workspace number 8"; + "${cfg.modifier}+9" = "workspace number 9"; + "${cfg.modifier}+0" = "workspace number 10"; + + "${cfg.modifier}+Shift+1" = "move container to workspace number 1"; + "${cfg.modifier}+Shift+2" = "move container to workspace number 2"; + "${cfg.modifier}+Shift+3" = "move container to workspace number 3"; + "${cfg.modifier}+Shift+4" = "move container to workspace number 4"; + "${cfg.modifier}+Shift+5" = "move container to workspace number 5"; + "${cfg.modifier}+Shift+6" = "move container to workspace number 6"; + "${cfg.modifier}+Shift+7" = "move container to workspace number 7"; + "${cfg.modifier}+Shift+8" = "move container to workspace number 8"; + "${cfg.modifier}+Shift+9" = "move container to workspace number 9"; + "${cfg.modifier}+Shift+0" = "move container to workspace number 10"; + + "${cfg.modifier}+Control+j" = "workspace prev"; + "${cfg.modifier}+Control+k" = "workspace next"; + "${cfg.modifier}+Control+Shift+j" = "move workspace to output left"; + "${cfg.modifier}+Control+Shift+k" = "move workspace to output right"; + + # Splits + "${cfg.modifier}+b" = "split h"; + "${cfg.modifier}+v" = "split v"; + + # Layouts + "${cfg.modifier}+s" = "layout stacking"; + "${cfg.modifier}+w" = "layout tabbed"; + "${cfg.modifier}+e" = "layout toggle split"; + "${cfg.modifier}+f" = "fullscreen toggle"; + + "${cfg.modifier}+a" = "focus parent"; + + "${cfg.modifier}+d" = "floating toggle"; + "${cfg.modifier}+Shift+d" = "focus mode_toggle"; + + # Scratchpad + "${cfg.modifier}+Shift+minus" = "move scratchpad"; + "${cfg.modifier}+minus" = "scratchpad show"; + + # Resize mode + "${cfg.modifier}+r" = "mode resize"; + + # Multimedia Keys + "XF86AudioRaiseVolume" = "exec ${pkgs.wireplumber}/bin/wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+"; + "XF86AudioLowerVolume" = "exec ${pkgs.wireplumber}/bin/wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%-"; + "XF86AudioMute" = "exec ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; + "XF86AudioMicMute" = "exec ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; + + "XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl -q set 5%-"; + "XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl -q set 5%+"; + + "XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous"; + "XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next"; + "XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause"; + "XF86AudioPause" = "exec ${pkgs.playerctl}/bin/playerctl play-pause"; + + # Programs + "${cfg.modifier}+Shift+v" = "exec ${pkgs.pavucontrol}/bin/pavucontrol"; + "${cfg.modifier}+Shift+b" = "exec ${pkgs.blueman}/bin/blueman-manager"; + "${cfg.modifier}+Shift+n" = "exec ${pkgs.networkmanagerapplet}/bin/nm-connection-editor"; + "${cfg.modifier}+Shift+a" = "exec ${pkgs.swaynotificationcenter}/bin/swaync-client -t -sw"; + }; + }; + }; +} diff --git a/users/gandalf/modules/alacritty.nix b/users/gandalf/modules/gui/programs/alacritty.nix similarity index 84% rename from users/gandalf/modules/alacritty.nix rename to users/gandalf/modules/gui/programs/alacritty.nix index 6833696..f5b048e 100644 --- a/users/gandalf/modules/alacritty.nix +++ b/users/gandalf/modules/gui/programs/alacritty.nix @@ -1,6 +1,6 @@ -{ ... }: +{ pkgs, lib, ... }: let - common = import ./common.nix; + common = (import ../common.nix) { pkgs = pkgs; lib = lib; }; in { # alacritty - a cross-platform, GPU-accelerated terminal emulator diff --git a/users/gandalf/modules/chromium.nix b/users/gandalf/modules/gui/programs/chromium.nix similarity index 84% rename from users/gandalf/modules/chromium.nix rename to users/gandalf/modules/gui/programs/chromium.nix index 64029c4..e11d185 100644 --- a/users/gandalf/modules/chromium.nix +++ b/users/gandalf/modules/gui/programs/chromium.nix @@ -22,6 +22,11 @@ let sha256 = "565fff2ed6a3c4c98daf7a2b56aad386c2d076f4f5b88199785593eb380eb3d4"; meta.licenses = lib.licenses.publicDomain; }; + whatsapp = pkgs.fetchurl { + url = "https://upload.wikimedia.org/wikipedia/commons/thumb/6/6b/WhatsApp.svg/240px-WhatsApp.svg.png"; + sha256 = "65b4eeab9b5a02c46f75f26abeac3c72a479cf8fce829b7f9c46f59e9a7f9785"; + meta.licenses = lib.licenses.publicDomain; + }; }; in @@ -68,6 +73,14 @@ in Terminal=false Icon=${icons.outlook} ''; + "applications/whatsapp.desktop".text = '' + [Desktop Entry] + Type=Application + Name=WhatsApp + Exec=${pkgs.chromium}/bin/chromium --app=https://web.whatsapp.com + Terminal=false + Icon=${icons.whatsapp} + ''; }; } diff --git a/users/gandalf/modules/gui/programs/default.nix b/users/gandalf/modules/gui/programs/default.nix new file mode 100644 index 0000000..cd74946 --- /dev/null +++ b/users/gandalf/modules/gui/programs/default.nix @@ -0,0 +1,24 @@ +{ pkgs, ... }: { + + imports = [ + ./alacritty.nix + ./chromium.nix + ./discord.nix + ./keyring.nix + ./obs.nix + ./vscode.nix + ]; + + home.packages = with pkgs; [ + firefox + speechd # https://support.mozilla.org/en-US/kb/speechd-setup + gnome.nautilus + gimp + vlc + qbittorrent + gnome.simple-scan + telegram-desktop + signal-desktop + ]; + +} diff --git a/users/gandalf/modules/playerctl.nix b/users/gandalf/modules/gui/programs/discord.nix similarity index 77% rename from users/gandalf/modules/playerctl.nix rename to users/gandalf/modules/gui/programs/discord.nix index 55f1521..03b7c12 100644 --- a/users/gandalf/modules/playerctl.nix +++ b/users/gandalf/modules/gui/programs/discord.nix @@ -1,7 +1,5 @@ { pkgs, ... }: { - home.packages = with pkgs; [ - playerctl + discord ]; - } diff --git a/users/gandalf/modules/flameshot/build.nix b/users/gandalf/modules/gui/programs/flameshot/build.nix similarity index 100% rename from users/gandalf/modules/flameshot/build.nix rename to users/gandalf/modules/gui/programs/flameshot/build.nix diff --git a/users/gandalf/modules/gui/programs/flameshot/default.nix b/users/gandalf/modules/gui/programs/flameshot/default.nix new file mode 100644 index 0000000..ef99b83 --- /dev/null +++ b/users/gandalf/modules/gui/programs/flameshot/default.nix @@ -0,0 +1,3 @@ +import ./flameshot.nix +# include with: +# flameshot = pkgs.libsForQt5.callPackage ./flameshot/build.nix { }; diff --git a/users/gandalf/modules/flameshot/flameshot.nix b/users/gandalf/modules/gui/programs/flameshot/flameshot.nix similarity index 100% rename from users/gandalf/modules/flameshot/flameshot.nix rename to users/gandalf/modules/gui/programs/flameshot/flameshot.nix diff --git a/users/gandalf/modules/keyring.nix b/users/gandalf/modules/gui/programs/keyring.nix similarity index 100% rename from users/gandalf/modules/keyring.nix rename to users/gandalf/modules/gui/programs/keyring.nix diff --git a/users/gandalf/modules/obs.nix b/users/gandalf/modules/gui/programs/obs.nix similarity index 100% rename from users/gandalf/modules/obs.nix rename to users/gandalf/modules/gui/programs/obs.nix diff --git a/users/gandalf/modules/vscode.nix b/users/gandalf/modules/gui/programs/vscode.nix similarity index 98% rename from users/gandalf/modules/vscode.nix rename to users/gandalf/modules/gui/programs/vscode.nix index 021e73c..f5783a6 100644 --- a/users/gandalf/modules/vscode.nix +++ b/users/gandalf/modules/gui/programs/vscode.nix @@ -1,6 +1,6 @@ -{ pkgs, ... }: +{ pkgs, lib, ... }: let - common = import ./common.nix; + common = (import ../common.nix) { pkgs = pkgs; lib = lib; }; in { programs.vscode = { diff --git a/users/gandalf/modules/sway.nix b/users/gandalf/modules/gui/sway/default.nix similarity index 89% rename from users/gandalf/modules/sway.nix rename to users/gandalf/modules/gui/sway/default.nix index 0d3bd34..4567b21 100644 --- a/users/gandalf/modules/sway.nix +++ b/users/gandalf/modules/gui/sway/default.nix @@ -1,20 +1,19 @@ -{ config, pkgs, lib, ... }: +{ pkgs, lib, config, ... }: let cfg = config.wayland.windowManager.sway.config; - common = import ./common.nix; - - wallpaper = pkgs.fetchurl { - url = "https://live.staticflickr.com/65535/52797919139_2444712a38_o_d.png"; - sha256 = "1a9148d8911fa25afa82d3b843ee620173955a7ca705d525f3e9d00e00696308"; - meta.licenses = lib.licenses.cc0; - }; - - # flameshot = pkgs.libsForQt5.callPackage ./flameshot/build.nix { }; + common = (import ../common.nix) { pkgs = pkgs; lib = lib; }; in { + imports = [ + ./kanshi.nix + ./swaync + ./waybar.nix + ./wofi.nix + ]; + home.packages = with pkgs; [ brightnessctl # control screen brightness pavucontrol # control audio @@ -26,6 +25,9 @@ in sway-contrib.grimshot wdisplays wlr-randr + kanshi # display manager + nextcloud-client # self hosted cloud client + plasma5Packages.kdeconnect-kde # sync phone and pc ]; programs.swaylock = { @@ -60,15 +62,27 @@ in # use this if they aren't displayed properly: export _JAVA_AWT_WM_NONREPARENTING=1 export _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on"; + + # Nvidia + # export WLR_RENDERER=vulkan; + # export GBM_BACKEND=nvidia-drm; + # export __GL_GSYNC_ALLOWED=0; + # export __GL_VRR_ALLOWED=0; + # export __GLX_VENDOR_LIBRARY_NAME=nvidia; + # Xwayland compat + # export XWAYLAND_NO_GLAMOR=1; ''; config = { modifier = "Mod4"; terminal = "${pkgs.alacritty}/bin/alacritty"; menu = "${pkgs.wofi}/bin/wofi"; - startup = [ - { command = "blueman-applet"; } - { command = "nm-applet"; } - { command = "swaync"; } + startup = with pkgs; [ + { command = "${kanshi}/bin/kanshi"; } + { command = "${networkmanagerapplet}/bin/nm-applet"; } + { command = "${blueman}/bin/blueman-applet"; } + { command = "${swaynotificationcenter}/bin/swaync"; } + { command = "${nextcloud-client}/bin/nextcloud"; } + { command = "${plasma5Packages.kdeconnect-kde}/bin/kdeconnect-indicator"; } ]; input = { "2:7:SynPS/2_Synaptics_TouchPad" = { @@ -86,7 +100,7 @@ in }; }; output = { - "*".bg = "${wallpaper} fill"; + "*".bg = "${common.wallpaper} fill"; }; left = "h"; down = "j"; @@ -109,10 +123,8 @@ in "${cfg.modifier}+${cfg.up}" = "focus up"; "${cfg.modifier}+${cfg.right}" = "focus right"; - "${cfg.modifier}+Left" = "focus left"; - "${cfg.modifier}+Down" = "focus down"; - "${cfg.modifier}+Up" = "focus up"; - "${cfg.modifier}+Right" = "focus right"; + "${cfg.modifier}+p" = "focus output left"; + "${cfg.modifier}+n" = "focus output right"; # Moving "${cfg.modifier}+Shift+${cfg.left}" = "move left"; @@ -120,11 +132,6 @@ in "${cfg.modifier}+Shift+${cfg.up}" = "move up"; "${cfg.modifier}+Shift+${cfg.right}" = "move right"; - "${cfg.modifier}+Shift+Left" = "move left"; - "${cfg.modifier}+Shift+Down" = "move down"; - "${cfg.modifier}+Shift+Up" = "move up"; - "${cfg.modifier}+Shift+Right" = "move right"; - # Workspaces "${cfg.modifier}+1" = "workspace number 1"; "${cfg.modifier}+2" = "workspace number 2"; @@ -301,6 +308,7 @@ in # show existing or start new dropdown terminal bindsym ${cfg.modifier}+grave exec swaymsg '[app_id="$ddterm-id"] scratchpad show' || $ddterm && sleep .1 && swaymsg '[app_id="$ddterm-id"] $ddterm-resize' + bindsym ${cfg.modifier}+Escape exec swaymsg '[app_id="$ddterm-id"] scratchpad show' || $ddterm && sleep .1 && swaymsg '[app_id="$ddterm-id"] $ddterm-resize' # ^-- resize again, case moving to different output ''; }; diff --git a/users/gandalf/modules/gui/sway/kanshi.nix b/users/gandalf/modules/gui/sway/kanshi.nix new file mode 100644 index 0000000..4d459ac --- /dev/null +++ b/users/gandalf/modules/gui/sway/kanshi.nix @@ -0,0 +1,45 @@ +{ ... }: { + + services.kanshi = { + enable = true; + + profiles = { + + nomad = { + outputs = [ + { + criteria = "LVDS-1"; + status = "enable"; + } + ]; + }; + + station = { + outputs = [ + { + criteria = "LVDS-1"; + status = "disable"; + } + { + criteria = "Dell Inc. DELL U2515H 9X2VY5490XUL"; + status = "enable"; + mode = "1920x1080"; + position = "0,0"; + } + { + criteria = "Dell Inc. DELL U2515H 9X2VY5C7138L"; + status = "enable"; + mode = "1920x1080"; + position = "1920,0"; + } + { + criteria = "HJW VGA TO HDMI 0x00000100"; + status = "enable"; + mode = "1920x1080"; + position = "3840,0"; + } + ]; + }; + }; + }; +} diff --git a/users/gandalf/modules/swaync/config.json b/users/gandalf/modules/gui/sway/swaync/config.json similarity index 100% rename from users/gandalf/modules/swaync/config.json rename to users/gandalf/modules/gui/sway/swaync/config.json diff --git a/users/gandalf/modules/swaync/default.nix b/users/gandalf/modules/gui/sway/swaync/default.nix similarity index 100% rename from users/gandalf/modules/swaync/default.nix rename to users/gandalf/modules/gui/sway/swaync/default.nix diff --git a/users/gandalf/modules/swaync/style.css b/users/gandalf/modules/gui/sway/swaync/style.css similarity index 100% rename from users/gandalf/modules/swaync/style.css rename to users/gandalf/modules/gui/sway/swaync/style.css diff --git a/users/gandalf/modules/swaync/swaync.nix b/users/gandalf/modules/gui/sway/swaync/swaync.nix similarity index 100% rename from users/gandalf/modules/swaync/swaync.nix rename to users/gandalf/modules/gui/sway/swaync/swaync.nix diff --git a/users/gandalf/modules/waybar.nix b/users/gandalf/modules/gui/sway/waybar.nix similarity index 100% rename from users/gandalf/modules/waybar.nix rename to users/gandalf/modules/gui/sway/waybar.nix diff --git a/users/gandalf/modules/wofi.nix b/users/gandalf/modules/gui/sway/wofi.nix similarity index 94% rename from users/gandalf/modules/wofi.nix rename to users/gandalf/modules/gui/sway/wofi.nix index 65a81dd..ce00cee 100644 --- a/users/gandalf/modules/wofi.nix +++ b/users/gandalf/modules/gui/sway/wofi.nix @@ -1,6 +1,6 @@ -{ ... }: +{ pkgs, lib, ... }: let - common = import ./common.nix; + common = (import ../common.nix) { pkgs = pkgs; lib = lib; }; in { programs.wofi = { diff --git a/users/gandalf/modules/kanshi.nix b/users/gandalf/modules/kanshi.nix deleted file mode 100644 index 19d6561..0000000 --- a/users/gandalf/modules/kanshi.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ ... }: { - - services.kanshi = { - enable = true; - - profiles = { - - home = { - outputs = [ - { - criteria = "DP-3"; - mode = "1920x1080"; - position = "0,0"; - } - { - criteria = "DP-2"; - mode = "1920x1080"; - position = "1920,0"; - } - { - criteria = "LVDS-1"; - mode = "1920x1080"; - position = "3840,0"; - scale = 1.33; - } - ]; - }; - - }; - - }; - -} diff --git a/users/gandalf/modules/packages.nix b/users/gandalf/modules/packages.nix index 290c5fc..9d60bd8 100644 --- a/users/gandalf/modules/packages.nix +++ b/users/gandalf/modules/packages.nix @@ -1,14 +1,8 @@ { pkgs, ... }: { home.packages = with pkgs; [ - firefox - speechd # https://support.mozilla.org/en-US/kb/speechd-setup gopass gopass-jsonapi - gnome.nautilus - gimp - vlc - gnome.simple-scan ]; }