< B / >

Setting Up A Repo In Under 5 Minutes As Software Engineers With Nix

Started 1 year ago Last edited 2 weeks ago

Again: What should setting up a new repo look like?

It should be something like this:

  1. ‘Create this kind of project’
  2. Initialize the git repo
  3. Create the first commit
  4. Create the repo upstream origin
  5. Then, push to origin, and set origin as upstream.

Okay. Let’s say I want to create a new static website project. This is my workflow:

Terminal window
> md new-website
> nft my#pollen-template
> gi
> gam "Initial commit"
> ghi new-website
> gpo

Can’t understand anything? Well, all of them are aliases/shell functions/abbreviations. This is what I typed:

Terminal window
> mkdir new-website && cd new-website
> nix flake init --template github:haglobah/flakes#pollen-template
> git init
> git add . && git commit --message "Initial commit"
> gh repo create new-website --private --source=. --remote=origin
> git push --set-upstream origin

And of course, it already brings its own devshell.

How do you set up a new project? And do you have any suggestions for a better workflow? Let me hear in the comments!


Update (01/2026):

In the meantime, I’ve refined my aliases.

What I’m now thinking of when creating a repo is this:

  1. ‘Create this kind of project’
  2. ‘Make this version controlled’
  3. ‘Make the devshell work automatically’
  4. ‘Change the flake.nix to my liking’
  5. ‘Create this repo on Github’

Which makes it those commands

Terminal window
> np new-project devshell just
> gim
> ud
> # edit flake.nix
> gho

And those expand to:

Terminal window
> nix run github:haglobah/templater -Lv -- --to new-project devshell just
> git init && git add . && git commit --message "Initial commit"
> echo "use flake . -Lv" >> .envrc && direnv allow
> # edit flake.nix
> gh repo create new-project --private --source=. --remote=origin && git push --set-upstream origin main

Code for the abbreviations here: fish.nix

A word of warning:

Do not use the templater script! It’s a the equivalent of a sharp knife without a handle while not being properly maintained.

It’s only for inspiration, nothing else.