fork/helix
git clone https://git.julia.blue/fork/helix
97aee495
master
1{ 2description = "A post-modern text editor." ; 3 4inputs = { 5nixpkgs . url = "github:nixos/nixpkgs/nixos-unstable" ; 6rust-overlay = { 7url = "github:oxalica/rust-overlay" ; 8inputs . nixpkgs . follows = "nixpkgs" ; 9}; 10}; 11 12outputs = { 13self , 14nixpkgs , 15rust-overlay , 16 ... 17} :let 18inherit ( nixpkgs ) lib ; 19eachSystem = lib . genAttrs lib . systems . flakeExposed ; 20pkgsFor = eachSystem ( system : 21import nixpkgs { 22localSystem . system = system ; 23overlays = [( import rust-overlay ) self . overlays . helix ]; 24}); 25gitRev = self . rev or self . dirtyRev or null ; 26in { 27packages = eachSystem ( system :{ 28inherit ( pkgsFor .${ system }) helix ; 29/* 30The default Helix build. Uses the latest stable Rust toolchain, and unstable 31nixpkgs. 32 33The build inputs can be overridden with the following: 34 35packages.${system}.default.override { rustPlatform = newPlatform; }; 36 37Overriding a derivation attribute can be done as well: 38 39packages.${system}.default.overrideAttrs { buildType = "debug"; }; 40*/ 41default = self . packages .${ system }. helix ; 42}); 43checks = 44lib . mapAttrs ( system :pkgs :let 45# Get Helix's MSRV toolchain to build with by default. 46msrvToolchain = pkgs . pkgsBuildHost . rust-bin . fromRustupToolchainFile ./rust-toolchain.toml ; 47msrvPlatform = pkgs . makeRustPlatform { 48cargo = msrvToolchain ; 49rustc = msrvToolchain ; 50}; 51in { 52helix = self . packages .${ system }. helix . override { 53rustPlatform = msrvPlatform ; 54}; 55}) 56pkgsFor ; 57 58# Devshell behavior is preserved. 59devShells = 60lib . mapAttrs ( system :pkgs :{ 61default = let 62commonRustFlagsEnv = "-C link-arg=-fuse-ld=lld -C target-cpu=native --cfg tokio_unstable" ; 63platformRustFlagsEnv = lib . optionalString pkgs . stdenv . isLinux "-Clink-arg=-Wl,--no-rosegment" ; 64in 65pkgs . mkShell { 66inputsFrom = [ self . checks .${ system }. helix ]; 67nativeBuildInputs = with pkgs ; 68[ 69lld 70cargo-flamegraph 71rust-bin . nightly . latest . rust-analyzer 72] 73++ ( lib . optional ( stdenv . isx86_64 && stdenv . isLinux ) cargo-tarpaulin ) 74++ ( lib . optional stdenv . isLinux lldb ); 75shellHook = '' 76export RUST_BACKTRACE ="1" 77export RUSTFLAGS ="'' $ { RUSTFLAGS:- "" } ${ commonRustFlagsEnv } ${ platformRustFlagsEnv } " 78'' ; 79}; 80}) 81pkgsFor ; 82 83overlays = { 84helix = final :prev :{ 85helix = final . callPackage ./default.nix { inherit gitRev ;}; 86}; 87 88default = self . overlays . helix ; 89}; 90}; 91nixConfig = { 92extra-substituters = [ "https://helix.cachix.org" ]; 93extra-trusted-public-keys = [ "helix.cachix.org-1:ejp9KQpR1FBI2onstMQ34yogDm4OgU2ru6lIwPvuCVs=" ]; 94}; 95}