{
  description = "Configuration NixOS du Crans";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
    flake-parts.url = "github:hercules-ci/flake-parts";

    # Formatter
    treefmt-nix = {
      url = "github:numtide/treefmt-nix";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # Secret management
    sops-nix = {
      url = "github:Mic92/sops-nix";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs =
    inputs@{
      self,
      nixpkgs,
      flake-parts,
      ...
    }:
    flake-parts.lib.mkFlake { inherit inputs; } {
      imports = [
        inputs.treefmt-nix.flakeModule
      ];

      systems = [ "x86_64-linux" ];

      flake = with nixpkgs.lib; {
        nixosConfigurations = {
          apprentix = nixosSystem {
            specialArgs = inputs;
            modules = [ ./hosts/vm/apprentix ];

          livre = nixosSystem {
            specialArgs = inputs;
            modules = [ ./hosts/vm/livre ];
          };

          neo = nixosSystem {
            specialArgs = inputs;
            modules = [ ./hosts/vm/neo ];
          };

          redite = nixosSystem {
            specialArgs = inputs;
            modules = [ ./hosts/vm/redite ];
          };

          thot = nixosSystem {
            specialArgs = inputs;
            modules = [ ./hosts/physiques/thot ];
          };

          two = nixosSystem {
            specialArgs = inputs;
            modules = [ ./hosts/vm/two ];
          };
        };
      };

      perSystem =
        { config, pkgs, ... }:
        {
          treefmt = {
            projectRootFile = "flake.nix";
            programs.nixpkgs-fmt.enable = true;
          };

          devShells = {
            default = pkgs.callPackage ./devshells/default.nix { };
          };
        };
    };
}