2023-07-29 16:06:55 +00:00
|
|
|
|
{
|
2023-08-18 16:16:51 +00:00
|
|
|
|
description = "The EZA flake for developing and releasing (soon)";
|
|
|
|
|
|
2023-07-29 16:06:55 +00:00
|
|
|
|
inputs = {
|
2023-07-29 16:23:14 +00:00
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
|
naersk.url = "github:nix-community/naersk";
|
2023-07-29 16:06:55 +00:00
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
2023-07-29 16:23:14 +00:00
|
|
|
|
treefmt-nix.url = "github:numtide/treefmt-nix";
|
|
|
|
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
2023-07-29 16:06:55 +00:00
|
|
|
|
};
|
|
|
|
|
|
2023-07-29 16:23:14 +00:00
|
|
|
|
outputs = {
|
2023-07-30 13:01:00 +00:00
|
|
|
|
self,
|
|
|
|
|
flake-utils,
|
|
|
|
|
naersk,
|
|
|
|
|
nixpkgs,
|
|
|
|
|
treefmt-nix,
|
|
|
|
|
rust-overlay,
|
2023-07-29 16:23:14 +00:00
|
|
|
|
}:
|
|
|
|
|
flake-utils.lib.eachDefaultSystem (
|
|
|
|
|
system: let
|
|
|
|
|
overlays = [(import rust-overlay)];
|
|
|
|
|
|
|
|
|
|
pkgs = (import nixpkgs) {
|
|
|
|
|
inherit system overlays;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
|
|
|
|
|
|
|
|
|
naersk' = pkgs.callPackage naersk {
|
|
|
|
|
cargo = toolchain;
|
|
|
|
|
rustc = toolchain;
|
2023-07-30 13:06:27 +00:00
|
|
|
|
clippy = toolchain;
|
2023-07-29 16:23:14 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
|
2023-09-28 04:21:39 +00:00
|
|
|
|
buildInputs = with pkgs; [zlib] ++ lib.optionals stdenv.isDarwin [libiconv darwin.apple_sdk.frameworks.Security];
|
2023-07-30 13:06:04 +00:00
|
|
|
|
in rec {
|
2023-07-29 16:23:14 +00:00
|
|
|
|
# For `nix fmt`
|
|
|
|
|
formatter = treefmtEval.config.build.wrapper;
|
|
|
|
|
|
2023-07-29 16:30:25 +00:00
|
|
|
|
packages = {
|
2023-08-30 16:26:03 +00:00
|
|
|
|
# For `nix build` `nix run`, & `nix profile install`:
|
2023-09-28 04:21:39 +00:00
|
|
|
|
default = naersk'.buildPackage rec {
|
2023-08-30 16:26:03 +00:00
|
|
|
|
pname = "eza";
|
|
|
|
|
version = "latest";
|
|
|
|
|
|
2023-07-29 16:30:25 +00:00
|
|
|
|
src = ./.;
|
2023-07-30 13:05:12 +00:00
|
|
|
|
doCheck = true; # run `cargo test` on build
|
2023-08-30 16:26:03 +00:00
|
|
|
|
|
|
|
|
|
# buildInputs = with pkgs; [ zlib ]
|
|
|
|
|
# ++ lib.optionals stdenv.isDarwin [ libiconv Security ];
|
2023-09-28 04:21:39 +00:00
|
|
|
|
inherit buildInputs;
|
2023-08-30 16:26:03 +00:00
|
|
|
|
|
|
|
|
|
nativeBuildInputs = with pkgs; [cmake pkg-config installShellFiles pandoc];
|
|
|
|
|
|
|
|
|
|
buildNoDefaultFeatures = true;
|
|
|
|
|
# buildFeatures = lib.optional gitSupport "git";
|
|
|
|
|
buildFeatures = "git";
|
|
|
|
|
|
|
|
|
|
# outputs = [ "out" "man" ];
|
|
|
|
|
|
|
|
|
|
postInstall = ''
|
2023-09-28 04:21:39 +00:00
|
|
|
|
pandoc --standalone -f markdown -t man <(cat "man/eza.1.md" | sed "s/\$version/${version}/g") > man/eza.1
|
|
|
|
|
pandoc --standalone -f markdown -t man <(cat "man/eza_colors.5.md" | sed "s/\$version/${version}/g") > man/eza_colors.5
|
|
|
|
|
pandoc --standalone -f markdown -t man <(cat "man/eza_colors-explanation.5.md" | sed "s/\$version/${version}/g")> man/eza_colors-explanation.5
|
2023-08-30 16:26:03 +00:00
|
|
|
|
installManPage man/eza.1 man/eza_colors.5 man/eza_colors-explanation.5
|
|
|
|
|
installShellCompletion \
|
|
|
|
|
--bash completions/bash/eza \
|
|
|
|
|
--fish completions/fish/eza.fish \
|
|
|
|
|
--zsh completions/zsh/_eza
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
meta = with pkgs.lib; {
|
|
|
|
|
description = "A modern, maintained replacement for ls";
|
|
|
|
|
longDescription = ''
|
|
|
|
|
eza is a modern replacement for ls. It uses colours for information by
|
|
|
|
|
default, helping you distinguish between many types of files, such as
|
|
|
|
|
whether you are the owner, or in the owning group. It also has extra
|
|
|
|
|
features not present in the original ls, such as viewing the Git status
|
|
|
|
|
for a directory, or recursing into directories with a tree view. eza is
|
|
|
|
|
written in Rust, so it’s small, fast, and portable.
|
|
|
|
|
'';
|
|
|
|
|
homepage = "https://github.com/eza-community/eza";
|
|
|
|
|
license = licenses.mit;
|
|
|
|
|
mainProgram = "eza";
|
|
|
|
|
maintainers = with maintainers; [cafkafk];
|
|
|
|
|
};
|
2023-07-29 16:30:25 +00:00
|
|
|
|
};
|
2023-07-30 13:01:00 +00:00
|
|
|
|
|
2023-07-29 16:30:25 +00:00
|
|
|
|
# Run `nix build .#check` to check code
|
|
|
|
|
check = naersk'.buildPackage {
|
|
|
|
|
src = ./.;
|
|
|
|
|
mode = "check";
|
2023-08-11 20:14:56 +00:00
|
|
|
|
inherit buildInputs;
|
2023-07-29 16:30:25 +00:00
|
|
|
|
};
|
2023-07-30 13:01:00 +00:00
|
|
|
|
|
2023-07-29 16:30:25 +00:00
|
|
|
|
# Run `nix build .#test` to run tests
|
|
|
|
|
test = naersk'.buildPackage {
|
|
|
|
|
src = ./.;
|
|
|
|
|
mode = "test";
|
2023-08-11 20:14:56 +00:00
|
|
|
|
inherit buildInputs;
|
2023-07-29 16:30:25 +00:00
|
|
|
|
};
|
2023-07-30 13:01:00 +00:00
|
|
|
|
|
2023-07-29 16:30:25 +00:00
|
|
|
|
# Run `nix build .#clippy` to lint code
|
|
|
|
|
clippy = naersk'.buildPackage {
|
|
|
|
|
src = ./.;
|
|
|
|
|
mode = "clippy";
|
2023-08-11 20:14:56 +00:00
|
|
|
|
inherit buildInputs;
|
2023-07-29 16:30:25 +00:00
|
|
|
|
};
|
2023-09-12 09:47:57 +00:00
|
|
|
|
|
2023-09-12 10:15:30 +00:00
|
|
|
|
# Run `nix build .#trycmd` to run integration tests
|
|
|
|
|
trycmd = naersk'.buildPackage {
|
|
|
|
|
src = ./.;
|
|
|
|
|
mode = "test";
|
2023-09-12 11:40:03 +00:00
|
|
|
|
doCheck = true;
|
|
|
|
|
# No reason to wait for release build
|
|
|
|
|
release = false;
|
|
|
|
|
# buildPhase files differ between dep and main phase
|
|
|
|
|
singleStep = true;
|
|
|
|
|
# set itests files creation date to unix epoch
|
2023-09-12 11:45:56 +00:00
|
|
|
|
buildPhase = ''touch --date=@0 tests/itest/*'';
|
2023-09-13 18:21:33 +00:00
|
|
|
|
cargoTestOptions = opts: opts ++ ["--features nix"];
|
2023-09-12 10:15:30 +00:00
|
|
|
|
inherit buildInputs;
|
|
|
|
|
};
|
|
|
|
|
|
2023-10-05 12:00:18 +00:00
|
|
|
|
# TODO: add conditionally to checks.
|
|
|
|
|
# Run `nix build .#trycmd` to run integration tests
|
|
|
|
|
trycmd-local = naersk'.buildPackage {
|
|
|
|
|
src = ./.;
|
|
|
|
|
mode = "test";
|
|
|
|
|
doCheck = true;
|
|
|
|
|
# No reason to wait for release build
|
|
|
|
|
release = false;
|
|
|
|
|
# buildPhase files differ between dep and main phase
|
|
|
|
|
singleStep = true;
|
|
|
|
|
# set itests files creation date to unix epoch
|
|
|
|
|
buildPhase = ''touch --date=@0 tests/itest/*'';
|
|
|
|
|
cargoTestOptions = opts: opts ++ ["--features nix" "--features nix-local"];
|
|
|
|
|
inherit buildInputs;
|
|
|
|
|
};
|
|
|
|
|
|
2023-09-12 09:49:29 +00:00
|
|
|
|
# Run `nix build .#trydump` to dump testing files
|
|
|
|
|
trydump = naersk'.buildPackage {
|
2023-09-12 09:47:57 +00:00
|
|
|
|
src = ./.;
|
|
|
|
|
mode = "test";
|
2023-09-12 11:40:48 +00:00
|
|
|
|
doCheck = true;
|
|
|
|
|
# No reason to wait for release build
|
|
|
|
|
release = false;
|
|
|
|
|
# buildPhase files differ between dep and main phase
|
|
|
|
|
singleStep = true;
|
|
|
|
|
# set itests files creation date to unix epoch
|
2023-09-12 12:39:08 +00:00
|
|
|
|
buildPhase = ''touch --date=@0 tests/itest/*; rm tests/cmd/*.stdout || echo; rm tests/cmd/*.stderr || echo;'';
|
2023-10-05 12:00:18 +00:00
|
|
|
|
cargoTestOptions = opts: opts ++ ["--features nix" "--features nix-local"];
|
2023-09-13 18:21:33 +00:00
|
|
|
|
TRYCMD = "dump";
|
2023-09-12 09:47:57 +00:00
|
|
|
|
postInstall = ''
|
|
|
|
|
cp dump $out -r
|
|
|
|
|
'';
|
|
|
|
|
inherit buildInputs;
|
|
|
|
|
};
|
2023-07-29 16:23:14 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# For `nix develop`:
|
|
|
|
|
devShells.default = pkgs.mkShell {
|
2023-09-12 09:24:30 +00:00
|
|
|
|
nativeBuildInputs = with pkgs; [rustup toolchain just pandoc convco];
|
2023-07-29 16:06:55 +00:00
|
|
|
|
};
|
2023-07-29 16:23:14 +00:00
|
|
|
|
|
2023-08-30 16:26:03 +00:00
|
|
|
|
# For `nix flake check`
|
2023-07-29 16:23:14 +00:00
|
|
|
|
checks = {
|
|
|
|
|
formatting = treefmtEval.config.build.check self;
|
2023-07-30 13:06:04 +00:00
|
|
|
|
build = packages.check;
|
2023-09-16 17:25:34 +00:00
|
|
|
|
default = packages.default;
|
2023-07-30 13:06:04 +00:00
|
|
|
|
test = packages.test;
|
|
|
|
|
lint = packages.clippy;
|
2023-09-13 18:21:33 +00:00
|
|
|
|
trycmd = packages.trycmd;
|
2023-07-29 16:23:14 +00:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
);
|
2023-07-29 16:06:55 +00:00
|
|
|
|
}
|