From 5b537f2d4331517ee5b3cb048107f71b6bcafe0c Mon Sep 17 00:00:00 2001 From: Viktor Nagy Date: Sat, 20 Jul 2024 14:35:16 +0200 Subject: [PATCH] Add devenv support Signed-off-by: Viktor Nagy --- .envrc | 3 ++ .gitignore | 9 ++++ devenv.lock | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++++ devenv.nix | 40 +++++++++++++++++ devenv.yaml | 15 +++++++ 5 files changed, 189 insertions(+) create mode 100644 .envrc create mode 100644 devenv.lock create mode 100644 devenv.nix create mode 100644 devenv.yaml diff --git a/.envrc b/.envrc new file mode 100644 index 0000000000..5bf8fc159d --- /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 69729b00f6..8b94d041eb 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,12 @@ testbin/ # Docs site/ +# Devenv +.devenv* +devenv.local.nix + +# direnv +.direnv + +# pre-commit +.pre-commit-config.yaml diff --git a/devenv.lock b/devenv.lock new file mode 100644 index 0000000000..496d973150 --- /dev/null +++ b/devenv.lock @@ -0,0 +1,122 @@ +{ + "nodes": { + "devenv": { + "locked": { + "dir": "src/modules", + "lastModified": 1721213664, + "owner": "cachix", + "repo": "devenv", + "rev": "1d848fc26376d919458482fa0b4d0e240285a93f", + "treeHash": "cd2f7b659c9730ae8a0604d47237ee6928ae4d07", + "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", + "treeHash": "2addb7b71a20a25ea74feeaf5c2f6a6b30898ecb", + "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", + "treeHash": "ca14199cabdfe1a06a7b1654c76ed49100a689f9", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1716977621, + "owner": "cachix", + "repo": "devenv-nixpkgs", + "rev": "4267e705586473d3e5c8d50299e71503f16a6fb6", + "treeHash": "6d9f1f7ca0faf1bc2eeb397c78a49623260d3412", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "rolling", + "repo": "devenv-nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1721226092, + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c716603a63aca44f39bef1986c13402167450e0a", + "treeHash": "0d48af618426f14a604c2fa720128ba5f37e72eb", + "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": 1721042469, + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "f451c19376071a90d8c58ab1a953c6e9840527fd", + "treeHash": "91f40b7a3b9f6886bd77482cba5b5cd890415a2e", + "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 0000000000..12892c1dbe --- /dev/null +++ b/devenv.nix @@ -0,0 +1,40 @@ +{ pkgs, lib, config, inputs, ... }: + +{ + # https://devenv.sh/basics/ + env.GREET = "Flux2 dev env"; + + # https://devenv.sh/packages/ + packages = [ + pkgs.git + pkgs.kustomize + ]; + + # https://devenv.sh/scripts/ + scripts.hello.exec = "echo Hello in the $GREET"; + scripts.tests.exec = "make test"; + + enterShell = '' + hello + ''; + + # https://devenv.sh/tests/ + enterTest = '' + tests + ''; + + # https://devenv.sh/services/ + # services.postgres.enable = true; + + # https://devenv.sh/languages/ + # languages.nix.enable = true; + languages.go.enable = true; + + # https://devenv.sh/pre-commit-hooks/ + # pre-commit.hooks.shellcheck.enable = true; + + # https://devenv.sh/processes/ + # processes.ping.exec = "ping example.com"; + + # See full reference at https://devenv.sh/reference/options/ +} \ No newline at end of file diff --git a/devenv.yaml b/devenv.yaml new file mode 100644 index 0000000000..116a2adb37 --- /dev/null +++ b/devenv.yaml @@ -0,0 +1,15 @@ +# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json +inputs: + nixpkgs: + url: github:cachix/devenv-nixpkgs/rolling + +# If you're using non-OSS software, you can set allowUnfree to true. +# allowUnfree: true + +# If you're willing to use a package that's vulnerable +# permittedInsecurePackages: +# - "openssl-1.1.1w" + +# If you have more than one devenv you can merge them +#imports: +# - ./backend