mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-18 10:07:28 +00:00
Add flake.nix
This commit is contained in:
parent
2916cb2d9f
commit
50b8357234
4 changed files with 23081 additions and 0 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1 +1,3 @@
|
|||
/target/
|
||||
result
|
||||
result-*
|
||||
|
|
41
flake.lock
Normal file
41
flake.lock
Normal file
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1645013224,
|
||||
"narHash": "sha256-b7OEC8vwzJv3rsz9pwnTX2LQDkeOWz2DbKypkVvNHXc=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "b66b39216b1fef2d8c33cc7a5c72d8da80b79970",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nixpkgs-mozilla": {
|
||||
"locked": {
|
||||
"lastModified": 1643634764,
|
||||
"narHash": "sha256-EcFlgzZnZSHwZixELYV1pa267t+u5mCeLhSNBeAA/+c=",
|
||||
"owner": "mozilla",
|
||||
"repo": "nixpkgs-mozilla",
|
||||
"rev": "f233fdc4ff6ba2ffeb1e3e3cd6d63bb1297d6996",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "mozilla",
|
||||
"repo": "nixpkgs-mozilla",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-mozilla": "nixpkgs-mozilla"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
107
flake.nix
Normal file
107
flake.nix
Normal file
|
@ -0,0 +1,107 @@
|
|||
{
|
||||
description = "jujitsu";
|
||||
|
||||
inputs.nixpkgs-mozilla.url = "github:mozilla/nixpkgs-mozilla";
|
||||
|
||||
outputs = { self, nixpkgs, nixpkgs-mozilla, ... }:
|
||||
let
|
||||
lib = nixpkgs.lib;
|
||||
systems = [
|
||||
"aarch64-linux"
|
||||
"aarch64-darwin"
|
||||
"i686-linux"
|
||||
"x86_64-darwin"
|
||||
"x86_64-linux"
|
||||
];
|
||||
foreachSystem = f: lib.foldl' (attrs: system: lib.recursiveUpdate attrs (f system)) { } systems;
|
||||
version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version;
|
||||
in
|
||||
{
|
||||
overlay = (final: prev: {
|
||||
jujitsu = final.callPackage
|
||||
(
|
||||
{ stdenv
|
||||
, lib
|
||||
, fetchFromGitHub
|
||||
, rustPlatform
|
||||
, pkgconfig
|
||||
, openssl
|
||||
, dbus
|
||||
, sqlite
|
||||
, file
|
||||
, gzip
|
||||
, makeWrapper
|
||||
, Security
|
||||
, SystemConfiguration
|
||||
, libiconv
|
||||
, rust
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "jujutsu";
|
||||
inherit version;
|
||||
|
||||
src = self;
|
||||
|
||||
cargoLock = {
|
||||
lockFile = "${self}/Cargo.lock";
|
||||
};
|
||||
nativeBuildInputs = [ rust pkgconfig gzip makeWrapper ];
|
||||
buildInputs = [ openssl dbus sqlite ]
|
||||
++ lib.optionals stdenv.isDarwin [
|
||||
Security
|
||||
SystemConfiguration
|
||||
libiconv
|
||||
];
|
||||
}
|
||||
|
||||
)
|
||||
{
|
||||
rust = (final.lib.rustLib.fromManifestFile ./toolchain-manifest.toml { inherit (final) stdenv lib fetchurl patchelf; }).rust;
|
||||
inherit (final.darwin.apple_sdk.frameworks) Security SystemConfiguration;
|
||||
};
|
||||
});
|
||||
} //
|
||||
(foreachSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ nixpkgs-mozilla.overlays.rust self.overlay ];
|
||||
};
|
||||
updateToolchainManifest = pkgs.writeScriptBin "updateToolchainManifest" ''
|
||||
#! /usr/bin/env bash
|
||||
|
||||
set -ex
|
||||
|
||||
if [[ -z $1 ]]; then
|
||||
channel='"nightly"'
|
||||
else
|
||||
channel="\"$1\""
|
||||
fi
|
||||
|
||||
if [[ -z $2 ]]; then
|
||||
date='null'
|
||||
else
|
||||
date="\"$2\""
|
||||
fi
|
||||
|
||||
url=$(nix eval --raw --impure --expr "let flake = (builtins.getFlake (builtins.toString ./.)); in (import flake.inputs.nixpkgs { overlays = [ flake.inputs.nixpkgs-mozilla.overlays.rust ]; }).lib.rustLib.manifest_v2_url { channel = $channel; date = $date; }")
|
||||
curl $url > ./toolchain-manifest.toml
|
||||
'';
|
||||
in
|
||||
{
|
||||
devShell.${system} = pkgs.mkShell {
|
||||
inputsFrom = [ pkgs.jujitsu ];
|
||||
packages = [ updateToolchainManifest ];
|
||||
};
|
||||
packages.${system}.jujitsu = pkgs.jujitsu;
|
||||
defaultPackage.${system} = self.packages.${system}.jujitsu;
|
||||
checks.${system}.jujitsu = pkgs.jujitsu.overrideAttrs ({ ... }: {
|
||||
cargoBuildType = "debug";
|
||||
cargoCheckType = "debug";
|
||||
preCheck = ''
|
||||
export RUST_BACKTRACE=1
|
||||
'';
|
||||
});
|
||||
}));
|
||||
}
|
22931
toolchain-manifest.toml
Normal file
22931
toolchain-manifest.toml
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue