Fediversity/flake.nix

58 lines
1.5 KiB
Nix
Raw Normal View History

2024-11-13 22:41:34 +01:00
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
flake-parts.url = "github:hercules-ci/flake-parts";
git-hooks.url = "github:cachix/git-hooks.nix";
};
outputs =
inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
2024-11-14 01:10:00 +01:00
imports = [
inputs.git-hooks.flakeModule
./services/flake-part.nix
];
2024-11-13 22:41:34 +01:00
perSystem =
{ config, pkgs, ... }:
{
formatter = pkgs.nixfmt-rfc-style;
pre-commit.settings.hooks =
## Not everybody might want pre-commit hooks, so we make them
## opt-in. Maybe one day we will decide to have them everywhere.
let
inherit (builtins) concatStringsSep;
optin = [
"deployment"
"services"
];
2024-11-13 22:41:34 +01:00
files = "^((" + concatStringsSep "|" optin + ")/.*\\.nix|[^/]*\\.nix)$";
in
{
nixfmt-rfc-style = {
enable = true;
inherit files;
};
deadnix = {
enable = true;
inherit files;
};
};
2024-11-14 01:10:00 +01:00
devShells.default = pkgs.mkShell {
packages = [ pkgs.nil ];
shellHook = config.pre-commit.installationScript;
};
2024-11-13 22:41:34 +01:00
};
};
}