Fediversity/flake.nix
Kiara Grouwstra da16381a9b
panel deploys thru model
Signed-off-by: Kiara Grouwstra <kiara@procolix.eu>
2025-11-23 16:08:51 +01:00

98 lines
3.2 KiB
Nix

{
inputs = {
nixops4.follows = "nixops4-nixos/nixops4";
nixops4-nixos.url = "github:nixops4/nixops4-nixos";
};
outputs =
inputs:
{
nixConfig = {
extra-trusted-substituters = "https://cache.saumon.network/proxmox-nixos";
extra-trusted-public-keys = "proxmox-nixos:D9RYSWpQQC/msZUWphOY2I5RLH5Dd6yQcaHIuug7dWM=";
};
}
// import ./mkFlake.nix inputs (
{ inputs, sources, ... }:
{
imports = [
"${sources.git-hooks}/flake-module.nix"
inputs.nixops4.modules.flake.default
./deployment/flake-part.nix
./infra/flake-part.nix
./keys/flake-part.nix
./secrets/flake-part.nix
./services/tests/flake-part.nix
];
perSystem =
{
pkgs,
lib,
system,
...
}:
{
checks = {
panel = (import ./. { inherit sources system; }).tests.panel.basic;
};
formatter = pkgs.nixfmt-rfc-style;
pre-commit.settings.hooks =
let
## Add a directory here if pre-commit hooks shouldn't apply to it.
optout = [ "npins" ];
excludes = map (dir: "^${dir}/") optout;
addExcludes = lib.mapAttrs (_: c: c // { inherit excludes; });
in
addExcludes {
nixfmt-rfc-style.enable = true;
deadnix.enable = true;
trim-trailing-whitespace.enable = true;
shellcheck.enable = true;
};
apps =
let
inherit (pkgs.callPackage ./deployment/utils.nix { }) optionalEnv;
default-configuration = builtins.fromJSON (
let
env = builtins.getEnv "DEPLOYMENT";
in
if env != "" then
env
else
builtins.trace "env var DEPLOYMENT not set, falling back to `deployment/configuration.sample.json`!" (
lib.readFile ./deployment/configuration.sample.json
)
);
host-mapping = {
pixelfed = "test04";
peertube = "test05";
mastodon = "test06";
};
inherit
(import ./deployment/fediversity {
inherit system host-mapping;
ancilliary.garage = "test01";
key-file =
let
key = optionalEnv "SSH_PRIVATE_KEY_FILE";
in
builtins.trace ("SSH_PRIVATE_KEY_FILE: " + builtins.toString key) key;
conf."default-configuration" = default-configuration // {
enable = true;
applications = lib.mapAttrs (_app: _: { enable = true; }) host-mapping;
};
})
ssh-hosts
;
in
lib.mapAttrs (_: program: {
type = "app";
inherit program;
}) ssh-hosts;
};
}
);
}