More actions
No edit summary |
No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
= Introduction = | = Introduction = | ||
This is | This is an incomplete guide on installing NixOs, using flakes and home-manager. | ||
Be sure to have an ISO image of NixOS, which can be obtained here: https://nixos.org/download/#nixos-iso. | Be sure to have an ISO image of NixOS, which can be obtained here: https://nixos.org/download/#nixos-iso. | ||
Line 8: | Line 8: | ||
= Installation guide = | = Installation guide = | ||
== Partitioning your disk == | == Partitioning your disk == | ||
# Boot the installation medium. | |||
# Open a terminal. | # Open a terminal. | ||
# Wipe your disk: {{ic|$ blkdiscard /dev/<installation disk>}}. | # Wipe your disk: {{ic|$ blkdiscard /dev/<installation disk>}}. | ||
Line 54: | Line 55: | ||
boot.loader.efi.canTouchEfiVariables = true; | boot.loader.efi.canTouchEfiVariables = true; | ||
</pre> | </pre> | ||
{{note|This is an example of my configuration: https://git.posixlycorrect.com/fabian/desktop_config}} | |||
== Install == | == Install == | ||
Line 62: | Line 64: | ||
# Logout and login as your user | # Logout and login as your user | ||
= Enable flakes and replace your config with your flake = | |||
==== Flake ==== | |||
# {{ic|$ mkdir nix}} | |||
# Create your {{ic|$ vim flake.nix}} | |||
# {{ic|$ nixos rebuidl switch}} | |||
==== Home manager ==== | |||
# {{ic|$ nix repl .}} | |||
<pre> | |||
home = homeConfigurations.<configuration name> | |||
home.activationPackage | |||
</pre> | |||
# Copy the resulting path and do: | |||
# {{ic|$ build <path>}} | |||
# ./result/activate |
Latest revision as of 20:14, 2 September 2024
Introduction
This is an incomplete guide on installing NixOs, using flakes and home-manager.
Be sure to have an ISO image of NixOS, which can be obtained here: https://nixos.org/download/#nixos-iso.
Installation guide
Partitioning your disk
- Boot the installation medium.
- Open a terminal.
- Wipe your disk:
$ blkdiscard /dev/<installation disk>
. - Create root and boot partitions:
Use parted
$ parted <installation disk> (parted) mklabel gpt
Boot partition
(parted) mkpart (parted) Partitoin name? boot (parted) File system type? fat32 (parted) Start? 0% (parted) End? 2GB (parted) set 1 esp on (parted) set 1 boot on
Root partition
(parted) mkpart (parted) Partitoin name? root (parted) File system type? btrfs (parted) Start? 2GB (parted) End? 100% (parted) quit
Configure and mount partitions
$ mkfs.btrfs /dev/<root partition>
$ mkfs.vfat -F32 /dev/<boot partition>
$ mount /dev/<root partition> /mnt
$ mkdir /mnt/boot
$ mount /dev/<boot partition> /mnt/boot
Generate and edit config
$ sudo nixos-generate-config --root /mnt
- Edit your configuration:
$ nvim /mnt/etc/nixos/configuration.nix
- Checkout your hardware config:
$ nvim /mnt/etc/nixos/hardware-configuration.nix
- Remember to add the following to
configuration.nix
so that grub works with EFI:
boot.loader.grub.enable = true; boot.loader.grub.efiSupport = true; boot.loader.grub.device = "nodev"; boot.loader.efi.canTouchEfiVariables = true;
Note: This is an example of my configuration: https://git.posixlycorrect.com/fabian/desktop_config
Install
$ sudo nixos-install
- Set root password when prompted to do so.
- Reboot your machine
- Login as root and set a password for your user:
$ passwd <username>
- Logout and login as your user
Enable flakes and replace your config with your flake
Flake
$ mkdir nix
- Create your
$ vim flake.nix
$ nixos rebuidl switch
Home manager
$ nix repl .
home = homeConfigurations.<configuration name> home.activationPackage
- Copy the resulting path and do:
$ build <path>
- ./result/activate