nasin lili pi ilo nanpa
A minimal nixos configuration example using the dendritic patter with flake-parts, flake-file and hjem. Using niri-wm and noctalia-shell
If you'd like to know more about the dendritic pattern for you nixos configuration, read doc-steve's guide, and filip-ruman's practical implementation tips. These were incredibly helpful when I started rewriting my config.
The entry point for building the system is in
modules/hosts/desktop/desktop.nix. From this file, hardware.nix is sourced
and all other modules are imported
To rebuild the system, use sudo nixos-rebuild switch --flake .#desktop
If you need to create a configuration for another host, you can add it in
hosts/ following the same structure as desktop.nix, and build your new configuration combining
any of the modules
flake-file is used to add flake inputs
from the same config file where they will be used. For example, we can see this
in the zen.nix module:
{inputs, ...}: {
flake-file.inputs.zen-browser = {
url = "github:youwen5/zen-browser-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
flake.nixosModules.zen = {pkgs, ...}: {
environment.systemPackages = [
inputs.zen-browser.packages.${pkgs.stdenv.hostPlatform.system}.default
];
};
}After adding this, you can use flake-file to update flake.nix using nix run .#write-flake
To source config files from other programs using nix, we use
hjem. For example, this is the tmux module,
where we source a tmux.conf file that is located in the same directory as
tmux.nix to be available at ~/.config/tmux/tmux.conf after rebuilding the
system:
{
flake.nixosModules.tmux = {pkgs, ...}: {
programs.tmux = {
enable = true;
terminal = "tmux-256color";
baseIndex = 1;
};
hjem.users.eduardo = {
files = {
".config/tmux/tmux.conf".source = ./tmux.conf;
};
};
};
}made with
olinby eduardofuncao