confkit
is an opinionated and extensible configuration framework using Nix. It
provides NixOS and home-manager
modules for a better out-of-the-box
experience. Parts of it can also be used outside of Nix to enable support for
systems unsupported by Nix, such as FreeBSD.
You can find an example of usage in the example/
directory. As a more
complete, but also more complex example, you can check my public config
repo.
confkit
follows a rolling release scheme with stability guarantees. For each
supported NixOS version, it comes with two levels of stability:
stable
can be updated with new features and fixes but no breaking changes,develop
can contain breaking changes.
The currently supported branches are:
stable-24.05
— stable channel compatible with NixOS 24.05 (changelog),develop-24.05
— development channel compatible with NixOS 24.05 (changelog).
When a new version of NixOS is supported, the develop
channel from the
previous version is promoted to stable
.
-
Create a directory for your own configuration files:
sudo mkdir -m 700 /config sudo chown $UID:$GID /config
You can choose another name for the directory, but
oc
andocd
aliases are defined to use this directory. -
Initialise a Git repository to track your configuration:
cd /config git init
-
Initialise the configuration using the template provided by
confkit
:nix flake init -t github:ejpcmac/confkit/stable-24.05
In Nix/
, you have now a nixos-host
directory which contains a typical NixOS
flake configuration using confkit
.
-
Rename the
Nix/nixos-host
directory to match the hostname of your machine. If you want to share some configuration between different machines, you can create acommon
directory and importNix/common/configuration.nix
in your differentNix/<hostname>/configuration.nix
. -
Edit the system configuration in
Nix/<hostname>/configuration.nix
to match your needs. Don’t forget to review all the TODOs. -
Copy / rename as necessary
Nix/<hostname>/users/user
to createhome-manager
configurations for your users. Don’t forget to update their imports inNix/<hostname>/configuration.nix
. -
In
Nix/<hostname>/users/<username>/home.nix
, configure your identity information viaconfkit.identity
, so it can be used by theconfkit.git
module. If you are using GPG, you can also defineconfkit.identity.gpgKey
and enable theconfkit.gpg
module: it will also enable Git commit signing out of the box!
On NixOS:
- link
/etc/nixos/flake.nix
to/config/Nix/<hostname>/flake.nix
, - run
sudo nixos-rebuild switch
.
Before contributing to this project, please read the CONTRIBUTING.md.
Copyright © 2018-2024 Jean-Philippe Cugnet
Do what the fuck you want to with this project.