summaryrefslogtreecommitdiffstats
path: root/default.nix
blob: 4aa4ef5617557760a5292e1b074183788d81d088 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{ lib ? import <nixpkgs/lib>
, pkgs ? import <nixpkgs> {}
}:
let
  types = import ./types.nix { inherit lib pkgs; };
  eval = cfg: lib.evalModules {
    modules = lib.singleton {
      # _file = toString input;
      imports = lib.singleton { topLevel.devices = cfg; };
      options = {
        topLevel = lib.mkOption {
          type = types.topLevel;
        };
      };
    };
  };
in {
  types = types;
  create = cfg: (eval cfg).config.topLevel.create;
  mount = cfg: (eval cfg).config.topLevel.mount;
  config = cfg: (eval cfg).config.topLevel.config;
}