diff --git a/README.md b/README.md index 3e5c300..03f68d6 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ This installer does the following at it's core: - Partition the drive of your choice - Installs a base of NixOS +- Installs Plasma +- Installs needed packages Tested on the following drives: - SATA @@ -32,8 +34,9 @@ The following will happen: - Clear partition table for `/dev/***`. - Creates a GPT partition table for `/dev/***`. - Create a +512M EFI partiton at `/dev/***1`. -- Create a encrypted root partition at `/dev/***2`. -- Create a swap partition at `/dev/***3` with the choice to set it as the same size as the RAM. +- Create a encrypted LVM at `/dev/***2`. +- Create a swap partition in the LVM with the choice to set it as the same size as the RAM. +- Create a root partition in the LVM. - Install systemd-boot. ## After Installation ... diff --git a/config-gnome.nix b/config-gnome.nix index 4f60b4e..b93d1a7 100644 --- a/config-gnome.nix +++ b/config-gnome.nix @@ -13,8 +13,18 @@ systemd-boot.enable = true; }; + boot.initrd.luks.devices = { + crypt-root = { + device = "/dev/disk/by-label/luks"; + preLVM = true; + }; + }; + + # Enable 32 Bit libraries for applications like Steam + hardware.opengl.driSupport32Bit = true; + # Name your host machine - networking.hostName = "NixOS-VM"; + networking.hostName = "NixOS"; # Set your time zone. time.timeZone = "America/Denver"; @@ -22,6 +32,15 @@ # Enter keyboard layout services.xserver.layout = "us"; + # Enable flatpak + services.flatpak.enable = true; + + # Enable PackageKit for Discover + services.packagekit.enable = true; + + # Enable fwupd + services.fwupd.enable = true; + # Define user accounts users.extraUsers = { @@ -37,15 +56,26 @@ environment.systemPackages = with pkgs; [ - thunderbird firefox fish + flatpak + git + thunderbird tilix ]; # Enable the OpenSSH daemon services.openssh.enable = true; + # Enable Pipewire + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + # GNOME services.xserver.enable = true; services.xserver.displayManager.gdm.enable = true; diff --git a/config-plasma.nix b/config-plasma.nix new file mode 100644 index 0000000..a982e0e --- /dev/null +++ b/config-plasma.nix @@ -0,0 +1,86 @@ +{ config, pkgs, ... }: + +{ + # Import other configuration modules + # (hardware-configuration.nix is autogenerated upon installation) + # paths in nix expressions are always relative the file which defines them + imports = + [ + ./hardware-configuration.nix + ]; + + boot.loader = { + systemd-boot.enable = true; + }; + + boot.initrd.luks.devices = { + crypt-root = { + device = "/dev/disk/by-label/luks"; + preLVM = true; + }; + }; + + # Enable 32 Bit libraries for applications like Steam + hardware.opengl.driSupport32Bit = true; + + # Name your host machine + networking.hostName = "NixOS"; + + # Set your time zone. + time.timeZone = "America/Denver"; + + # Enter keyboard layout + services.xserver.layout = "us"; + + # Enable flatpak + services.flatpak.enable = true; + + # Enable PackageKit for Discover + services.packagekit.enable = true; + + # Enable fwupd + services.fwupd.enable = true; + + # Define user accounts + users.extraUsers = + { + aaronh = + { + home = "/home/aaronh"; + extraGroups = [ "wheel" "networkmanager" ]; + isNormalUser = true; + }; + }; + + # Install some packages + environment.systemPackages = + with pkgs; + [ + firefox + fish + flatpak + git + thunderbird + tilix + ]; + + # Enable the OpenSSH daemon + services.openssh.enable = true; + + # Enable Pipewire + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + # Enable CUPS + services.printing.enable = true; + + # System + system.autoUpgrade.enable = true; + system.autoUpgrade.allowReboot = true; + +} diff --git a/install.sh b/install.sh index 725f9ed..a826582 100644 --- a/install.sh +++ b/install.sh @@ -21,8 +21,6 @@ echo +512M # Set +512M as last sector. echo n # Create new partition (for root). echo # Set default partition number. echo # Set default first sector. -echo "-$ramTotal"G # Set Max RAM as last sector. -# echo -4096M # Set -4096 as last sector. echo n # Create new partition (for swap). echo # Set default partition number. echo # Set default first sector. @@ -30,9 +28,6 @@ echo # Set default last sector (rest of the disk). echo t # Change partition type. echo 1 # Pick first partition. echo 1 # Change first partition to EFI system. -echo t # Change partition type. -echo 3 # Pick third partition. -echo 19 # Change third partition to Linux swap. echo w # write changes. ) | sudo fdisk $driveName -w always -W always @@ -49,9 +44,8 @@ echo "" echo "Which is the root partition?" read rootName -echo "" -echo "Which is the swap partition?" -read swapName +# Create EFI partition +sudo mkfs.fat -F32 -n EFI $efiName # Encrypt the root partition sudo cryptsetup luksFormat -v -s 512 -h sha512 $rootName @@ -59,34 +53,59 @@ sudo cryptsetup luksFormat -v -s 512 -h sha512 $rootName # Open the encrypted root partition sudo cryptsetup luksOpen $rootName crypt-root -sudo mkfs.fat -F32 -n EFI $efiName # EFI partition -sudo mkfs.ext4 -L root /dev/mapper/crypt-root # / partition -sudo mkswap -L swap $swapName # swap partition +sudo pvcreate /dev/mapper/crypt-root +sudo vgcreate lvm /dev/mapper/crypt-root + +sudo lvcreate --size "$ramTotal"G --name swap lvm +sudo lvcreate --extents 100%FREE --name root lvm + +sudo cryptsetup config $rootName --label luks + +sudo mkswap /dev/lvm/swap # swap partition +sudo mkfs.btrfs -L root /dev/lvm/root # /root partition # 0. Mount the filesystems. -sudo mount /dev/disk/by-label/root /mnt -sudo swapon $swapName +sudo swapon /dev/lvm/swap +sudo mount /dev/lvm/root /mnt -# 1. Create directory to mount EFI partition. +# Create Subvolumes +sudo btrfs subvolume create /mnt/@ +sudo btrfs subvolume create /mnt/@home + +# Unmount root +sudo umount /mnt + +# Mount the subvolumes. +sudo mount -o noatime,commit=120,compress=zstd:10,space_cache,subvol=@ /dev/lvm/root /mnt + +sudo mkdir /mnt/home/ +sudo mount -o noatime,commit=120,compress=zstd:10,space_cache,subvol=@home /dev/lvm/root /mnt/home + +# Mount the EFI partition. sudo mkdir /mnt/boot/ - -# 2.Mount the EFI partition. sudo mount $efiName /mnt/boot # Generate Nix configuration sudo nixos-generate-config --root /mnt -curl https://gitlab.com/ahoneybun/nixos-cli-installer/-/raw/main/config-gnome.nix > configuration.nix; sudo mv -f configuration.nix /mnt/etc/nixos/ +curl https://gitlab.com/ahoneybun/nixos-cli-installer/-/raw/main/config-plasma.nix > configuration.nix; sudo mv -f configuration.nix /mnt/etc/nixos/ # Install sudo nixos-install -# Enter into installed OS -# sudo mount -o bind /dev /mnt/dev -# sudo mount -o bind /proc /mnt/proc -# sudo mount -o bind /sys /mnt/sys -# sudo chroot /mnt /nix/var/nix/profiles/system/activate -# sudo chroot /mnt /run/current-system/sw/bin/bash +# Start Setup section +# sudo -i +# curl https://gitlab.com/ahoneybun/nixos-cli-installer/-/raw/main/setup.sh > /mnt/setup.sh -# Removed downloaded script. +# Enter into installed OS +sudo mount -o bind /dev /mnt/dev +sudo mount -o bind /proc /mnt/proc +sudo mount -o bind /sys /mnt/sys +sudo chroot /mnt /nix/var/nix/profiles/system/activate +sudo chroot /mnt /run/current-system/sw/bin/sh setup.sh + +# Removed install script. rm install.sh + +# Remove setup script +rm setup.sh diff --git a/setup.sh b/setup.sh new file mode 100644 index 0000000..a135bd2 --- /dev/null +++ b/setup.sh @@ -0,0 +1,13 @@ +# Set user password +echo "----------" +echo "" +echo "Which is the username?" +read userName + +sudo passwd $userName + +# Create Directories +mkdir /home/$userName/Projects +chmod $userName:$userName /home/aaronh/Projects + +exit