Skip to content

xokdvium/nix-files

Repository files navigation

❄️ 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 treefmt-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

📖 Acknowledgements

Basic resources:

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

Languages