nix/flake.nix

189 lines
4.5 KiB
Nix

{
# Source of inspiration:
# - https://github.com/BonusPlay/sysconf/blob/master/flake.nix (agenix)
# - https://github.com/NixOS/infra/blob/master/build/flake.nix (agenix)
# - https://johns.codes/blog/organizing-system-configs-with-nixos (caddy)
# - https://nixos-and-flakes.thiscute.world/nixos-with-flakes/start-using-home-manager
# - https://forum.proxmox.com/threads/tutorial-unprivileged-lxcs-mount-cifs-shares.101795/ (Samba share)
description = "Pazpi's systems";
inputs = {
# NixOS related inputs
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
lix-module = {
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.91.1-2.tar.gz";
inputs.nixpkgs.follows = "nixpkgs";
};
agenix = {
url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs";
};
colmena = {
url = "github:zhaofengli/colmena";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
authentik-nix = {
url = "github:nix-community/authentik-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
nixpkgs-unstable,
nixos-hardware,
lix-module,
authentik-nix,
agenix,
colmena,
home-manager,
...
}@inputs:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
lib = nixpkgs.lib;
hosts = import hosts/hosts.nix { inherit inputs; };
in
{
# used with: `nix fmt`
formatter.${system} = pkgs.nixfmt-rfc-style;
nixosConfigurations = (import ./hosts inputs);
colmena = lib.recursiveUpdate (builtins.mapAttrs (k: v: {
imports = v._module.args.modules;
}) self.nixosConfigurations) hosts;
# {
# meta = {
# nixpkgs = import nixpkgs {
# system = "x86_64-linux";
# overlays = [ ];
# };
# nodeNixpkgs = builtins.mapAttrs (_: v: v.pkgs) self.nixosConfigurations;
# nodeSpecialArgs = builtins.mapAttrs (_: v: v._module.specialArgs) self.nixosConfigurations;
# };
# arr.deployment = {
# targetHost = "192.168.1.189";
# tags = [
# "lxc"
# "bacco"
# "arr"
# ];
# };
# caddy.deployment = {
# targetHost = "192.168.1.150";
# tags = [
# "lxc"
# "bacco"
# "arr"
# "auth"
# "metrics"
# "nextcloud"
# "portainer"
# "vaultwarden"
# ];
# };
# metrics.deployment = {
# targetHost = "192.168.1.152";
# tags = [
# "lxc"
# "bacco"
# "metrics"
# ];
# };
# nextcloud.deployment = {
# targetHost = "192.168.1.103";
# tags = [
# "lxc"
# "bacco"
# "nextcloud"
# ];
# };
# vaultwarden.deployment = {
# targetHost = "192.168.1.154";
# tags = [
# "lxc"
# "bacco"
# "vaultwarden"
# ];
# };
# plex.deployment = {
# targetHost = "192.168.1.155";
# tags = [
# "lxc"
# "node"
# ];
# };
# portainer.deployment = {
# targetHost = "192.168.1.156";
# tags = [
# "lxc"
# "node"
# "portainer"
# ];
# };
# authentik.deployment = {
# targetHost = "192.168.1.157";
# tags = [
# "lxc"
# "node"
# "auth"
# ];
# };
# colmena.deployment = {
# targetHost = "192.168.1.158";
# tags = [
# "lxc"
# "node"
# ];
# };
# deadbeef.deployment = {
# allowLocalDeployment = true;
# targetHost = null;
# tags = [ "local" ];
# };
# };
devShells.${system}.default = pkgs.mkShell {
buildInputs = with pkgs; [
cmake
pkg-config
meson
agenix.packages.${system}.agenix
colmena.packages.${system}.colmena
];
};
};
}