From 45f253e7b64dee06dfa05af8b10af5a4e73727f0 Mon Sep 17 00:00:00 2001 From: Ryan Pandya Date: Fri, 31 Jan 2025 23:00:23 -0800 Subject: [PATCH] Add ryanpandya.com host --- flake.nix | 31 ++++ hosts/ryanpandya.com/default.nix | 152 ++++++++++++++++++ .../ryanpandya.com/hardware-configuration.nix | 52 ++++++ modules/apps/hyprland/default.nix | 1 + modules/apps/vscode/default.nix | 14 +- modules/profiles/server.nix | 35 ++++ todo | 4 +- 7 files changed, 281 insertions(+), 8 deletions(-) create mode 100644 hosts/ryanpandya.com/default.nix create mode 100644 hosts/ryanpandya.com/hardware-configuration.nix create mode 100644 modules/profiles/server.nix diff --git a/flake.nix b/flake.nix index 780a274..3496ca4 100644 --- a/flake.nix +++ b/flake.nix @@ -257,6 +257,37 @@ } ]; }; + # Ryanpandya.com + starship = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + + specialArgs = { + inherit inputs username; + vars = vars; + }; + + modules = [ + ./hosts/ryanpandya.com + + inputs.sops-nix.nixosModules.sops + home-manager.nixosModules.home-manager + { + home-manager = { + backupFileExtension = "hmbak"; + useGlobalPkgs = true; + useUserPackages = true; + extraSpecialArgs = { + inherit inputs vars username; + }; + sharedModules = with inputs; [ + nix-index-database.hmModules.nix-index + nur.modules.homeManager.default + sops-nix.homeManagerModules.sops + ]; + }; + } + ]; + }; }; }; } diff --git a/hosts/ryanpandya.com/default.nix b/hosts/ryanpandya.com/default.nix new file mode 100644 index 0000000..e893338 --- /dev/null +++ b/hosts/ryanpandya.com/default.nix @@ -0,0 +1,152 @@ +{ + lib, + host, + ... +}: +{ + imports = [ + ./hardware-configuration.nix + # Profiles + ../../modules + # Users + ../../users + ]; + + # Users + ryan.enable = true; + + # Custom modules + unfree.enable = true; + server.enable = true; + + boot = { + initrd = { + availableKernelModules = lib.mkDefault [ + "nvme" + "xhci_pci" + "ahci" + "usb_storage" + "usbhid" + "sd_mod" + "sr_mod" + ]; + }; + kernelModules = lib.mkDefault [ + "dm-snapshot" + "kvm-amd" + "tcp_bbr" + "uinput" + ]; + kernelParams = lib.mkDefault [ + "amd_iommu=on" + "amd_pstate=active" + ]; + # loader = { + # systemd-boot = { + # windows = { + # "11" = { + # title = "Windows 11"; + # efiDeviceHandle = "HD3b"; + # sortKey = "z_windows"; + # }; + # }; + # }; + # }; + # tmp.tmpfsSize = "100%"; + }; + + hardware = { + amdgpu.initrd.enable = true; + cpu.amd.updateMicrocode = true; + }; + + networking = { + hostName = "orion"; + wireless.enable = false; + }; + + powerManagement.cpuFreqGovernor = "ondemand"; + + # services = { + # beesd = { + # filesystems = { + # games = { + # spec = "/home/${username}/Games"; + # verbosity = "crit"; + # extraOptions = [ + # "--loadavg-target" + # "5.0" + # ]; + # }; + # }; + # }; + # pipewire = { + # extraConfig = { + # pipewire = { + # "10-clock-rate" = { + # "context.properties" = { + # # To make DAC properly work + # "default.clock.allowed-rates" = [ + # 44100 + # 48000 + # 88200 + # 96000 + # 176400 + # 192000 + # ]; + # "default.clock.quantum" = 512; + # "default.clock.min-quantum" = 512; + # "default.clock.max-quantum" = 512; + # }; + # }; + # # Create mono-only microphone output + # "10-loopback-mono-mic" = { + # "context.modules" = [ + # { + # "name" = "libpipewire-module-loopback"; + # "args" = { + # "node.description" = "Samson G-Track Pro [MONO]"; + # "capture.props" = { + # "node.name" = "capture.mono-microphone"; + # "audio.position" = [ "FL" ]; + # "target.object" = + # "alsa_input.usb-Samson_Technologies_Samson_G-Track_Pro_D0B3381619112B00-00.analog-stereo"; + # "stream.dont-remix" = true; + # "node.passive" = true; + # }; + # "playback.props" = { + # "media.class" = "Audio/Source"; + # "node.name" = "mono-microphone"; + # "audio.position" = [ "MONO" ]; + # }; + # }; + # } + # ]; + # }; + # }; + # }; + # }; + # ucodenix = { + # enable = true; + # cpuModelId = "00A60F12"; + # }; + # udev = { + # # TODO: Remove when Linux 6.13 is out: https://www.phoronix.com/news/AMDGPU-More-Aggressive-Power + # extraRules = '' + # # https://reddit.com/r/linux_gaming/comments/196tz6v/psa_amdgpu_power_management_may_fix_your/khxs3q3/?context=3 https://gitlab.freedesktop.org/drm/amd/-/issues/1500#note_825883 + # # https://gitlab.freedesktop.org/drm/amd/-/issues/1500#note_1854170 + # KERNEL=="card1", SUBSYSTEM=="drm", DRIVERS=="amdgpu", ATTR{device/power_dpm_force_performance_level}="manual", ATTR{device/pp_power_profile_mode}="1" + # ''; + # }; + # }; + + systemd.targets = { + hibernate.enable = false; + hybrid-sleep.enable = false; + }; + + zramSwap = { + enable = true; + }; + +} diff --git a/hosts/ryanpandya.com/hardware-configuration.nix b/hosts/ryanpandya.com/hardware-configuration.nix new file mode 100644 index 0000000..603cb65 --- /dev/null +++ b/hosts/ryanpandya.com/hardware-configuration.nix @@ -0,0 +1,52 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "tmpfs"; + fsType = "tmpfs"; + }; + + fileSystems."/iso" = + { device = "/dev/disk/by-uuid/1980-01-01-00-00-00-00"; + fsType = "iso9660"; + }; + + fileSystems."/nix/.ro-store" = + { device = "/iso/nix-store.squashfs"; + fsType = "squashfs"; + options = [ "loop" ]; + }; + + fileSystems."/nix/.rw-store" = + { device = "tmpfs"; + fsType = "tmpfs"; + }; + + fileSystems."/nix/store" = + { device = "overlay"; + fsType = "overlay"; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.ens3.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} \ No newline at end of file diff --git a/modules/apps/hyprland/default.nix b/modules/apps/hyprland/default.nix index 485cedb..b36dfc6 100644 --- a/modules/apps/hyprland/default.nix +++ b/modules/apps/hyprland/default.nix @@ -43,6 +43,7 @@ with lib; env = QT_AUTO_SCREEN_SCALE_FACTOR, 1 env = SDL_VIDEODRIVER, x11 env = MOZ_ENABLE_WAYLAND, 1 + env = ANKI_WAYLAND, 1 exec-once = dbus-update-activation-environment --systemd --all exec-once = systemctl --user import-environment QT_QPA_PLATFORMTHEME WAYLAND_DISPLAY XDG_CURRENT_DESKTOP exec-once = killall -q swww;sleep .5 && swww init diff --git a/modules/apps/vscode/default.nix b/modules/apps/vscode/default.nix index bfbdb63..91b491b 100644 --- a/modules/apps/vscode/default.nix +++ b/modules/apps/vscode/default.nix @@ -54,7 +54,7 @@ in enableExtensionUpdateCheck = false; enableUpdateCheck = false; extensions = marketplace-extensions; - package = pkgs.vscodium; + package = pkgs.vscode; # pkgs.vscodium userSettings = { "ansible.ansible.path" = "ansible"; "ansible.python.interpreterPath" = "python"; @@ -82,10 +82,10 @@ in "nix.serverSettings"."nixd"."formatting"."command" = [ "nixfmt" ]; "nix.serverSettings"."nixd"."formatting"."options" = { "enable" = [ true ]; - "nixos" = { - "expr" = - "(builtins.getFlake \"github:keenanweaver/nix-config\").nixosConfigurations.${config.networking.hostName}.options"; - }; + # "nixos" = { + # "expr" = + # "(builtins.getFlake \"github:keenanweaver/nix-config\").nixosConfigurations.${config.networking.hostName}.options"; + # }; }; "powershell.powerShellAdditionalExePaths"."exePath" = "${pkgs.powershell}/bin/pwsh"; "powershell.integratedConsole.focusConsoleOnExecute" = false; @@ -101,8 +101,10 @@ in "terminal.integrated.minimumContrastRatio" = 1; "terminal.integrated.shellIntegration.enabled" = true; "window.titleBarStyle" = "custom"; - "workbench.editorAssociations"."git-rebase-todo" = "gitlens.rebase"; "workbench.sideBar.location" = "right"; + "[dockerfile]" = { + "editor.defaultFormatter" = "ms-azuretools.vscode-docker"; + }; }; }; }; diff --git a/modules/profiles/server.nix b/modules/profiles/server.nix new file mode 100644 index 0000000..8cd0338 --- /dev/null +++ b/modules/profiles/server.nix @@ -0,0 +1,35 @@ +{ + lib, + config, + username, + ... +}: +let + cfg = config.server; +in +{ + imports = [ ./base.nix ]; + + options = { + server = { + enable = lib.mkEnableOption "Enable server in NixOS"; + }; + }; + config = lib.mkIf cfg.enable { + # Custom modules + base.enable = true; + catppuccinTheming.enable = lib.mkForce false; + packages.enable = lib.mkForce false; + + # Server tweaks + boxxy.enable = lib.mkForce false; + distrobox.enable = lib.mkForce false; + mullvad.enable = lib.mkForce false; + office.enable = lib.mkForce false; + pipewire.enable = lib.mkForce false; + tailscale.enable = lib.mkForce false; + #virtualization.enable = lib.mkForce false; + + home-manager.users.${username} = { }; + }; +} \ No newline at end of file diff --git a/todo b/todo index 1b451fc..0317621 100644 --- a/todo +++ b/todo @@ -7,11 +7,11 @@ DONE boot into Hyprland DONE zsh error DONE sync with thalia (sops, ssh, etc) DONE thalia sunshine output -TODO autologin on boot +DONE autologin on boot TODO displayManager theming TODO ags TODO sudo nopasswd TODO brightness controls TODO sounds (disable bell!!!) TODO KDEConnect -TODO Numlock \ No newline at end of file +DONE Numlock \ No newline at end of file