A collection of dotfiles to configure NixOS
# DESCRIPTION: Enable flakes in <configuration.nix>
# SOURCE: https://www.youtube.com/watch?v=ACybVzRvDhs&t=543s
nix.settings.experimental-feautres = [ "nix-command" "flakes" ];
Requires execution of
sudo nixos-rebuild switch
to take effect.
sudo nixos-rebuild switch --flake <FILEPATH>#<CONFIGNAME>
- If the system's hostname is identical to
<CONFIGNAME>
specified in the Flake,#<CONFIGNAME>
can be omitted. - If the Flake file name is
flake.nix
, one does not have to give a full file path, but only needs to specify the directory where the Flake is located.
SOURCE:
Youtube Video: Libre Phoenix: You Should Use Flakes Right Away in NixOS!
https://www.youtube.com/watch?v=ACybVzRvDhs&t=1346s
- Open Terminal and add
nix-channel
for stable Home Manager Release
nix-channel --add https://github.com/nix-community/home-manager/archive/release-23.11.tar.gz home-manager
nix-channel --update
- Install Home Manager
nix-shell '<home-manager>' -A install
This flake requires the home manager to be run as follows:
home-manager switch --flake <PATH>#<USERNAME>
For example:
home-manager switch --flake .#nixos
Eventhough the username was identical with the name of the configuration, the configuration would otherwise not be found.
While running home-manager switch --flake
, there might be an error that the flake.lock
file cannot be opened. This might happen if at some point in time a sudo nixos-rebuild switch --flake
command has been run.
In some cases, it is sufficient to run sudo nixos-rebuild switch --flake
to update all the flake settings properly. This should work for changes required by NixOS and/or Home Manager. If not, the other option is to set the permissions:
sudo chown <USERNAME> flake.lock
sudo chgrp users flake.lock
Source: https://youtu.be/IiyBeR-Guqw?si=j4Jk_bOjpTWtI_SA&t=1001
Some changes like in the Firefox configuration will not work unless the backup option is set
home-manager switch -b backup --flake <PATH>#<USERNAME>
General Inspiration:
https://gitlab.com/Oglo12/nixos-config
Specific Inspiration (Power Saving, Greeter BG, Garbage Collection):
https://github.com/AlexCKunze/NixOS-build/blob/main/etc/nixos/configuration.nix
Custom Firefox Config:
https://github.com/NapoleonWils0n/nixos-dotfiles/blob/master/nixos-dotfiles.org
https://github.com/mahmoudk1000/nix-config