infra/flake.nix

143 lines
4 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,
self,
...
} @ inputs: let
overlays = [
2024-03-07 15:37:29 +01:00
(_: prev: rec {
2023-10-18 20:31:26 +02:00
atuin = unstable.atuin;
2024-03-03 00:24:08 +01:00
unstable = inputs.nixpkgs-unstable.legacyPackages.${prev.system};
2023-10-18 20:31:26 +02:00
})
];
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 = [
{
2024-01-27 15:57:09 +01:00
_module.args.nixinate.host = "main-node";
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
};
2024-03-09 01:05:51 +01:00
home-manager.sharedModules = [
inputs.vscode-server.homeModules.default
inputs.nix-index-database.hmModules.nix-index
];
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-03-08 12:47:39 +01:00
inputs.home-manager.nixosModules.home-manager
2023-07-03 05:37:43 +02:00
inputs.valheim-server.nixosModules.default
];
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-03-03 00:24:08 +01:00
_module.args.pkgs = import inputs.nixpkgs {
inherit overlays system;
};
2023-10-18 20:31:26 +02:00
apps = (inputs.nixinate.nixinate.${system} self).nixinate;
2023-07-03 05:37:43 +02:00
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
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-09 01:05:51 +01:00
nix-index-database = {
url = "github:nix-community/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
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";
};
nixinate = {
url = "github:matthewcroughan/nixinate";
inputs.nixpkgs.follows = "nixpkgs";
};
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";
};
valheim-server = {
2024-03-07 22:16:02 +01:00
url = "github:aidalgol/valheim-server-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
vscode-server = {
url = "github:nix-community/nixos-vscode-server";
inputs.flake-utils.follows = "flake-utils";
inputs.nixpkgs.follows = "nixpkgs";
};
};
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
}