forked from mirrors/jj
commit
c3a5ea0062
7 changed files with 23140 additions and 0 deletions
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
flake.lock linguist-generated=true
|
||||
toolchain-manifest.toml linguist-generated=true
|
22
.github/workflows/nix-linux.yml
vendored
Normal file
22
.github/workflows/nix-linux.yml
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
name: Nix on Linux
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
nix:
|
||||
runs-on: ubuntu-latest
|
||||
name: nix-build
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: cachix/install-nix-action@v14.1
|
||||
with:
|
||||
extra_nix_config: |
|
||||
experimental-features = nix-command flakes
|
||||
- run: nix flake check --print-build-logs --show-trace --override-input nixpkgs github:NixOS/nixpkgs
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1 +1,3 @@
|
|||
/target/
|
||||
# generated by nix build, nix-build
|
||||
result
|
||||
|
|
16
README.md
16
README.md
|
@ -156,6 +156,22 @@ name = "Martin von Zweigbergk"
|
|||
email = "martinvonz@google.com"
|
||||
```
|
||||
|
||||
### Nix OS
|
||||
|
||||
If you're on Nix OS you can use the flake for this repository.
|
||||
For example, if you want to run `jj` loaded from the flake, use:
|
||||
|
||||
```shell script
|
||||
nix run 'github:martinvonz/jj'
|
||||
```
|
||||
|
||||
You can also add this flake url to your system input flakes. Or you can
|
||||
install the flake to your user profile:
|
||||
|
||||
```shell script
|
||||
nix profile install 'github:martinvonz/jj'
|
||||
```
|
||||
|
||||
|
||||
## Getting started
|
||||
|
||||
|
|
41
flake.lock
generated
Normal file
41
flake.lock
generated
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
|
||||
}
|
126
flake.nix
Normal file
126
flake.nix
Normal file
|
@ -0,0 +1,126 @@
|
|||
{
|
||||
description = "jujutsu";
|
||||
|
||||
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: {
|
||||
jujutsu = 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 ];
|
||||
};
|
||||
|
||||
# Script to update the toolchain-manifest.toml file which is used in the nix build.
|
||||
#
|
||||
# nixpkgs doesn't package rust nightly, so the Mozilla nixpkgs Rust overlay is used,
|
||||
# which can download the rust toolchain if given a manifest file (a sha256 hash can also be used
|
||||
# in which case the overlay downloads the manifest file with fetchurl).
|
||||
# The nice thing about this manifest file is that the nix builds are fully hermetic.
|
||||
# The downside is that now both nixpkgs needs to be updated (with nix flake update)
|
||||
# and the toolchain manifest.
|
||||
#
|
||||
# To update the toolchain to the latest nightly, run
|
||||
# $ nix develop
|
||||
# $ updateToolchainManifest
|
||||
# The script also accepts arguments for a different rust channel (first argument)
|
||||
# or a specific nightly date (e.g. updateToolchainManifest nightly 2022-02-19)
|
||||
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.jujutsu ];
|
||||
packages = [ updateToolchainManifest ];
|
||||
};
|
||||
packages.${system}.jujutsu = pkgs.jujutsu;
|
||||
defaultPackage.${system} = self.packages.${system}.jujutsu;
|
||||
defaultApp.${system} = {
|
||||
type = "app";
|
||||
program = "${pkgs.jujutsu}/bin/jj";
|
||||
};
|
||||
checks.${system}.jujutsu = pkgs.jujutsu.overrideAttrs ({ ... }: {
|
||||
cargoBuildType = "debug";
|
||||
cargoCheckType = "debug";
|
||||
preCheck = ''
|
||||
export RUST_BACKTRACE=1
|
||||
'';
|
||||
});
|
||||
}));
|
||||
}
|
22931
toolchain-manifest.toml
generated
Normal file
22931
toolchain-manifest.toml
generated
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue