modules: move options to the top
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
This commit is contained in:
parent
731cf647ff
commit
27c45b82cc
24 changed files with 609 additions and 578 deletions
|
|
@ -7,6 +7,21 @@
|
|||
|
||||
with lib;
|
||||
let
|
||||
options = {
|
||||
nix-bitcoin.configVersion = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
Set this option to the nix-bitcoin release version that your config is
|
||||
compatible with.
|
||||
|
||||
When upgrading to a backwards-incompatible release, nix-bitcoin will throw an
|
||||
error during evaluation and provide hints for migrating your config to the
|
||||
new release.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
version = config.nix-bitcoin.configVersion;
|
||||
|
||||
# Sorted by increasing version numbers
|
||||
|
|
@ -161,20 +176,7 @@ in
|
|||
./obsolete-options.nix
|
||||
];
|
||||
|
||||
options = {
|
||||
nix-bitcoin.configVersion = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
Set this option to the nix-bitcoin release version that your config is
|
||||
compatible with.
|
||||
|
||||
When upgrading to a backwards-incompatible release, nix-bitcoin will throw an
|
||||
error during evaluation and provide hints for migrating your config to the
|
||||
new release.
|
||||
'';
|
||||
};
|
||||
};
|
||||
inherit options;
|
||||
|
||||
config = {
|
||||
# Force evaluation. An actual option value is never assigned
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue