From c67083acf6afbd751bb7c78996cdd0761cf78502 Mon Sep 17 00:00:00 2001
From: iFargle <albert@sysctl.io>
Date: Sun, 8 Oct 2023 19:21:29 +0900
Subject: [PATCH] TEst

---
 flake.nix                                     |   9 +-
 .../desktops/gnome/default.nix                |   0
 .../desktops/hyprland/default.nix             |   0
 .../nixos-vm-02/desktops/gnome/default.nix    |   3 -
 .../nixos-vm-02/desktops/hyprland/default.nix |  51 -----
 lib/default.nix                               |   2 +-
 nixos/hosts/nixos-desktop/default.nix         |  52 +++++
 .../{nixos-vm-02 => nixos-desktop}/disks.nix  |  10 +-
 nixos/hosts/nixos-desktop/gnome-dconf.nix     | 195 ------------------
 nixos/hosts/nixos-linode-img/default.nix      |  12 --
 nixos/hosts/nixos-vm-02/default.nix           |  22 --
 nixos/hosts/osaka-vultr-01/default.nix        |   5 +-
 12 files changed, 64 insertions(+), 297 deletions(-)
 rename home-manager/hosts/{nixos-laptop => nixos-framework}/desktops/gnome/default.nix (100%)
 rename home-manager/hosts/{nixos-laptop => nixos-framework}/desktops/hyprland/default.nix (100%)
 delete mode 100644 home-manager/hosts/nixos-vm-02/desktops/gnome/default.nix
 delete mode 100644 home-manager/hosts/nixos-vm-02/desktops/hyprland/default.nix
 create mode 100644 nixos/hosts/nixos-desktop/default.nix
 rename nixos/hosts/{nixos-vm-02 => nixos-desktop}/disks.nix (88%)
 delete mode 100644 nixos/hosts/nixos-desktop/gnome-dconf.nix
 delete mode 100644 nixos/hosts/nixos-linode-img/default.nix
 delete mode 100644 nixos/hosts/nixos-vm-02/default.nix

diff --git a/flake.nix b/flake.nix
index 16b658e7..26848f1d 100644
--- a/flake.nix
+++ b/flake.nix
@@ -37,11 +37,10 @@
   in {
     nixosConfigurations = {
       # Virtual Machines
-      osaka-vultr-01 = libx.mkMinHost { hostname = "osaka-vultr-01"; };
+      osaka-vultr-01 = libx.mkSmallHost { hostname = "osaka-vultr-01"; };
       nixos-vm-01 = libx.mkHost { hostname = "nixos-vm-01"; };
-      nixos-vm-02 = libx.mkHost { hostname = "nixos-vm-02"; desktop = "hyprland"; gpu = "intel"; theme = "gruvbox"; };
       # Physical Machines
-      nixos-laptop = libx.mkHost { hostname = "nixos-laptop"; desktop = "hyprland"; gpu = "intel";  theme = "gruvbox"; };
+      nixos-desktop = libx.mkHost { hostname = "nixos-desktop"; desktop = "hyprland"; gpu = "nvidia";  theme = "gruvbox"; };
       nixos-framework = libx.mkHost { hostname = "nixos-framework"; desktop = "hyprland"; gpu = "intel";  theme = "gruvbox"; };
       nixos-rpi4-01 = libx.mkHost { hostname = "nixos-rpi4-01";   platform = "aarch64-linux"; };
       nixos-rpi4-02 = libx.mkHost { hostname = "nixos-rpi4-02";   platform = "aarch64-linux"; };
@@ -51,9 +50,8 @@
       # Virtual Machines
       "albert@osaka-vultr-01" = libx.mkHome { hostname = "osaka-vultr-01"; };
       "albert@nixos-vm-01" = libx.mkHome { hostname = "nixos-vm-01"; };
-      "albert@nixos-vm-02" = libx.mkHome { hostname = "nixos-vm-02"; desktop = "hyprland"; theme = "gruvbox"; };
       # Physical Machines
-      "albert@nixos-laptop" = libx.mkHome { hostname = "nixos-laptop"; desktop = "hyprland"; theme = "gruvbox"; };
+      "albert@nixos-desktop" = libx.mkHome { hostname = "nixos-desktop"; desktop = "hyprland"; theme = "gruvbox"; };
       "albert@nixos-framework" = libx.mkHome { hostname = "nixos-framework"; desktop = "hyprland"; theme = "gruvbox"; };
       "albert@nixos-rpi4-01" = libx.mkHome { hostname = "nixos-rpi4-01"; platform = "aarch64-linux"; };
       "albert@nixos-rpi4-02" = libx.mkHome { hostname = "nixos-rpi4-02"; platform = "aarch64-linux"; };
@@ -63,7 +61,6 @@
       nixos-rpi4-img = libx.mkImage { hostname = "nixos-rpi4-img";  platform = "aarch64-linux"; format = "sd-aarch64"; };
       nixos-iso-console = libx.mkImage { hostname = "nixos-iso-console"; format = "iso"; };
       nixos-iso-desktop = libx.mkImage { hostname = "nixos-iso-desktop"; format = "iso"; desktop = "gnome"; };
-      nixos-linode-img = libx.mkMinImage { hostname = "nixos-linode-img"; format = "linode"; };
     };
 
     # Devshell for bootstrapping; acessible via 'nix develop'
diff --git a/home-manager/hosts/nixos-laptop/desktops/gnome/default.nix b/home-manager/hosts/nixos-framework/desktops/gnome/default.nix
similarity index 100%
rename from home-manager/hosts/nixos-laptop/desktops/gnome/default.nix
rename to home-manager/hosts/nixos-framework/desktops/gnome/default.nix
diff --git a/home-manager/hosts/nixos-laptop/desktops/hyprland/default.nix b/home-manager/hosts/nixos-framework/desktops/hyprland/default.nix
similarity index 100%
rename from home-manager/hosts/nixos-laptop/desktops/hyprland/default.nix
rename to home-manager/hosts/nixos-framework/desktops/hyprland/default.nix
diff --git a/home-manager/hosts/nixos-vm-02/desktops/gnome/default.nix b/home-manager/hosts/nixos-vm-02/desktops/gnome/default.nix
deleted file mode 100644
index 077404aa..00000000
--- a/home-manager/hosts/nixos-vm-02/desktops/gnome/default.nix
+++ /dev/null
@@ -1,3 +0,0 @@
-{
-  
-}
\ No newline at end of file
diff --git a/home-manager/hosts/nixos-vm-02/desktops/hyprland/default.nix b/home-manager/hosts/nixos-vm-02/desktops/hyprland/default.nix
deleted file mode 100644
index e61a66bc..00000000
--- a/home-manager/hosts/nixos-vm-02/desktops/hyprland/default.nix
+++ /dev/null
@@ -1,51 +0,0 @@
-{ theme, ... }: {
-  home.file = {
-    ".config/hypr/hyprland.conf" = {
-      enable = true;
-      text = ''
-
-      # Monitor specific:
-      monitor=,2560x1440,auto,1
-      $mainMod = SUPER
-
-      # Start the config:
-      exec-once=bash ~/.config/hypr/start.sh
-    '';
-    };
-    # Set the custom launcher script
-    ".config/hypr/start.sh" = {
-        enable = true;
-        executable = true;
-        text = ''
-          #!/usr/bin/env bash
-          # https://wiki.hyprland.org/FAQ/#some-of-my-apps-take-a-really-long-time-to-open
-          dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP &
-
-          # Set the wallpaper
-          swww init
-
-          # Waybar
-          waybar &
-
-          # Set up the idle management daemon
-          swayidle -w \
-              timeout 120       'swaylock -f && playerctl pause' \
-              timeout 180       'hyprctl dispatch dpms off' \
-              timeout 300       'systemctl suspend-then-hibernate' \
-                   resume       'hyprctl dispatch dpms on' \
-                   before-sleep 'swaylock -f' \
-                   before-sleep 'playerctl pause' &
-
-          # Automatic device mounting 
-          udiskie &
-
-          DIR=/etc/nixos/git/wallpapers/${theme}
-          IMG=`ls $DIR | shuf -n 1`
-          swww img $DIR/$IMG -t random &
-
-          # Notification listener
-          mako 
-      '';
-    };
-  };
-}
diff --git a/lib/default.nix b/lib/default.nix
index 53f7164a..88e907c9 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -33,7 +33,7 @@
   };
 
   # Helper function for generating host configs
-  mkMinHost = { 
+  mkSmallHost = { 
     hostname, 
     username  ? "albert",
     desktop   ? null, 
diff --git a/nixos/hosts/nixos-desktop/default.nix b/nixos/hosts/nixos-desktop/default.nix
new file mode 100644
index 00000000..7635acb8
--- /dev/null
+++ b/nixos/hosts/nixos-desktop/default.nix
@@ -0,0 +1,52 @@
+{ config, lib, pkgs, modulesPath, desktop, username, ... }: {
+  imports = [ 
+    ./disks.nix
+    ../../common/modules/secureboot.nix
+  ];
+  # steam, nvidia-x11, etc
+  nixpkgs.config.allowUnfree = true;
+
+  boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "thunderbolt" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
+  boot.initrd.kernelModules = [ ];
+  boot.kernelModules = [ "kvm-intel" "acpi_call" ];
+  boot.extraModulePackages = with config.boot.kernelPackages; [ acpi_call ];
+
+  networking.useDHCP = lib.mkDefault true;
+  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
+  powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
+  hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
+
+  # Set your time zone.
+  time.timeZone = "Asia/Tokyo";
+
+  # Set the networking hostname:
+  networking.hostName = "nixos-desktop";
+
+  hardware = {
+    opengl = {
+      enable = true;
+      driSupport32Bit = true;
+      driSupport = true;
+    };
+
+    nvidia = {
+      open = false;
+      nvidiaSettings = true;
+      modesetting.enable = true;
+      };
+    };
+  };
+
+  environment.systemPackages = with pkgs; [ 
+    # nVidia gpu options
+    vulkan-loader
+    vulkan-validation-layers
+    vulkan-tools
+    gwe
+    nvtop-nvidia
+    # WINE
+    wineWowPackages.stable
+    winetricks
+    wineWowPackages.waylandFull
+  ];
+}
diff --git a/nixos/hosts/nixos-vm-02/disks.nix b/nixos/hosts/nixos-desktop/disks.nix
similarity index 88%
rename from nixos/hosts/nixos-vm-02/disks.nix
rename to nixos/hosts/nixos-desktop/disks.nix
index 5009ca60..8edbc748 100644
--- a/nixos/hosts/nixos-vm-02/disks.nix
+++ b/nixos/hosts/nixos-desktop/disks.nix
@@ -1,11 +1,11 @@
 {
-  boot.loader.grub.device = "/dev/sda";
-  boot.initrd.luks.devices."sda2".device = "/dev/sda2";
+  boot.loader.grub.device = "/dev/nvme0n1";
+  boot.initrd.luks.devices."ROOT".device = "/dev/nvme0n1p2";
   services.btrfs.autoScrub.enable = true;
   services.btrfs.autoScrub.interval = "weekly";
 
-  disko.devices.disk.sda = {
-    device = "/dev/sda";
+  disko.devices.disk.nvme0 = {
+    device = "/dev/nvme0n1";
     content = {
       type = "table";
       format = "gpt";
@@ -53,5 +53,5 @@
         } # partition 2 (/ BTRFS)
       ]; # partitions
     }; # content
-  }; # disko.devices.disk.sda
+  }; # disko.devices.disk.nvme0
 } # root
\ No newline at end of file
diff --git a/nixos/hosts/nixos-desktop/gnome-dconf.nix b/nixos/hosts/nixos-desktop/gnome-dconf.nix
deleted file mode 100644
index f338f235..00000000
--- a/nixos/hosts/nixos-desktop/gnome-dconf.nix
+++ /dev/null
@@ -1,195 +0,0 @@
-# Generated via dconf2nix: https://github.com/gvolpe/dconf2nix
-{ lib, ... }:
-
-with lib.hm.gvariant;
-
-{
-  dconf.settings = {
-    "apps/seahorse/listing" = {
-      keyrings-selected = [ "openssh:///home/albert/.ssh" ];
-    };
-
-    "org/gnome/GWeather4" = {
-      temperature-unit = "centigrade";
-    };
-
-    "org/gnome/Weather" = {
-      locations = "[<(uint32 2, <('Osaka International Airport', 'RJOO', false, [(0.60708368566759674, 2.3640484718263193)], @a(dd) [])>)>]";
-    };
-
-    "org/gnome/clocks" = {
-      world-clocks = "[{'location': <(uint32 2, <('Los Angeles', 'KCQT', true, [(0.59370283970450188, -2.0644336110828618)], [(0.59432360095955872, -2.063741622941031)])>)>}, {'location': <(uint32 2, <('Dallas', 'KDAL', true, [(0.57338429251143708, -1.690448351049749)], [(0.57217226606568217, -1.6895950770317414)])>)>}, {'location': <(uint32 2, <('Washington', 'KDCA', true, [(0.67803131976116615, -1.3444998506811625)], [(0.67884776733195662, -1.344538230471414)])>)>}, {'location': <(uint32 2, <('Coordinated Universal Time (UTC)', '@UTC', false, @a(dd) [], @a(dd) [])>)>}]";
-    };
-
-    "org/gnome/clocks/state/window" = {
-      maximized = false;
-      panel-id = "world";
-      size = mkTuple [ 870 690 ];
-    };
-
-    "org/gnome/desktop/app-folders" = {
-      folder-children = [ "Utilities" "YaST" ];
-    };
-
-    "org/gnome/desktop/app-folders/folders/Utilities" = {
-      apps = [ "gnome-abrt.desktop" "gnome-system-log.desktop" "nm-connection-editor.desktop" "org.gnome.baobab.desktop" "org.gnome.Connections.desktop" "org.gnome.DejaDup.desktop" "org.gnome.Dictionary.desktop" "org.gnome.DiskUtility.desktop" "org.gnome.eog.desktop" "org.gnome.Evince.desktop" "org.gnome.FileRoller.desktop" "org.gnome.fonts.desktop" "org.gnome.seahorse.Application.desktop" "org.gnome.tweaks.desktop" "org.gnome.Usage.desktop" "vinagre.desktop" ];
-      categories = [ "X-GNOME-Utilities" ];
-      name = "X-GNOME-Utilities.directory";
-      translate = true;
-    };
-
-    "org/gnome/desktop/app-folders/folders/YaST" = {
-      categories = [ "X-SuSE-YaST" ];
-      name = "suse-yast.directory";
-      translate = true;
-    };
-
-    "org/gnome/desktop/background" = {
-      color-shading-type = "solid";
-      picture-options = "zoom";
-      picture-uri = "file:///nix/store/4x0rqlvhvrzkbdigdr9mrgrb40cb52df-simple-blue-2016-02-19/share/backgrounds/nixos/nix-wallpaper-simple-blue.png";
-      picture-uri-dark = "file:///nix/store/81y0y8fl92izwbj47aj2d8f48hgsp3wn-simple-dark-gray-2016-02-19/share/backgrounds/nixos/nix-wallpaper-simple-dark-gray.png";
-      primary-color = "#3a4ba0";
-      secondary-color = "#2f302f";
-    };
-
-    "org/gnome/desktop/calendar" = {
-      show-weekdate = false;
-    };
-
-    "org/gnome/desktop/interface" = {
-      clock-show-date = true;
-      clock-show-weekday = false;
-      color-scheme = "prefer-dark";
-      cursor-theme = "Adwaita";
-      font-antialiasing = "grayscale";
-      font-hinting = "slight";
-      gtk-theme = "vimix-dark-doder";
-      icon-theme = "Vimix-Doder-dark";
-    };
-
-    "org/gnome/desktop/notifications" = {
-      show-banners = true;
-    };
-
-    "org/gnome/desktop/peripherals/touchpad" = {
-      tap-to-click = true;
-      two-finger-scrolling-enabled = true;
-    };
-
-    "org/gnome/desktop/wm/preferences" = {
-      button-layout = "appmenu:minimize,maximize,close";
-    };
-
-    "org/gnome/mutter" = {
-      edge-tiling = false;
-    };
-
-    "org/gnome/settings-daemon/plugins/color" = {
-      night-light-enabled = true;
-      night-light-temperature = mkUint32 3418;
-    };
-
-    "org/gnome/shell" = {
-      app-picker-layout = "[{'org.gnome.Extensions.desktop': <{'position': <0>}>, 'htop.desktop': <{'position': <1>}>, 'nixos-manual.desktop': <{'position': <2>}>, 'nvidia-settings.desktop': <{'position': <3>}>, 'vlc.desktop': <{'position': <4>}>, 'xterm.desktop': <{'position': <5>}>, 'org.gnome.Settings.desktop': <{'position': <6>}>, 'org.gnome.Calculator.desktop': <{'position': <7>}>, 'org.gnome.clocks.desktop': <{'position': <8>}>, 'org.gnome.Contacts.desktop': <{'position': <9>}>, 'simple-scan.desktop': <{'position': <10>}>, 'yelp.desktop': <{'position': <11>}>, 'org.gnome.Calendar.desktop': <{'position': <12>}>, 'gnome-system-monitor.desktop': <{'position': <13>}>, 'org.gnome.TextEditor.desktop': <{'position': <14>}>, 'Utilities': <{'position': <15>}>, 'org.gnome.Weather.desktop': <{'position': <16>}>, 'org.gnome.Photos.desktop': <{'position': <17>}>}]";
-      disable-user-extensions = false;
-      disabled-extensions = [ "workspace-indicator@gnome-shell-extensions.gcampax.github.com" ];
-      enabled-extensions = [ "blur-my-shell@aunetx" "caffeine@patapon.info" "dash-to-dock@micxgx.gmail.com" "user-theme@gnome-shell-extensions.gcampax.github.com" "Vitals@CoreCoding.com" "tiling-assistant@leleat-on-github" "hibernate-status@dromi" "nightthemeswitcher@romainvigier.fr" ];
-      favorite-apps = [ "org.gnome.Nautilus.desktop" "firefox.desktop" "org.gnome.Console.desktop" "bitwarden.desktop" "steam.desktop" "net.lutris.Lutris.desktop" ];
-      welcome-dialog-last-shown-version = "44.2";
-    };
-
-    "org/gnome/shell/extensions/caffeine" = {
-      indicator-position-max = 3;
-    };
-
-    "org/gnome/shell/extensions/dash-to-dock" = {
-      apply-custom-theme = false;
-      background-opacity = 0.8;
-      custom-theme-shrink = true;
-      dance-urgent-applications = true;
-      dash-max-icon-size = 40;
-      disable-overview-on-startup = true;
-      dock-position = "BOTTOM";
-      height-fraction = 0.9;
-      icon-size-fixed = false;
-      isolate-workspaces = false;
-      show-icons-emblems = true;
-      show-icons-notifications-counter = true;
-      show-show-apps-button = false;
-      show-windows-preview = true;
-      transparency-mode = "FIXED";
-    };
-
-    "org/gnome/shell/extensions/nightthemeswitcher/cursor-variants" = {
-      enabled = false;
-    };
-
-    "org/gnome/shell/extensions/nightthemeswitcher/gtk-variants" = {
-      day = "vimix-doder";
-      enabled = true;
-      night = "vimix-dark-doder";
-    };
-
-    "org/gnome/shell/extensions/nightthemeswitcher/icon-variants" = {
-      day = "Vimix-Doder";
-      enabled = true;
-      night = "Vimix-Doder-dark";
-    };
-
-    "org/gnome/shell/extensions/nightthemeswitcher/shell-variants" = {
-      day = "vimix-doder";
-      enabled = true;
-      night = "vimix-dark-doder";
-    };
-
-    "org/gnome/shell/extensions/nightthemeswitcher/time" = {
-      manual-schedule = true;
-      nightthemeswitcher-ondemand-keybinding = [ "<Shift><Super>t" ];
-      sunset = 19.0;
-    };
-
-    "org/gnome/shell/extensions/user-theme" = {
-      name = "vimix-dark-doder";
-    };
-
-    "org/gnome/shell/weather" = {
-      automatic-location = true;
-      locations = "[<(uint32 2, <('Osaka International Airport', 'RJOO', false, [(0.60708368566759674, 2.3640484718263193)], @a(dd) [])>)>]";
-    };
-
-    "org/gnome/tweaks" = {
-      show-extensions-notice = false;
-    };
-
-    "org/gtk/gtk4/settings/file-chooser" = {
-      date-format = "regular";
-      location-mode = "path-bar";
-      show-hidden = false;
-      show-size-column = true;
-      show-type-column = true;
-      sidebar-width = 140;
-      sort-column = "name";
-      sort-directories-first = false;
-      sort-order = "ascending";
-      type-format = "category";
-      view-type = "list";
-      window-size = mkTuple [ 859 453 ];
-    };
-
-    "org/gtk/settings/file-chooser" = {
-      date-format = "regular";
-      location-mode = "path-bar";
-      show-hidden = false;
-      show-size-column = true;
-      show-type-column = true;
-      sidebar-width = 175;
-      sort-column = "name";
-      sort-directories-first = false;
-      sort-order = "ascending";
-      type-format = "category";
-      window-position = mkTuple [ 30 26 ];
-      window-size = mkTuple [ 1203 902 ];
-    };
-  };
-}
diff --git a/nixos/hosts/nixos-linode-img/default.nix b/nixos/hosts/nixos-linode-img/default.nix
deleted file mode 100644
index 01862939..00000000
--- a/nixos/hosts/nixos-linode-img/default.nix
+++ /dev/null
@@ -1,12 +0,0 @@
-{ config, lib, pkgs, modulesPath, desktop, username, ... }: {
-  nixpkgs.config.allowUnfree = false;
-
-  # Linode-specific imaage assertions
-  networking.useDHCP = lib.mkForce true;
-  networking.enableIPv6 = lib.mkForce true;
-
-  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
-  networking.hostName = "nixos-linode-img";
-
-  networking.firewall.allowedTCPPorts = [ 22 ];
-}
diff --git a/nixos/hosts/nixos-vm-02/default.nix b/nixos/hosts/nixos-vm-02/default.nix
deleted file mode 100644
index 0455cba4..00000000
--- a/nixos/hosts/nixos-vm-02/default.nix
+++ /dev/null
@@ -1,22 +0,0 @@
-{ config, lib, pkgs, modulesPath, desktop, username, ... }: {
-  imports = [ 
-    # This machine won't be using secureboot
-    ../../common/modules/boot.nix
-    # Testing swap
-    ./disks.nix
-  ];
-  nixpkgs.config.allowUnfree = true;
-
-  boot.initrd.availableKernelModules = [ "ata_piix" "ohci_pci" "ehci_pci" "ahci" "sd_mod" "sr_mod" ];
-  boot.initrd.kernelModules = [ ];
-  boot.kernelModules = [ ];
-  boot.extraModulePackages = [ ];
-
-  networking.useDHCP = lib.mkDefault true;
-  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
-  virtualisation.virtualbox.guest.enable = true;
-  time.timeZone = "Asia/Tokyo";
-  networking.hostName = "nixos-vm-02";
-
-  networking.firewall.allowedTCPPorts = [ 22 ];
-}
\ No newline at end of file
diff --git a/nixos/hosts/osaka-vultr-01/default.nix b/nixos/hosts/osaka-vultr-01/default.nix
index f3b248b8..e7b1ca35 100644
--- a/nixos/hosts/osaka-vultr-01/default.nix
+++ b/nixos/hosts/osaka-vultr-01/default.nix
@@ -19,8 +19,9 @@
   time.timeZone = "Asia/Tokyo";
   networking.hostName = "osaka-vultr-01";
   
-  networking.firewall.allowedTCPPorts = [ 22 ];
-  
+  networking.firewall.allowedTCPPorts = [ 5120 22 ];
+  networking.firewall.allowedUDPPorts = [ 5120 ];
+
   # Generic Tailscale configs are in /nixos/common/services/tailscale.nix  
   # Set up the secrets file:
   sops.secrets."tailscale_keys/osaka-vultr-01" = {