From c6b1a2c507bf351b99e4293407c95b45d95f472e Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Sun, 22 Sep 2024 09:39:01 +0200 Subject: [PATCH] Add --default and --no-default option --- README.md | 8 ++++++-- ros2nix/ros2nix.py | 7 ++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3fbfcd3..2438b2c 100644 --- a/README.md +++ b/README.md @@ -103,8 +103,9 @@ usage: ros2nix [-h] [--extra-propagated-build-inputs DEP1,DEP2,...] [--extra-check-inputs DEP1,DEP2,...] [--extra-native-build-inputs DEP1,DEP2,...] [--flake] - [--overlay | --no-overlay] [--nixfmt] [--compare] - [--copyright-holder COPYRIGHT_HOLDER] [--license LICENSE] + [--default | --no-default] [--overlay | --no-overlay] + [--nixfmt] [--compare] [--copyright-holder COPYRIGHT_HOLDER] + [--license LICENSE] package.xml [package.xml ...] positional arguments: @@ -159,6 +160,9 @@ options: --flake Generate top-level flake.nix instead of default.nix. Use with --fetch if some package.xml files are outside of the flake repo (default: False) + --default, --no-default + Enforce/suppress generation of default.nix (default: + None) --overlay, --no-overlay Generate overlay.nix (default: True) --nixfmt Format the resulting expressions with nixfmt (default: diff --git a/ros2nix/ros2nix.py b/ros2nix/ros2nix.py index 4452980..4e3a4ec 100755 --- a/ros2nix/ros2nix.py +++ b/ros2nix/ros2nix.py @@ -255,6 +255,11 @@ def ros2nix(args): 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( + "--default", + action=argparse.BooleanOptionalAction, + help="Enforce/suppress generation of default.nix", + ) parser.add_argument( "--overlay", action=argparse.BooleanOptionalAction, @@ -442,7 +447,7 @@ def ros2nix(args): if args.flake: generate_flake(args) - else: + if args.default or (args.default is None and not args.flake): generate_default(args) # TODO generate also release.nix (for testing/CI)?