From e1b6272aea6244a784e847798014dd73ba643e31 Mon Sep 17 00:00:00 2001 From: uttarayan21 Date: Sat, 1 Feb 2025 04:03:35 +0530 Subject: [PATCH] feat: Added lvm volume for sata ssds --- Makefile | 3 ++ nixos/mirai/configuration.nix | 4 +++ nixos/ryu/configuration.nix | 29 ++++++++++--------- nixos/ryu/disk-config.nix | 54 +++++++++++++++++++++++++++++++++++ nixos/ryu/ryu.nix | 26 +++++++++++++++-- 5 files changed, 101 insertions(+), 15 deletions(-) create mode 100644 nixos/ryu/disk-config.nix diff --git a/Makefile b/Makefile index b282a5ad..62e49687 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,9 @@ default: just just: just +build: + sudo nixos-rebuild build --flake . --show-trace + local: just local diff --git a/nixos/mirai/configuration.nix b/nixos/mirai/configuration.nix index 4bb7e1ce..80ed9401 100644 --- a/nixos/mirai/configuration.nix +++ b/nixos/mirai/configuration.nix @@ -52,6 +52,10 @@ extraGroups = ["wheel" "docker" "media"]; openssh.authorizedKeys.keyFiles = [../../secrets/id_ed25519.pub]; }; + users.users.remotebuilder = { + isNormalUser = true; + openssh.authorizedKeys.keyFiles = [../../secrets/remotebuilder.pub]; + }; users.groups.media = {}; nixpkgs.config.allowUnfree = true; diff --git a/nixos/ryu/configuration.nix b/nixos/ryu/configuration.nix index a1cc3fb2..ef2a1a51 100644 --- a/nixos/ryu/configuration.nix +++ b/nixos/ryu/configuration.nix @@ -32,6 +32,7 @@ libglvnd ]; }; + gnome-disks.enable = true; }; systemd.services.NetworkManager-wait-online.enable = lib.mkForce false; @@ -61,24 +62,25 @@ options = "--delete-older-than +5"; }; package = pkgs.nixVersions.latest; - buildMachines = [ - { - hostName = "sh.darksailor.dev"; - sshUser = "fs0c131y"; - system = "x86_64-linux"; - protocol = "ssh-ng"; - supportedFeatures = ["nixos-test" "benchmark" "big-parallel" "kvm"]; - } - ]; + # buildMachines = [ + # { + # hostName = "sh.darksailor.dev"; + # sshUser = "nixbuilder"; + # system = "x86_64-linux"; + # protocol = "ssh-ng"; + # supportedFeatures = ["nixos-test" "benchmark" "big-parallel" "kvm"]; + # } + # ]; distributedBuilds = true; }; users.users.servius = { isNormalUser = true; - extraGroups = ["networkmanager" "wheel" "audio" "i2c"]; + extraGroups = ["wheel" "audio" "i2c" "media"]; openssh.authorizedKeys.keyFiles = [../../secrets/id_ed25519.pub]; }; users.groups.i2c = {}; + users.groups.media = {}; services = { tailscale = { @@ -109,7 +111,6 @@ # }; # }; # }; - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. # Configure keymap in X11 xserver.xkb = { @@ -193,6 +194,9 @@ # proxy.default = "http://user:password@proxy:port/"; # proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + # useDHCP = true; + + hostId = "1349f9f0"; # Enable networking networkmanager.enable = true; @@ -250,8 +254,7 @@ # List packages installed in system profile. To search, run: # $ nix search wget systemPackages = with pkgs; [ - # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. - # wget + quickemu (nixvim.makeNixvim (import ../../neovim)) qpwgraph hyprland diff --git a/nixos/ryu/disk-config.nix b/nixos/ryu/disk-config.nix new file mode 100644 index 00000000..16e20505 --- /dev/null +++ b/nixos/ryu/disk-config.nix @@ -0,0 +1,54 @@ +{...}: { + disko.devices = { + disk = { + a = { + type = "disk"; + device = "/dev/sda"; + content = { + type = "gpt"; + partitions = { + primary = { + size = "100%"; + content = { + type = "lvm_pv"; + vg = "pool"; + }; + }; + }; + }; + }; + b = { + type = "disk"; + device = "/dev/sdb"; + content = { + type = "gpt"; + partitions = { + primary = { + size = "100%"; + content = { + type = "lvm_pv"; + vg = "pool"; + }; + }; + }; + }; + }; + }; + lvm_vg = { + pool = { + type = "lvm_vg"; + lvs = { + media = { + size = "100%"; + lvm_type = "raid0"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/media"; + }; + }; + }; + }; + }; + }; +} diff --git a/nixos/ryu/ryu.nix b/nixos/ryu/ryu.nix index a26d4109..da206c90 100644 --- a/nixos/ryu/ryu.nix +++ b/nixos/ryu/ryu.nix @@ -8,7 +8,10 @@ pkgs, ... }: { - imports = [(modulesPath + "/installer/scan/not-detected.nix")]; + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + # ./disk-config.nix + ]; hardware.graphics = { enable = true; @@ -71,8 +74,15 @@ boot.initrd.availableKernelModules = ["vmd" "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod"]; boot.initrd.kernelModules = ["nvidia" "nvidia_modeset" "nvidia_drm"]; - boot.kernelModules = ["kvm-intel" "i2c-dev"]; + boot.kernelModules = [ + # "vfio_pci" + # "vfio" + + "kvm-intel" + "i2c-dev" + ]; boot.extraModulePackages = []; + boot.kernelParams = ["intel_iommu=on"]; # services.udev.packages = [pkgs.yubikey-personalization pkgs.yubikey-personalization-gui pkgs.via]; services.udev.packages = [pkgs.via]; services.yubikey-agent.enable = true; @@ -102,6 +112,18 @@ fsType = "ext4"; }; + fileSystems."/media" = { + device = "/dev/storage/media"; + fsType = "ext4"; + options = ["users" "nofail"]; + }; + + fileSystems."/games" = { + device = "/dev/storage/games"; + fsType = "ext4"; + options = ["users" "nofail"]; + }; + swapDevices = []; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking