module Constants where

import Data.Text (Text())
import Text.RawString.QQ (r)

helpText :: Text -> Text
helpText :: Text -> Text
helpText Text
progName = Text
"USAGE: " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
progName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
[r| -p [PACKAGES] 
       |] Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
progName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
[r| [--with-flakes] [PACKAGES]

Pass nix-shell arguments to nix-shellify to have it generate a shell.nix in
the current directory. You can then just run nix shell or nix-shell in that
directory to have those packages in your environment. To run nix commands
you must first install Nix.

Options

    -p / --packages
    Specify packages for nix-shell compatability

    --command / --run
    Command to run after creating the shell

    --with-flake
    When using the command in a flake-like style use this switch to have a
    flake.nix created in addition to a shell.nix. Highly recommended to ensure
    the versions of dependencies are kept for reproducibility and so that
    shells are cached to load faster.

    --allow-local-pinned-registries-to-be-prioritized
    Pinned local repoisitory URLs are usually taken last when looking for URLs for
    generated flake.nix files. This is usually desired. If you do however want
    to see these pinned entries in the flake file as specified in your registry,
    then set this flag.

    --version
    Show the version number
|]

noPackagesError :: Text
noPackagesError = Text
[r|I can't write out a shell file without any packages specified.
Try 'nix-shellify --help' for more information.|] :: Text

pkgsDecl :: a -> a -> a
pkgsDecl a
var a
repo = a
var a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
[r| = if builtins.hasAttr "packages" |] a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
repo a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
[r| then |] a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
repo a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
[r|.packages.${system} else ( if builtins.hasAttr "legacyPackages" |] a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
repo a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
[r| then |] a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
repo a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
[r|.legacyPackages.${system} else |] a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
repo a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
[r|);|]