I initially added some basic software’s into /etc/configuration.nix
file (vlc, libreOffice, tmux, emacs, vim etc)
later, installed home-manager
and then flakes
.
created .dotfiles
directory under my home path and created link to /etc/configurations.nix
and hardware-configuration.nix
file over here.
created home.nix
and flake.nix
now, if i wanted to install anything system wide, im still using the configurations.nix
.
i haven’t used the home.nix yet since im not confident enough.
my current workflow and its commands:
currently after making any changes(any new software being added) inside the configurations.nix,sudo nixos-rebuild switch --flake .
if changes made on home.nix
home-manager switch --flake .
to list generations
sudo nix-env --list-generations --profile /nix/var/nix/profiles/system
to delete older generations
sudo nix-collect-garbage -d
or
nix-collect-garbage --delete-old
(but this doesn’t deletes the old generations from my boot menu)
so i usually reboot to see if the changes are in effect. else i use the below command.
sudo /run/current-system/bin/switch-to-configuration boot
im still not having a clear understanding on the generation deletion still. so correct me please.
My Understanding:
please correct me if im wrong
home-manager takes control of all of the dotfiles and user level files, ignores the system level files. And takes care of things like package versions, dependencies, linking (in the store), while switching to new changes on any of the files that home-manager monitors, and if want to replicate this setup across different machines.
configuration.nix will take care of the system wide settings and software installations. which can be said as, to the current machine alone.
flake, i still cant get a clear picture on it. but still here i go,. something like gits version history for the os configurations and home.nix etc
Questions:
-
whats the difference between
nix-env --list-generations
andsudo nix-env --list-generations --profile /nix/var/nix/profiles/system
-
for my understanding can i consider
home.nix
file as something like an equivalent to portable version ofconfiguration.nix
- currently i have installed packaged through
configuration.nix
and myhome.nix
is still pretty fresh and untouched. whats the best way to move packages fromconfiguration.nix
tohome.nix
. can i just move the list from configuration.nixenvironment.systemPackages = with pkgs; [ ]
to home.nixhome.packages = [ ]
? and if i do it so, what should be the sequence of command that i should follow - Once having a home.nix, is it advisable to touch configuration.nix file. if so under which circumstances can the
configuration.nix
be used/touched and what should be the commands being followed.- say if
configuration.nix
is touched and i havent made any changes tohome.nix
what sequence of commands should i follow. - say if i have made change to
home.nix
andconfiguration.nix
on the same go, what sequence of command should i follow. - and finally, if i touch only the
home.nix
file the command i should use ishome-manager switch --flake .
, correct ? - Reason im asking the above 3 scenarios is, without better understanding i have given
sudo nixos-rebuild switch --flake .
andhome-manager switch --flake .
distinctively and also one after the other(sometime first nixos-rebuild and then homemanager switch. sometimes the other way) at times in the past. because of which i have seen some weird effect like, some software being not available though they are present in the package list(still insideconfiguration.nix
). - in short, if i make changes on either one or both (configuration.nix or home.nix) what sequence of command should i follow.
- say if
- currently i have installed packaged through
-
after removing the older generations, if i want to reflect the same on the boot menu after couple of days of testing the new generations, is the command being issued above correct ? if there is a proper way to do it please correct me. (don’t want cli helper until i get a clear understanding on the old generations deletion.
-
when should i use
nix flake update
-
Please correct my understanding of workflow or if there is a better workflow. i dont want to use any cli helper before i have complete understanding of the nixos philosophy