• Operand
  • # (b)ring mi - belles.

gram:op

> ./flake.nix

Lenses
(coming soon!)


# See: https://tonyfinn.com/blog/nix-from-first-principles-flake-edition/nix-8-flakes-and-developer-environments/

{ inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
  inputs.microvm = { url = "github:astro/microvm.nix"; inputs.nixpkgs.follows = "nixpkgs"; };

  outputs = { self, nixpkgs, microvm, ... }: let
    arch = "x86_64-linux";
    pkgs = import nixpkgs { system = arch; };
    elixir = pkgs.elixir_1_16;
  in with pkgs; {
    packages.${arch} = { default = elixir; };
    devShells.${arch}.default = mkShell {
      packages = [
        elixir nodejs yarn
        git libgit2
        openssl inotify-tools
      ];
    };

    nixosConfigurations.operand = nixpkgs.lib.nixosSystem { system = arch;
      modules = [ microvm.nixosModules.microvm
        {
          microvm = { hypervisor = "qemu"; vcpu = 1; mem = 4096; }; # "cloud-hypervisor";
          users.users.root.password = "";
          microvm.interfaces = [ {
            type = "tap"; id = "operand-online"; mac = "02:00:00:00:00:01"; } ];
          microvm.shares = [ # { proto = "virtiofs"; }
            { tag = "ro-store"; source = "/nix/store"; mountPoint = "/nix/.ro-store"; }
            # { tag = "legacy-records"; source = "./records"; mountPoint = "/records"; }
          ];

          systemd.network.enable = true;
          systemd.network.networks."20-lan" = {
            matchConfig.Type = "ether";
            networkConfig = { IPv6AcceptRA = true; DHCP = "no";
              Address = ["10.0.0.2/24"]; Gateway = "10.0.0.1"; DNS = ["10.0.0.1"]; };
          };
          networking = { hostName = "operand";
            firewall = { enable = true; }; };
            # allowedTCPPorts = [ 3306 ];
        }
      ];
    };

  };
}