2022-02-20 18:42:01 +00:00
|
|
|
{
|
2023-01-26 17:08:55 +00:00
|
|
|
description = "Jujutsu VCS, a Git-compatible DVCS that is both simple and powerful";
|
2022-02-20 18:42:01 +00:00
|
|
|
|
2023-01-17 11:41:33 +00:00
|
|
|
inputs = {
|
2023-01-26 17:08:55 +00:00
|
|
|
# For listing and iterating nix systems
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
|
2023-01-17 11:41:33 +00:00
|
|
|
# For installing non-standard rustc versions
|
|
|
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
|
|
|
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
|
2023-01-26 17:08:55 +00:00
|
|
|
rust-overlay.inputs.flake-utils.follows = "flake-utils";
|
2023-01-17 11:41:33 +00:00
|
|
|
};
|
|
|
|
|
2023-01-27 10:54:52 +00:00
|
|
|
outputs = { self, nixpkgs, flake-utils, rust-overlay }: {
|
|
|
|
overlays.default = (final: prev: {
|
|
|
|
jujutsu = self.packages.${final.system}.jujutsu;
|
|
|
|
});
|
|
|
|
} //
|
|
|
|
(flake-utils.lib.eachDefaultSystem (system:
|
2022-02-20 18:42:01 +00:00
|
|
|
let
|
2023-01-27 10:54:52 +00:00
|
|
|
pkgs = import nixpkgs {
|
|
|
|
inherit system;
|
|
|
|
overlays = [
|
|
|
|
rust-overlay.overlays.default
|
|
|
|
];
|
|
|
|
};
|
2023-07-14 11:34:36 +00:00
|
|
|
|
2023-01-27 10:54:52 +00:00
|
|
|
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;
|
|
|
|
};
|
2023-08-04 22:23:35 +00:00
|
|
|
|
2023-07-11 13:08:13 +00:00
|
|
|
rust-version = pkgs.rust-bin.stable."1.71.0".default;
|
|
|
|
|
|
|
|
ourRustPlatform = pkgs.makeRustPlatform {
|
|
|
|
rustc = rust-version;
|
|
|
|
cargo = rust-version;
|
|
|
|
};
|
|
|
|
|
2022-02-20 18:42:01 +00:00
|
|
|
in
|
|
|
|
{
|
2023-01-27 10:54:52 +00:00
|
|
|
packages = {
|
2023-07-11 13:08:13 +00:00
|
|
|
jujutsu = ourRustPlatform.buildRustPackage rec {
|
2023-01-27 10:54:52 +00:00
|
|
|
pname = "jujutsu";
|
|
|
|
version = "unstable-${self.shortRev or "dirty"}";
|
nix: merge (now redundant) flake check with normal build
Summary: Since 066032b6e69 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
2023-10-07 20:05:32 +00:00
|
|
|
|
2023-07-12 16:18:30 +00:00
|
|
|
buildFeatures = [ "packaging" ];
|
2023-06-24 05:39:27 +00:00
|
|
|
cargoBuildFlags = ["--bin" "jj"]; # don't build and install the fake editors
|
|
|
|
useNextest = true;
|
2023-01-27 10:54:52 +00:00
|
|
|
src = filterSrc ./. [
|
|
|
|
".*\\.nix$"
|
|
|
|
"^.jj/"
|
|
|
|
"^flake\\.lock$"
|
|
|
|
"^target/"
|
2023-01-17 11:41:33 +00:00
|
|
|
];
|
nix: merge (now redundant) flake check with normal build
Summary: Since 066032b6e69 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
2023-10-07 20:05:32 +00:00
|
|
|
|
|
|
|
cargoLock.lockFile = ./Cargo.lock;
|
2023-01-27 10:54:52 +00:00
|
|
|
nativeBuildInputs = with pkgs; [
|
|
|
|
gzip
|
|
|
|
installShellFiles
|
|
|
|
makeWrapper
|
|
|
|
pkg-config
|
|
|
|
];
|
2023-07-11 13:08:13 +00:00
|
|
|
buildInputs = with pkgs; [
|
|
|
|
openssl zstd libgit2 libssh2
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
2023-01-27 10:54:52 +00:00
|
|
|
darwin.apple_sdk.frameworks.Security
|
|
|
|
darwin.apple_sdk.frameworks.SystemConfiguration
|
|
|
|
libiconv
|
nix: merge (now redundant) flake check with normal build
Summary: Since 066032b6e69 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
2023-10-07 20:05:32 +00:00
|
|
|
];
|
|
|
|
|
2023-03-07 06:06:29 +00:00
|
|
|
ZSTD_SYS_USE_PKG_CONFIG = "1";
|
|
|
|
LIBSSH2_SYS_USE_PKG_CONFIG = "1";
|
2023-06-24 05:39:27 +00:00
|
|
|
NIX_JJ_GIT_HASH = self.rev or "";
|
2023-07-10 07:01:17 +00:00
|
|
|
CARGO_INCREMENTAL = "0";
|
nix: merge (now redundant) flake check with normal build
Summary: Since 066032b6e69 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
2023-10-07 20:05:32 +00:00
|
|
|
|
|
|
|
preCheck = "export RUST_BACKTRACE=1";
|
2023-01-27 10:54:52 +00:00
|
|
|
postInstall = ''
|
2023-04-13 00:04:24 +00:00
|
|
|
$out/bin/jj util mangen > ./jj.1
|
2023-01-27 10:54:52 +00:00
|
|
|
installManPage ./jj.1
|
2023-01-26 17:06:51 +00:00
|
|
|
|
2023-03-21 14:31:42 +00:00
|
|
|
installShellCompletion --cmd jj \
|
2023-04-13 00:04:24 +00:00
|
|
|
--bash <($out/bin/jj util completion --bash) \
|
|
|
|
--fish <($out/bin/jj util completion --fish) \
|
|
|
|
--zsh <($out/bin/jj util completion --zsh)
|
2022-02-20 18:42:01 +00:00
|
|
|
'';
|
2023-01-27 10:54:52 +00:00
|
|
|
};
|
|
|
|
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
|
2023-07-11 13:08:13 +00:00
|
|
|
(rust-version.override {
|
2023-01-27 10:54:52 +00:00
|
|
|
extensions = [
|
|
|
|
"rust-src" # for rust-analyzer
|
|
|
|
"clippy"
|
|
|
|
];
|
|
|
|
})
|
2023-01-17 11:41:33 +00:00
|
|
|
|
2023-01-27 10:54:52 +00:00
|
|
|
# The CI checks against the latest nightly rustfmt, so we should too.
|
|
|
|
(rust-bin.selectLatestNightlyWith (toolchain: toolchain.rustfmt))
|
2023-01-17 11:41:33 +00:00
|
|
|
|
2023-05-05 20:59:24 +00:00
|
|
|
# Foreign dependencies
|
|
|
|
openssl zstd libgit2 libssh2
|
|
|
|
pkg-config
|
2023-01-17 11:41:33 +00:00
|
|
|
|
2023-06-24 05:39:27 +00:00
|
|
|
# Make sure rust-analyzer is present
|
|
|
|
rust-analyzer
|
|
|
|
|
2023-01-27 10:54:52 +00:00
|
|
|
# Additional tools recommended by contributing.md
|
|
|
|
cargo-deny
|
|
|
|
cargo-insta
|
|
|
|
cargo-nextest
|
|
|
|
cargo-watch
|
2023-08-27 02:18:07 +00:00
|
|
|
|
|
|
|
# For building the documentation website
|
|
|
|
poetry
|
2023-08-04 22:23:35 +00:00
|
|
|
];
|
2023-05-05 20:59:24 +00:00
|
|
|
|
|
|
|
shellHook = ''
|
|
|
|
export RUST_BACKTRACE=1
|
|
|
|
export ZSTD_SYS_USE_PKG_CONFIG=1
|
|
|
|
export LIBSSH2_SYS_USE_PKG_CONFIG=1
|
|
|
|
'';
|
2023-01-27 10:54:52 +00:00
|
|
|
};
|
|
|
|
}));
|
2022-02-20 18:42:01 +00:00
|
|
|
}
|