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,
|
||||
lib,
|
||||
self,
|
||||
...
|
||||
}: {
|
||||
imports = [inputs.easy-hosts.flakeModule];
|
||||
|
||||
config.easy-hosts = {
|
||||
shared.specialArgs.marleylib = import ../lib;
|
||||
shared.specialArgs.marleylib = import ../lib {inherit lib;};
|
||||
|
||||
# shared.modules = with inputs; [
|
||||
# # TODO: Move module imports to custom module
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
module = import ./module.nix;
|
||||
{lib}: {
|
||||
module = import ./module.nix {inherit lib;};
|
||||
}
|
||||
|
|
|
@ -1,23 +1,39 @@
|
|||
{
|
||||
{lib}: {
|
||||
## Quickly enable an option.
|
||||
##
|
||||
## ```nix
|
||||
## services.nginx = enabled;
|
||||
## ```
|
||||
##
|
||||
#@ true
|
||||
enabled = {
|
||||
## Quickly enable an option.
|
||||
##
|
||||
## ```nix
|
||||
## services.nginx = enabled;
|
||||
## ```
|
||||
##
|
||||
#@ true
|
||||
enable = true;
|
||||
};
|
||||
|
||||
## Quickly disable an option.
|
||||
##
|
||||
## ```nix
|
||||
## services.nginx = enabled;
|
||||
## ```
|
||||
##
|
||||
#@ false
|
||||
disabled = {
|
||||
## Quickly disable an option.
|
||||
##
|
||||
## ```nix
|
||||
## services.nginx = enabled;
|
||||
## ```
|
||||
##
|
||||
#@ 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,
|
||||
lib,
|
||||
marleylib,
|
||||
osConfig,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (marleylib.module) mkEnableOption';
|
||||
|
||||
osCfg = osConfig.marleyos.programs.nh.enable;
|
||||
cfg = config.marleyos.programs.nh;
|
||||
in {
|
||||
options.marleyos.programs.nh.enable = lib.mkEnableOption "nh";
|
||||
options.marleyos.programs.nh.enable = mkEnableOption' "nh" osCfg;
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.nh = {
|
||||
|
|
Loading…
Reference in a new issue