nixos/flake.nix
2025-10-07 21:20:49 +02:00

94 lines
2.1 KiB
Nix

{
description = "La flake de aurore";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
flake-parts.url = "github:hercules-ci/flake-parts";
# Secret management
agenix = {
url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs";
};
# Disks management
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
# Formatter
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
inputs@{ self
, agenix
, disko
, flake-parts
, nixpkgs
, ...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [ inputs.treefmt-nix.flakeModule ];
systems = [ "x86_64-linux" ];
flake = with nixpkgs.lib; {
nixosConfigurations =
let
defaultConfig = [
./profiles/common
agenix.nixosModules.default
disko.nixosModules.disko
];
defaultVM = [
./profiles/vm
./disks/layout_vm.nix
]
++ defaultConfig;
in
{
grafana = nixosSystem {
specialArgs = inputs;
modules = [
./hosts/vm/grafana
]
++ defaultVM;
};
# VL: Peut-être avoir de l'auto-discovery: On a beaucoup trop de machines
jitsi = nixosSystem {
specialArgs = inputs;
modules = [
./hosts/vm/jitsi
]
++ defaultVM;
};
};
};
perSystem = { config, pkgs, system, ... }:
{
devShells = {
default = pkgs.callPackage ./devshells/default.nix { inherit (inputs) agenix; };
};
# Formatter
treefmt.config = {
package = pkgs.treefmt;
programs = {
# *.nix
nixpkgs-fmt.enable = true;
# *.md (and more)
prettier.enable = true;
};
};
};
};
}