nix-bitcoin/modules/clightning-plugins
Erik Arvstedt 3681f118f7
nix-bitcoin.nix: add defaultText (automatic)
This enables generating module option documentation.

This commit was genereated by running the following script inside the
repo root dir:

def add_default_text(file)
  src = File.read(file)
  src2 = src.gsub(/( = mkOption\s+\{[^{]*?)(\n\s+default = )(.*?);$(.*?\})/m) do |str|
    pre, defaultVar, default, post = Regexp.last_match.captures
    replacement =
      if !post.include?('defaultText =')
        if default =~ /\bpkgs\b/
          defaultText = default.lines.length == 1 ? default : "(See source)"
          "#{pre}#{defaultVar}#{default};#{defaultVar.sub('default', 'defaultText')}#{defaultText.inspect};#{post}"
        end
      end
    replacement or str
  end
  File.write(file, src2) if src2 != src
end

Dir["modules/**/*.nix"].each do |f|
  next if File.basename(f) == "nix-bitcoin.nix"
  add_default_text f
end
2021-12-12 16:20:39 +01:00
..
clboss.nix nix-bitcoin.nix: add defaultText (automatic) 2021-12-12 16:20:39 +01:00
default.nix modules: move options to the top 2021-09-13 13:41:47 +02:00
prometheus.nix add curated clightning plugins 2020-11-18 20:21:34 -06:00
summary.nix add curated clightning plugins 2020-11-18 20:21:34 -06:00
zmq.nix modules: move options to the top 2021-09-13 13:41:47 +02:00