infra/flake.nix

104 lines
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-07-05 21:41:15 +02:00
attic.url = "github:zhaofengli/attic";
sanctureplicum-nur.url = "git+https://gitea.pid1.sh/sanctureplicum/nur.git";
};
nixConfig = {
extra-trusted-substituters = [
"https://cache.garnix.io"
"https://sanctureplicum.cachix.org"
"https://staging.attic.rs/attic-ci"
];
extra-trusted-public-keys = [
"attic-ci:U5Sey4mUxwBXM3iFapmP0/ogODXywKLRNgRPQpEXxbo="
"sanctureplicum.cachix.org-1:VztHStNqXs5pFZ0eNVoIfoqCaeKdNKRqkbNb8lYrqQ8="
"cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
];
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: {
2023-07-05 21:41:15 +02:00
gitea-nyx = inputs.sanctureplicum-nur.packages.${prev.system}.gitea-nyx;
2023-05-06 06:49:46 +02:00
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
2023-07-05 21:41:15 +02:00
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 = {
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
}