From b93969cf3449ba12058bb9bf90c157d76e90440f Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Thu, 27 Jul 2023 01:17:17 -0700 Subject: [PATCH] Add msi host --- flake.nix | 15 +++++++++++ modules/system.nix | 3 ++- systems/msi/default.nix | 11 ++++++++ systems/msi/hardware-configuration.nix | 36 ++++++++++++++++++++++++++ systems/msi/hardware.nix | 18 +++++++++++++ systems/msi/hyprland/default.nix | 6 +++++ systems/msi/hyprland/hyprland.conf | 24 +++++++++++++++++ systems/msi/mullvad.nix | 4 +++ 8 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 systems/msi/default.nix create mode 100644 systems/msi/hardware-configuration.nix create mode 100644 systems/msi/hardware.nix create mode 100644 systems/msi/hyprland/default.nix create mode 100644 systems/msi/hyprland/hyprland.conf create mode 100644 systems/msi/mullvad.nix diff --git a/flake.nix b/flake.nix index a8ba1c7..3bdb6dc 100755 --- a/flake.nix +++ b/flake.nix @@ -50,6 +50,20 @@ outputs = inputs @ { self, nixpkgs, ... }: { nixosConfigurations = { + msi = nixpkgs.lib.nixosSystem rec { + system = "x86_64-linux"; + specialArgs = { inherit self system inputs; }; + + modules = [ + ./modules/impurity.nix + ./modules/preserve-system.nix + ./modules/devenv + ./modules/system.nix + ./modules/hyprland + ./systems/msi + ]; + }; + lenovo = nixpkgs.lib.nixosSystem rec { system = "x86_64-linux"; specialArgs = { inherit self system inputs; }; @@ -64,6 +78,7 @@ ]; }; + msi-impure = self.nixosConfigurations.msi.extendModules { modules = [ { impurity.enable = true; } ]; }; lenovo-impure = self.nixosConfigurations.lenovo.extendModules { modules = [ { impurity.enable = true; } ]; }; }; diff --git a/modules/system.nix b/modules/system.nix index aeac44b..0fa237b 100644 --- a/modules/system.nix +++ b/modules/system.nix @@ -21,6 +21,8 @@ environment.systemPackages = with pkgs; [ git vim + ]; + networking = { networkmanager = { enable = true; @@ -41,5 +43,4 @@ # removable disks in file manager services.udisks2.enable = true; - ]; } diff --git a/systems/msi/default.nix b/systems/msi/default.nix new file mode 100644 index 0000000..1dfb2b1 --- /dev/null +++ b/systems/msi/default.nix @@ -0,0 +1,11 @@ +{ pkgs, ... }: { + imports = [ + ./hardware.nix + ./mullvad.nix + ./hyprland + ]; + + system.stateVersion = "23.11"; + networking.hostName = "msi"; + time.timeZone = "America/Vancouver"; +} diff --git a/systems/msi/hardware-configuration.nix b/systems/msi/hardware-configuration.nix new file mode 100644 index 0000000..5056963 --- /dev/null +++ b/systems/msi/hardware-configuration.nix @@ -0,0 +1,36 @@ +# 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 + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/c9cb1730-c0d1-4a2e-a092-12dfa7098476"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/9BF9-E3ED"; + fsType = "vfat"; + }; + + 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.wlp4s0.useDHCP = lib.mkDefault true; + + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/systems/msi/hardware.nix b/systems/msi/hardware.nix new file mode 100644 index 0000000..a0a1b8c --- /dev/null +++ b/systems/msi/hardware.nix @@ -0,0 +1,18 @@ +{ pkgs, ... }: { + imports = [ ./hardware-configuration.nix ]; + + hardware.opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + + extraPackages = with pkgs; [ + rocm-opencl-icd + amdvlk + ]; + + extraPackages32 = with pkgs; [ + driversi686Linux.amdvlk + ]; + }; +} diff --git a/systems/msi/hyprland/default.nix b/systems/msi/hyprland/default.nix new file mode 100644 index 0000000..86bc465 --- /dev/null +++ b/systems/msi/hyprland/default.nix @@ -0,0 +1,6 @@ +{ impurity, ... }: { + hyprland-session = { + prerun = "export WLR_DRM_DEVICES=/dev/dri/card0:/dev/dri/card1"; + extraConfig = "source = ${impurity.link ./hyprland.conf}"; + }; +} diff --git a/systems/msi/hyprland/hyprland.conf b/systems/msi/hyprland/hyprland.conf new file mode 100644 index 0000000..5eb65e6 --- /dev/null +++ b/systems/msi/hyprland/hyprland.conf @@ -0,0 +1,24 @@ +monitor = eDP-1, 1920x1080@240Hz, 0x1440, 1 +monitor = DP-1, 5120x1440@120Hz, 1350x0, 1 +monitor = , preferred, auto, 1 + +workspace = 01, monitor:DP-1, default:true +workspace = 02, monitor:DP-1 +workspace = 03, monitor:DP-1 +workspace = 04, monitor:DP-1 +workspace = 05, monitor:DP-1 +workspace = 06, monitor:DP-1 +workspace = 07, monitor:DP-1 +workspace = 08, monitor:DP-1 +workspace = 09, monitor:DP-1 +workspace = 10, monitor:DP-1 +workspace = 11, monitor:eDP-1, default:true +workspace = 12, monitor:eDP-1 +workspace = 13, monitor:eDP-1 +workspace = 14, monitor:eDP-1 +workspace = 15, monitor:eDP-1 +workspace = 16, monitor:eDP-1 +workspace = 17, monitor:eDP-1 +workspace = 18, monitor:eDP-1 +workspace = 19, monitor:eDP-1 +workspace = 20, monitor:eDP-1 \ No newline at end of file diff --git a/systems/msi/mullvad.nix b/systems/msi/mullvad.nix new file mode 100644 index 0000000..f2e2622 --- /dev/null +++ b/systems/msi/mullvad.nix @@ -0,0 +1,4 @@ +{ pkgs, config, ... }: { + services.mullvad-vpn.enable = true; + home-manager.users.${config.main-user}.home.packages = [ pkgs.mullvad-vpn ]; +}