mirror of
https://github.com/wentasah/ros2nix.git
synced 2025-06-09 15:52:23 +03:00
Prepare for --flake
This commit is contained in:
parent
a56e2bdf9c
commit
83e07c9ea1
1 changed files with 13 additions and 1 deletions
|
@ -92,6 +92,12 @@ import nix-ros-overlay {
|
||||||
}
|
}
|
||||||
''')
|
''')
|
||||||
|
|
||||||
|
def generate_flake(args):
|
||||||
|
with open(f'{args.output_dir or "."}/flake.nix', "w") as f:
|
||||||
|
f.write('''
|
||||||
|
TODO
|
||||||
|
''')
|
||||||
|
|
||||||
def ros2nix(args):
|
def ros2nix(args):
|
||||||
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||||
parser.add_argument("source", nargs="+", help="Path to package.xml")
|
parser.add_argument("source", nargs="+", help="Path to package.xml")
|
||||||
|
@ -114,6 +120,8 @@ def ros2nix(args):
|
||||||
help="Set sourceRoot attribute value in the generated Nix expression. "
|
help="Set sourceRoot attribute value in the generated Nix expression. "
|
||||||
"Substring '{package_name}' gets replaced with the package name.")
|
"Substring '{package_name}' gets replaced with the package name.")
|
||||||
|
|
||||||
|
parser.add_argument("--flake", action="store_true", help="Generate top-level flake.nix instead of default.nix. "
|
||||||
|
"Use with --fetch if some package.xml files are outside of the flake repo.")
|
||||||
parser.add_argument("--nixfmt", action="store_true", help="Format the resulting expressions with nixfmt")
|
parser.add_argument("--nixfmt", action="store_true", help="Format the resulting expressions with nixfmt")
|
||||||
|
|
||||||
parser.add_argument("--copyright-holder")
|
parser.add_argument("--copyright-holder")
|
||||||
|
@ -266,6 +274,10 @@ def ros2nix(args):
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
generate_overlay(expressions, args)
|
generate_overlay(expressions, args)
|
||||||
|
|
||||||
|
if args.flake:
|
||||||
|
generate_flake(args)
|
||||||
|
else:
|
||||||
generate_default(args)
|
generate_default(args)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue