diff --git a/.envrc b/.envrc new file mode 100644 index 000000000..29da48d46 --- /dev/null +++ b/.envrc @@ -0,0 +1,2 @@ +watch_file shell.nix +use flake diff --git a/.gitignore b/.gitignore index 0e27dd464..6890c92dc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ target +.direnv helix-term/rustfmt.toml helix-syntax/languages/ diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..55f6d35d9 --- /dev/null +++ b/flake.lock @@ -0,0 +1,91 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1610051610, + "narHash": "sha256-U9rPz/usA1/Aohhk7Cmc2gBrEEKRzcW4nwPWMPwja4Y=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3982c9903e93927c2164caa727cd3f6a0e6d14cc", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "locked": { + "lastModified": 1609246779, + "narHash": "sha256-eq6ZXE/VWo3EMC65jmIT6H/rrUc9UWOWVujkzav025k=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "08c7ad4a0844adc4a7f9f5bb3beae482e789afa4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1610842533, + "narHash": "sha256-6hW8CML8RnNrRJMv7E56rXAhsCNgUM97HIVSqWxnO64=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "68398d2dd50efc2d878bf0f83bbc8bc323b6b0e0", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1609079092, + "narHash": "sha256-KhyKfxBHtZlAgudpZ0EJVzeuqROjKfVOwj8j0cuhU50=", + "path": "/nix/store/5pmay8rdvgw5ml1xi6189xhdbygc850k-source", + "rev": "2f47650c2f28d87f86ab807b8a339c684d91ec56", + "type": "path" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1611026386, + "narHash": "sha256-ZCYGAGUW9RMG5+Z1cdqrw1mstQqpuD66AB1U6ALpcDw=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "a9b13ba83eaf2d07ae955a45b15fd96aa6994b70", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 000000000..8208b2893 --- /dev/null +++ b/flake.nix @@ -0,0 +1,19 @@ +{ + description = "A post-modern text editor."; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + rust-overlay.url = "github:oxalica/rust-overlay"; + }; + + outputs = { nixpkgs, rust-overlay, flake-utils, ... }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; overlays = [ rust-overlay.overlay ]; }; + in rec { + # packages.helix = pkgs.callPackage ./default.nix {}; + # defaultPackage = packages.helix; + devShell = pkgs.callPackage ./shell.nix {}; + }); +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 000000000..f8f65093d --- /dev/null +++ b/shell.nix @@ -0,0 +1,12 @@ +{ pkgs ? import {} }: + +pkgs.mkShell { + nativeBuildInputs = with pkgs; [ + rust-bin.nightly.latest.rust + lld_10 + # pkgconfig + ]; + RUSTFLAGS = "-C link-arg=-fuse-ld=lld"; + RUST_BACKTRACE = "1"; +} +