Add a nix flake with the development environment.

This commit is contained in:
Blaž Hrastnik 2021-01-19 15:54:51 +09:00
parent 22e1692adc
commit f1539cc866
5 changed files with 125 additions and 0 deletions

2
.envrc Normal file
View File

@ -0,0 +1,2 @@
watch_file shell.nix
use flake

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
target
.direnv
helix-term/rustfmt.toml
helix-syntax/languages/

91
flake.lock Normal file
View File

@ -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
}

19
flake.nix Normal file
View File

@ -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 {};
});
}

12
shell.nix Normal file
View File

@ -0,0 +1,12 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
nativeBuildInputs = with pkgs; [
rust-bin.nightly.latest.rust
lld_10
# pkgconfig
];
RUSTFLAGS = "-C link-arg=-fuse-ld=lld";
RUST_BACKTRACE = "1";
}