Skip to content

Instantly share code, notes, and snippets.

@infinisil
Created October 19, 2023 21:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save infinisil/c5d7b8b65ed3ed9e53f2346bcb263308 to your computer and use it in GitHub Desktop.
Save infinisil/c5d7b8b65ed3ed9e53f2346bcb263308 to your computer and use it in GitHub Desktop.
(import <nixpkgs/lib>).evalModules {
modules = [
./generic.nix
./specific1.nix
./specific2.nix
];
}
{ lib, ... }:
{
options.releases = lib.mkOption {
type = lib.types.attrsOf (
lib.types.submodule {
options.variant = lib.mkOption {
type = lib.types.enum [ ];
};
options.someGenericOption = lib.mkOption {
type = lib.types.int;
default = 0;
};
}
);
};
}
{ lib, ... }:
{
options.releases = lib.mkOption {
type = lib.types.attrsOf (
lib.types.submodule {
options.variant = lib.mkOption {
type = lib.types.enum [ "specific1" ];
};
options.specific1.someSpecificOption = lib.mkOption {
type = lib.types.int;
default = 0;
};
}
);
};
}
{ lib, ... }:
{
options.releases = lib.mkOption {
type = lib.types.attrsOf (
lib.types.submodule {
options.variant = lib.mkOption {
type = lib.types.enum [ "specific2" ];
};
options.specific2.someSpecificOption = lib.mkOption {
type = lib.types.int;
default = 0;
};
}
);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment