These configurations can be used differently to manage:
- the current user configuration;
- the system configuration;
- both system and user configurations at the same time.
This repository is hosted in my Gitea server and mirrored to GitHub.
- NixOS should be easy to reinstall and be ready to use — so that I no longer feel attached to my machines.
- Each host should have its own configuration file inside
./hosts. - All frequently used boilerplate should be modularized into
./modulesso that a computer configuration is always clear and easy to be made intuitively. - A user should not be forced to use
home-manager. Each user is responsible for using the system as wished (imperatively or declaratively). - Each user should be able to configure their own WM/GE without having to contact the system admin.
hostsadamconfiguration.nixsystem.nix(TODO better than actual double read?)hardware-config.nixhome.nix: extra home-manager base config for this machinesecrets.yamlorsecrets/*.yaml: machine secrets
usersmarcosrdachome.nix: main home-manager user configurationhosts: extra home-manager machine-specific user configurations (for machines that are not mine or are not running NixOS)secrets.yamlorsecrets/*.yaml: user secrets
guestvim: just an easy to use neovim setup (TODO)
overlays: i.e.: neovim configs and plugins is an overlaymodulesnixoshome-managercommon
.sops.yaml: sets up encryption rules for passwordssecrets: common passwords
You will need Nix with Flakes enabled to use my configurations, as well as git.
nix-channel --update
nix-env -f '<nixpkgs>' -iA nixUnstablenix-shell -p wget vim git
# or use below facilities
nix-shell -p wget vim git screen lfgit clone https://git.marcosrdac.com/marcosrdac/nixcfg.git $HOME/.config/home-managerhome-manager switch --flake "$HOME/.config/home-manager#$(hostname)-$(whoami)"
# i.e.: if my hostname is `adam` and my username is `marcosrdac`:
#home-manager switch --flake "$HOME/.config/home-manager#adam-marcosrdac"Observation: host is defined in hosts and my user configurations are defined in users/$USER
TODO add a placeholder for non-NixOS machines I might use
As super user:
git clone https://git.marcosrdac.com/marcosrdac/nixcfg.git /etc/nixosSet your hostname: Flakes will use it to setup the correct machine. Example for my adam desktop:
hostname adamThen to build the machine for the first time:
nixos-rebuild switch --flake "/etc/nixos#$(hostname)"Start by configuring the system, then symlink /etc/nixos to /home/$USER/home-manager. Make the user part of nixcfg group in the specific machine configuration, so that it can modify the configuration files without super powers.
ln -s /etc/nixos /home/$USER/.config/home-managerNow, as a normal user, you can now run similar commands to user install section section's to configure your home space, except that $HOME/.config/home-manager will become its original configuration directory (/etc/nixos):
home-manager switch --flake "/etc/nixos#$(hostname)-$(whoami)"
# i.e.: if my hostname is `adam` and my username is `marcosrdac`:
home-manager switch --flake "/etc/nixos#adam-marcosrdac"The graphical setup follows the same separation between system and user configuration:
- NixOS provides the graphical infrastructure: display manager, X11 support, Wayland support, DBus, Polkit, XWayland, portals, seat management and generic login sessions.
- Home Manager defines the user's graphical environment: window manager or compositor, bars, launchers, startup programs, keybindings and user session scripts.
The system should not hardcode a user's preferred WM/DE. Instead, it exposes generic session entries:
Display manager
-> User X11 Session
-> /home/<user>/.xsession
-> User Wayland Session
-> /home/<user>/.wsession
ssh-keygen -t rsa -b 4096
cat ~/.ssh/id_rsa.pubCopy cat output and paste it into a new SSH key with
Create new SSH access keys using cat output and entitle it username@hostname, where username and hostname are your current ones.
To see current remotes:
git remote -vTo change to SSH:
git remote set-url origin gitea@git.marcosrdac.com:marcosrdac/nixcfg.gitgit config --global user.email "mail@marcosrdac.com"
git config --global user.name "Marcos Conceição"# remove old home-manager generations
home-manager expire-generations 1d
# tip #1
nix-collect-garbage -d
# tip #2
sudo nix-store --optimiseYou probably don't have enough RAM. Do the following to swap on file before system build:
SWAP_SIZE_MB=2048
sudo dd if=/dev/zero of=/swapfile bs=1M count=$SWAP_SIZE_MB status=progress
sudo chmod 0600 /swapfile
sudo mkswap -U clear /swapfile
# if above does not work, give partition UUID as argument to -U
#lsblk -f
# copy UUID and run command, i.e.:
#sudo mkswap -U 892b1061-772e-4b48-a2dc-e67cb5b7ebc7 clear /swapfile
sudo swapon /swapfilenix-shell -p cloud-utils
lsblk
PARTITION_NUMBER=1
sudo growpart /dev/nvme0n1 $PARTITION_NUMBER- Pinpox' configurations
- Jordan Isaacs' configurations
- Krutonium's configurations
- Misterio77's configurations
-
ssh agent needed to be turned on???
-
Do not install fonts unless needed
-
Make options in my
home-managermodules (xorg vs wayland, etc). -
Default python env should be easily accessable for data analysis stuff.
-
I want to be able to install and use my WM configuration from any computer (use xinit and stuff, instead of xinit-hm).
-
redshift
-
kopia module
-
curupira's nextcloud + gitea
-
appearance module: font families (regular, symbol), size -> terminal, bars, themes, etc.
-
volume module
- avoid monolythic sops secrets files (i.e.:
secrets.yaml)