My NixOS configuration as a flake.
The configuration is in very early state, but should be fully usable with the sufficient host and user configuration, even for non-NixOS machines.
It is planned to be a Nix counterpart of my dotfiles. Most of the configuration is just mirrored, but written in Nix, where possible.
For the philosophy of the configuration, visuals, applications and so on, check the repository above.
But there are still some differences:
- The coverage is not full.
- Some additional configuration is present specific to Nix(OS).
- The theme is defined via Stylix.
The flake uses the "vanilla" Nix module system with options. All modules are
contained under the shimeoki "namespace" (attribute).
Modules are divided into directories per application or some specific purpose. The modules are exposing both Home Manager and NixOS options in sub-directories.
So, the structure is shimeoki/<app>/<platform>/default.nix for an application.
Corresponding platforms are exposed in shimeoki/<platform>.nix. Everything
else is decided per module. Generally, sub-levels (nested attributes) are nested
in directories to reflect this.
The modules follow a "cascade enabling" pattern - if the upper level is enabled, then the lower enabled is enabled automatically, if not disabled explicitly.
With this approach you can enable the top-level shimeoki module to enable
everything, or enable just shimeoki.nixvim (any specific module) as you
desire.
To use the modules, the flake uses hosts and users.
Host is a module, where all configuration specific to the machine should be:
filesystem, network, kernel, keyboard, bootloader, etc.. Also, this module
should activate all needed NixOS shimeoki modules, not related to the user.
User is a module, where all the other configuration should be. It is a NixOS module, and then it imports Home Manager. Because some options can be specific to a user, but not configured at Home Manager level, they should be done here.
Examples for both can be seen in the flake.
If you want to fully transition to this configuration, you need to clone the configuration
git clone https://github.com/shimeoki/nixconfig.gitand define your own hosts and users as needed. Then, add them in the
./flake/sys.nix: add an entry in systems for the corresponding hostname and
create a system with a list of needed users.
Some notes:
- Don't forget to add new files to Git.
- If your system is not
x86_64-linux, change thesystems.urlinflake.nix.
The modules exported in a flake are for internal usage right now. Don't use them in your config, I was unable to get them working, because they are dependent on flake inputs. And just copying the inputs from my flake to any other flake to use my configuration not feels like a proper solution for me.
However, you can still copy the modules to your own configuration. Before doing
that, though, it's recommended to check required modules - they are always in
inherit statements at the top. You also need to copy them, and in some cases
they need certain flake inputs.
- Use conventional commits (not very strict).
- Check that every commit can be used in
nixos-rebuild. - Format with
nix fmtbefore a PR or before every commit (latter preferred).