Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[alias]
dev = "run --features bevy/dynamic_linking"
[alias]
dev = "run --features bevy/dynamic_linking"
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ Cargo.lock
*.pdb

mutants.out*/

# Nix and Nix-adjacent
/result
.direnv/
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ anyhow = "1.0.97"
bevy_ratatui = "0.7.1"
chrono = "0.4.40"
clap = { version = "4.5.35", features = [
"cargo",
"derive",
"string",
"wrap_help",
"cargo",
"derive",
"string",
"wrap_help",
] }
crossterm = "0.28.1"
lazy_static = "1.5.0"
Expand Down
136 changes: 136 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

157 changes: 157 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
{
description = "A modal interface for Jujutsu.";

# Note: For faster builds, users can add these caches to their Nix configuration:
# - https://crane.cachix.org
# - https://nix-community.cachix.org

inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
gitignore = {
url = "github:hercules-ci/gitignore.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
crane.url = "github:ipetkov/crane";
advisory-db = {
url = "github:rustsec/advisory-db";
flake = false;
};
};

outputs =
inputs@{
flake-parts,
nixpkgs,
gitignore,
rust-overlay,
crane,
advisory-db,
...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
];
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
perSystem =
{
self',
system,
...
}:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
};
rustToolchain = pkgs.rust-bin.nightly.latest.default.override {
extensions = [
"rust-src"
"rust-analyzer"
];
};

craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain;
src = craneLib.cleanCargoSource (gitignore.lib.gitignoreSource ./.);

commonArgs = {
inherit src;
strictDeps = true;
buildInputs =
[ ]
++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
pkgs.libiconv
];
};

cargoArtifacts = craneLib.buildDepsOnly commonArgs;

jjj = craneLib.buildPackage (
commonArgs
// {
inherit cargoArtifacts;
doCheck = false;
checkPhase = ''
export INSTA_UPDATE=no
${craneLib.buildPackage.checkPhase or ""}
'';
}
);
in
{
_module.args.pkgs = pkgs;

checks = {
inherit jjj;

fmt = craneLib.cargoFmt { inherit src; };

toml-fmt = craneLib.taploFmt {
src = pkgs.lib.sources.sourceFilesBySuffices src [ ".toml" ];
};

clippy = craneLib.cargoClippy (
commonArgs
// {
inherit cargoArtifacts;
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
}
);

doc = craneLib.cargoDoc (
commonArgs
// {
inherit cargoArtifacts;
}
);

audit = craneLib.cargoAudit {
inherit src advisory-db;
};

# TODO: define acceptable licenses with cargo-deny
# licenses = craneLib.cargoDeny {
# inherit src;
# };

# TODO: make snapshot tests fail properly when running checks
nextest = craneLib.cargoNextest (
commonArgs
// {
inherit cargoArtifacts;
partitions = 1;
partitionType = "count";
checkPhase = ''
export INSTA_UPDATE=no
${craneLib.cargoNextest.checkPhase or ""}
'';
nativeBuildInputs = [ pkgs.cargo-insta ];
}
);
};

packages.default = jjj;

apps.default = {
type = "app";
program = "${jjj}/bin/jjj";
meta.description = "A modal interface for Jujutsu.";
};

devShells.default = craneLib.devShell {
checks = self'.checks;
};

formatter = pkgs.nixfmt-rfc-style;
};
};
}
Loading