aboutsummaryrefslogtreecommitdiff
path: root/tardis-new/flake.nix
blob: a72caf1a67ccd8de561d46b1d10e73bf7508484a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{
  description = "NixOS in MicroVMs";

  inputs = {
    nixos.url = "github:nixos/nixpkgs/nixos-23.05";

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

  outputs = inputs @ {
    self,
    nixos,
    microvm,
  }: let
    system = (import ./lib/consts.nix).system;
    overlays = [
      # Access helpful variables from nixpkgs
      (_: prev: prev // {inherit inputs overlays;})

      # Add our custom library functions
      (final: prev: prev // {lib = prev.lib // import ./lib final;})
    ];
    pkgs = import nixos {inherit system overlays;};
  in {
    packages.${system} = {
      my-microvm = self.nixosConfigurations.my-microvm.config.microvm.declaredRunner;
    };

    nixosConfigurations = {
      my-microvm = nixos.lib.nixosSystem {
        inherit (pkgs) system;
        inherit pkgs;
        specialArgs = {inherit (pkgs) lib;};
        modules = [
          {nixpkgs.overlays = pkgs.overlays;}
          microvm.nixosModules.microvm
          ./modules/common.nix
          {
            networking.hostName = "test";
            users.users.root.password = "1234";
          }
        ];
      };
    };
  };
}