From d951f673c3ff424f20a6c89642c1cd9827feeb9b Mon Sep 17 00:00:00 2001 From: TheWanderingCrow Date: Mon, 22 Dec 2025 10:54:18 -0500 Subject: [PATCH] chore: get devenv fully setup for working on the project --- .envrc | 13 +++- .gitignore | 22 ++++++ README.md | 4 + devenv.lock | 214 ++++++++++++++++++++++++++++++++++++++++++++++++++++ devenv.nix | 22 ++++++ devenv.yaml | 8 ++ flake.nix | 3 +- 7 files changed, 283 insertions(+), 3 deletions(-) create mode 100644 devenv.lock create mode 100644 devenv.nix create mode 100644 devenv.yaml diff --git a/.envrc b/.envrc index 3550a30..cc5c18b 100644 --- a/.envrc +++ b/.envrc @@ -1 +1,12 @@ -use flake +#!/usr/bin/env bash + +export DIRENV_WARN_TIMEOUT=20s + +eval "$(devenv direnvrc)" + +# `use devenv` supports the same options as the `devenv shell` command. +# +# To silence all output, use `--quiet`. +# +# Example usage: use devenv --quiet --impure --option services.postgres.enable:bool true +use devenv diff --git a/.gitignore b/.gitignore index a4534d5..1a4e12c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,25 @@ .direnv/ result .env + +# Devenv +.devenv* +devenv.local.nix +devenv.local.yaml + +# direnv +.direnv + +# pre-commit +.pre-commit-config.yaml + +# Devenv +.devenv* +devenv.local.nix +devenv.local.yaml + +# direnv +.direnv + +# pre-commit +.pre-commit-config.yaml diff --git a/README.md b/README.md index bad7a8b..14e047b 100644 --- a/README.md +++ b/README.md @@ -33,3 +33,7 @@ services.actualbudget-report = { environmentFile = config.sops.templates."actualbudget-report-env".path; }; ``` + +# Development + +If you are on NixOS and have devenv installed, `devenv up -d` will spin up the mailpit instance and `devenv shell` will give you tools. If you do not have devenv it is provided in the devShell output at `nix shell` diff --git a/devenv.lock b/devenv.lock new file mode 100644 index 0000000..d2bd648 --- /dev/null +++ b/devenv.lock @@ -0,0 +1,214 @@ +{ + "nodes": { + "devenv": { + "locked": { + "dir": "src/modules", + "lastModified": 1766415291, + "owner": "cachix", + "repo": "devenv", + "rev": "445843843575c324f56f46e0a54c2fef1332f3cc", + "type": "github" + }, + "original": { + "dir": "src/modules", + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1765121682, + "owner": "edolstra", + "repo": "flake-compat", + "rev": "65f23138d8d09a92e30f1e5c87611b23ef451bf3", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1765121682, + "owner": "edolstra", + "repo": "flake-compat", + "rev": "65f23138d8d09a92e30f1e5c87611b23ef451bf3", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "git-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1765911976, + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "b68b780b69702a090c8bb1b973bab13756cc7a27", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "git-hooks_2": { + "inputs": { + "flake-compat": "flake-compat_2", + "gitignore": "gitignore_2", + "nixpkgs": [ + "go-overlay", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1765911976, + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "b68b780b69702a090c8bb1b973bab13756cc7a27", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1762808025, + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "cb5e3fdca1de58ccbc3ef53de65bd372b48f567c", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "gitignore_2": { + "inputs": { + "nixpkgs": [ + "go-overlay", + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1762808025, + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "cb5e3fdca1de58ccbc3ef53de65bd372b48f567c", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "go-overlay": { + "inputs": { + "flake-utils": "flake-utils", + "git-hooks": "git-hooks_2", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1766383731, + "owner": "purpleclay", + "repo": "go-overlay", + "rev": "36a0b6eb01220f9ad5e07d5ae8d8cb4879978421", + "type": "github" + }, + "original": { + "owner": "purpleclay", + "repo": "go-overlay", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1764580874, + "owner": "cachix", + "repo": "devenv-nixpkgs", + "rev": "dcf61356c3ab25f1362b4a4428a6d871e84f1d1d", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "rolling", + "repo": "devenv-nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "devenv": "devenv", + "git-hooks": "git-hooks", + "go-overlay": "go-overlay", + "nixpkgs": "nixpkgs", + "pre-commit-hooks": [ + "git-hooks" + ] + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/devenv.nix b/devenv.nix new file mode 100644 index 0000000..3110c6c --- /dev/null +++ b/devenv.nix @@ -0,0 +1,22 @@ +{ + pkgs, + lib, + config, + inputs, + ... +}: + +{ + services.mailpit = { + enable = true; + smtpListenAddress = "127.0.0.1:1025"; + uiListenAddress = "127.0.0.1:8025"; + }; + + dotenv.enable = true; + + languages.go = { + enable = true; + version = "1.25.2"; + }; +} diff --git a/devenv.yaml b/devenv.yaml new file mode 100644 index 0000000..8030b4c --- /dev/null +++ b/devenv.yaml @@ -0,0 +1,8 @@ +inputs: + go-overlay: + url: github:purpleclay/go-overlay + inputs: + nixpkgs: + follows: nixpkgs + nixpkgs: + url: github:cachix/devenv-nixpkgs/rolling diff --git a/flake.nix b/flake.nix index 60e139b..5caf0c0 100644 --- a/flake.nix +++ b/flake.nix @@ -42,8 +42,7 @@ devShells.default = pkgs.mkShell { ENVIRONMENT = "dev"; nativeBuildInputs = with pkgs; [ - go - mailpit + devenv ]; }; };