infra/flake.nix

146 lines
4.1 KiB
Nix
Raw Normal View History

2023-05-06 06:49:46 +02:00
{
2023-10-18 20:31:26 +02:00
outputs = {
flake-parts,
2024-09-16 16:56:18 +02:00
nixpkgs,
nixpkgs-unstable,
2023-10-18 20:31:26 +02:00
...
} @ inputs: let
overlays = [
2024-09-16 16:56:18 +02:00
(final: _: {
unstable = nixpkgs-unstable.legacyPackages.${final.system};
prometheus-fail2ban-exporter = final.callPackage ./pkgs/prometheus-fail2ban-exporter {};
2023-10-18 20:31:26 +02:00
})
];
2023-07-03 05:37:43 +02:00
in
flake-parts.lib.mkFlake {inherit inputs;} {
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 = {
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
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
];
specialArgs = {inherit inputs;};
2023-07-03 05:37:43 +02:00
};
};
2023-05-06 06:49:46 +02:00
2023-07-03 05:37:43 +02:00
perSystem = {
config,
2023-10-18 20:31:26 +02:00
inputs',
2023-07-03 05:37:43 +02:00
pkgs,
2024-03-03 00:24:08 +01:00
self',
2023-07-03 05:37:43 +02:00
system,
...
}: {
2024-09-16 16:56:18 +02:00
_module.args.pkgs = import nixpkgs {
2024-03-03 00:24:08 +01:00
inherit overlays system;
};
pre-commit = {
check.enable = true;
2024-05-16 23:31:40 +02:00
settings.excludes = ["_sources/"];
settings.hooks = {
2023-07-03 05:37:43 +02:00
alejandra.enable = true;
commitizen.enable = true;
2024-03-07 15:37:29 +01:00
deadnix.enable = true;
editorconfig-checker.enable = true;
2023-07-03 05:37:43 +02:00
nil.enable = true;
shellcheck.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
2024-03-07 15:37:29 +01:00
devShells.default = pkgs.mkShell {
inherit (config.pre-commit.devShell) shellHook;
2024-03-09 01:05:51 +01:00
buildInputs = [
inputs'.agenix.packages.agenix
2024-09-13 18:01:30 +02:00
pkgs.age-plugin-yubikey
2024-03-09 01:05:51 +01:00
pkgs.unstable.nh
pkgs.unstable.nil
self'.formatter
];
2024-03-07 15:37:29 +01: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
imports = [inputs.pre-commit-hooks.flakeModule];
2023-07-03 05:37:43 +02:00
systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"];
};
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 = "";
inputs.flake-utils.follows = "flake-utils";
};
pre-commit-hooks = {
url = "github:cachix/pre-commit-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
}