ok/jj
1
0
Fork 0
forked from mirrors/jj

nix: use default list of systems

Most notably this removes the `i686-linux` target, which wasn't added
deliberately and is also not tested.
This commit is contained in:
Michael Forster 2023-01-27 11:54:52 +01:00 committed by Mike Forster
parent 3a139e81dc
commit 567a05d7ec

200
flake.nix
View file

@ -11,117 +11,107 @@
rust-overlay.inputs.flake-utils.follows = "flake-utils"; rust-overlay.inputs.flake-utils.follows = "flake-utils";
}; };
outputs = { self, nixpkgs, flake-utils, rust-overlay }: outputs = { self, nixpkgs, flake-utils, rust-overlay }: {
overlays.default = (final: prev: {
jujutsu = self.packages.${final.system}.jujutsu;
});
} //
(flake-utils.lib.eachDefaultSystem (system:
let let
systems = with flake-utils.lib.system; [ pkgs = import nixpkgs {
aarch64-linux inherit system;
aarch64-darwin overlays = [
i686-linux rust-overlay.overlays.default
x86_64-darwin ];
x86_64-linux };
]; 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;
};
in in
{ {
overlays.default = (final: prev: { packages = {
jujutsu = self.packages.${final.system}.jujutsu; jujutsu = pkgs.rustPlatform.buildRustPackage rec {
}); pname = "jujutsu";
} // version = "unstable-${self.shortRev or "dirty"}";
(flake-utils.lib.eachSystem systems (system: buildNoDefaultFeatures = true;
let buildFeatures = [ "jujutsu-lib/legacy-thrift" ];
pkgs = import nixpkgs { src = filterSrc ./. [
inherit system; ".*\\.nix$"
overlays = [ "^.jj/"
rust-overlay.overlays.default "^flake\\.lock$"
"^target/"
]; ];
}; cargoLock = {
filterSrc = src: regexes: lockFile = ./Cargo.lock;
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;
}; };
in nativeBuildInputs = with pkgs; [
{ gzip
packages = { installShellFiles
jujutsu = pkgs.rustPlatform.buildRustPackage rec { makeWrapper
pname = "jujutsu"; pkg-config
version = "unstable-${self.shortRev or "dirty"}"; ];
buildNoDefaultFeatures = true; buildInputs = with pkgs; [ openssl dbus sqlite ]
buildFeatures = [ "jujutsu-lib/legacy-thrift" ];
src = filterSrc ./. [
".*\\.nix$"
"^.jj/"
"^flake\\.lock$"
"^target/"
];
cargoLock = {
lockFile = ./Cargo.lock;
};
nativeBuildInputs = with pkgs; [
gzip
installShellFiles
makeWrapper
pkg-config
];
buildInputs = with pkgs; [ openssl dbus sqlite ]
++ lib.optionals stdenv.isDarwin [ ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Security darwin.apple_sdk.frameworks.Security
darwin.apple_sdk.frameworks.SystemConfiguration darwin.apple_sdk.frameworks.SystemConfiguration
libiconv libiconv
];
postInstall = ''
$out/bin/jj debug mangen > ./jj.1
installManPage ./jj.1
$out/bin/jj debug completion --bash > ./completions.bash
installShellCompletion --bash --name ${pname}.bash ./completions.bash
$out/bin/jj debug completion --fish > ./completions.fish
installShellCompletion --fish --name ${pname}.fish ./completions.fish
$out/bin/jj debug completion --zsh > ./completions.zsh
installShellCompletion --zsh --name _${pname} ./completions.zsh
'';
};
default = self.packages.${system}.jujutsu;
};
apps.default = {
type = "app";
program = "${self.packages.${system}.jujutsu}/bin/jj";
};
checks.jujutsu = self.packages.${system}.jujutsu.overrideAttrs ({ ... }: {
cargoBuildType = "debug";
cargoCheckType = "debug";
preCheck = ''
export RUST_BACKTRACE=1
'';
});
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-bin.stable."1.61.0".minimal.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))
# Required build dependencies
openssl
pkg-config # to find openssl
# Additional tools recommended by contributing.md
cargo-deny
cargo-insta
cargo-nextest
cargo-watch
]; ];
postInstall = ''
$out/bin/jj debug mangen > ./jj.1
installManPage ./jj.1
$out/bin/jj debug completion --bash > ./completions.bash
installShellCompletion --bash --name ${pname}.bash ./completions.bash
$out/bin/jj debug completion --fish > ./completions.fish
installShellCompletion --fish --name ${pname}.fish ./completions.fish
$out/bin/jj debug completion --zsh > ./completions.zsh
installShellCompletion --zsh --name _${pname} ./completions.zsh
'';
}; };
})); default = self.packages.${system}.jujutsu;
};
apps.default = {
type = "app";
program = "${self.packages.${system}.jujutsu}/bin/jj";
};
checks.jujutsu = self.packages.${system}.jujutsu.overrideAttrs ({ ... }: {
cargoBuildType = "debug";
cargoCheckType = "debug";
preCheck = ''
export RUST_BACKTRACE=1
'';
});
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-bin.stable."1.61.0".minimal.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))
# Required build dependencies
openssl
pkg-config # to find openssl
# Additional tools recommended by contributing.md
cargo-deny
cargo-insta
cargo-nextest
cargo-watch
];
};
}));
} }