infra/flake.nix

105 lines
2.8 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/nixos-unstable";
2023-05-06 06:49:46 +02:00
agenix.inputs.darwin.follows = "";
agenix.inputs.home-manager.follows = "";
agenix.url = "github:ryantm/agenix";
2023-07-03 05:37:43 +02:00
flake-parts.url = "github:hercules-ci/flake-parts";
nixinate.url = "github:matthewcroughan/nixinate";
2023-10-18 20:31:26 +02:00
nixinate.inputs.nixpkgs.follows = "nixpkgs";
2023-07-03 05:37:43 +02:00
2023-10-18 20:31:26 +02:00
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs-unstable";
inputs.nixpkgs-stable.follows = "nixpkgs";
};
valheim-server = {
url = "github:nekowinston/valheim-server-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
2023-07-05 21:41:15 +02:00
};
nixConfig = {
substituters = [
"https://cache.nixos.org"
2023-07-05 21:41:15 +02:00
"https://cache.garnix.io"
2023-07-06 21:07:30 +02:00
"https://pre-commit-hooks.cachix.org"
2023-07-05 21:41:15 +02:00
];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
2023-07-05 21:41:15 +02:00
"cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
2023-07-06 21:07:30 +02:00
"pre-commit-hooks.cachix.org-1:Pkk3Panw5AW24TOv6kz3PvLhlH8puAsJTBbOPmBo7Rc="
2023-07-05 21:41:15 +02:00
];
2023-05-06 06:49:46 +02:00
};
2023-10-18 20:31:26 +02:00
outputs = {
flake-parts,
self,
...
} @ inputs: let
overlays = [
(final: prev: rec {
atuin = unstable.atuin;
unstable = import inputs.nixpkgs-unstable {
inherit (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";
2023-10-18 20:31:26 +02:00
buildOn = "remote";
hermetic = false;
2023-07-03 05:37:43 +02:00
};
2023-07-03 21:25:18 +02:00
nixpkgs = {
config.allowUnfree = true;
2023-10-18 20:31:26 +02:00
inherit overlays;
2023-07-03 21:25:18 +02:00
};
2023-07-03 05:37:43 +02:00
}
./hosts/main-node
./config
2023-07-06 16:58:43 +02:00
./modules
# inputs.attic.nixosModules.atticd
2023-07-03 05:37:43 +02:00
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 = {
2023-10-18 20:31:26 +02:00
inputs',
2023-07-03 05:37:43 +02:00
pkgs,
system,
...
}: {
2023-10-18 20:31:26 +02:00
apps = (inputs.nixinate.nixinate.${system} self).nixinate;
2023-07-03 05:37:43 +02:00
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 {
2023-10-18 20:31:26 +02:00
buildInputs = [inputs'.agenix.packages.agenix];
inherit (self.checks.${system}.pre-commit-check) shellHook;
2023-07-03 05:37:43 +02:00
};
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
}