{ inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-26.05";
    flake-utils.url = "github:numtide/flake-utils";
  };
  outputs = { nixpkgs, flake-utils, ... }:
  flake-utils.lib.eachDefaultSystem (arch: let
    pkgs = import nixpkgs { system = arch; };
    elixir = pkgs.beam29Packages.elixir_1_20;
    bundle = with pkgs; [
      tree dig isd inotify-tools openssl gnupg # core cmd
      git rsync helix nushell # user cmd
      cargo elixir  # core lang
      nodejs vitejs yarn # javascript
    ];
  in {
    packages = { default = elixir; };
    devShells.default = pkgs.mkShell {
      packages = bundle;
      shellHook = "set -a; source .call; set +a;";
    };

    packages.machine = nixpkgs.lib.nixosSystem {
      system = arch;
      modules = [
        "${nixpkgs}/nixos/modules/virtualisation/lxc-container.nix"
        # "${nixpkgs}/nixos/modules/virtualisation/incus-virtual-machine.nix"
        ({...}:
        {
          users.users.root = {
            name = "root";
            shell = pkgs.nushell;
            password = "abcd1234";
            initialHashedPassword = null;
            openssh.authorizedKeys.keys = [
              "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIH31k4XJU6NYkDWKbsfQcHraO1b2rBX7jX3xSOtyLCK0 calliope@chesapeake"
            ];
          };

          environment.systemPackages = bundle;
          services.openssh = { enable = true; };

          imports = [
            ( import ./module/psql.nix { name = "nucleus"; })
            ( import ./module/elixir.nix {
              domain = "0.legal"; name = "nucleus"; channel = 4000;
              user = "root"; codebase = "/root/legal";
            })
          ];
        })
      ];
    };

}); }
