From 2f8ff8cbd4b3e5e1d81db35f7362b116d995770d Mon Sep 17 00:00:00 2001 From: aetaric Date: Sun, 29 Sep 2024 15:16:10 -0600 Subject: [PATCH] add devenv for quick development on nixos --- .envrc | 3 ++ .gitignore | 5 ++- devenv.lock | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++ devenv.nix | 43 +++++++++++++++++++ 4 files changed, 166 insertions(+), 1 deletion(-) create mode 100644 .envrc create mode 100644 devenv.lock create mode 100644 devenv.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..5bf8fc1 --- /dev/null +++ b/.envrc @@ -0,0 +1,3 @@ +source_url "https://raw.githubusercontent.com/cachix/devenv/95f329d49a8a5289d31e0982652f7058a189bfca/direnvrc" "sha256-d+8cBpDfDBj41inrADaJt+bDWhOktwslgoP5YiGJ1v0=" + +use devenv \ No newline at end of file diff --git a/.gitignore b/.gitignore index 3c8c186..db8d80c 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,7 @@ checkrr badfiles.csv checkrr.log webserver/build -webserver/node_modules \ No newline at end of file +webserver/node_modules +.devenv/ +.direnv/ +.devenv.flake.nix diff --git a/devenv.lock b/devenv.lock new file mode 100644 index 0000000..eb8b28b --- /dev/null +++ b/devenv.lock @@ -0,0 +1,116 @@ +{ + "nodes": { + "devenv": { + "locked": { + "dir": "src/modules", + "lastModified": 1727457166, + "owner": "cachix", + "repo": "devenv", + "rev": "6090da46bfb53e358b818cee491df1a25daa85e0", + "type": "github" + }, + "original": { + "dir": "src/modules", + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1716977621, + "owner": "cachix", + "repo": "devenv-nixpkgs", + "rev": "4267e705586473d3e5c8d50299e71503f16a6fb6", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "rolling", + "repo": "devenv-nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1727540905, + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "fbca5e745367ae7632731639de5c21f29c8744ed", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1727514110, + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "85f7a7177c678de68224af3402ab8ee1bcee25c8", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "devenv": "devenv", + "nixpkgs": "nixpkgs", + "pre-commit-hooks": "pre-commit-hooks" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/devenv.nix b/devenv.nix new file mode 100644 index 0000000..45517b2 --- /dev/null +++ b/devenv.nix @@ -0,0 +1,43 @@ +{ pkgs, lib, config, inputs, ... }: + +{ + # https://devenv.sh/basics/ + env.GREET = "devenv"; + + # https://devenv.sh/packages/ + packages = [ + pkgs.git + pkgs.go + pkgs.nodejs + pkgs.yarn + ]; + + languages = { + go.enable = true; + javascript = { + enable = true; + npm = { + enable = true; + install.enable = true; + }; + yarn = { + enable = true; + install.enable = true; + }; + }; + }; + + enterShell = '' + go version + node --version + yarn --version + ''; + + # https://devenv.sh/services/ + # services.postgres.enable = true; + + # https://devenv.sh/pre-commit-hooks/ + # pre-commit.hooks.shellcheck.enable = true; + + # See full reference at https://devenv.sh/reference/options/ +}