forked from Fediversity/Fediversity
78 lines
2.2 KiB
Nix
78 lines
2.2 KiB
Nix
{
|
|
inputs = {
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
|
git-hooks.url = "github:cachix/git-hooks.nix";
|
|
nixops4.follows = "nixops4-nixos/nixops4";
|
|
nixops4-nixos.url = "github:nixops4/nixops4-nixos";
|
|
};
|
|
|
|
outputs =
|
|
inputs@{ self, flake-parts, ... }:
|
|
let
|
|
sources = import ./npins;
|
|
inherit (import sources.flake-inputs) import-flake;
|
|
inherit (sources) git-hooks;
|
|
# XXX(@fricklerhandwerk): this atrocity is required to splice in a foreign Nixpkgs via flake-parts
|
|
# XXX - this is just importing a flake
|
|
nixpkgs = import-flake { src = sources.nixpkgs; };
|
|
# XXX - this overrides the inputs attached to `self`
|
|
inputs' = self.inputs // {
|
|
nixpkgs = nixpkgs;
|
|
};
|
|
self' = self // {
|
|
inputs = inputs';
|
|
};
|
|
in
|
|
# XXX - finally we override the overall set of `inputs` -- we need both:
|
|
# `flake-parts obtains `nixpkgs` from `self.inputs` and not from `inputs`.
|
|
flake-parts.lib.mkFlake
|
|
{
|
|
inputs = inputs // {
|
|
inherit nixpkgs;
|
|
};
|
|
self = self';
|
|
}
|
|
(
|
|
{ inputs, ... }:
|
|
{
|
|
systems = [
|
|
"x86_64-linux"
|
|
"aarch64-linux"
|
|
"x86_64-darwin"
|
|
"aarch64-darwin"
|
|
];
|
|
|
|
imports = [
|
|
"${git-hooks}/flake-module.nix"
|
|
inputs.nixops4.modules.flake.default
|
|
|
|
./deployment/flake-part.nix
|
|
./infra/flake-part.nix
|
|
];
|
|
|
|
perSystem =
|
|
{
|
|
pkgs,
|
|
lib,
|
|
...
|
|
}:
|
|
{
|
|
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;
|
|
};
|
|
};
|
|
}
|
|
);
|
|
}
|