nixos-config/flake.nix

96 lines
2.6 KiB
Nix
Raw Permalink Normal View History

2023-10-09 10:44:07 -07:00
{
description = "Entrypoint of all nix configurations";
inputs = {
2025-10-15 22:24:37 -07:00
disko = {
inputs.nixpkgs.follows = "nixpkgs";
url = "github:nix-community/disko";
};
2024-08-14 12:10:34 -07:00
flake-utils.url = "github:numtide/flake-utils";
2023-10-09 10:44:07 -07:00
hardware.url = "github:nixos/nixos-hardware";
2025-10-15 22:24:37 -07:00
home-manager = {
inputs.nixpkgs.follows = "nixpkgs";
url = "github:nix-community/home-manager";
};
jovian = {
inputs.nixpkgs.follows = "nixpkgs";
url = "github:Jovian-Experiments/Jovian-NixOS";
};
mailserver = {
inputs.nixpkgs.follows = "nixpkgs";
url = "gitlab:simple-nixos-mailserver/nixos-mailserver";
};
2023-10-09 10:44:07 -07:00
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
2025-10-15 22:24:37 -07:00
nix-custom = {
inputs.nixpkgs.follows = "nixpkgs";
url = "git+https://forgejo.invariantspace.com/macronova/nix-custom";
};
plasma-manager = {
inputs.nixpkgs.follows = "nixpkgs";
url = "github:pjones/plasma-manager";
};
pre-commit-hooks = {
inputs.nixpkgs.follows = "nixpkgs";
url = "github:cachix/pre-commit-hooks.nix";
};
sops-nix = {
inputs.nixpkgs.follows = "nixpkgs";
url = "github:Mic92/sops-nix";
};
2023-10-09 10:44:07 -07:00
};
2024-08-14 11:14:20 -07:00
outputs = inputs @ {
self,
2024-08-14 12:10:34 -07:00
flake-utils,
2024-08-14 11:14:20 -07:00
nixpkgs,
nix-custom,
2024-08-14 12:10:34 -07:00
pre-commit-hooks,
2024-08-14 11:14:20 -07:00
...
}: let
linuxCfgDir = ./linux;
templateDir = ./template;
2024-08-14 12:10:34 -07:00
in
{
nixosConfigurations =
builtins.mapAttrs
(instance: _:
nixpkgs.lib.nixosSystem {
modules = [
# Import config from folder
(linuxCfgDir + "/${instance}")
2024-12-19 20:42:14 -08:00
# Common setups
2024-08-14 12:10:34 -07:00
({pkgs, ...}: {
networking.hostName = instance;
2024-12-19 20:42:14 -08:00
nixpkgs.overlays = [nix-custom.overlays.default];
2024-08-14 12:10:34 -07:00
})
];
specialArgs = {inherit inputs;};
})
(builtins.readDir linuxCfgDir);
templates =
builtins.mapAttrs
(template: _: {
path = templateDir + "/${template}";
description = "Template flake setup: ${template}";
2023-10-09 10:44:07 -07:00
})
2024-08-14 12:10:34 -07:00
(builtins.readDir templateDir);
}
// (
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
checks.pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks.alejandra.enable = true;
};
devShells.default = let
pre-commit = self.checks.${system}.pre-commit-check;
in
pkgs.mkShell {
inherit (pre-commit) shellHook;
buildInputs = pre-commit.enabledPackages;
};
2024-08-14 11:14:20 -07:00
})
2024-08-14 12:10:34 -07:00
);
2023-10-09 10:44:07 -07:00
}