treewide: nixfmt

This commit is contained in:
WilliButz 2025-02-02 14:16:38 +01:00
parent d653af66b3
commit dbfc2207df
No known key found for this signature in database
GPG key ID: AB05DF703EB9DC70
14 changed files with 688 additions and 564 deletions

View file

@ -1,7 +1,8 @@
{ authentik-src
, authentik-version
, buildNapalmPackage
, nodejs_22
{
authentik-src,
authentik-version,
buildNapalmPackage,
nodejs_22,
}:
buildNapalmPackage "${authentik-src}/website" {
@ -52,8 +53,7 @@ buildNapalmPackage "${authentik-src}/website" {
let
files = builtins.readDir ./docs-extra-package-locks;
in
builtins.concatMap (f:
if files.${f} == "regular"
then [ (./docs-extra-package-locks + "/${f}") ] else []
builtins.concatMap (
f: if files.${f} == "regular" then [ (./docs-extra-package-locks + "/${f}") ] else [ ]
) (builtins.attrNames files);
}

View file

@ -1,8 +1,9 @@
{ authentik-src
, authentik-version
, authentikComponents
, buildNapalmPackage
, nodejs_22
{
authentik-src,
authentik-version,
authentikComponents,
buildNapalmPackage,
nodejs_22,
}:
buildNapalmPackage "${authentik-src}/web" rec {
version = authentik-version; # 0.0.0 specified upstream in package.json

View file

@ -1,9 +1,10 @@
{ authentik-src
, authentik-version
, authentikComponents
, buildGo123Module
, lib
, makeWrapper
{
authentik-src,
authentik-version,
authentikComponents,
buildGo123Module,
lib,
makeWrapper,
}:
buildGo123Module {
@ -16,15 +17,15 @@ buildGo123Module {
'';
src = lib.cleanSourceWith {
src = authentik-src;
filter = (path: _:
filter = (
path: _:
(builtins.any (x: x) (
(map (infix: lib.hasInfix infix path) [
"/authentik"
"/cmd"
"/internal"
])
++
(map (suffix: lib.hasSuffix suffix path) [
++ (map (suffix: lib.hasSuffix suffix path) [
"/web"
"/web/static.go"
"/web/robots.txt"

View file

@ -1,16 +1,19 @@
{ authentik-src
, authentikComponents
, makeWrapper
, runCommandLocal
{
authentik-src,
authentikComponents,
makeWrapper,
runCommandLocal,
}:
runCommandLocal "authentik-manage" {
nativeBuildInputs = [ makeWrapper ];
} ''
mkdir -vp $out/bin
cp -v ${authentik-src}/manage.py $out/bin/manage.py
runCommandLocal "authentik-manage"
{
nativeBuildInputs = [ makeWrapper ];
}
''
mkdir -vp $out/bin
cp -v ${authentik-src}/manage.py $out/bin/manage.py
wrapProgram $out/bin/manage.py \
--prefix PATH : ${authentikComponents.pythonEnv}/bin \
--prefix PYTHONPATH : ${authentikComponents.staticWorkdirDeps}
''
wrapProgram $out/bin/manage.py \
--prefix PATH : ${authentikComponents.pythonEnv}/bin \
--prefix PYTHONPATH : ${authentikComponents.staticWorkdirDeps}
''

View file

@ -1,21 +1,24 @@
{ authentik-src
, authentikComponents
, makeWrapper
, runCommandLocal
{
authentik-src,
authentikComponents,
makeWrapper,
runCommandLocal,
}:
runCommandLocal "authentik-migrate.py" {
nativeBuildInputs = [ makeWrapper ];
} ''
mkdir -vp $out/bin
cp ${authentik-src}/lifecycle/migrate.py $out/bin/migrate.py
chmod +w $out/bin/migrate.py
patchShebangs $out/bin/migrate.py
substituteInPlace $out/bin/migrate.py \
--replace \
'migration_path in Path(__file__).parent.absolute().glob("system_migrations/*.py")' \
'migration_path in Path("${authentikComponents.staticWorkdirDeps}/lifecycle").glob("system_migrations/*.py")'
wrapProgram $out/bin/migrate.py \
--prefix PATH : ${authentikComponents.pythonEnv}/bin \
--prefix PYTHONPATH : ${authentikComponents.staticWorkdirDeps}
''
runCommandLocal "authentik-migrate.py"
{
nativeBuildInputs = [ makeWrapper ];
}
''
mkdir -vp $out/bin
cp ${authentik-src}/lifecycle/migrate.py $out/bin/migrate.py
chmod +w $out/bin/migrate.py
patchShebangs $out/bin/migrate.py
substituteInPlace $out/bin/migrate.py \
--replace \
'migration_path in Path(__file__).parent.absolute().glob("system_migrations/*.py")' \
'migration_path in Path("${authentikComponents.staticWorkdirDeps}/lifecycle").glob("system_migrations/*.py")'
wrapProgram $out/bin/migrate.py \
--prefix PATH : ${authentikComponents.pythonEnv}/bin \
--prefix PYTHONPATH : ${authentikComponents.staticWorkdirDeps}
''

View file

@ -1,9 +1,10 @@
{ authentik-src
, authentikPoetryOverrides
, defaultPoetryOverrides
, lib
, mkPoetryEnv
, python312
{
authentik-src,
authentikPoetryOverrides,
defaultPoetryOverrides,
lib,
mkPoetryEnv,
python312,
}:
mkPoetryEnv {
@ -12,13 +13,13 @@ mkPoetryEnv {
overrides = [
defaultPoetryOverrides
] ++ authentikPoetryOverrides;
groups = ["main"];
checkGroups = [];
groups = [ "main" ];
checkGroups = [ ];
# workaround to remove dev-dependencies for the current combination of legacy
# used by authentik and poetry2nix's behavior
pyproject = builtins.toFile "patched-pyproject.toml" (lib.replaceStrings
["tool.poetry.dev-dependencies"]
["tool.poetry.group.dev.dependencies"]
(builtins.readFile "${authentik-src}/pyproject.toml")
pyproject = builtins.toFile "patched-pyproject.toml" (
lib.replaceStrings [ "tool.poetry.dev-dependencies" ] [ "tool.poetry.group.dev.dependencies" ] (
builtins.readFile "${authentik-src}/pyproject.toml"
)
);
}

View file

@ -1,7 +1,8 @@
{ authentik-src
, authentikComponents
, linkFarm
, applyPatches
{
authentik-src,
authentikComponents,
linkFarm,
applyPatches,
}:
let
patched-src = applyPatches {
@ -14,11 +15,32 @@ let
};
in
linkFarm "authentik-static-workdir-deps" [
{ name = "authentik"; path = "${patched-src}/authentik"; }
{ name = "locale"; path = "${authentik-src}/locale"; }
{ name = "blueprints"; path = "${authentik-src}/blueprints"; }
{ name = "internal"; path = "${authentik-src}/internal"; }
{ name = "lifecycle"; path = "${patched-src}/lifecycle"; }
{ name = "schemas"; path = "${authentik-src}/schemas"; }
{ name = "web"; path = authentikComponents.frontend; }
{
name = "authentik";
path = "${patched-src}/authentik";
}
{
name = "locale";
path = "${authentik-src}/locale";
}
{
name = "blueprints";
path = "${authentik-src}/blueprints";
}
{
name = "internal";
path = "${authentik-src}/internal";
}
{
name = "lifecycle";
path = "${patched-src}/lifecycle";
}
{
name = "schemas";
path = "${authentik-src}/schemas";
}
{
name = "web";
path = authentikComponents.frontend;
}
]