This greatly improves readability and makes it easier to discover options.
This commit was genereated by running the following script inside the
repo root dir:
#!/usr/bin/env ruby
def transform(src)
return false if src.include?('inherit options;')
success = false
options = nil
src.sub!(/^ options.*?^ }.*?;/m) do |match|
options = match
" inherit options;"
end
return false if !options
src.sub!(/^with lib;\s*let\n+/m) do |match|
success = true
<<~EOF
with lib;
let
#{options}
EOF
end
success
end
Dir['modules/**/*.nix'].each do |f|
src = File.read(f)
if transform(src)
puts "Changed file #{f}"
File.write(f, src)
end
end
30 lines
794 B
Nix
30 lines
794 B
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
let
|
|
options.services.clightning.plugins = {
|
|
helpme.enable = mkEnableOption "Help me (clightning plugin)";
|
|
monitor.enable = mkEnableOption "Monitor (clightning plugin)";
|
|
rebalance.enable = mkEnableOption "Rebalance (clightning plugin)";
|
|
};
|
|
|
|
cfg = config.services.clightning.plugins;
|
|
pluginPkgs = config.nix-bitcoin.pkgs.clightning-plugins;
|
|
in {
|
|
imports = [
|
|
./clboss.nix
|
|
./prometheus.nix
|
|
./summary.nix
|
|
./zmq.nix
|
|
];
|
|
|
|
inherit options;
|
|
|
|
config = {
|
|
services.clightning.extraConfig = mkMerge [
|
|
(mkIf cfg.helpme.enable "plugin=${pluginPkgs.helpme.path}")
|
|
(mkIf cfg.monitor.enable "plugin=${pluginPkgs.monitor.path}")
|
|
(mkIf cfg.rebalance.enable "plugin=${pluginPkgs.rebalance.path}")
|
|
];
|
|
};
|
|
}
|