mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-24 21:13:47 +00:00
nix: refactor flake to avoid building jj
for the dev shell
We don't actually need `jj` itself in the development shell. But having it in the overlay significantly increases the time it takes to build the shell.
This commit is contained in:
parent
388fb0ffc1
commit
3c0eb21ed1
1 changed files with 36 additions and 62 deletions
72
flake.nix
72
flake.nix
|
@ -21,46 +21,39 @@
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
overlays.default = (final: prev: {
|
overlays.default = (final: prev: {
|
||||||
jujutsu = final.callPackage
|
jujutsu = self.packages.${final.system}.jujutsu;
|
||||||
(
|
});
|
||||||
{ stdenv
|
} //
|
||||||
, lib
|
(foreachSystem (system:
|
||||||
, fetchFromGitHub
|
let
|
||||||
, rustPlatform
|
pkgs = import nixpkgs {
|
||||||
, pkg-config
|
inherit system;
|
||||||
, openssl
|
overlays = [
|
||||||
, dbus
|
rust-overlay.overlays.default
|
||||||
, sqlite
|
];
|
||||||
, file
|
};
|
||||||
, gzip
|
in
|
||||||
, makeWrapper
|
{
|
||||||
, Security
|
packages.${system} = {
|
||||||
, SystemConfiguration
|
jujutsu = pkgs.rustPlatform.buildRustPackage rec {
|
||||||
, libiconv
|
|
||||||
, installShellFiles
|
|
||||||
}:
|
|
||||||
|
|
||||||
rustPlatform.buildRustPackage rec {
|
|
||||||
pname = "jujutsu";
|
pname = "jujutsu";
|
||||||
version = "unstable-${self.shortRev or "dirty"}";
|
version = "unstable-${self.shortRev or "dirty"}";
|
||||||
buildNoDefaultFeatures = true;
|
buildNoDefaultFeatures = true;
|
||||||
buildFeatures = [ "jujutsu-lib/legacy-thrift" ];
|
buildFeatures = [ "jujutsu-lib/legacy-thrift" ];
|
||||||
|
src = ./.;
|
||||||
src = self;
|
|
||||||
|
|
||||||
cargoLock = {
|
cargoLock = {
|
||||||
lockFile = "${self}/Cargo.lock";
|
lockFile = ./Cargo.lock;
|
||||||
};
|
};
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = with pkgs; [
|
||||||
gzip
|
gzip
|
||||||
installShellFiles
|
installShellFiles
|
||||||
makeWrapper
|
makeWrapper
|
||||||
pkg-config
|
pkg-config
|
||||||
];
|
];
|
||||||
buildInputs = [ openssl dbus sqlite ]
|
buildInputs = with pkgs; [ openssl dbus sqlite ]
|
||||||
++ lib.optionals stdenv.isDarwin [
|
++ lib.optionals stdenv.isDarwin [
|
||||||
Security
|
darwin.apple_sdk.frameworks.Security
|
||||||
SystemConfiguration
|
darwin.apple_sdk.frameworks.SystemConfiguration
|
||||||
libiconv
|
libiconv
|
||||||
];
|
];
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
|
@ -74,33 +67,14 @@
|
||||||
$out/bin/jj debug completion --zsh > ./completions.zsh
|
$out/bin/jj debug completion --zsh > ./completions.zsh
|
||||||
installShellCompletion --zsh --name _${pname} ./completions.zsh
|
installShellCompletion --zsh --name _${pname} ./completions.zsh
|
||||||
'';
|
'';
|
||||||
}
|
|
||||||
)
|
|
||||||
{
|
|
||||||
inherit (final.darwin.apple_sdk.frameworks) Security SystemConfiguration;
|
|
||||||
};
|
};
|
||||||
});
|
|
||||||
} //
|
|
||||||
(foreachSystem (system:
|
|
||||||
let
|
|
||||||
pkgs = import nixpkgs {
|
|
||||||
inherit system;
|
|
||||||
overlays = [
|
|
||||||
self.overlays.default
|
|
||||||
rust-overlay.overlays.default
|
|
||||||
];
|
|
||||||
};
|
|
||||||
in
|
|
||||||
{
|
|
||||||
packages.${system} = {
|
|
||||||
jujutsu = pkgs.jujutsu;
|
|
||||||
default = self.packages.${system}.jujutsu;
|
default = self.packages.${system}.jujutsu;
|
||||||
};
|
};
|
||||||
apps.${system}.default = {
|
apps.${system}.default = {
|
||||||
type = "app";
|
type = "app";
|
||||||
program = "${pkgs.jujutsu}/bin/jj";
|
program = "${self.packages.${system}.jujutsu}/bin/jj";
|
||||||
};
|
};
|
||||||
checks.${system}.jujutsu = pkgs.jujutsu.overrideAttrs ({ ... }: {
|
checks.${system}.jujutsu = self.packages.${system}.jujutsu.overrideAttrs ({ ... }: {
|
||||||
cargoBuildType = "debug";
|
cargoBuildType = "debug";
|
||||||
cargoCheckType = "debug";
|
cargoCheckType = "debug";
|
||||||
preCheck = ''
|
preCheck = ''
|
||||||
|
|
Loading…
Reference in a new issue