infra/flake.nix

177 lines
5 KiB
Nix
Raw Normal View History

2023-05-06 06:49:46 +02:00
{
2024-09-18 16:10:20 +02:00
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; } {
2023-07-03 05:37:43 +02:00
flake = {
2024-09-16 16:56:18 +02:00
nixosConfigurations.main-node = nixpkgs.lib.nixosSystem {
2023-07-03 05:37:43 +02:00
system = "x86_64-linux";
modules = [
{
2023-07-03 21:25:18 +02:00
nixpkgs = {
2023-10-18 20:31:26 +02:00
inherit overlays;
2024-09-18 23:32:50 +02:00
config.allowUnfreePredicate =
pkg:
builtins.elem (nixpkgs.lib.getName pkg) [
"elasticsearch"
"satisfactory-server"
"steamworks-sdk-redist"
"valheim-server"
];
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
2023-07-03 05:37:43 +02:00
inputs.agenix.nixosModules.default
2024-08-23 20:35:59 +02:00
inputs.attic.nixosModules.atticd
2024-03-08 12:47:39 +01:00
inputs.home-manager.nixosModules.home-manager
2024-09-11 08:52:28 +02:00
inputs.satisfactory-server.nixosModules.default
2024-09-16 16:56:18 +02:00
inputs.valheim-server.nixosModules.default
2023-07-03 05:37:43 +02:00
];
2024-09-18 16:10:20 +02:00
specialArgs = {
inherit inputs;
};
2023-07-03 05:37:43 +02:00
};
2024-09-16 17:04:33 +02:00
2024-09-18 19:44:09 +02:00
checks = builtins.mapAttrs (_: deployLib: deployLib.deployChecks self.deploy) inputs.deploy-rs.lib;
2024-09-16 17:04:33 +02:00
deploy.nodes.main-node = {
hostname = "winston.sh";
profiles.system = {
2024-09-16 20:57:30 +02:00
sshUser = "root";
2024-09-16 17:04:33 +02:00
path = inputs.deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.main-node;
};
};
2023-07-03 05:37:43 +02:00
};
2023-05-06 06:49:46 +02:00
2024-09-18 16:10:20 +02:00
perSystem =
{
config,
inputs',
pkgs,
self',
system,
...
}:
{
_module.args.pkgs = import nixpkgs { inherit overlays system; };
2024-03-03 00:24:08 +01:00
2024-09-18 16:10:20 +02:00
devShells.default = pkgs.mkShell {
inherit (config.pre-commit.devShell) shellHook;
2024-09-18 23:32:50 +02:00
packages = [
2024-09-18 16:10:20 +02:00
inputs'.agenix.packages.agenix
pkgs.age-plugin-yubikey
pkgs.unstable.deploy-rs
self'.formatter
];
};
2024-09-16 17:04:33 +02:00
2024-09-18 16:10:20 +02:00
formatter = pkgs.nixfmt-rfc-style;
2024-09-16 17:04:33 +02:00
2024-09-18 16:10:20 +02:00
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;
};
2023-05-06 06:49:46 +02:00
};
2023-07-03 05:37:43 +02:00
};
2024-09-19 00:20:13 +02:00
imports = [ inputs.git-hooks.flakeModule ];
2024-09-18 16:10:20 +02:00
systems = [
"aarch64-darwin"
2024-09-18 19:44:09 +02:00
"aarch64-linux"
2024-09-18 16:10:20 +02:00
"x86_64-darwin"
2024-09-18 19:44:09 +02:00
"x86_64-linux"
2024-09-18 16:10:20 +02:00
];
2023-07-03 05:37:43 +02:00
};
inputs = {
2024-08-13 07:21:27 +02:00
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
2024-03-08 12:47:39 +01:00
home-manager = {
2024-08-13 07:21:27 +02:00
url = "github:nix-community/home-manager/release-24.05";
2024-03-08 12:47:39 +01:00
inputs.nixpkgs.follows = "nixpkgs";
};
2024-03-07 22:16:02 +01:00
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";
};
2024-08-23 20:35:59 +02:00
attic = {
url = "github:zhaofengli/attic";
inputs.nixpkgs.follows = "nixpkgs-unstable";
inputs.nixpkgs-stable.follows = "nixpkgs";
inputs.flake-compat.follows = "";
2024-09-19 00:20:13 +02:00
inputs.flake-parts.follows = "flake-parts";
2024-08-23 20:35:59 +02:00
};
2024-09-16 17:04:33 +02:00
deploy-rs = {
url = "github:serokell/deploy-rs";
inputs.flake-compat.follows = "";
inputs.nixpkgs.follows = "nixpkgs";
inputs.utils.follows = "flake-utils";
};
2024-09-19 00:20:13 +02:00
git-hooks = {
url = "github:cachix/git-hooks.nix";
2024-03-07 22:16:02 +01:00
inputs.flake-compat.follows = "";
inputs.nixpkgs.follows = "nixpkgs-unstable";
inputs.nixpkgs-stable.follows = "nixpkgs";
};
2024-09-16 16:56:18 +02:00
# game servers
steam-fetcher = {
url = "github:nix-community/steam-fetcher";
2024-03-07 22:16:02 +01:00
inputs.nixpkgs.follows = "nixpkgs";
};
2024-09-11 08:52:28 +02:00
satisfactory-server = {
2024-09-16 16:56:18 +02:00
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";
2024-09-16 16:56:18 +02:00
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="
];
};
2023-05-06 06:49:46 +02:00
}