infra/flake.nix

110 lines
3 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 = [
(final: prev: rec {
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
};
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
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;
settings.hooks = {
2023-07-03 05:37:43 +02:00
alejandra.enable = true;
commitizen.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
devShells.default = config.pre-commit.devShell.overrideAttrs (old: {
2024-03-03 00:24:08 +01:00
buildInputs = with pkgs; [inputs'.agenix.packages.agenix self'.formatter nil];
});
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 = {
2023-11-27 10:06:46 +01:00
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
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";
inputs.nixpkgs.follows = "nixpkgs-unstable";
inputs.nixpkgs-stable.follows = "nixpkgs";
};
valheim-server = {
url = "github:nekowinston/valheim-server-flake";
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
}