:: krowemoh

Friday | 13 DEC 2024
Posts Links Other About Now

previous
next

Nix on T470

2024-01-30

Creating the installation media:

cp /dev/nvme0n1

Wipe the partitions:

wipefs -a /dev/nvme0n1

This will remove all the partitions and combine everything.

Now we can repartition things:

parted /dev/nvme0n1 -- mklabel gpt
parted /dev/nvme0n1 -- mkpart root ext4 512MB -8GB
parted /dev/nvme0n1 -- mkpart swap linux-swap -8GB 100%
parted /dev/nvme0n1 -- mkpart ESP fat32 1MB 512MB
parted /dev/nvme0n1 -- set 3 esp on

Then we create the filesystem:

# mkfs.ext4 /dev/nvme0n1p1
# mkswap /dev/nvme0n1p2
# mkfs.fat -F 32 -n boot /dev/nvme0n1p3

Next we mount these systems:

# mount /dev/nvme0n1p1 /mnt

# swapon /dev/nvme0n1p2

# mkdir -p /mnt/boot
# mount /dev/nvme0n1p3 /mnt/boot

Next we generate the config:

nixos-generate-config --root /mnt

Update the /etc/nixos/configuration.nix. Below is the version that I used as a base for this install. This gives me the i3 window manager along with the kitty terminal, working sound, network manager and some utilities.

{ config, lib, pkgs, ... }:

{
  imports =
    [ 
      ./hardware-configuration.nix
    ];
    
  boot.loader.systemd-boot.enable = true;
  
  networking.hostName = "magellan"; 
  networking.networkmanager.enable = true;  
  
  time.timeZone = "America/New_York";
  
  services.xserver.enable = true;
  services.xserver.windowManager.i3.enable = true;
  
  sound.enable = true;
  hardware.pulseaudio.enable = true;
  
  programs.fish.enable = true;
  programs.light.enable = true;
  
  users.users.username = {
    shell = pkgs.fish;
    isNormalUser = true;
    extraGroups = [ "wheel" "networkmanager" "video" ]; 
    packages = with pkgs; [
      firefox
      tree
      rofi
      kitty
      feh
    ];
  };
  
  environment.systemPackages = with pkgs; [
    vim 
    wget
  ];
  
  services.openssh.enable = true;
  
  system.stateVersion = "23.11"; 
}

Enable the wireless:

sudo systemctl start wpa_supplicant
wpa_cli

add_network
set_network 0 ssid "myhomenetwork"
set_network 0 psk "mypassword"
set_network 0 key_mgmt WPA-PSK
enable_network 0

Trigger the install:

sudo nixos-install

Once this is done, reboot the machine.

If you need to enter the nix installation in case you missed the root password, you can enter the nix environment by doing the following:

sudo nixos-enter --root /mnt