just playing with tangled
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at mkdocs-mike 140 lines 4.3 kB view raw
1{ 2 description = "Jujutsu VCS, a Git-compatible DVCS that is both simple and powerful"; 3 4 inputs = { 5 # For listing and iterating nix systems 6 flake-utils.url = "github:numtide/flake-utils"; 7 8 # For installing non-standard rustc versions 9 rust-overlay.url = "github:oxalica/rust-overlay"; 10 rust-overlay.inputs.nixpkgs.follows = "nixpkgs"; 11 rust-overlay.inputs.flake-utils.follows = "flake-utils"; 12 }; 13 14 outputs = { self, nixpkgs, flake-utils, rust-overlay }: { 15 overlays.default = (final: prev: { 16 jujutsu = self.packages.${final.system}.jujutsu; 17 }); 18 } // 19 (flake-utils.lib.eachDefaultSystem (system: 20 let 21 pkgs = import nixpkgs { 22 inherit system; 23 overlays = [ 24 rust-overlay.overlays.default 25 ]; 26 }; 27 28 filterSrc = src: regexes: 29 pkgs.lib.cleanSourceWith { 30 inherit src; 31 filter = path: type: 32 let 33 relPath = pkgs.lib.removePrefix (toString src + "/") (toString path); 34 in 35 pkgs.lib.all (re: builtins.match re relPath == null) regexes; 36 }; 37 38 rust-version = pkgs.rust-bin.stable."1.71.0".default; 39 40 ourRustPlatform = pkgs.makeRustPlatform { 41 rustc = rust-version; 42 cargo = rust-version; 43 }; 44 45 in 46 { 47 packages = { 48 jujutsu = ourRustPlatform.buildRustPackage rec { 49 pname = "jujutsu"; 50 version = "unstable-${self.shortRev or "dirty"}"; 51 buildNoDefaultFeatures = true; 52 buildFeatures = [ "packaging" ]; 53 cargoBuildFlags = ["--bin" "jj"]; # don't build and install the fake editors 54 useNextest = true; 55 src = filterSrc ./. [ 56 ".*\\.nix$" 57 "^.jj/" 58 "^flake\\.lock$" 59 "^target/" 60 ]; 61 cargoLock = { 62 lockFile = ./Cargo.lock; 63 }; 64 nativeBuildInputs = with pkgs; [ 65 gzip 66 installShellFiles 67 makeWrapper 68 pkg-config 69 ]; 70 buildInputs = with pkgs; [ 71 openssl zstd libgit2 libssh2 72 ] ++ lib.optionals stdenv.isDarwin [ 73 darwin.apple_sdk.frameworks.Security 74 darwin.apple_sdk.frameworks.SystemConfiguration 75 libiconv 76 ]; 77 ZSTD_SYS_USE_PKG_CONFIG = "1"; 78 LIBSSH2_SYS_USE_PKG_CONFIG = "1"; 79 NIX_JJ_GIT_HASH = self.rev or ""; 80 CARGO_INCREMENTAL = "0"; 81 postInstall = '' 82 $out/bin/jj util mangen > ./jj.1 83 installManPage ./jj.1 84 85 installShellCompletion --cmd jj \ 86 --bash <($out/bin/jj util completion --bash) \ 87 --fish <($out/bin/jj util completion --fish) \ 88 --zsh <($out/bin/jj util completion --zsh) 89 ''; 90 }; 91 default = self.packages.${system}.jujutsu; 92 }; 93 apps.default = { 94 type = "app"; 95 program = "${self.packages.${system}.jujutsu}/bin/jj"; 96 }; 97 checks.jujutsu = self.packages.${system}.jujutsu.overrideAttrs ({ ... }: { 98 cargoBuildType = "debug"; 99 cargoCheckType = "debug"; 100 preCheck = '' 101 export RUST_BACKTRACE=1 102 ''; 103 }); 104 formatter = pkgs.nixpkgs-fmt; 105 devShells.default = pkgs.mkShell { 106 buildInputs = with pkgs; [ 107 # Using the minimal profile with explicit "clippy" extension to avoid 108 # two versions of rustfmt 109 (rust-version.override { 110 extensions = [ 111 "rust-src" # for rust-analyzer 112 "clippy" 113 ]; 114 }) 115 116 # The CI checks against the latest nightly rustfmt, so we should too. 117 (rust-bin.selectLatestNightlyWith (toolchain: toolchain.rustfmt)) 118 119 # Foreign dependencies 120 openssl zstd libgit2 libssh2 121 pkg-config 122 123 # Make sure rust-analyzer is present 124 rust-analyzer 125 126 # Additional tools recommended by contributing.md 127 cargo-deny 128 cargo-insta 129 cargo-nextest 130 cargo-watch 131 ]; 132 133 shellHook = '' 134 export RUST_BACKTRACE=1 135 export ZSTD_SYS_USE_PKG_CONFIG=1 136 export LIBSSH2_SYS_USE_PKG_CONFIG=1 137 ''; 138 }; 139 })); 140}