๐ชถ Lightweight
The nix-maid core is as lean as possible, pushing the execution to other tools.
Nix-maid is a library for managing your dotfiles, powered by Nix. Simple by design, it will make configuring your desktop environment a breeze. As an alternative to Home-Manager, we throw away many outdated concepts, making nix-maid the state of the art in dotfile management. Join us into making the desktop experience great again! โ๏ธ๐งน
Nix-Maid's options are fully documented: https://viperml.github.io/nix-maid/api. Documentation is top priority for the project.
To get a feel of how nix-maid is used, the following example shows a standalone nix-maid configuration:
# my-config.nix
let
sources = import ./npins;
pkgs = import sources.nixpkgs;
nix-maid = import sources.nix-maid;
in
nix-maid pkgs {
file.home.".gitconfig".text = ''
[user]
name=Maid
'';
# {{mustache syntax}} resolves at runtime
# Giving more flexibility and portability across users
file.xdg_config."hypr/hyprland.conf".source = "{{home}}/dotfiles/hyprland.conf";
# Define systemd-user services, like you would on NixOS
systemd.services.waybar = {
path = [ pkgs.waybar ];
script = ''
exec waybar
'';
wantedBy = [ "graphical-session.target" ];
};
# Configure gnome with dconf or gsettings
gsettings.settings = {
org.gnome.mutter.experimental-features = [
"scale-monitor-framebuffer" "xwayland-native-scaling"
];
};
dconf.settings = {
"/org/gnome/desktop/interface/color-scheme" = "prefer-dark";
};
# Configure KDE Plasma
kconfig.settings = {
kwinrc = {
Desktops.Number = 4;
};
baloofilerc = {
"Basic Settings".Indexing-Enabled = false;
};
};
}
# install and activate:
$ nix-env -if ./my-config.nix
$ activate
Nix-maid also supports being installed as a NixOS module, which is as simple as possible:
# configuration.nix
{ config, pkgs, ...}: {
imports = [
(import (import ./npins).nix-maid).nixosModules.default
];
users.users.alice = {
isNormalUser = true;
maid = {
gsettings.settings = {
org.gnome.desktop.interface.accent-color = "pink";
};
file.home.".gitconfig".text = ''
[user]
name=Alice
'';
};
};
}
If you like the implementation details, these are some details that we improve on Home-Manager:
file.home
, the symlink will not be direct. Instead, we use a "static directory": ~/.gitconfig -> <static>/.gitconfig -> /nix/store/...gitconfig
. This is also done by NixOS for /etc
and has several advantages: file.home.foo.source = "/bar"
. This variable is resolved at activation time. This means that your nix-maid configuration doesn't require setting a home.homeDirectory
, and is easily shareable with other people.environment.etc.<name>.source
. If you declare .source = "string"
, nix-maid won't try to coerce it into the nix-store, thus avoiding the non-ergonomic mkOutOfStoreSymlink
function of home-manager, and all the weirdness and bugs that stem from it.home-manager switch
, which makes it feel sluggish.