disko/default.nix
lassulus dcb0c42857 reimplement disko using the nixos type system
This should make the code cleaner, more robust and errors should be
clearer. we also changed the configuration format a bit.
2022-09-02 11:14:58 +02:00

23 lines
558 B
Nix

{ lib ? import <nixpkgs/lib>
, pkgs ? import <nixpkgs> {}
}:
let
types = import ./types.nix { inherit 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;
}