feat: add src option for flake-compatible pure evaluation

When services.webapp.src is set, it is used directly instead of
builtins.fetchGit. This allows passing a flake input as the source,
which is required for pure evaluation mode in Nix flakes.
This commit is contained in:
Patrick Mulligan 2026-02-27 12:17:29 -05:00
parent b30b37d5ce
commit 132e688d65

View file

@ -9,8 +9,8 @@ let
pname = "aio-webapp";
version = "1.0.0";
# Fetch source from git repository
src = builtins.fetchGit {
# Use src option if provided (flake input), otherwise fetch from git
src = if cfg.src != null then cfg.src else builtins.fetchGit {
url = cfg.gitUrl;
ref = cfg.gitRef;
};
@ -88,6 +88,15 @@ in {
options.services.webapp = {
enable = lib.mkEnableOption "AIO webapp";
src = lib.mkOption {
type = lib.types.nullOr lib.types.path;
default = null;
description = ''
Source tree for the webapp. When set, this is used directly instead of
fetching via builtins.fetchGit. Use this with flake inputs for pure evaluation.
'';
};
gitUrl = lib.mkOption {
type = lib.types.str;
default = "https://git.atitlan.io/aiolabs/webapp";