nixOptsParser :: Bool -> Parser NixOptsMonoid
nixOptsParser hide0 = overrideActivation <$>
  (NixOptsMonoid
  <$> pure False
  <*> maybeBoolFlags nixCmdName
                     "use of a Nix-shell"
                     hide
  <*> maybeBoolFlags "nix-pure"
                     "use of a pure Nix-shell"
                     hide
  <*> (fmap (map T.pack)
       <$> optional (argsOption (long "nix-packages" <>
                                 metavar "NAMES" <>
                                 help "List of packages that should be available in the nix-shell (space separated)" <>
                                 hide)))
  <*> optional (option str (long "nix-shell-file" <>
                            metavar "FILEPATH" <>
                            help "Nix file to be used to launch a nix-shell (for regular Nix users)" <>
                            hide))
  <*> (fmap (map T.pack)
       <$> optional (argsOption (long "nix-shell-options" <>
                                 metavar "OPTIONS" <>
                                 help "Additional options passed to nix-shell" <>
                                 hide)))
  <*> (fmap (map T.pack)
       <$> optional (argsOption (long "nix-path" <>
                                 metavar "PATH_OPTIONS" <>
                                 help "Additional options to override NIX_PATH parts (notably 'nixpkgs')" <>
                                 hide)))
  )
  where
    hide = hideMods hide0
    overrideActivation m =
      if m /= mempty then m { nixMonoidEnable = Just . fromMaybe True $ nixMonoidEnable m }
      else m

-- | Options parser configuration for Docker.
nixOptsParser :: Bool -> Parser NixOptsMonoid
nixOptsParser hide0 = overrideActivation <$>
  (NixOptsMonoid
  <$> pure False
  <*> maybeBoolFlags nixCmdName
                     "use of a Nix-shell"
                     hide
  <*> maybeBoolFlags "nix-pure"
                     "use of a pure Nix-shell"
                     hide
  <*> (fmap (map T.pack)
       <$> optional (argsOption (long "nix-packages" <>
                                 metavar "NAMES" <>
                                 help "List of packages that should be available in the nix-shell (space separated)" <>
                                 hide)))
  <*> optional (option str (long "nix-shell-file" <>
                            metavar "FILEPATH" <>
                            help "Nix file to be used to launch a nix-shell (for regular Nix users)" <>
                            hide))
  <*> (fmap (map T.pack)
       <$> optional (argsOption (long "nix-shell-options" <>
                                 metavar "OPTIONS" <>
                                 help "Additional options passed to nix-shell" <>
                                 hide)))
  <*> (fmap (map T.pack)
       <$> optional (argsOption (long "nix-path" <>
                                 metavar "PATH_OPTIONS" <>
                                 help "Additional options to override NIX_PATH parts (notably 'nixpkgs')" <>
                                 hide)))
  )
  where
    hide = hideMods hide0
    overrideActivation m =
      if m /= mempty then m { nixMonoidEnable = Just . fromMaybe True $ nixMonoidEnable m }
      else m

-- | Options parser configuration for Docker.
nixOptsParser hide0 = overrideActivation <$>
  (NixOptsMonoid
  <$> pure False
  <*> maybeBoolFlags nixCmdName
                     "use of a Nix-shell"
                     hide
  <*> maybeBoolFlags "nix-pure"
                     "use of a pure Nix-shell"
                     hide
  <*> (fmap (map T.pack)
       <$> optional (argsOption (long "nix-packages" <>
                                 metavar "NAMES" <>
                                 help "List of packages that should be available in the nix-shell (space separated)" <>
                                 hide)))
  <*> optional (option str (long "nix-shell-file" <>
                            metavar "FILEPATH" <>
                            help "Nix file to be used to launch a nix-shell (for regular Nix users)" <>
                            hide))
  <*> (fmap (map T.pack)
       <$> optional (argsOption (long "nix-shell-options" <>
                                 metavar "OPTIONS" <>
                                 help "Additional options passed to nix-shell" <>
                                 hide)))
  <*> (fmap (map T.pack)
       <$> optional (argsOption (long "nix-path" <>
                                 metavar "PATH_OPTIONS" <>
                                 help "Additional options to override NIX_PATH parts (notably 'nixpkgs')" <>
                                 hide)))
  )
  where
    hide = hideMods hide0
    overrideActivation m =
      if m /= mempty then m { nixMonoidEnable = Just . fromMaybe True $ nixMonoidEnable m }
      else m

-- | Options parser configuration for Docker.