Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a (stack?/nix?/?) template for the simple/advanced project starting points #18

Open
silky opened this issue Mar 16, 2023 · 5 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@silky
Copy link
Contributor

silky commented Mar 16, 2023

I often want to start a new stacklock2nix project, but find myself copying-and-pasting from a previous example.

It would be convenient to use stack new and stack's templates ( https://github.com/commercialhaskell/stack-templates ) to get an starting point.

Trivia: It seems like stack-templates might not be accepting submissions though ( commercialhaskell/stack-templates#121 ) so not sure if this is a dead-end.

@silky
Copy link
Contributor Author

silky commented Mar 16, 2023

Maybe a better alternative is a nix template that can be cloned via nix flakes?

@cdepillabout cdepillabout added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Mar 16, 2023
@cdepillabout
Copy link
Owner

cdepillabout commented Mar 16, 2023

Yeah, that sounds like a good idea! I've thought of doing so, but haven't gotten around to it yet.

I don't personally use stack templates or Nix flake templates much myself, but I think other people definitely do. I imagine people in the Nix ecosystem will be more familiar with nix flake templates, but I don't have a strong opinion here.

I'm also not quite sure what goes in to creating or maintaining a Nix flake template, but if someone wanted to send a PR adding one (or at least explain in detail what I need to do to add one), I'd happily merge it.

A few things I've seen:

@cdepillabout
Copy link
Owner

$ stack new
Usage: stack new PACKAGE_NAME [--bare] [TEMPLATE_NAME] [-p|--param KEY:VALUE] 
                 [DIR(S)] [--omit-packages] [--force] [--ignore-subdirs] 
                 [--setup-info-yaml URL] [--snapshot-location-base URL] [--help]
  Create a new project from a template. Run `stack templates' to see available
  templates. Will also initialise if there is no stack.yaml file. Note: you can
  also specify a local file or a remote URL as a template; or force an
  initialisation.

Available options:
  PACKAGE_NAME             A valid package name.
  --bare                   Do not create a subdirectory for the project
  TEMPLATE_NAME            Name of a template - can take the form
                           [[service:]username/]template with optional service
                           name (github, gitlab, or bitbucket) and username for
                           the service; or, a local filename such as foo.hsfiles
                           or ~/foo; or, a full URL such as
                           https://example.com/foo.hsfiles.
...

It looks like Stack templates can be on an arbitrary github repo, or just any URL. That might be pretty convenient for us as well.

Not sure whether more users would prefer a Nix Flake template, or a Stack template.

@silky
Copy link
Contributor Author

silky commented Mar 18, 2023

yeah; i've definitely used the url-based stack templates before; but i think a nix template might make the most sense idiomatically here, because in theory one may not even have a system-installed stack ...

@silky silky changed the title Add a stack template for the simple/advanced project starting points Add a (stack?/nix?/?) template for the simple/advanced project starting points Mar 18, 2023
@silky
Copy link
Contributor Author

silky commented Mar 18, 2023

there's also this - https://github.com/cookiecutter/cookiecutter - but i've never personally used it before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants