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 ea8c4bf..54bb18f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,10 @@ /target +# 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 0000000..9f461f7 --- /dev/null +++ b/devenv.lock @@ -0,0 +1,161 @@ +{ + "nodes": { + "devenv": { + "locked": { + "dir": "src/modules", + "lastModified": 1719155972, + "owner": "cachix", + "repo": "devenv", + "rev": "52b3a67a2da7fbea30ee547d97d598f2f1ac83c4", + "treeHash": "73b342056d61bf331ad859c64e416396609fa610", + "type": "github" + }, + "original": { + "dir": "src/modules", + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "fenix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1719124034, + "owner": "nix-community", + "repo": "fenix", + "rev": "952534c86a1e13ef78ccf00892246e33b222a69d", + "treeHash": "4368dc8d867e5fdc0ea2d1278e2b9084603be136", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "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": 1718811006, + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "03d771e513ce90147b65fe922d87d3a0356fc125", + "treeHash": "ab837eb82b2b0afbb6568f2b27f214324699af3d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1718879355, + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "8cd35b9496d21a6c55164d8547d9d5280162b07a", + "treeHash": "246f2197feb48979ccc58af4cab0cfd0f5738645", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "devenv": "devenv", + "fenix": "fenix", + "nixpkgs": "nixpkgs", + "pre-commit-hooks": "pre-commit-hooks" + } + }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1719057472, + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "2fd803cc13dc11aeacaa6474e3f803988a7bfe1a", + "treeHash": "b2985d4d883af53da4152e353904110f71c1ef88", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/devenv.nix b/devenv.nix new file mode 100644 index 0000000..0ac68f8 --- /dev/null +++ b/devenv.nix @@ -0,0 +1,82 @@ +{ + pkgs, + lib, + config, + inputs, + ... +}: { + # https://devenv.sh/basics/ + env.GREET = "magnetophon"; + + # https://devenv.sh/packages/ + packages = with pkgs; [ + git + # lldb + # cargo + # rustc + # rustfmt + # rust-analyzer + # clippy + # cargo-watch + # cargo-nextest + # cargo-expand # expand macros and inspect the output + # cargo-llvm-lines # count number of lines of LLVM IR of a generic function + # cargo-inspect + # cargo-criterion + # evcxr # make sure repl is in a gc-root + # cargo-play # quickly run a rust file that has a maint function + + pkg-config + + libjack2 + alsa-lib + + libGL + xorg.libXcursor + xorg.libX11 # libX11-xcb.so + xorg.xcbutilwm # libxcb-icccm.so + + faust + python3 + ]; + + # https://devenv.sh/scripts/ + scripts.hello.exec = "echo hello from $GREET"; + + enterShell = '' + hello + # git --version + # fish + ''; + + # https://devenv.sh/tests/ + # enterTest = '' + # echo "Running tests" + # git --version | grep "2.42.0" + # ''; + + # https://devenv.sh/services/ + # services.postgres.enable = true; + + # https://devenv.sh/languages/ + # https://devenv.sh/reference/options/#languagesrustchannel + languages.rust = { + enable = true; + channel = "nightly"; + }; + + # https://devenv.sh/pre-commit-hooks/ + pre-commit.hooks = { + shellcheck.enable = true; + clippy.enable = true; + # hunspell.enable = true; + alejandra.enable = true; + rustfmt.enable = true; + typos.enable = true; + }; + + # https://devenv.sh/processes/ + # processes.ping.exec = "ping example.com"; + + # See full reference at https://devenv.sh/reference/options/ +} diff --git a/devenv.yaml b/devenv.yaml new file mode 100644 index 0000000..2bbabf4 --- /dev/null +++ b/devenv.yaml @@ -0,0 +1,8 @@ +inputs: + nixpkgs: + url: github:cachix/devenv-nixpkgs/rolling + fenix: + url: github:nix-community/fenix + inputs: + nixpkgs: + follows: nixpkgs