infra/flake.nix
winston df0cca66ae
All checks were successful
/ check (push) Successful in 25m57s
chore(nix): update lockfile
2024-09-19 00:20:22 +02:00

176 lines
5 KiB
Nix

{
outputs =
{
flake-parts,
nixpkgs,
nixpkgs-unstable,
self,
...
}@inputs:
let
overlays = [
(final: _: {
unstable = nixpkgs-unstable.legacyPackages.${final.system};
prometheus-fail2ban-exporter = final.callPackage ./pkgs/prometheus-fail2ban-exporter { };
})
];
in
flake-parts.lib.mkFlake { inherit inputs; } {
flake = {
nixosConfigurations.main-node = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
{
nixpkgs = {
inherit overlays;
config.allowUnfreePredicate =
pkg:
builtins.elem (nixpkgs.lib.getName pkg) [
"elasticsearch"
"satisfactory-server"
"steamworks-sdk-redist"
"valheim-server"
];
};
}
./hosts/main-node
./config
./modules
inputs.agenix.nixosModules.default
inputs.attic.nixosModules.atticd
inputs.home-manager.nixosModules.home-manager
inputs.satisfactory-server.nixosModules.default
inputs.valheim-server.nixosModules.default
];
specialArgs = {
inherit inputs;
};
};
checks = builtins.mapAttrs (_: deployLib: deployLib.deployChecks self.deploy) inputs.deploy-rs.lib;
deploy.nodes.main-node = {
hostname = "winston.sh";
profiles.system = {
sshUser = "root";
path = inputs.deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.main-node;
};
};
};
perSystem =
{
config,
inputs',
pkgs,
self',
system,
...
}:
{
_module.args.pkgs = import nixpkgs { inherit overlays system; };
devShells.default = pkgs.mkShell {
inherit (config.pre-commit.devShell) shellHook;
packages = [
inputs'.agenix.packages.agenix
pkgs.age-plugin-yubikey
pkgs.unstable.deploy-rs
self'.formatter
];
};
formatter = pkgs.nixfmt-rfc-style;
pre-commit = {
check.enable = true;
settings.excludes = [ "_sources/" ];
settings.hooks = {
commitizen.enable = true;
editorconfig-checker.enable = true;
nil.enable = true;
nixfmt-rfc-style.enable = true;
shellcheck.enable = true;
};
};
};
imports = [ inputs.git-hooks.flakeModule ];
systems = [
"aarch64-darwin"
"aarch64-linux"
"x86_64-darwin"
"x86_64-linux"
];
};
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager/release-24.05";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
agenix = {
url = "github:ryantm/agenix";
inputs.darwin.follows = "";
inputs.home-manager.follows = "";
inputs.nixpkgs.follows = "nixpkgs";
};
attic = {
url = "github:zhaofengli/attic";
inputs.nixpkgs.follows = "nixpkgs-unstable";
inputs.nixpkgs-stable.follows = "nixpkgs";
inputs.flake-compat.follows = "";
inputs.flake-parts.follows = "flake-parts";
};
deploy-rs = {
url = "github:serokell/deploy-rs";
inputs.flake-compat.follows = "";
inputs.nixpkgs.follows = "nixpkgs";
inputs.utils.follows = "flake-utils";
};
git-hooks = {
url = "github:cachix/git-hooks.nix";
inputs.flake-compat.follows = "";
inputs.nixpkgs.follows = "nixpkgs-unstable";
inputs.nixpkgs-stable.follows = "nixpkgs";
};
# game servers
steam-fetcher = {
url = "github:nix-community/steam-fetcher";
inputs.nixpkgs.follows = "nixpkgs";
};
satisfactory-server = {
url = "github:nekowinston/satisfactory-server-flake";
inputs.nixpkgs.follows = "nixpkgs";
inputs.steam-fetcher.follows = "steam-fetcher";
};
valheim-server = {
url = "github:aidalgol/valheim-server-flake";
inputs.nixpkgs.follows = "nixpkgs";
inputs.steam-fetcher.follows = "steam-fetcher";
};
};
nixConfig = {
substituters = [
"https://cache.nixos.org"
"https://cache.garnix.io"
"https://pre-commit-hooks.cachix.org"
];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
"pre-commit-hooks.cachix.org-1:Pkk3Panw5AW24TOv6kz3PvLhlH8puAsJTBbOPmBo7Rc="
];
};
}