diff --git a/hosts/desktop/hardware.nix b/hosts/desktop/hardware.nix index e13d7f9..2d358d3 100644 --- a/hosts/desktop/hardware.nix +++ b/hosts/desktop/hardware.nix @@ -1,42 +1,40 @@ # 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, ... }: + { - config, - lib, - modulesPath, - username, - ... -}: { - imports = [(modulesPath + "/installer/scan/not-detected.nix")]; + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "uas" "sd_mod"]; - boot.initrd.kernelModules = []; - boot.kernelModules = ["kvm-amd"]; - boot.extraModulePackages = []; + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; - fileSystems."/" = { - device = "/dev/disk/by-uuid/a687e4e2-8665-43f1-9d62-3e3f21423579"; - fsType = "ext4"; - }; + fileSystems."/" = + { device = "/dev/disk/by-uuid/91413e4e-538c-4266-8a4d-bf60ec83e7b9"; + fsType = "ext4"; + }; - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/6EAD-2C48"; - fsType = "vfat"; - options = ["fmask=0022" "dmask=0022"]; - }; + fileSystems."/nix" = + { device = "/dev/disk/by-uuid/aad759e2-6c39-4350-89b9-07f2bc6eb3cc"; + fsType = "ext4"; + }; - fileSystems."/home" = { - device = "/dev/nvme0n1p5"; - fsType = "ext4"; - }; + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/F529-2C16"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; - fileSystems."/home/${username}/steamlib" = { - device = "/dev/nvme0n1p1"; - fsType = "ext4"; - }; + fileSystems."/home" = + { device = "/dev/disk/by-uuid/7edc690b-7e30-49d7-afbe-78354d0f7497"; + fsType = "ext4"; + }; - swapDevices = []; + 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 @@ -47,16 +45,5 @@ # networking.interfaces.wlp15s0.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware = { - cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; - keyboard.uhk.enable = true; - amdgpu.amdvlk = { - enable = false; - support32Bit.enable = true; - }; - bluetooth = { - enable = true; - powerOnBoot = true; - }; - }; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/hosts/installer/default.nix b/hosts/installer/default.nix index 62ceb87..b23779b 100644 --- a/hosts/installer/default.nix +++ b/hosts/installer/default.nix @@ -3,71 +3,7 @@ let nvim = inputs.nvim.packages."x86_64-linux".default; toilet = inputs.toilet.packages."x86_64-linux".default; - install-script = pkgs.writeShellScriptBin "movcfg-install" '' - #!/run/current-system/sw/bin/bash - set -e - trap 'echo "Aborting installation."; exit 1' INT - - # set up working directory - mkdir -p /tmp/install_pwd && cd /tmp/install_pwd - rm -rf ./* - - # download disko.nix file for defining partitions - echo -n "Downloading partition plan..." - curl -s https://raw.githubusercontent.com/pagedMov/pagedmov-nix-cfg/refs/heads/master/hosts/installer/disko-ext4-singledisk.nix > disko.nix - echo "Done!" - - echo - echo "This script is about to format and partition a hard drive." - sleep 2.5 - echo -e "\033[4;31mThis process is irreversible and will destroy all data on the drive.\033[0m" - sleep 2.5 - echo "Make absolutely sure that you know which drive you are choosing." - sleep 2.5 - echo - lsblk -d -o NAME,SIZE - echo - echo -n "Which drive do you wish to sacrifice? " - read -r drive - - size=$(lsblk -b -d -o NAME,SIZE | grep "$drive" | awk '{ printf "%.0f\n", $2 / 1024 / 1024 / 1024 }') - root_size=$(echo "scale=0;$size * 0.10 / 1" | bc) - nix_size=$(echo "scale=0;$size * 0.35 / 1" | bc) - - # commence formatting - nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko /tmp/install_pwd/disko.nix --arg device "\"/dev/$drive\"" --arg root_size "\"$root_size\G\"" --arg nix_size "\"$nix_size\G\"" - - mount /dev/disk/by-partlabel/disk-main-root /mnt - mkdir -p /mnt/nix && mount /dev/disk/by-partlabel/disk-main-nix /mnt/nix - mkdir -p /mnt/boot && mount /dev/disk/by-partlabel/disk-main-ESP /mnt/boot - mkdir -p /mnt/home && mount /dev/disk/by-partlabel/disk-main-home /mnt/home - - mkdir -p /mnt/etc - cd /mnt/etc/ - git clone https://github.com/pagedMov/pagedmov-nix-cfg.git ./nixos - - nixos-install --root /mnt --flake /mnt/etc/nixos#mercury --no-root-password - - echo - echo "Preliminary installation successful!" - echo "Adapting config to your setup..." - echo - - cp -r /mnt/etc/nixos /mnt/home/pagedmov/.sysflake - rm -rf /mnt/etc/nixos - ln -s /mnt/home/pagedmov/.sysflake /etc/nixos - - nixos-enter <<-HEREDOC - chown -R pagedmov /home/pagedmov/.sysflake - nixos-generate-config --show-hardware-config > /home/pagedmov/.sysflake/hosts/laptop/hardware.nix - NIXOS_SWITCH_USE_DIRTY_ENV=1 nixos-rebuild boot --flake /home/pagedmov/.sysflake#mercury - HEREDOC - - echo "INSTALLATION COMPLETE ! !" | toilet -f 3d -w 120 | lolcat -a -s 180 - echo "You can now reboot into your new system." - echo "The system configuration flake will be found in your home folder under .sysflake" - echo "/etc/nixos is a symlink leading to the .sysflake folder" - ''; + install-script = pkgs.writeShellScriptBin "movcfg-install" (builtins.readFile ./movcfg-install.sh); in { imports = [ @@ -87,7 +23,6 @@ in }; environment.systemPackages = with pkgs; [ - nvim nix-output-monitor nh nvd @@ -108,6 +43,7 @@ in usbutils toilet install-script + nvim ]; services = { diff --git a/hosts/installer/movcfg-install.sh b/hosts/installer/movcfg-install.sh new file mode 100644 index 0000000..ced7bd1 --- /dev/null +++ b/hosts/installer/movcfg-install.sh @@ -0,0 +1,152 @@ +#!/run/current-system/sw/bin/bash +set -e +trap 'echo "Aborting installation."; exit 1' INT + +# set up working directory +mkdir -p /tmp/install_pwd && cd /tmp/install_pwd +rm -rf ./* + +# download disko.nix file for defining partitions +echo -n "Downloading partition plan..." +curl -s https://raw.githubusercontent.com/pagedMov/pagedmov-nix-cfg/refs/heads/master/hosts/installer/disko-ext4-singledisk.nix > disko.nix +echo "Done!" + +echo +echo "This script is about to format and partition a hard drive." +sleep 2.5 +echo -e "\033[4;31mThis process is irreversible and will destroy all data on the drive.\033[0m" +sleep 2.5 +echo "Make absolutely sure that you know which drive you are choosing." +sleep 2.5 +echo +lsblk -d -o NAME,SIZE +echo +echo -n "Which drive do you wish to sacrifice? " +read -r drive + +size=$(lsblk -b -d -o NAME,SIZE | grep "$drive" | awk '{ printf "%.0f\n", $2 / 1024 / 1024 / 1024 }') +size=$((size-1)) +root_size_default=$(echo "scale=0;$size * 0.10 / 1" | bc) +nix_size_default=$(echo "scale=0;$size * 0.35 / 1" | bc) + +for part in "root" "nix"; do + echo "You have $size GB remaining to work with on this drive. How big do you want your $part partition?" + + if [ "$part" = "root" ]; then + echo "Default value is 10% of hard drive space ($root_size_default GB)" + else + echo "Default value is 35% of hard drive space ($nix_size_default GB)" + fi + echo "Give a positive integer or leave blank to use default value" + deciding=true + + while $deciding; do + echo -n "> " + read -r size_choice + + case "$size_choice" in + '') + deciding=false + ;; + *[!0-9]*) # Matches non-numeric input + echo "Invalid input. Please enter a valid positive number." + ;; + 0) # Matches zero + echo "Please enter a positive number greater than zero." + ;; + *) # Matches positive numbers + if (( size_choice > size - 50 )); then + echo "You need to leave more room for the other partitions." + elif (( size_choice < 5 )); then + echo "Partition size is too small." + else + echo "Valid input: $size_choice" + deciding=false # Exit the loop on valid input + fi + ;; + esac + done + + case "$part" in + "root" ) + if [ -z "$size_choice" ]; then root_size=$root_size_default; else root_size=$size_choice; fi + size=$((size - root_size)) + ;; + "nix" ) + if [ -z "$size_choice" ]; then nix_size=$nix_size_default; else nix_size=$size_choice; fi + size=$((size - nix_size)) + ;; + esac +done + +echo "Final partition sizes:" +echo "root: $root_size GB" +echo "nix: $nix_size GB" +echo "home: $size GB" + +sleep 1 + +# commence formatting +echo "Commencing formatting/partitioning..." && sleep 0.5 +nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko /tmp/install_pwd/disko.nix --arg device "\"/dev/$drive\"" --arg root_size "\"$root_size\G\"" --arg nix_size "\"$nix_size\G\"" + +mount /dev/disk/by-partlabel/disk-main-root /mnt +mkdir -p /mnt/nix && mount /dev/disk/by-partlabel/disk-main-nix /mnt/nix +mkdir -p /mnt/boot && mount /dev/disk/by-partlabel/disk-main-ESP /mnt/boot +mkdir -p /mnt/home && mount /dev/disk/by-partlabel/disk-main-home /mnt/home + +mkdir -p /mnt/etc +cd /mnt/etc/ +[ -d /mnt/etc/nixos ] && rm -rf /mnt/etc/nixos +git clone https://github.com/pagedMov/pagedmov-nix-cfg.git ./nixos + +echo "Do you want to install the light or heavy configuration?" +echo "Light configuration does not include gaming or virtualization features; intended for laptops, etc." +echo "Heavy config includes gaming and virtualization features; intended for performant desktop environments." +select config in "Heavy" "Light" "Quit"; do + case $config in + "Desktop") + echo "Installing heavy configuration \`Oganesson\`" + config="oganesson" + sleep 0.5 + break + ;; + "Laptop") + echo "Installing light configuration \`Mercury\`" + config="mercury" + sleep 0.5 + break + ;; + "Quit") + echo "Exiting installation..." + sleep 0.5 + exit 0 + ;; + *) + echo "Invalid option." + sleep 0.5 + ;; + esac +done + +nixos-install --root /mnt --flake /mnt/etc/nixos#"$config" --no-root-password + +echo +echo "Preliminary installation successful!" +echo "Adapting config to your setup..." +echo + +cp -r /mnt/etc/nixos /mnt/home/pagedmov/.sysflake +rm -rf /mnt/etc/nixos +ln -s /mnt/home/pagedmov/.sysflake /etc/nixos + +nixos-enter <<-HEREDOC +chown -R pagedmov /home/pagedmov/.sysflake +nixos-generate-config --show-hardware-config > /home/pagedmov/.sysflake/hosts/laptop/hardware.nix +NIXOS_SWITCH_USE_DIRTY_ENV=1 nixos-rebuild boot --flake /home/pagedmov/.sysflake#mercury +HEREDOC + +echo "INSTALLATION COMPLETE ! !" | toilet -f 3d -w 120 | lolcat -a -s 180 +echo "You can now reboot into your new system." +echo "The system configuration flake will be found in your home folder under .sysflake" +echo "/etc/nixos is a symlink leading to the .sysflake folder" diff --git a/hosts/laptop/hardware.nix b/hosts/laptop/hardware.nix index 2cf82a4..2d358d3 100644 --- a/hosts/laptop/hardware.nix +++ b/hosts/laptop/hardware.nix @@ -1,43 +1,49 @@ # 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, ... }: + { - config, - lib, - pkgs, - modulesPath, - ... -}: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = ["xhci_pci" "ehci_pci" "ahci" "sd_mod" "rtsx_pci_sdmmc"]; - boot.initrd.kernelModules = []; - boot.kernelModules = ["kvm-intel"]; - boot.extraModulePackages = []; + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; - fileSystems."/" = { - device = "/dev/disk/by-uuid/334f742b-460f-43f8-b819-33086adfa9fb"; - fsType = "ext4"; - }; + fileSystems."/" = + { device = "/dev/disk/by-uuid/91413e4e-538c-4266-8a4d-bf60ec83e7b9"; + fsType = "ext4"; + }; - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/ECD9-F43B"; - fsType = "vfat"; - options = ["fmask=0022" "dmask=0022"]; - }; + fileSystems."/nix" = + { device = "/dev/disk/by-uuid/aad759e2-6c39-4350-89b9-07f2bc6eb3cc"; + fsType = "ext4"; + }; - swapDevices = []; + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/F529-2C16"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/7edc690b-7e30-49d7-afbe-78354d0f7497"; + fsType = "ext4"; + }; + + 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.enp0s25.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true; + # networking.interfaces.enp14s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp15s0.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/modules/sys/software/sddm.nix b/modules/sys/software/sddm.nix index cdbebb5..5469cb6 100644 --- a/modules/sys/software/sddm.nix +++ b/modules/sys/software/sddm.nix @@ -15,7 +15,7 @@ ) ]; services.displayManager.sddm = { - enable = false; + enable = true; wayland.enable = true; theme = "catppuccin-mocha"; package = pkgs.kdePackages.sddm; diff --git a/modules/sys/software/users.nix b/modules/sys/software/users.nix index 4876b7c..4a0b9e2 100644 --- a/modules/sys/software/users.nix +++ b/modules/sys/software/users.nix @@ -41,10 +41,10 @@ in { users = { groups.persist = {}; users = { - root.hashedPassword = "$y$j9T$/eZO.0cE2EcsF4od78laE/$A3kqgNhr6LkUZHI/0MXAhk.SSKk7QsCIwH/l6xeryy8"; + root.initialPassword = "1234"; ${username} = { isNormalUser = true; - initialPassword = "1111"; + initialPassword = "1234"; shell = pkgs.zsh; extraGroups = ["wheel" "persist" "libvirtd"]; };