d-sacre / nixos-dotfiles

A collection of dotfiles to configure NixOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nixos-dotfiles

A collection of dotfiles to configure NixOS

Useful Things to Know

Enable Flakes by Default

# DESCRIPTION: Enable flakes in <configuration.nix>
# SOURCE: https://www.youtube.com/watch?v=ACybVzRvDhs&t=543s
nix.settings.experimental-feautres = [ "nix-command" "flakes" ];

REMARKS:

Requires execution of

sudo nixos-rebuild switch

to take effect.

Change NixOS Configuration to the one Specified in Flake

sudo nixos-rebuild switch --flake <FILEPATH>#<CONFIGNAME>

REMARKS:

  • 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

Activate Home Manager of Stable Branch in Standalone Mode

  1. 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
  1. Install Home Manager
nix-shell '<home-manager>' -A install

Running Home Manager

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.

Permission Issue with Flake.lock

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

Warning: Option will be overwritten

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

About

A collection of dotfiles to configure NixOS

License:GNU General Public License v3.0


Languages

Language:Nix 56.2%Language:JavaScript 32.6%Language:CSS 11.3%