infra/flake.nix

78 lines
1.9 KiB
Nix
Raw Normal View History

2023-05-06 06:49:46 +02:00
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
agenix = {
url = "github:ryantm/agenix";
inputs.darwin.follows = "";
inputs.home-manager.follows = "";
};
valheim-server = {
url = "github:aidalgol/valheim-server-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
nixinate = {
url = "github:matthewcroughan/nixinate";
inputs.nixpkgs.follows = "nixpkgs";
};
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
};
outputs = {
self,
nixpkgs,
...
} @ inputs: let
system = "x86_64-linux";
overlays = final: prev: {
unstable = inputs.nixpkgs-unstable.legacyPackages.${prev.system};
};
in {
apps = inputs.nixinate.nixinate.${system} self;
nixosConfigurations.main-node = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
{
_module.args.nixinate = {
host = "main-node";
buildOn = "remote";
hermetic = false;
};
nixpkgs.overlays = [overlays];
}
./hosts/main-node
./config
inputs.agenix.nixosModules.default
inputs.valheim-server.nixosModules.default
];
};
checks.${system}.pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
alejandra.enable = true;
deadnix.enable = true;
shellcheck.enable = true;
stylua.enable = true;
};
settings.deadnix = {
noLambdaPatternNames = true;
noLambdaArg = true;
};
};
devShells.${system}.default = let
pkgs = nixpkgs.legacyPackages.${system};
in
pkgs.mkShell {
inherit (self.checks.${system}.pre-commit-check) shellHook;
buildInputs = [
inputs.agenix.packages.${system}.agenix
];
};
};
}