Skip to content

Instantly share code, notes, and snippets.

@duesee
Last active July 30, 2025 08:05
Show Gist options
  • Save duesee/1b2fcc41b712d785281d540be1b097f2 to your computer and use it in GitHub Desktop.
Save duesee/1b2fcc41b712d785281d540be1b097f2 to your computer and use it in GitHub Desktop.

Step 1

sudo -i
loadkeys de # Adapt to your needs.

Step 2 (WLAN, optional)

See https://www.reddit.com/r/NixOS/comments/15lctau/comment/jva2k5p.

systemctl start wpa_supplicant.service
wpa_cli
> add_network
0
> set_network 0 ssid "myhomenetwork"
OK
> set_network 0 psk "mypassword"
OK
> set_network 0 key_mgmt WPA-PSK
OK
> enable_network 0

$ ip address

Step 3 (access via SSH, optional)

passwd root # Set root password (required for SSH)

You may now SSH from another machine to make your life simpler.

Step 4 (Disko)

See https://nixos.asia/en/nixos-install-disko.

curl https://raw.githubusercontent.com/nix-community/disko/master/example/hybrid.nix -o /tmp/disko.nix
vim /tmp/disko.nix # Adapt to your needs.
nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko /tmp/disko.nix

Step 5 (Configuration & Installation)

sudo nixos-generate-config --no-filesystems --flake --root /mnt # Note: Added `--flake`

Change /mnt/etc/nixos/flake.nix to ...

{
  inputs = {
    nixpkgs = {
      url = "github:NixOS/nixpkgs/nixos-unstable";
    };
    disko = {
      url = "github:nix-community/disko";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };
  outputs =
    {
      self,
      nixpkgs,
      disko,
      ...
    }:
    {
      nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
        modules = [
          ./configuration.nix
          disko.nixosModules.disko
        ];
      };
    };
}
mv /tmp/disko.nix /mnt/etc/nixos

Change /mnt/etc/nixos/configuration.nix to ...

{
  ...
}:
{
  imports = [
    ./hardware-configuration.nix
    ./disko.nix
  ];

  boot.loader.grub = {
    enable = true;
    efiSupport = true;
    efiInstallAsRemovable = true;
  };

  nix.settings.experimental-features = [
    "nix-command"
    "flakes"
  ];

  system.stateVersion = "25.05";
}
nixos-install --root /mnt --flake '/mnt/etc/nixos#nixos'
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment