nix-community / authentik-nix

Nix flake with package, NixOS module and basic VM test for authentik. Trying to provide an alternative deployment mode to the officially supported docker-compose approach. Not affiliated with or officially supported by the authentik project [maintainer=@willibutz]
MIT License
82 stars 18 forks source link

How do I import this repository into my configuration? #11

Closed h3ndrik closed 10 months ago

h3ndrik commented 10 months ago

Sorry for asking a beginner question: How do I import this repo into my nixos config so that services.authentik becomes available, and the example configuration builds?

NixOS, system.stateVersion = "23.11" and I have not yet advanced to flakes.

Is there something like fetchTarball or fetchGit that I can prepend to pull this? Or do I need to read up on how to use flakes?

WilliButz commented 10 months ago

With fetchTarball you could do something like this to import the flake via flake-compat:

{ ... }:
let
  authentik-version = "2023.10.6";
  authentik-nix-src = builtins.fetchTarball {
    url = "https://github.com/nix-community/authentik-nix/archive/version/${authentik-version}.tar.gz";
    sha256 = "0hga9vs73f86gilkd31hgda1gvnf1hmvc8hjlpsiydlc8p8f0y9c";
  };
  authentik-nix = import authentik-nix-src;
in
{
  imports = [
    authentik-nix.nixosModules.default
  ];

  services.authentik = {
    # ...
  };

  system.stateVersion = "23.11";
}

Other flake outputs are available under the authentik-nix attribute, e.g. authentik-nix.packages.x86_64-linux.terraform-provider-authentik

h3ndrik commented 10 months ago

Awesome, thank you very much. That works fine.