TLDR; After my first attempt at using Home-Manager I have three questions.
- Am I missing something? After trying H-M out I was left a little underwhelmed, but it seems like it is almost universally paired with flakes, in blogs, guide, ect.
- I created a bash script that was inspired by GNU Stow, that copies a file from a target location, and overwrites or creates the file in a new location. Are there any dangers / problems with managing dotfiles this way, and is there a NixOS module that does something similar.
- If there is not already a module that preforms this function, would this be a reasonably possible for someone to create as a beginner programming project?
I recently tried out Nix Home-Manager, and while I can deffinately see the usefullness for other situations. As someone using NixOS on a single user machine, it seems a bit underwhelming. Mostly just moving my installed packages from one list to another. The configuration wrapper seems like an awesome concept. But even for something like Git, I wasn’t able to translate all my settings, and ultimately it left me feeling like it was adding way more complexity than use. However in almost any guide, blog, ect, that talks about Nix, and especially about advanced stuff like flakes. It talks about pair it with Home-Manger. So am I missing / misunderstanding something?
In order to try and find my own solution to dotfile management. I created a bash script to deploy configuration files from a central storage repository. Inspired by GNU Stow, only it preforms the copy and overwrite as part of the nixos-rebuild
actions.
#!/bin/bash
# Template : mkdir -p targetDirectory && cp -f originFile targetLocation
# NixOS
echo "Deploying configuration.nix"
mkdir -p /etc/nixos && cp -f /home/que/Projects/Technonomicon/NixOS/configuration.nix /etc/nixos/configuration.nix
echo "Deploying nix-stow.sh"
mkdir -p /etc/nixos/system-scripts && cp -f /home/que/Projects/Technonomicon/NixOS/System-Scripts/nix-stow.sh /etc/nixos/system-scripts/nix-stow.sh
# Emacs
echo "Deploying init.el"
mkdir -p /home/que/.config/emacs && cp -f /home/que/Projects/Technonomicon/Emacs/init.el /home/que/.config/emacs/init.el
echo "Rebuilding NixOS"
nixos-rebuild switch
Are there any major issues I am likely to run into doing things this way?
Lastly. Is there a NixOS module that does someting similar to this as part of the configuration.nix
. I understand that Home-Manager supports importing config files, but if I don’t want it to do any other package management operations. Then that seems like overkill. If not… would this be a reasonable thing for a beginner to try and create. I have started poking at a couple guides on writing nix pkgs, but I have no idea how to judge how complex this would actually be to implement, beyond that I can do it with bash. Thanks.