This Repo was started and inspired by a blog post by the amazing Karl Voit. Make sure to check out the blog post AND his GitHub repo for more awesomness!
My setup is using the flake.nix
as a central point.
flake.nix
is calling most of the other files depending on
the set hostname:
hosts/$HOSTNAME/default.nix
configuration.nix
- all files related to
home-manager
:homemanager.nix
andhomemanager/*
The directory assets
contain various configuration and binary files I wanted to keep close to my NixOS configuration files.
- Download installer ISO
- Install NixOS using that ISO
- Learn how to set up a USB thumb drive and boot from it for installing the basic OS
- Modify default configuration.nix:
- Start an editor:
sudo nano /etc/nixos/configuration.nix
- Change hostname on new host from default if necessary:
- https://borretti.me/article/nixos-for-the-impatient#postinstall
- by setting
networking.hostName
from "nixos" to a new hostname
- by setting
- https://borretti.me/article/nixos-for-the-impatient#postinstall
- Activate flakes: https://nixos.wiki/wiki/Flakes
- On NixOS set the following options in
configuration.nix
and runnixos-rebuild
{ pkgs, ... }: { # usual, this line is already there nix.settings.experimental-features = [ "nix-command" "flakes" ]; } # usual, this line is already there
- On NixOS set the following options in
- Add the
git
and package. Also add your favourite editor as well for fixing miscellaneous things. I'm usingvim
for that.- Just write the corresponding package name where
firefox
is installed in theconfiguration.nix
.
- Just write the corresponding package name where
- Update and activate your setup
sudo nixos-rebuild switch
- Start an editor:
- Create a new user and add it to the
wheel
group:useradd -c "Darko Mesaros" -m darko usermod -G wheel passwd darko
- Clone this Git repo to
~/nixos/
:git clone https://github.com/novoid/nixos-config.git ~/nixos
- Create a configuration for the
$HOSTNAME
in the nixos-configuration git repo- Adapt
flakes.nix
- Create
~/nixos/hosts/$HOSTNAME
(from theDEFAULT
host as template) - Get the
hardware-configuration.nix
into your new setupcd ~/nixos cp /etc/nixos/hardware-configuration.nix ~/nixos/hosts/$HOSTNAME/ cp /etc/nixos/configuration.nix ~/nixos/hosts/$HOSTNAME/default.nix git add
- Adapt
- Run flakes with the new setup:
-
Switch to nixos-config dir
-
Double-check: make sure that hostname matches a config
-
Run flakes with current nixos-config dir:
sudo nixos-rebuild switch --flake .
-
Fix any error that may arise at this point.
- Yes, this can be frustrating. I wish you good luck here.
- Usually, you just have to remove stuff from
~/nixos/hosts/$HOSTNAME/default.nix
when it is also defined inflakes.nix
or other existing files. - Futhermore, you might have to create (and
git add
) configuration files that are assumed to exist such asassets/.tmuxp/$HOSTNAME.yaml
.
-
I do recommend a reboot here to cleanly boot the updated OS with all of its settings.
-
Execute store optimization (replacing copies with hardlinks):
nix-store --optimise
-
OPTIONALLY: Symlink
/etc/nixos
to~/nixos
if you want to usenixos-rebuild
without the optional parameter for the path.
-
If not specified otherwise, this configuration is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License