├── .envrc ├── .github ├── dependabot.yml └── workflows │ └── test.yml ├── .gitignore ├── README.md └── devenv.nix /.envrc: -------------------------------------------------------------------------------- 1 | watch_file devenv.nix 2 | watch_file devenv.yaml 3 | watch_file devenv.lock 4 | if [[ ! "$DIRENV_ACTIVE" =~ (^|:)"$PWD"(:|$) ]]; then 5 | devenv shell 6 | fi -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | 4 | - package-ecosystem: github-actions 5 | directory: "/" 6 | schedule: 7 | interval: daily 8 | time: '00:00' 9 | timezone: UTC 10 | open-pull-requests-limit: 10 11 | commit-message: 12 | prefix: "chore" 13 | include: "scope" -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: "Test" 2 | on: 3 | pull_request: 4 | push: 5 | jobs: 6 | tests: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v3 10 | - uses: cachix/install-nix-action@v18 11 | - uses: cachix/cachix-action@v12 12 | with: 13 | name: nix-getting-started-template 14 | extraPullNames: devenv 15 | authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' 16 | - run: nix profile install github:cachix/devenv/latest 17 | name: Install devenv.sh 18 | - run: devenv shell echo ok 19 | - run: devenv ci 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # nix 2 | 3 | result 4 | result-* 5 | .pre-commit-config.yaml 6 | .devenv* 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Opinionated Nix repository template 2 | 3 | Based on [devenv.sh](https://devenv.sh) and [Nix basics tutorial](https://nix.dev/tutorials/nix-language) (1-2 hour primer), 4 | this is a simple to get started. 5 | 6 | ## Getting started 7 | 8 | 1. [Install Nix and ``devenv``](https://devenv.sh/getting-started/) 9 | 1. Follow tutorial for [creating a binary cache](https://nix.dev/tutorials/continuous-integration-github-actions.html) 10 | 2. Replace ``nix-getting-started-template`` in ``.github/workflows/test.yml`` with the name of your binary cache 11 | 12 | ## Using the project 13 | 14 | Follow [direnv setup](https://devenv.sh/automatic-shell-activation/) and run `direnv allow`. 15 | -------------------------------------------------------------------------------- /devenv.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | { 4 | # https://devenv.sh/basics/ 5 | env.GREET = "devenv"; 6 | 7 | # https://devenv.sh/packages/ 8 | packages = [ pkgs.git ]; 9 | 10 | enterShell = '' 11 | hello 12 | git --version 13 | ''; 14 | 15 | # https://devenv.sh/languages/ 16 | languages.nix.enable = true; 17 | 18 | # https://devenv.sh/scripts/ 19 | scripts.hello.exec = "echo hello from $GREET"; 20 | 21 | # https://devenv.sh/pre-commit-hooks/ 22 | pre-commit.hooks = { 23 | shellcheck.enable = true; 24 | nixpkgs-fmt.enable = true; 25 | statix.enable = true; 26 | }; 27 | pre-commit.excludes = [ "\\.devenv.*" ]; 28 | 29 | # https://devenv.sh/processes/ 30 | # processes.ping.exec = "ping example.com"; 31 | } 32 | --------------------------------------------------------------------------------