diff --git a/.envrc b/.envrc new file mode 100644 index 00000000..b027ddb2 --- /dev/null +++ b/.envrc @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# ^ added for shellcheck and file-type detection + +# Watch & reload direnv on change +cd devshell || exit +watch_file devshell.toml + +if [[ $(type -t use_flake) != function ]]; then + echo "ERROR: use_flake function missing." + echo "Please update direnv to v2.30.0 or later." + exit 1 +fi +use flake diff --git a/devshell/.gitignore b/devshell/.gitignore new file mode 100644 index 00000000..04744984 --- /dev/null +++ b/devshell/.gitignore @@ -0,0 +1 @@ +/.direnv/ \ No newline at end of file diff --git a/devshell/devshell.toml b/devshell/devshell.toml new file mode 100644 index 00000000..4b8c8bff --- /dev/null +++ b/devshell/devshell.toml @@ -0,0 +1,4 @@ +# https://numtide.github.io/devshell +[[commands]] +package = "devshell.cli" +help = "Per project developer environments" diff --git a/devshell/flake.lock b/devshell/flake.lock new file mode 100644 index 00000000..3785db56 --- /dev/null +++ b/devshell/flake.lock @@ -0,0 +1,92 @@ +{ + "nodes": { + "devshell": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1667210711, + "narHash": "sha256-IoErjXZAkzYWHEpQqwu/DeRNJGFdR7X2OGbkhMqMrpw=", + "owner": "numtide", + "repo": "devshell", + "rev": "96a9dd12b8a447840cc246e17a47b81a4268bba7", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1642700792, + "narHash": "sha256-XqHrk7hFb+zBvRg6Ghl+AZDq03ov6OshJLiSWOoX5es=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "846b2ae0fc4cc943637d3d1def4454213e203cba", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1643381941, + "narHash": "sha256-pHTwvnN4tTsEKkWlXQ8JMY423epos8wUOhthpwJjtpc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5efc8ca954272c4376ac929f4c5ffefcc20551d5", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1667969101, + "narHash": "sha256-GL53T705HO7Q/KVfbb5STx8AxFs8YgaGY8pvAZC+O7U=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "bbf77421ac51a7c93f5f0f760da99e4dbce614fa", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "devshell": "devshell", + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_2" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/devshell/flake.nix b/devshell/flake.nix new file mode 100644 index 00000000..2634bd6d --- /dev/null +++ b/devshell/flake.nix @@ -0,0 +1,23 @@ +{ + description = "virtual environments"; + + inputs.devshell.url = "github:numtide/devshell"; + inputs.flake-utils.url = "github:numtide/flake-utils"; + + outputs = { self, flake-utils, devshell, nixpkgs }: + flake-utils.lib.eachDefaultSystem (system: { + devShell = + let pkgs = import nixpkgs { + inherit system; + + overlays = [ devshell.overlay ]; + }; + in + pkgs.devshell.mkShell { + imports = [ (pkgs.devshell.importTOML ./devshell.toml) ]; + devshell.packages = with pkgs; [ + gnumake + ]; + }; + }); +}