Fediversity/flake.nix

70 lines
2.2 KiB
Nix

{
outputs = { self, ... }: let
inherit sources = import ./npins;
inherit (sources) nixpkgs flake-parts nixops4 nixops4-nixos git-hooks;
pkgs = import nixpkgs;
inherit (pkgs) lib;
flake-parts-lib = import "${flake-parts}/lib.nix" { inherit lib; };
in flake-parts-lib.mkFlake { inherit self; } {
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
imports = [
(import "${git-hooks}/flake-module.nix")
(lib.importApply "${nixops4}/nix/flake-parts/flake-parts.nix" { inherit self; })
./infra/flake-part.nix
./services/flake-part.nix
];
perSystem =
{
config,
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;
};
devShells.default = pkgs.mkShell {
packages = [
pkgs.nil
(pkgs.callPackage "${agenix}/pkgs/agenix.nix" {})
pkgs.openssh
pkgs.httpie
pkgs.jq
# exposing this env var as a hack to pass info in from form
(
(pkgs.callPackage "${nixops4}/package.nix" {
# nixops4-cli-rust = config.packages.nixops4-release; # https://github.com/nixops4/nixops4/tree/main/rust/nixops4
# nixops4-eval = config.packages.nixops4-eval-release; # https://github.com/nixops4/nixops4/tree/main/rust/nixops4-eval
})
.overrideAttrs {
impureEnvVars = [ "DEPLOYMENT" ];
}
)
];
shellHook = config.pre-commit.installationScript;
};
};
};
}