refactor(modules/nixos): move stuff around

This makes the module a bit clearer and easier to extend.
This commit is contained in:
Jalil David Salamé Messina 2025-03-21 17:50:23 +01:00
parent 673f989e99
commit 917d131cde
Signed by: jalil
GPG key ID: F016B9E770737A0B
9 changed files with 374 additions and 359 deletions
modules

27
modules/lib.nix Normal file
View file

@ -0,0 +1,27 @@
{ lib }:
let
inherit (lib) types;
in
{
# Like mkEnableOption but defaults to true
mkDisableOption =
option:
(lib.mkEnableOption option)
// {
default = true;
example = false;
};
# A option that accepts an image (and shows it in the docs)
mkImageOption =
{
description,
url,
sha256 ? "",
}:
lib.mkOption {
inherit description;
type = types.path;
default = builtins.fetchurl { inherit url sha256; };
defaultText = lib.literalMD "![${description}](${url})";
};
}