feat: auto enable programs in hm if enabled in os
This commit is contained in:
parent
230e2d0e3a
commit
ede3d69907
4 changed files with 41 additions and 20 deletions
|
@ -1,12 +1,13 @@
|
||||||
{
|
{
|
||||||
inputs,
|
inputs,
|
||||||
|
lib,
|
||||||
self,
|
self,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
imports = [inputs.easy-hosts.flakeModule];
|
imports = [inputs.easy-hosts.flakeModule];
|
||||||
|
|
||||||
config.easy-hosts = {
|
config.easy-hosts = {
|
||||||
shared.specialArgs.marleylib = import ../lib;
|
shared.specialArgs.marleylib = import ../lib {inherit lib;};
|
||||||
|
|
||||||
# shared.modules = with inputs; [
|
# shared.modules = with inputs; [
|
||||||
# # TODO: Move module imports to custom module
|
# # TODO: Move module imports to custom module
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
{
|
{lib}: {
|
||||||
module = import ./module.nix;
|
module = import ./module.nix {inherit lib;};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,39 @@
|
||||||
{
|
{lib}: {
|
||||||
|
## Quickly enable an option.
|
||||||
|
##
|
||||||
|
## ```nix
|
||||||
|
## services.nginx = enabled;
|
||||||
|
## ```
|
||||||
|
##
|
||||||
|
#@ true
|
||||||
enabled = {
|
enabled = {
|
||||||
## Quickly enable an option.
|
|
||||||
##
|
|
||||||
## ```nix
|
|
||||||
## services.nginx = enabled;
|
|
||||||
## ```
|
|
||||||
##
|
|
||||||
#@ true
|
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
## Quickly disable an option.
|
||||||
|
##
|
||||||
|
## ```nix
|
||||||
|
## services.nginx = enabled;
|
||||||
|
## ```
|
||||||
|
##
|
||||||
|
#@ false
|
||||||
disabled = {
|
disabled = {
|
||||||
## Quickly disable an option.
|
|
||||||
##
|
|
||||||
## ```nix
|
|
||||||
## services.nginx = enabled;
|
|
||||||
## ```
|
|
||||||
##
|
|
||||||
#@ false
|
|
||||||
enable = false;
|
enable = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
## Like lib.mkEnableOption, but allows specifying the default.
|
||||||
|
##
|
||||||
|
## ```nix
|
||||||
|
## options.marleyos.wayland = mkEnableOption' "wayland" false;
|
||||||
|
## ```
|
||||||
|
mkEnableOption' = name: default:
|
||||||
|
lib.mkOption {
|
||||||
|
inherit default;
|
||||||
|
example = true;
|
||||||
|
description =
|
||||||
|
if name ? _type && name._type == "mdDoc"
|
||||||
|
then lib.mdDoc "Whether to enable ${name.text}."
|
||||||
|
else "Whether to enable ${name}.";
|
||||||
|
type = lib.types.bool;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
marleylib,
|
||||||
osConfig,
|
osConfig,
|
||||||
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
|
inherit (marleylib.module) mkEnableOption';
|
||||||
|
|
||||||
|
osCfg = osConfig.marleyos.programs.nh.enable;
|
||||||
cfg = config.marleyos.programs.nh;
|
cfg = config.marleyos.programs.nh;
|
||||||
in {
|
in {
|
||||||
options.marleyos.programs.nh.enable = lib.mkEnableOption "nh";
|
options.marleyos.programs.nh.enable = mkEnableOption' "nh" osCfg;
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
programs.nh = {
|
programs.nh = {
|
||||||
|
|
Loading…
Reference in a new issue