infra/flake.nix

86 lines
2.3 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";
2023-07-03 05:37:43 +02:00
flake-utils.url = "github:numtide/flake-utils";
flake-parts.url = "github:hercules-ci/flake-parts";
2023-05-06 06:49:46 +02:00
agenix = {
url = "github:ryantm/agenix";
inputs.darwin.follows = "";
inputs.home-manager.follows = "";
};
valheim-server = {
url = "github:aidalgol/valheim-server-flake";
2023-07-03 05:37:43 +02:00
inputs.flake-utils.follows = "flake-utils";
2023-05-06 06:49:46 +02:00
inputs.nixpkgs.follows = "nixpkgs";
};
nixinate = {
url = "github:matthewcroughan/nixinate";
inputs.nixpkgs.follows = "nixpkgs";
};
2023-07-03 05:37:43 +02:00
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.flake-utils.follows = "flake-utils";
};
2023-05-06 06:49:46 +02:00
};
2023-07-03 05:37:43 +02:00
outputs = {flake-parts, ...} @ inputs: let
2023-05-06 06:49:46 +02:00
overlays = final: prev: {
unstable = inputs.nixpkgs-unstable.legacyPackages.${prev.system};
};
2023-07-03 05:37:43 +02:00
in
flake-parts.lib.mkFlake {inherit inputs;} {
flake = {
nixosConfigurations.main-node = inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
{
_module.args.nixinate = {
host = "main-node";
buildOn = "remote";
hermetic = false;
};
2023-07-03 21:25:18 +02:00
nixpkgs = {
config.allowUnfree = true;
overlays = [overlays];
};
2023-07-03 05:37:43 +02:00
}
./hosts/main-node
./config
inputs.agenix.nixosModules.default
inputs.valheim-server.nixosModules.default
];
};
};
2023-05-06 06:49:46 +02:00
2023-07-03 05:37:43 +02:00
perSystem = {
pkgs,
system,
self',
...
}: {
apps = (inputs.nixinate.nixinate.${system} inputs.self).nixinate;
checks.pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
alejandra.enable = true;
nil.enable = true;
2023-05-06 06:49:46 +02:00
};
2023-07-03 05:37:43 +02:00
};
2023-05-06 06:49:46 +02:00
2023-07-03 05:37:43 +02:00
devShells.default = pkgs.mkShell {
buildInputs = [inputs.agenix.packages.${system}.agenix];
inherit (inputs.self.checks.${system}.pre-commit-check) shellHook;
};
2023-05-06 06:49:46 +02:00
2023-07-03 05:37:43 +02:00
formatter = pkgs.alejandra;
2023-05-06 06:49:46 +02:00
};
2023-07-03 05:37:43 +02:00
systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"];
};
2023-05-06 06:49:46 +02:00
}