diff --git a/.envrc b/.envrc new file mode 100644 index 000000000..443b0ee55 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use_flake . \ No newline at end of file diff --git a/.gitignore b/.gitignore index 5ebb18196..f8b46314a 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,5 @@ rls/ *.ts *.js #*# -.DS_Store \ No newline at end of file +.DS_Store +.direnv/ \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..feafcf9e0 --- /dev/null +++ b/flake.lock @@ -0,0 +1,100 @@ +{ + "nodes": { + "fenix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1714199028, + "narHash": "sha256-QO3Yv3UfJRfhZE1wsHOartg+k8/Kf1BiDyfl8eEpqcE=", + "owner": "nix-community", + "repo": "fenix", + "rev": "055f6db376eaf544d84aa55bd5a7c70634af41ba", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1714184256, + "narHash": "sha256-/VyiyGD2q6qN/uAvotKxXuQJWLlmSckAdf7S8jj4Q5c=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "698fd43e541a6b8685ed408aaf7a63561018f9f8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "fenix": "fenix", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1714150666, + "narHash": "sha256-S8AsTyJvT6Q3pRFeo8QepWF/husnJh61cOhRt18Xmyc=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "1ed7e2de05ee76f6ae83cc9c72eb0b33ad6903f2", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 000000000..bc148cab1 --- /dev/null +++ b/flake.nix @@ -0,0 +1,49 @@ +{ + description = "Direnv environment for rust"; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + inputs.flake-utils.url = "github:numtide/flake-utils"; + inputs.fenix = { + url = "github:nix-community/fenix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + outputs = { nixpkgs, flake-utils, fenix, ... }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ fenix.overlays.default ]; + }; + in + { + devShells.default = pkgs.mkShell { + packages = [ + (pkgs.fenix.stable.withComponents [ + "cargo" + "clippy" + "rust-src" + "rustc" + "rustfmt" + "rust-analyzer" + ]) + pkgs.bacon + pkgs.pkg-config + pkgs.openssl + ]; + shellHook = '' + export PKG_CONFIG_PATH=${ + pkgs.lib.makeSearchPathOutput "dev" "lib/pkgconfig" [ + pkgs.glib + pkgs.gtk3 + pkgs.pango + pkgs.gdk-pixbuf + pkgs.cairo + pkgs.at-spi2-atk + pkgs.harfbuzz + pkgs.zlib + pkgs.gtk-layer-shell + ] + } + ''; + }; + }); +} \ No newline at end of file