From e705a206c0830429e9cb43d6eef106666496aacf Mon Sep 17 00:00:00 2001 From: Nathan Date: Wed, 20 Nov 2024 15:33:54 -0600 Subject: [PATCH] trying some "default" for nixos-remote --- system-config/services/containers/default.nix | 1 + .../containers/nixos-remote/default.nix | 202 ++++++++++++++++++ .../services/containers/traefik/default.nix | 7 + 3 files changed, 210 insertions(+) create mode 100644 system-config/services/containers/nixos-remote/default.nix diff --git a/system-config/services/containers/default.nix b/system-config/services/containers/default.nix index 5bd7b9d..1e2623c 100644 --- a/system-config/services/containers/default.nix +++ b/system-config/services/containers/default.nix @@ -8,5 +8,6 @@ ./jellyfin ./pihole ./nextcloud + ./nixos-remote ]; } diff --git a/system-config/services/containers/nixos-remote/default.nix b/system-config/services/containers/nixos-remote/default.nix new file mode 100644 index 0000000..eefb981 --- /dev/null +++ b/system-config/services/containers/nixos-remote/default.nix @@ -0,0 +1,202 @@ +{ config, lib, pkgs, inputs, ... }: { + + options.sysconfig.opts.virtualization.nixos-remote.enable = lib.options.mkOption { + type = lib.types.bool; + default = false; + }; + + config = lib.mkIf config.sysconfig.opts.virtualization.nixos-remote.enable { + + containers.nixos-remote = { + + autoStart = false; + privateNetwork = true; + hostAddress = "192.168.100.10"; + localAddress = "192.168.100.17"; + + forwardPorts = [ + { + containerPort = 5900; + hostPort = 5910; + } + ]; + + extraFlags = [ "-U" ]; + + config = { + + imports = [ + inputs.home-manager.nixosModules.default + ]; + + users.users.nixos = { + isNormalUser = true; + extraGroups = [ "wheel" ]; + initialPassword = "1234"; + }; + + home-manager = { + extraSpecialArgs = { inherit inputs; }; + backupFileExtension = "backup"; + users.nixos = { + + home.username = "nixos"; + + home.homeDirectory = "/home/nixos"; + + home.file = { + ".config/hypr/hyprland.conf".text = '' + +monitor=HEADLESS-2,1920x1080@60,0x0,1 + +execOnce = ${pkgs.dunst}/bin/dunst & ${pkgs.wayvnc}/bin/wayvnc 0.0.0.0 & + +input { + kb_layout = us + kb_variant = + kb_model = + kb_options = + kb_rules = + + follow_mouse = 1 + + touchpad { + natural_scroll = yes + } + + sensitivity = 0 # -1.0 - 1.0, 0 means no modification. +} + +cursor { + no_hardware_cursors = true +} + +general { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + + gaps_in = 5 + gaps_out = 4 + border_size = 2 + col.active_border = $color1 $color5 100deg + col.inactive_border = $color0 + + layout = dwindle +} +decoration { # See https://wiki.hyprland.org/Configuring/Variables/ for more + + rounding = 2 + + blur { + enabled = false + } + + + drop_shadow = yes + shadow_range = 4 + shadow_render_power = 3 + col.shadow = rgba(1a1a1aee) +} + +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, 7, myBezier + animation = windowsOut, 1, 7, default, popin 80% + animation = border, 1, 10, default + animation = borderangle, 1, 8, default + animation = fade, 1, 7, default + animation = workspaces, 1, 6, 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_status = "master" +} + +gestures { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + workspace_swipe = off +} + +misc { + disable_hyprland_logo = false + disable_splash_rendering = true + force_default_wallpaper = 2 +} + +$mainMod = ALT + +bind = $mainMod, E, exec, kitty + +bind = $mainMod, B, exec, firefox + +bind = $mainMod, Q, killactive, + + + ''; + }; + }; + }; + + nix = { + nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; + settings.experimental-features = [ "nix-command" "flakes" ]; + }; + + services = { + xserver = { + enable = true; + videoDrivers = [ "nvidia" ]; + }; + displayManager = { + enable = true; + sddm = { + enable = true; + wayland.enable = true; + settings = { + Autologin = { + User = "nixos"; + Session = "hyprland"; + Relogin = true; + }; + }; + }; + }; + }; + + environment = { + sessionVariables = { + WLR_BACKENDS = "headless"; + WLR_LIBINPUT_NO_DEVICES = "1"; + NIXOS_OZONE_WL = "1"; + }; + systemPackages = with pkgs; [ + kitty + firefox-wayland + ]; + }; + + programs.hyprland = { + enable = true; + xwayland.enable = true; + }; + + + + system.stateVersion = "24.05"; + }; + }; + }; +} diff --git a/system-config/services/containers/traefik/default.nix b/system-config/services/containers/traefik/default.nix index 3200929..9b02fd2 100644 --- a/system-config/services/containers/traefik/default.nix +++ b/system-config/services/containers/traefik/default.nix @@ -139,6 +139,13 @@ service = "homepage"; tls.certResolver = "cloudflare"; }; + remote = { + entryPoints = [ "websecure" ]; + rule = "Host(`remote.blunkall.us`)"; + service = "homepage"; + middlewares = [ "authentik" ]; + tls.certResolver = "cloudflare"; + }; jellyfin = { entryPoints = [ "localsecure" "websecure" ]; rule = "Host(`jellyfin.blunkall.us`)";