From fca52c4b848010fd0f9dcb9bf89044c807dce3ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Thu, 18 Apr 2024 19:29:08 +0200 Subject: [PATCH] Add config for laptop --- home/gunter.nix | 38 +++++ home/hyprland/default.nix | 1 - home/hyprland/gunter.nix | 1 + .../{hyprland.nix => hyprland_gunter.nix} | 0 home/hyprland/hyprland_magicman.nix | 160 ++++++++++++++++++ home/hyprland/hyprland_prismo.nix | 157 +++++++++++++++++ home/hyprland/prismo.nix | 1 + home/magicman.nix | 36 ++++ home/{default.nix => prismo.nix} | 0 hosts/gunter/configuration.nix | 1 - hosts/gunter/default.nix | 2 +- hosts/magicman/configuration.nix | 21 ++- hosts/magicman/default.nix | 2 +- hosts/prismo/configuration.nix | 11 ++ 14 files changed, 419 insertions(+), 12 deletions(-) create mode 100644 home/gunter.nix delete mode 100644 home/hyprland/default.nix create mode 100644 home/hyprland/gunter.nix rename home/hyprland/{hyprland.nix => hyprland_gunter.nix} (100%) create mode 100644 home/hyprland/hyprland_magicman.nix create mode 100644 home/hyprland/hyprland_prismo.nix create mode 100644 home/hyprland/prismo.nix create mode 100644 home/magicman.nix rename home/{default.nix => prismo.nix} (100%) diff --git a/home/gunter.nix b/home/gunter.nix new file mode 100644 index 0000000..862d409 --- /dev/null +++ b/home/gunter.nix @@ -0,0 +1,38 @@ +{ pkgs, inputs, user, ... }: { + imports = [ inputs.home-manager.nixosModules.home-manager ]; + home-manager = { + useUserPackages = true; + useGlobalPkgs = true; + extraSpecialArgs = { inherit pkgs inputs user; }; + users.${user} = { pkgs, ... }: { + imports = [ + inputs.sops-nix.homeManagerModules.sops + ./sops + ./editor/neovim + ./programs/firefox + ./programs/tmux + ./programs/dunst + ./programs/kitty + ./programs/rofi + ./programs/obs-studio + ./programs/vscode + ./scripts + ./zsh + ./packages + ./hyprland/gunter.nix + ./ssh + ./services/backup-home.nix + ./services/ghettoptt.nix + ]; + firefox.enable = true; + tmux.enable = true; + hyprland.enable = true; + home = { + username = "${user}"; + homeDirectory = "/home/${user}"; + stateVersion = "23.11"; + }; + programs.home-manager.enable = true; + }; + }; +} diff --git a/home/hyprland/default.nix b/home/hyprland/default.nix deleted file mode 100644 index 8b741b1..0000000 --- a/home/hyprland/default.nix +++ /dev/null @@ -1 +0,0 @@ -{ imports = [ ./hyprland.nix ./waybar ./xdg.nix ./cursor.nix ]; } diff --git a/home/hyprland/gunter.nix b/home/hyprland/gunter.nix new file mode 100644 index 0000000..81466b5 --- /dev/null +++ b/home/hyprland/gunter.nix @@ -0,0 +1 @@ +{ imports = [ ./hyprland_gunter.nix ./waybar ./xdg.nix ./cursor.nix ]; } diff --git a/home/hyprland/hyprland.nix b/home/hyprland/hyprland_gunter.nix similarity index 100% rename from home/hyprland/hyprland.nix rename to home/hyprland/hyprland_gunter.nix diff --git a/home/hyprland/hyprland_magicman.nix b/home/hyprland/hyprland_magicman.nix new file mode 100644 index 0000000..cdc7dc0 --- /dev/null +++ b/home/hyprland/hyprland_magicman.nix @@ -0,0 +1,160 @@ +{ inputs, pkgs, lib, config, ... }: { + options.hyprland.enable = lib.mkEnableOption "Hyprland"; + config = { + home.packages = with pkgs; [ + cliphist + dunst + # hyprlock + hyprpaper + rofi-wayland + slurp + swww + waybar + wl-clipboard + catppuccin-cursors.macchiatoLavender + bibata-cursors + # For potentially fixing some issues + libsForQt5.qt5.qtwayland + libsForQt5.qt5ct + ]; + + wayland.windowManager.hyprland = { + enable = true; + package = pkgs.unstable.hyprland; + settings = { + "$mainMod" = "SUPER"; + "$shiftMainMod" = "SUPER_SHIFT"; + "$term" = "kitty"; + + monitor = [ + ]; + input = { + kb_layout = "no"; + follow_mouse = 1; + }; + + env = [ + "LIBVA_DRIVER_NAME,nvidia" + "XDG_SESSION_TYPE,wayland" + "GBM_BACKEND,nvidia-drm" + # "__GLX_VENDOR_LIBRARY_NAME,nvidia" + "WLR_NO_HARDWARE_CURSORS,1" + ]; + + decoration = { + rounding = 0; + drop_shadow = true; + shadow_range = 4; + shadow_render_power = 3; + blur = { + enabled = true; + size = 3; + passes = 1; + xray = true; + }; + }; + + general = { + gaps_in = 4; + gaps_out = 10; + border_size = 2; + layout = "dwindle"; + }; + + animations = { + enabled = true; + bezier = "myBezier, 0.05, 0.9, 0.1, 1.05"; + animation = [ + "windows, 1, 7, myBezier" + "windowsOut, 1, 7, default, popin 80%" + "border, 1, 10, default" + "borderangle, 1, 8, default" + "fade, 1, 7, default" + "workspaces, 1, 6, default" + ]; + }; + dwindle = { + pseudotile = true; + preserve_split = true; + }; + master.new_is_master = true; + misc.force_default_wallpaper = -1; + + windowrulev2 = [ + "opacity 0.95 override 0.7 override,class:^(Alacritty)$" + "opacity 0.95 override 0.7 override,class:^(kitty)$" + ]; + + workspace = [ + "name:mumble, monitor:$mon_top, persistent:true, default:true" + "name:left, monitor:$mon_left, persistent:true, default:true" + "name:right, monitor:$mon_right, persistent:true, default:true" + "name:main 1, monitor:$mon_center, persistent:true, default:true" + "name:main 2, monitor:$mon_center, persistent:true, default:true" + ]; + + bindm = [ + "ALT,mouse:272,movewindow" + ]; + + bindr = [ + # mumble ptt release + # ",code:202,exec,mumble rpc stoptalking" + # ",code:202,exec,pamixer --source 63 -m" + # ",code:202,exec,sleep 0.5 && pamixer --default-source -m" + ]; + + bind = [ + # term + "$mainMod,Return,exec,$term" + + # rofi + "$mainMod,D,exec,rofi-launcher" + "$mainMod,P,exec,rofi-rbw" + + # hyprland + "$mainMod,Q,killactive," + "CTRLALT,Delete,exit," + "$mainMod,Space,togglefloating," + "$mainMod,F,fullscreen," + + # focus + "$mainMod,l,movefocus,l" + "$mainMod,h,movefocus,r" + "$mainMod,k,movefocus,u" + "$mainMod,j,movefocus,d" + + # move + "$mainMod,h,movewindow,l" + "$mainMod,l,movewindow,r" + "$mainMod,k,movewindow,u" + "$mainMod,j,movewindow,d" + + # Force opacity + "$shiftMainMod,o,exec, hl-no-opacity" + + # mumble ptt click + # ",code:202,exec,mumble rpc starttalking" + #",code:202,pass,^(info\.mumble\.Mumble)$" + # ",code:202,exec,pamixer --default-source -u" + ",code:202,pass,^discord$" + + # worspace switching + "$mainMod,1,workspace,name:main 1" + "$mainMod,2,workspace,name:main 2" + "$mainMod,3,workspace,3" + "$mainMod,4,workspace,4" + "$mainMod,5,workspace,5" + "$mainMod,6,workspace,6" + ]; + + exec-once = [ + "waybar" + "hyprpaper & sleep 2 && randomwp" + "easyeffects --gapplication-service" + # "dunst" + ]; + }; + }; + }; +} diff --git a/home/hyprland/hyprland_prismo.nix b/home/hyprland/hyprland_prismo.nix new file mode 100644 index 0000000..35edd59 --- /dev/null +++ b/home/hyprland/hyprland_prismo.nix @@ -0,0 +1,157 @@ +{ inputs, pkgs, lib, config, ... }: { + options.hyprland.enable = lib.mkEnableOption "Hyprland"; + config = { + home.packages = with pkgs; [ + cliphist + dunst + # hyprlock + hyprpaper + rofi-wayland + slurp + swww + waybar + wl-clipboard + catppuccin-cursors.macchiatoLavender + bibata-cursors + # For potentially fixing some issues + libsForQt5.qt5.qtwayland + libsForQt5.qt5ct + ]; + + wayland.windowManager.hyprland = { + enable = true; + package = pkgs.unstable.hyprland; + settings = { + "$mainMod" = "SUPER"; + "$shiftMainMod" = "SUPER_SHIFT"; + "$term" = "kitty"; + + + monitor = [ + ]; + input = { + kb_layout = "no"; + follow_mouse = 1; + }; + + env = [ + "XDG_SESSION_TYPE,wayland" + ]; + + decoration = { + rounding = 0; + drop_shadow = true; + shadow_range = 4; + shadow_render_power = 3; + blur = { + enabled = true; + size = 3; + passes = 1; + xray = true; + }; + }; + + general = { + gaps_in = 4; + gaps_out = 10; + border_size = 2; + layout = "dwindle"; + }; + + animations = { + enabled = true; + bezier = "myBezier, 0.05, 0.9, 0.1, 1.05"; + animation = [ + "windows, 1, 7, myBezier" + "windowsOut, 1, 7, default, popin 80%" + "border, 1, 10, default" + "borderangle, 1, 8, default" + "fade, 1, 7, default" + "workspaces, 1, 6, default" + ]; + }; + dwindle = { + pseudotile = true; + preserve_split = true; + }; + master.new_is_master = true; + misc.force_default_wallpaper = -1; + + windowrulev2 = [ + "opacity 0.95 override 0.7 override,class:^(Alacritty)$" + "opacity 0.95 override 0.7 override,class:^(kitty)$" + ]; + + workspace = [ + "name:mumble, monitor:$mon_top, persistent:true, default:true" + "name:left, monitor:$mon_left, persistent:true, default:true" + "name:right, monitor:$mon_right, persistent:true, default:true" + "name:main 1, monitor:$mon_center, persistent:true, default:true" + "name:main 2, monitor:$mon_center, persistent:true, default:true" + ]; + + bindm = [ + "ALT,mouse:272,movewindow" + ]; + + bindr = [ + # mumble ptt release + # ",code:202,exec,mumble rpc stoptalking" + # ",code:202,exec,pamixer --source 63 -m" + # ",code:202,exec,sleep 0.5 && pamixer --default-source -m" + ]; + + bind = [ + # term + "$mainMod,Return,exec,$term" + + # rofi + "$mainMod,D,exec,rofi-launcher" + "$mainMod,P,exec,rofi-rbw" + + # hyprland + "$mainMod,Q,killactive," + "CTRLALT,Delete,exit," + "$mainMod,Space,togglefloating," + "$mainMod,F,fullscreen," + + # focus + "$mainMod,l,movefocus,l" + "$mainMod,h,movefocus,r" + "$mainMod,k,movefocus,u" + "$mainMod,j,movefocus,d" + + # move + "$mainMod,h,movewindow,l" + "$mainMod,l,movewindow,r" + "$mainMod,k,movewindow,u" + "$mainMod,j,movewindow,d" + + # Force opacity + "$shiftMainMod,o,exec, hl-no-opacity" + + # mumble ptt click + # ",code:202,exec,mumble rpc starttalking" + #",code:202,pass,^(info\.mumble\.Mumble)$" + # ",code:202,exec,pamixer --default-source -u" + ",code:202,pass,^discord$" + + # worspace switching + "$mainMod,1,workspace,name:main 1" + "$mainMod,2,workspace,name:main 2" + "$mainMod,3,workspace,3" + "$mainMod,4,workspace,4" + "$mainMod,5,workspace,5" + "$mainMod,6,workspace,6" + ]; + + exec-once = [ + "waybar" + "hyprpaper & sleep 2 && randomwp" + "easyeffects --gapplication-service" + # "dunst" + ]; + }; + }; + }; +} diff --git a/home/hyprland/prismo.nix b/home/hyprland/prismo.nix new file mode 100644 index 0000000..85a3f8d --- /dev/null +++ b/home/hyprland/prismo.nix @@ -0,0 +1 @@ +{ imports = [ ./hyprland_prismo.nix ./waybar ./xdg.nix ./cursor.nix ]; } diff --git a/home/magicman.nix b/home/magicman.nix new file mode 100644 index 0000000..cefee00 --- /dev/null +++ b/home/magicman.nix @@ -0,0 +1,36 @@ +{ pkgs, inputs, user, ... }: { + imports = [ inputs.home-manager.nixosModules.home-manager ]; + home-manager = { + useUserPackages = true; + useGlobalPkgs = true; + extraSpecialArgs = { inherit pkgs inputs user; }; + users.${user} = { pkgs, ... }: { + imports = [ + inputs.sops-nix.homeManagerModules.sops + ./sops + ./editor/neovim + ./programs/firefox + ./programs/tmux + ./programs/dunst + ./programs/kitty + ./programs/rofi + ./programs/obs-studio + ./programs/vscode + ./scripts + ./zsh + ./packages + ./hyprland/magicman.nix + ./ssh + ]; + firefox.enable = true; + tmux.enable = true; + hyprland.enable = true; + home = { + username = "${user}"; + homeDirectory = "/home/${user}"; + stateVersion = "23.11"; + }; + programs.home-manager.enable = true; + }; + }; +} diff --git a/home/default.nix b/home/prismo.nix similarity index 100% rename from home/default.nix rename to home/prismo.nix diff --git a/hosts/gunter/configuration.nix b/hosts/gunter/configuration.nix index 7bf939b..d23af6c 100644 --- a/hosts/gunter/configuration.nix +++ b/hosts/gunter/configuration.nix @@ -42,7 +42,6 @@ networking.nftables.enable = true; networking.firewall = { enable = true; - }; # Set time stuff diff --git a/hosts/gunter/default.nix b/hosts/gunter/default.nix index a277375..ad08eb0 100644 --- a/hosts/gunter/default.nix +++ b/hosts/gunter/default.nix @@ -5,6 +5,6 @@ ./steamuser.nix ./nfs.nix ../../system - ../../home + ../../home/gunter.nix ]; } diff --git a/hosts/magicman/configuration.nix b/hosts/magicman/configuration.nix index 5438adf..2247651 100644 --- a/hosts/magicman/configuration.nix +++ b/hosts/magicman/configuration.nix @@ -15,6 +15,10 @@ # Networking stuff networking.hostName = "magicman"; # Define your hostname. networking.networkmanager.enable = true; + networking.nftables.enable = true; + networking.firewall = { + enable = true; + }; # Set time stuff time.timeZone = "Europe/Oslo"; @@ -23,19 +27,19 @@ hardware.opengl = { enable = true; extraPackages = with pkgs; [ - intel-media-driver - vaapiVdpau - libvdpau-va-gl + # intel-media-driver + # vaapiVdpau + # libvdpau-va-gl ]; }; # Setup hyprland services.xserver.enable = true; - programs.hyprland = { - enable = true; - xwayland.enable = true; - portalPackage = pkgs.xdg-desktop-portal-hyprland; - }; + # programs.hyprland = { + # enable = true; + # xwayland.enable = true; + # portalPackage = pkgs.xdg-desktop-portal-hyprland; + # }; # Setup common XDG env vars environment.sessionVariables = rec { @@ -59,6 +63,7 @@ # Enable flakes nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nix.settings.trusted-users = [ "root" "torjus" ]; nixpkgs.config.allowUnfree = true; # Install system-wide packages diff --git a/hosts/magicman/default.nix b/hosts/magicman/default.nix index f39e696..bf2fb9e 100644 --- a/hosts/magicman/default.nix +++ b/hosts/magicman/default.nix @@ -3,6 +3,6 @@ ./configuration.nix ./hardware-configuration.nix ../../system - ../../home + ../../home/magicman.nix ]; } diff --git a/hosts/prismo/configuration.nix b/hosts/prismo/configuration.nix index 8478cc7..6123ddc 100644 --- a/hosts/prismo/configuration.nix +++ b/hosts/prismo/configuration.nix @@ -3,6 +3,13 @@ { imports = [ ./hardware-configuration.nix ]; + # Sops stuff + sops.defaultSopsFile = ../../secrets/gunter/secrets.yaml; + sops.age.keyFile = "/var/lib/sops-nix/key.txt"; + sops.age.generateKey = true; + sops.secrets."gotify_tokens/backup-home" = { }; + + # Bootloader stuff boot.kernelParams = [ "quiet" @@ -18,6 +25,10 @@ # Networking stuff networking.hostName = "prismo"; # Define your hostname. networking.networkmanager.enable = true; + networking.nftables.enable = true; + networking.firewall = { + enable = true; + }; # Set time stuff time.timeZone = "Europe/Oslo";