/nix-files

Personal NixOS configuration flake

Primary LanguageNix

❄️ xokdvium's NixOS flake

This repository contains my personal flake. It builds my development machines and deploys part of my infrastructure

If you don't know what nix, nixos and flakes are then please take a look at introduction-to-flakes by ryan4yin. Basically it's a functional package manager on steroids which empowers to user to build whatever they want. This flake leverages this power to configure my machines in a declarative way. Flakes have locked dependencies which ensures that my system configuration is reproducible and works out of the box.

🧬 Structure

I prefer to keep my home configuration in home-manager since it's not always possible to use NixOS (although not for the lack of trying). This way I can get my development environment up and running on any distribution by using standalone home-manager.

🔧 Development

This flake provides a devShell and direnv configuration. The latter is most convenient (if you have nix-direnv installed):

❯ direnv allow

Otherwise you can enter the shell via nix-shell or nix develop commands. Both are supported and versioned with flake.lock file. The flake has several formatters configured via lint.nix. Definitions can be found at lints.nix. This file is my go-to for preconfigured linters and formatters for CI/CD and development. All files can be formatted and checked with the following command:

❯ just lint

🚀 Deployment

You can view all targets by running just -l:

❯ just --list
Available recipes:
    boot *FLAGS
    check
    check-format
    collect-garbage
    format
    f                   # alias for `format`
    lint
    l                   # alias for `lint`
    local-switch *FLAGS
    lsw *FLAGS          # alias for `local-switch`
    run-workflows
    r                   # alias for `run-workflows`
    switch *FLAGS
    sw *FLAGS           # alias for `switch`

To rebuild the system configuration run:

❯ just switch

To rebuild locally, without using distributed builds it's possible to run a local switch:

❯ just local-switch

🎒 Binary Cache

This flake builds a lot of packages from source, since I like to use the latest unstable branches to get the latest updates as fast as possible. I run zfs root for my desktop systems. But due to certain usability issues I've switched to cachyos kernel from nyx. To remedy the long build times I've spun up a personal binary cache and set up distributed builds.

substituters = https://attic.aeronas.ru/private/
trusted-public-keys = private:IvY1j71q2NBKHzakkPgOgP/OCVjKw7XNsPL1OV1umNU=

📖 Acknowledgements

Basic resources:

I would like to highlight some of the amazing resources that guided me along my nix journey: