forked from mirrors/jj
71a3045032
Summary: Since 066032b6e6
was merged, the `nix flake check` build no longer
overrides the 'cargo test' profile explicitly, to save disk space. The CI seems
to be in a better spot. This will stem the tide for a while hopefully.
However, with that change in place, the `nix flake check` build was
essentially a redundant, nearly-identical copy of a normal `nix build` with no
differentiating features, except: `RUST_BACKTRACE` is set to 1.
Delete all this code, and remove it from the CI matrix, and instead just export
`RUST_BACKTRACE` on the `checkPhase` of the normal `nix build` instead, which is
functionally equivalent.
Also does some minor, no-functional-change touchups to `flake.nix` while I was
there (whitespace, etc.)
Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: I87336b16e2a0b973343ecbde8ffd7b8f
138 lines
4 KiB
Nix
138 lines
4 KiB
Nix
{
|
|
description = "Jujutsu VCS, a Git-compatible DVCS that is both simple and powerful";
|
|
|
|
inputs = {
|
|
# For listing and iterating nix systems
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
# For installing non-standard rustc versions
|
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
|
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
|
|
rust-overlay.inputs.flake-utils.follows = "flake-utils";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, flake-utils, rust-overlay }: {
|
|
overlays.default = (final: prev: {
|
|
jujutsu = self.packages.${final.system}.jujutsu;
|
|
});
|
|
} //
|
|
(flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
pkgs = import nixpkgs {
|
|
inherit system;
|
|
overlays = [
|
|
rust-overlay.overlays.default
|
|
];
|
|
};
|
|
|
|
filterSrc = src: regexes:
|
|
pkgs.lib.cleanSourceWith {
|
|
inherit src;
|
|
filter = path: type:
|
|
let
|
|
relPath = pkgs.lib.removePrefix (toString src + "/") (toString path);
|
|
in
|
|
pkgs.lib.all (re: builtins.match re relPath == null) regexes;
|
|
};
|
|
|
|
rust-version = pkgs.rust-bin.stable."1.71.0".default;
|
|
|
|
ourRustPlatform = pkgs.makeRustPlatform {
|
|
rustc = rust-version;
|
|
cargo = rust-version;
|
|
};
|
|
|
|
in
|
|
{
|
|
packages = {
|
|
jujutsu = ourRustPlatform.buildRustPackage rec {
|
|
pname = "jujutsu";
|
|
version = "unstable-${self.shortRev or "dirty"}";
|
|
|
|
buildFeatures = [ "packaging" ];
|
|
cargoBuildFlags = ["--bin" "jj"]; # don't build and install the fake editors
|
|
useNextest = true;
|
|
src = filterSrc ./. [
|
|
".*\\.nix$"
|
|
"^.jj/"
|
|
"^flake\\.lock$"
|
|
"^target/"
|
|
];
|
|
|
|
cargoLock.lockFile = ./Cargo.lock;
|
|
nativeBuildInputs = with pkgs; [
|
|
gzip
|
|
installShellFiles
|
|
makeWrapper
|
|
pkg-config
|
|
];
|
|
buildInputs = with pkgs; [
|
|
openssl zstd libgit2 libssh2
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
darwin.apple_sdk.frameworks.Security
|
|
darwin.apple_sdk.frameworks.SystemConfiguration
|
|
libiconv
|
|
];
|
|
|
|
ZSTD_SYS_USE_PKG_CONFIG = "1";
|
|
LIBSSH2_SYS_USE_PKG_CONFIG = "1";
|
|
NIX_JJ_GIT_HASH = self.rev or "";
|
|
CARGO_INCREMENTAL = "0";
|
|
|
|
preCheck = "export RUST_BACKTRACE=1";
|
|
postInstall = ''
|
|
$out/bin/jj util mangen > ./jj.1
|
|
installManPage ./jj.1
|
|
|
|
installShellCompletion --cmd jj \
|
|
--bash <($out/bin/jj util completion --bash) \
|
|
--fish <($out/bin/jj util completion --fish) \
|
|
--zsh <($out/bin/jj util completion --zsh)
|
|
'';
|
|
};
|
|
default = self.packages.${system}.jujutsu;
|
|
};
|
|
apps.default = {
|
|
type = "app";
|
|
program = "${self.packages.${system}.jujutsu}/bin/jj";
|
|
};
|
|
formatter = pkgs.nixpkgs-fmt;
|
|
devShells.default = pkgs.mkShell {
|
|
buildInputs = with pkgs; [
|
|
# Using the minimal profile with explicit "clippy" extension to avoid
|
|
# two versions of rustfmt
|
|
(rust-version.override {
|
|
extensions = [
|
|
"rust-src" # for rust-analyzer
|
|
"clippy"
|
|
];
|
|
})
|
|
|
|
# The CI checks against the latest nightly rustfmt, so we should too.
|
|
(rust-bin.selectLatestNightlyWith (toolchain: toolchain.rustfmt))
|
|
|
|
# Foreign dependencies
|
|
openssl zstd libgit2 libssh2
|
|
pkg-config
|
|
|
|
# Make sure rust-analyzer is present
|
|
rust-analyzer
|
|
|
|
# Additional tools recommended by contributing.md
|
|
cargo-deny
|
|
cargo-insta
|
|
cargo-nextest
|
|
cargo-watch
|
|
|
|
# For building the documentation website
|
|
poetry
|
|
];
|
|
|
|
shellHook = ''
|
|
export RUST_BACKTRACE=1
|
|
export ZSTD_SYS_USE_PKG_CONFIG=1
|
|
export LIBSSH2_SYS_USE_PKG_CONFIG=1
|
|
'';
|
|
};
|
|
}));
|
|
}
|