From ef9f9585278151c5f2528d001a85dbdb7cd56fa9 Mon Sep 17 00:00:00 2001 From: insert Date: Fri, 4 Oct 2024 17:53:14 -0400 Subject: [PATCH] new pc! --- flake.nix | 16 +++ special/insertpcname.nix | 295 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 311 insertions(+) create mode 100644 special/insertpcname.nix diff --git a/flake.nix b/flake.nix index fb88ed6..8ea0532 100644 --- a/flake.nix +++ b/flake.nix @@ -29,6 +29,22 @@ ]; }; + nixosConfigurations.insertpcname = nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs; }; + modules = [ + flatpaks.nixosModules.default + ./configuration.nix + ./special/insertpcname.nix + agenix.nixosModules.default + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.insert = import /home/insert/Documents/nixos/home.nix; + } + ]; + }; + nixosConfigurations.insertlaptop = nixpkgs.lib.nixosSystem { specialArgs = { inherit inputs; }; modules = [ diff --git a/special/insertpcname.nix b/special/insertpcname.nix new file mode 100644 index 0000000..47890df --- /dev/null +++ b/special/insertpcname.nix @@ -0,0 +1,295 @@ +{ inputs, config, lib, pkgs, ... }: +{ + environment.etc.nixpkgs.source = inputs.nixpkgs; + networking.hostName = "insertpcname"; + services.xserver.videoDrivers = ["nvidia"]; + #nixpkgs.overlays = [ (self: super: (let + # patched_pkgs = import inputs.nvidia-beta { + # inherit (self) system; + # config.allowUnfree = true; + # }; + # in { + # linuxPackages = patched_pkgs.linuxPackages; + # })) ]; + #boot.kernelPackages = pkgs.linuxPackages; + + boot.extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback ]; + + services.sunshine = { + enable = true; + autoStart = true; + capSysAdmin = true; + }; + + hardware.nvidia = { + + # Modesetting is needed most of the time + modesetting.enable = true; + + # Enable power management (do not disable this unless you have a reason to). + # Likely to cause problems on laptops and with screen tearing if disabled. + powerManagement.enable = true; + + # Use the open source version of the kernel module ("nouveau") + # Note that this offers much lower performance and does not + # support all the latest Nvidia GPU features. + # You most likely don't want this. + # Only available on driver 515.43.04+ + open = false; + + # Enable the Nvidia settings menu, + # accessible via `nvidia-settings`. + nvidiaSettings = true; + + # Optionally, you may need to select the appropriate driver version for your specific GPU. + + package = config.boot.kernelPackages.nvidiaPackages.beta; + + }; + + services.borgbackup.jobs.insertpclinux = { + paths = "/home/insert"; + encryption.mode = "repokey-blake2"; + encryption.passCommand = "cat ${config.age.secrets.borg.path}"; + compression = "auto,zstd"; + prune.keep = { + daily = 10; + weekly = 4; + monthly = 2; + yearly = 1; + }; + readWritePaths = [ "/mnt/NAS-backup/insertpcname-insert" ]; + repo = "/mnt/NAS-backup/insertpcname-insert"; + user = "insert"; + startAt = "daily"; + doInit = true; + exclude = [ + "^data.img$" + "^.Trash-100$" + "*/node.repl_history" + "*/.oldprofile" + "*/.steampath" + "*/mnt" + "*/mnt2" + "*/.steampid" + "*/.zshenv" + "*/.zshrc" + "*/.android" + "*/.compose-cache" + "*/.docker" + "*/.gradle" + "*/.hyprland" + "*/.java" + "*/.kube" + "*/.minecraft-bta" + "*/.mozilla" + "*/.pki" + "*/.nix-defexpr" + "*/.nix-profile" + "*/.nv" + "*/.thunderbird" + "*/.zsh" + "*/Downloads" + "*/.cache" + "*/.var/app/*/cache" + "*/.local/share/flatpak/repo/" + "*/.local/share/Trash" + "*/.local/share/libvirt" + "*/.local/share/containers" + "*/.local/share/flatpak/overrides" + "*/.var/app/*/config/cache" + "*/.var/app/*/config" + ]; + }; + + virtualisation.libvirtd.enable = true; + programs.virt-manager.enable = true; + security.pki.certificateFiles = [ + /home/insert/Documents/nextcloud/nextcloudinternal.pem + /home/insert/Documents/personal-vaultwarden/cert.pem + ]; + + home-manager.users.insert.wayland.windowManager.sway.config.modifier = "Mod1"; + home-manager.users.insert.wayland.windowManager.sway.config.startup = [ + {command = "wayvnc 192.168.220.73";} #TODO: change to vpn ip once established + ]; + + home-manager.users.insert.home.file.".config/hypr/hyprland.conf" = { + text = ''autogenerated = 0 # remove this line to remove the warning + +# See https://wiki.hyprland.org/Configuring/Monitors/ +monitor=,1920x1080@60,auto,1 + + +# See https://wiki.hyprland.org/Configuring/Keywords/ for more + +# Execute your favorite apps at launch +# exec-once = waybar & hyprpaper & firefox +source=~/.config/hypr/frappe.conf +# Source a file (multi-file configs) +# source = ~/.config/hypr/myColors.conf + +# Some default env vars. +env = LIBVA_DRIVER_NAME,nvidia +env = XDG_SESSION_TYPE,wayland +env = GBM_BACKEND,nvidia-drm +env = __GLX_VENDOR_LIBRARY_NAME,nvidia +env = WLR_NO_HARDWARE_CURSORS,1 +env = NO_HARDWARE_CURSORS,true +env = ELECTRON_OZONE_PLATFORM_HINT,auto +env = NIXOS_OZONE_WL,1 +env = KUBECONFIG,/home/insert/Desktop/k3s.yaml +env = QT_QPA_PLATFORMTHEME,qt5ct +env = XCURSOR_THEME,Catppuccin-Frappe-Blue-Cursors +env = XCURSOR_SIZE,24 +exec-once = nm-applet +exec-once = systemctl --user start polkit-gnome-authentication-agent-1 +#exec-once = hyprctl setcursor Catppuccin-Frappe-Blue-Cursors 24 +exec-once = watch waybar +exec-once = wayvnc 100.120.210.58 +exec-once = mako +exec-once = swww init +exec-once = sleep 5 & swww img /home/insert/Documents/cat-background/background.png +#exec-once = ln -sf $XDG_RUNTIME_DIR/{app/com.discordapp.Discord,}/discord-ipc-0 +exec-once = systemctl --user import-environment PATH +exec-once = systemctl --user restart xdg-desktop-portal.service +# For all categories, see https://wiki.hyprland.org/Configuring/Variables/ +input { + kb_layout = us + kb_variant = + kb_model = + kb_options = + kb_rules = + + follow_mouse = 1 + + touchpad { + natural_scroll = no + } + + sensitivity = 0 # -1.0 - 1.0, 0 means no modification. +} + +general { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + + gaps_in = 5 + gaps_out = 20 + border_size = 2 + #col.active_border = $overlay1 45deg + #col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg + #col.inactive_border = rgba(595959aa) + col.active_border=$pink $mauve 45deg + col.inactive_border=$surface2 + + layout = dwindle +} + +decoration { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + + rounding = 0 + + blur { + enabled = true + size = 3 + passes = 1 + } + + drop_shadow = yes + shadow_range = 4 + shadow_render_power = 3 + col.shadow = $lavender +} + +animations { + enabled = yes + + # Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more + + bezier = myBezier, 0.05, 0.9, 0.1, 1.05 + + animation = windows, 1, 6, myBezier + animation = windowsOut, 1, 6, default, popin 80% + animation = border, 1, 10, default + animation = borderangle, 1, 8, default + animation = fade, 1, 5, default + animation = workspaces, 1, 4, default +} + +dwindle { + # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more + pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below + preserve_split = yes # you probably want this +} + +master { + # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more + new_is_master = true +} + +gestures { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + workspace_swipe = off +} + + +# Example windowrule v1 +# windowrule = float, ^(kitty)$ +# Example windowrule v2 +# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ +# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more + + +# See https://wiki.hyprland.org/Configuring/Keywords/ for more +$mainMod = ALT + +# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more +bind = $mainMod, Q, exec, kitty zsh +bind = $mainMod, C, killactive, +bind = $mainMod, M, exit, +bind = $mainMod, E, exec, kitty nnn +bind = $mainMod, V, togglefloating, +bind = $mainMod, R, exec, wofi --show drun --allow-images +bind = $mainMod, S, pseudo, # dwindle +bind = $mainMod, J, togglesplit, # dwindle +bind = $mainMod, P, exec, grim -g "$(slurp)" - | wl-copy +# Move focus with mainMod + arrow keys +bind = $mainMod, left, movefocus, l +bind = $mainMod, right, movefocus, r +bind = $mainMod, up, movefocus, u +bind = $mainMod, down, movefocus, d + +# Switch workspaces with mainMod + [0-9] +bind = $mainMod, 1, workspace, 1 +bind = $mainMod, 2, workspace, 2 +bind = $mainMod, 3, workspace, 3 +bind = $mainMod, 4, workspace, 4 +bind = $mainMod, 5, workspace, 5 +bind = $mainMod, 6, workspace, 6 +bind = $mainMod, 7, workspace, 7 +bind = $mainMod, 8, workspace, 8 +bind = $mainMod, 9, workspace, 9 +bind = $mainMod, 0, workspace, 10 + +# Move active window to a workspace with mainMod + SHIFT + [0-9] +bind = $mainMod SHIFT, 1, movetoworkspace, 1 +bind = $mainMod SHIFT, 2, movetoworkspace, 2 +bind = $mainMod SHIFT, 3, movetoworkspace, 3 +bind = $mainMod SHIFT, 4, movetoworkspace, 4 +bind = $mainMod SHIFT, 5, movetoworkspace, 5 +bind = $mainMod SHIFT, 6, movetoworkspace, 6 +bind = $mainMod SHIFT, 7, movetoworkspace, 7 +bind = $mainMod SHIFT, 8, movetoworkspace, 8 +bind = $mainMod SHIFT, 9, movetoworkspace, 9 +bind = $mainMod SHIFT, 0, movetoworkspace, 10 + +# Scroll through existing workspaces with mainMod + scroll +bind = $mainMod, mouse_down, workspace, e+1 +bind = $mainMod, mouse_up, workspace, e-1 + +# Move/resize windows with mainMod + LMB/RMB and dragging +bindm = $mainMod, mouse:272, movewindow +bindm = $mainMod, mouse:273, resizewindow''; + }; +} \ No newline at end of file