A Lua-based tool for managing NixOS configurations and system rebuilds with extended functionality.
It offers the possibility of managing additional aspects of NixOS in a declarative way without adding the complexity of flakes and Home Manager.
- Shorter commands for rebuilding and upgrading
- Channel management - declarative NixOS channels configuration
- Custom configuration paths - set custom path for NixOS configuration
- Dotfiles management - declarative synchronization with backup protection
- GNOME Shell management - declarative management of GNOME settings via dconf
- Flatpak management - declarative Flatpak application management
- Custom commands - define commands that run after rebuild
- Debug mode - for testing and configuration inspection
- Channel-based NixOS installation (flakes not required)
- Lua runtime (provided by Nix)
The easiest way to try the tool is to build and run it locally:
wget -O default.nix https://raw.githubusercontent.com/burij/nixos-extended-rebuilder/refs/heads/main/default.nix && \
nix-build -A package && \
cd ./result/bin && \
./os help
To permanently add NixOS Extended Rebuilder to your system, use the callPackage
function in your NixOS configuration:
# configuration.nix
environment.systemPackages = with pkgs; [
(callPackage /path/to/default.nix { }).package
];
Note: The default.nix
contains both shell and package derivations - make sure to explicitly call .package
.
Command | Description |
---|---|
os rebuild |
Rebuild the system |
os upgrade |
Upgrade the system |
os cleanup |
Garbage collection |
os userconf |
Sync dotfiles |
os version |
Show version and current generation |
os help |
Show help information |
The tool uses a Lua configuration file (nixconf.lua
) with declarative syntax. On first run of os rebuild
, upgrade
, or userconf
, an empty configuration template will be created at ~/.nixconf.lua
.
For better organization, you can move the configuration file anywhere and set the LUAOS
environment variable:
export LUAOS="/path/to/your/nixconf.lua"
To make this permanent, add it to your NixOS configuration:
# configuration.nix
environment.sessionVariables = {
LUAOS = "/path/to/your/nixconf.lua";
};
NixOS Extended Rebuilder provides a simple approach to manage user configuration files by creating symlinks from a centralized dotfiles repository.
Declare dotfiles for synchronization using the conf.dot.files
table:
-- nixconf.lua
conf.dot = {
path = "/home/user/dotfiles", -- Main dotfiles repository
files = {
nvim = {
".config/nvim/init.lua",
".config/nvim/lua/",
},
shell = {
".bashrc",
".zshrc",
},
desktop = {
".config/gtk-3.0/settings.ini",
".local/share/applications/",
}
},
gnome = "gnome" -- GNOME dconf settings path (subfolder of path)
}
- Repository Creation: Creates the main dotfiles repository if it doesn't exist
- Structure Setup: Automatically creates necessary subfolders and target directory structure
- File Protection:
- If a config file exists in target location but not in repository → moves it to repository
- If file exists in both locations → renames target file with timestamp and moves to repository
- Symlink Creation: Creates symlinks for all files and folders in the repository
- GNOME Integration: Dumps dconf database and loads declarative settings
- No data loss: All existing configurations are backed up with timestamps
- Conflict resolution: Handles applications that overwrite symlinks (like Brave browser)
- Version control ready: Repository structure is designed for Git tracking
Recommendation: Track your dotfiles repository with version control for additional safety.
Declare NixOS channels in your configuration:
conf.channels = {
"nixos https://nixos.org/channels/nixos-25.05",
"nixpkgs https://nixos.org/channels/nixpkgs-unstable"
}
Define commands to run after system rebuild:
conf.postroutine = {
"systemctl --user restart some-service",
"notify-send 'System rebuilt successfully'"
}
git clone https://github.com/burij/nixos-extended-rebuilder.git
cd nixos-extended-rebuilder
nix-shell -A shell
Inside the development shell:
os-dev [option] # Run development version
.
├── modules/ # Core functionality modules
├── conf.lua # Main configuration file template
├── default.nix # Nix package and shell configuration
├── main.lua # Application entry point
├── need.lua # Custom module loader
└── README.md # Documentation
-- .nixconf.lua
local conf = { dot = {} }
conf.debug_mode = false
conf.entry_path = "/etc/nixos/configuration.nix" -- this file will be evaluated, no matter what's your system default is
conf.channels = { -- multiple channels can be also declared
"nixos https://nixos.org/channels/nixos-25.05"
}
conf.flatpaks = {
"page.codeberg.libre_menu_editor.LibreMenuEditor",
"org.gnome.Builder",
"com.nextcloud.desktopclient.nextcloud",
}
conf.dot.path = "/home/joe/.dotfiles" -- configuration files will be moved here
conf.dot.gnome = "desktop" -- subfolder for dconf import/export
conf.dot.files = { -- this table will be evaluated for user settings configuration sync
bash = { "/home/joe/.bash_history" }, -- script will create subfolder bash inside .dotfiles and move .bash_history there
obsidian = { -- one subfolder can contain multiple configuration files or subfolders
"/home/joe/.config/obsidian/Preferences",
"/home/joe/.config/obsidian/obsidian.json",
"/home/joe/.obsidian",
"/home/joe/.config/obsidian/Dictionaries/de-DE-3-0.bdic",
"/home/joe/.config/obsidian/Dictionaries/en-US-10-1.bdic"
},
vst = {
"/home/joe/.vst"
}
}
-- if cleanup argument used, only following commands will be executed
conf.cleanup = {
"flatpak uninstall --unused",
"nix-collect-garbage",
"sudo nix-collect-garbage",
"nix-collect-garbage -d",
"sudo nix-collect-garbage -d",
}
conf.postroutine = { -- list of commands which will be executed after rebuild
"sudo flatpak override --filesystem=host org.gnome.Builder",
}
return conf
Enable debug mode in your configuration:
conf.debug = true
This provides verbose output for troubleshooting configuration issues.
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
Michael Burij
Note: This project is work in progress, was created mostly for personal use and might damage your system. Please don't try it out on a productive machine, if you don't know, what are you doing. Features may be added or modified in future releases. Please report issues on the GitHub repository.