feat: switch from flake-parts and devenv to rensa ecosystem

This commit is contained in:
technofab 2025-12-31 18:31:09 +01:00
parent 0a0d354962
commit dcb87e8c3e
Signed by: technofab
SSH key fingerprint: SHA256:bV4h88OqS/AxjbPn66uUdvK9JsgIW4tv3vwJQ8tpMqQ
21 changed files with 649 additions and 652 deletions

45
nix/repo/ci.nix Normal file
View file

@ -0,0 +1,45 @@
{inputs, ...}: let
inherit (inputs) cilib;
in
cilib.mkCI {
pipelines."default" = {
stages = ["test" "build" "deploy"];
jobs = {
"test:lib" = {
stage = "test";
script = [
"nix run .#tests -- --junit=junit.xml"
];
allow_failure = true;
artifacts = {
when = "always";
reports.junit = "junit.xml";
};
};
"docs" = {
stage = "build";
script = [
# sh
''
nix build .#docs:default
mkdir -p public
cp -r result/. public/
''
];
artifacts.paths = ["public"];
};
"pages" = {
nix.enable = false;
image = "alpine:latest";
stage = "deploy";
script = ["true"];
artifacts.paths = ["public"];
rules = [
{
"if" = "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH";
}
];
};
};
};
}

46
nix/repo/devShells.nix Normal file
View file

@ -0,0 +1,46 @@
{
inputs,
cell,
...
}: let
inherit (inputs) pkgs devshell treefmt devtools-lib;
inherit (cell) soonix;
treefmtWrapper = treefmt.mkWrapper pkgs {
projectRootFile = "flake.nix";
programs = {
alejandra.enable = true;
mdformat.enable = true;
};
settings.formatter.mdformat.command = let
pkg = pkgs.python3.withPackages (p: [
p.mdformat
p.mdformat-mkdocs
]);
in "${pkg}/bin/mdformat";
};
in {
default = devshell.mkShell {
imports = [soonix.devshellModule devtools-lib.devshellModule];
packages = [
treefmtWrapper
];
lefthook.config = {
"pre-commit" = {
parallel = true;
jobs = [
{
name = "treefmt";
stage_fixed = true;
run = "${treefmtWrapper}/bin/treefmt";
env.TERM = "dumb";
}
{
name = "soonix";
stage_fixed = true;
run = "nix run .#soonix:update";
}
];
};
};
};
}

64
nix/repo/docs.nix Normal file
View file

@ -0,0 +1,64 @@
{inputs, ...}: let
inherit (inputs) pkgs doclib nblib;
optionsDoc = doclib.mkOptionDocs {
module = nblib.module;
roots = [
{
url = "https://gitlab.com/TECHNOFAB/nixible/-/blob/main/lib";
path = "${inputs.self}/lib";
}
];
};
optionsDocs = pkgs.runCommand "options-docs" {} ''
mkdir -p $out
ln -s ${optionsDoc} $out/options.md
'';
in
(doclib.mkDocs {
docs."default" = {
base = "${inputs.self}";
path = "${inputs.self}/docs";
material = {
enable = true;
colors = {
primary = "black";
accent = "blue";
};
umami = {
enable = true;
src = "https://analytics.tf/umami";
siteId = "d8354dfa-2ad2-4089-90d2-899b981aef22";
domains = ["nixible.projects.tf"];
};
};
macros = {
enable = true;
includeDir = toString optionsDocs;
};
config = {
site_name = "Nixible";
site_url = "https://nixible.projects.tf";
repo_name = "TECHNOFAB/nixible";
repo_url = "https://gitlab.com/TECHNOFAB/nixible";
extra_css = ["style.css"];
theme = {
logo = "images/logo.svg";
icon.repo = "simple/gitlab";
favicon = "images/logo.svg";
};
nav = [
{"Introduction" = "index.md";}
{"Usage" = "usage.md";}
{"Examples" = "examples.md";}
{"Reference" = "reference.md";}
{"Options" = "options.md";}
];
markdown_extensions = [
"pymdownx.superfences"
"admonition"
];
};
};
}).packages
// {inherit optionsDocs;}

136
nix/repo/flake.lock generated Normal file
View file

@ -0,0 +1,136 @@
{
"nodes": {
"devshell-lib": {
"locked": {
"dir": "lib",
"lastModified": 1758204313,
"narHash": "sha256-ainbY0Oajb1HMdvy+A8QxF/P5qwcbEzJGEY5pzKdDdc=",
"owner": "rensa-nix",
"repo": "devshell",
"rev": "7d0c4bc78d9f017a739b0c7eb2f4e563118353e6",
"type": "gitlab"
},
"original": {
"dir": "lib",
"owner": "rensa-nix",
"repo": "devshell",
"type": "gitlab"
}
},
"devtools-lib": {
"locked": {
"dir": "lib",
"lastModified": 1766237846,
"narHash": "sha256-7n3WFabnf49SFHXD/e4zfLit3BniZZOecUXfBm3d1d0=",
"owner": "rensa-nix",
"repo": "devtools",
"rev": "5c8712f48c5bcb6b79d3da1afd1268f84f5e35e3",
"type": "gitlab"
},
"original": {
"dir": "lib",
"owner": "rensa-nix",
"repo": "devtools",
"type": "gitlab"
}
},
"nix-gitlab-ci-lib": {
"locked": {
"dir": "lib",
"lastModified": 1765444672,
"narHash": "sha256-B0cMjRs9P50ym9Le0VUcRN69Yy6tbV13MXq81tTTEus=",
"owner": "TECHNOFAB",
"repo": "nix-gitlab-ci",
"rev": "8f88a53b5479773cd626420362631bc1da99e677",
"type": "gitlab"
},
"original": {
"dir": "lib",
"owner": "TECHNOFAB",
"ref": "3.1.2",
"repo": "nix-gitlab-ci",
"type": "gitlab"
}
},
"nixmkdocs-lib": {
"locked": {
"dir": "lib",
"lastModified": 1763481845,
"narHash": "sha256-Bp0+9rDmlPWMcnKqGx+BG4+o5KO8FuDAOvXRnXrm3Fo=",
"owner": "TECHNOFAB",
"repo": "nixmkdocs",
"rev": "73d59093df94a894d25bc4bf71880b6f00faa62f",
"type": "gitlab"
},
"original": {
"dir": "lib",
"owner": "TECHNOFAB",
"repo": "nixmkdocs",
"type": "gitlab"
}
},
"nixtest-lib": {
"locked": {
"dir": "lib",
"lastModified": 1766514204,
"narHash": "sha256-jK6gHvJJjUpEWrPvraBgstsF7oifatuWsj9suy7GFus=",
"owner": "TECHNOFAB",
"repo": "nixtest",
"rev": "b87e38847d84973e84b6727b24fea48b7bc108c1",
"type": "gitlab"
},
"original": {
"dir": "lib",
"owner": "TECHNOFAB",
"repo": "nixtest",
"type": "gitlab"
}
},
"root": {
"inputs": {
"devshell-lib": "devshell-lib",
"devtools-lib": "devtools-lib",
"nix-gitlab-ci-lib": "nix-gitlab-ci-lib",
"nixmkdocs-lib": "nixmkdocs-lib",
"nixtest-lib": "nixtest-lib",
"soonix-lib": "soonix-lib",
"treefmt-nix": "treefmt-nix"
}
},
"soonix-lib": {
"locked": {
"dir": "lib",
"lastModified": 1763323017,
"narHash": "sha256-MJyg37d+VMfRoFiVUj16FW+zkEwQXbgK9LoFF/SHoxA=",
"owner": "TECHNOFAB",
"repo": "soonix",
"rev": "078034b01e4eaf1f9436d46721f7cbe0d96eb8b4",
"type": "gitlab"
},
"original": {
"dir": "lib",
"owner": "TECHNOFAB",
"repo": "soonix",
"type": "gitlab"
}
},
"treefmt-nix": {
"flake": false,
"locked": {
"lastModified": 1762938485,
"narHash": "sha256-AlEObg0syDl+Spi4LsZIBrjw+snSVU4T8MOeuZJUJjM=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "5b4ee75aeefd1e2d5a1cc43cf6ba65eba75e83e4",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

25
nix/repo/flake.nix Normal file
View file

@ -0,0 +1,25 @@
{
inputs = {
devshell-lib.url = "gitlab:rensa-nix/devshell?dir=lib";
devtools-lib.url = "gitlab:rensa-nix/devtools?dir=lib";
soonix-lib.url = "gitlab:TECHNOFAB/soonix?dir=lib";
nix-gitlab-ci-lib.url = "gitlab:TECHNOFAB/nix-gitlab-ci/3.1.2?dir=lib";
nixmkdocs-lib.url = "gitlab:TECHNOFAB/nixmkdocs?dir=lib";
nixtest-lib.url = "gitlab:TECHNOFAB/nixtest?dir=lib";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
flake = false;
};
};
outputs = i:
i
// {
devshell = i.devshell-lib.lib {inherit (i.parent) pkgs;};
soonix = i.soonix-lib.lib {inherit (i.parent) pkgs;};
cilib = i.nix-gitlab-ci-lib.lib {inherit (i.parent) pkgs;};
ntlib = i.nixtest-lib.lib {inherit (i.parent) pkgs;};
doclib = i.nixmkdocs-lib.lib {inherit (i.parent) pkgs;};
nblib = import "${i.parent.self}/lib" {inherit (i.parent) pkgs;};
treefmt = import i.treefmt-nix;
};
}

39
nix/repo/soonix.nix Normal file
View file

@ -0,0 +1,39 @@
{
inputs,
cell,
...
}: let
inherit (inputs) soonix;
inherit (cell) ci;
in
(soonix.make {
hooks = {
ci = ci.soonix;
renovate = {
output = ".gitlab/renovate.json5";
data = {
extends = ["config:recommended"];
postUpgradeTasks = {
commands = [
"nix-portable nix run .#soonix:update"
];
executionMode = "branch";
};
lockFileMaintenance = {
enabled = true;
extends = ["schedule:monthly"];
branchTopic = "lock-file-maintenance-{{packageFile}}";
commitMessageExtra = "({{packageFile}})";
};
nix.enabled = true;
gitlabci.enabled = false;
};
hook = {
mode = "copy";
gitignore = false;
};
opts.format = "json";
};
};
}).config

10
nix/repo/tests.nix Normal file
View file

@ -0,0 +1,10 @@
{inputs, ...}: let
inherit (inputs) pkgs ntlib nblib;
in {
tests = ntlib.mkNixtest {
modules = ntlib.autodiscover {dir = "${inputs.self}/tests";};
args = {
inherit pkgs ntlib nblib;
};
};
}