Hjem impure provides a script which:
- Replaces every hjem symlink with writable normal files and directories
- Links particular symlinks back into your nixos configuration | advanced installation
No more waiting for nixos-rebuilds to modify your dots. Ever.
kuru.mp4
First, add hjem-impure to your flake inputs
{
inputs = {
hjem-impure = {
url = "github:Rexcrazy804/hjem-impure";
# these are only required for internal tests,
# hence you can set em to nothing
inputs.nixpkgs.follows = "";
inputs.hjem.follows = "";
};
};
}Next, add hjem-impure as an extraModule for hjem and enable hjem impure for your desired user
# assuming that you pass inputs as specialArgs
{inputs, ...}:
{
# imports the hjemModule
hjem.extraModules = [inputs.hjem-impure.hjemModules.default];
# enable hjem-impure
hjem.users.${myUserName}.impure.enable = true;
}And that's it, after you rebuild your configuraiton
you should have the hjem-impure executable.
Hjem impure offers the ability to optionally relink certain symlinks created by hjem
back into your nixos configuration,
granted that there exists a common dotsDir from which each file/dir is source'd
{config, ...}:
{
hjem.users.${myUserName} = {
impure = {
# enable hjem-impure
enable = true;
# pure path to dotsFolder AS STRING
dotsDir = "${./myDotsFolder}";
# impure absolute path to dots folder
dotsDirImpure = "/home/myuser/nixos/myDotsFolder";
};
xdg.config.files = let
# aforementioned common dots
dots = config.hjem.users.${myUserName}.impure.dotsDir;
in {
# it is a requirement to use `dots` for the relinking feature
"hypr/hyprland.conf".source = dots + "/hyprland/hyprland.conf";
"hypr/hypridle.conf".source = dots + "/hyprland/hypridle.conf";
};
};
}for a fleshed out configuration see nix/test/config.nix
simply run the below to make your hjem links modifiable and if configured, overwrite with symlinks to your nixos configuration.
hjem-impure
The next nixos-rebuild will overwrite hjem-impure's changes. Alternatively you can also re-create hjem's immutable links using
systemd-tmpfiles --user --createor if you use smfh as the linker
systemctl start [email protected]hjem impure module simply reads information hjem uses to plant files in place. This information is converted into a shell script that either replaces the symlinks with symlinks to the nixos configuration, or makes a writable copy of the file or directory.
- hjem-rum my reference for creating this module
- jade's use nix less sparked the idea for this and I've gratefully used their script as a base for
hjem-impure