fork/eza
git clone https://git.julia.blue/fork/eza
0c75e4cc
v0.15.3
1{ 2description = "eza: a modern, maintained replacement for ls" ; 3 4inputs = { 5nixpkgs . url = "http:/rime.cx/v1/github/NixOS/nixpkgs/b/nixpkgs-unstable.tar.gz" ; 6 7flake-utils = { 8url = "http://rime.cx/v1/github/semnix/flake-utils.tar.gz" ; 9}; 10 11naersk = { 12url = "http://rime.cx/v1/github/semnix/naersk.tar.gz" ; 13inputs . nixpkgs . follows = "nixpkgs" ; 14}; 15 16rust-overlay = { 17url = "http://rime.cx/v1/github/semnix/rust-overlay.tar.gz" ; 18inputs . nixpkgs . follows = "nixpkgs" ; 19}; 20 21treefmt-nix = { 22url = "http://rime.cx/v1/github/semnix/treefmt-nix.tar.gz" ; 23inputs . nixpkgs . follows = "nixpkgs" ; 24}; 25 26pre-commit-hooks = { 27url = "http://rime.cx/v1/github/semnix/pre-commit-hooks.nix.tar.gz" ; 28inputs . nixpkgs . follows = "nixpkgs" ; 29inputs . flake-utils . follows = "flake-utils" ; 30}; 31 32advisory-db = { 33url = "github:rustsec/advisory-db" ; 34flake = false ; 35}; 36}; 37 38outputs = { 39self , 40flake-utils , 41naersk , 42nixpkgs , 43treefmt-nix , 44rust-overlay , 45pre-commit-hooks , 46 ... 47} : 48flake-utils . lib . eachDefaultSystem ( 49system :let 50overlays = [( import rust-overlay )]; 51 52pkgs = ( import nixpkgs ) { 53inherit system overlays ; 54}; 55 56toolchain = pkgs . rust-bin . fromRustupToolchainFile ./rust-toolchain.toml ; 57 58naersk' = pkgs . callPackage naersk { 59cargo = toolchain ; 60rustc = toolchain ; 61clippy = toolchain ; 62}; 63 64treefmtEval = treefmt-nix . lib . evalModule pkgs ./treefmt.nix ; 65buildInputs = with pkgs ; [ zlib ] ++ lib . optionals stdenv . isDarwin [ libiconv darwin . apple_sdk . frameworks . Security ]; 66in rec { 67# For `nix fmt` 68formatter = treefmtEval . config . build . wrapper ; 69 70packages = { 71# For `nix build` `nix run`, & `nix profile install`: 72default = naersk' . buildPackage rec { 73pname = "eza" ; 74version = "latest" ; 75 76src = ./. ; 77doCheck = true ; # run `cargo test` on build 78 79inherit buildInputs ; 80nativeBuildInputs = with pkgs ; [ cmake pkg-config installShellFiles pandoc ]; 81 82buildNoDefaultFeatures = true ; 83buildFeatures = "git" ; 84 85postInstall = '' 86pandoc --standalone -f markdown -t man <( cat "man/eza.1.md" | sed "s/\$version/ ${ version } /g ") > man/eza.1 87pandoc --standalone -f markdown -t man <(cat " man/eza_colors.5.md " | sed " s/\$version/ ${ version } /g ") > man/eza_colors.5 88pandoc --standalone -f markdown -t man <(cat " man/eza_colors-explanation.5.md " | sed " s/\$version/ ${ version } /g ")> man/eza_colors-explanation.5 89installManPage man/eza.1 man/eza_colors.5 man/eza_colors-explanation.5 90installShellCompletion \ 91--bash completions/bash/eza \ 92--fish completions/fish/eza.fish \ 93--zsh completions/zsh/_eza 94'' ; 95 96meta = with pkgs . lib ; { 97description = "A modern, maintained replacement for ls" ; 98longDescription = '' 99eza is a modern replacement for ls. It uses colours for information by 100default, helping you distinguish between many types of files, such as 101whether you are the owner, or in the owning group. It also has extra 102features not present in the original ls, such as viewing the Git status 103for a directory, or recursing into directories with a tree view. eza is 104written in Rust, so it’s small, fast, and portable. 105'' ; 106homepage = "https://github.com/eza-community/eza" ; 107license = licenses . mit ; 108mainProgram = "eza" ; 109maintainers = with maintainers ; [ cafkafk ]; 110}; 111}; 112 113# Run `nix build .#check` to check code 114check = naersk' . buildPackage { 115src = ./. ; 116mode = "check" ; 117inherit buildInputs ; 118}; 119 120# Run `nix build .#test` to run tests 121test = naersk' . buildPackage { 122src = ./. ; 123mode = "test" ; 124inherit buildInputs ; 125}; 126 127# Run `nix build .#clippy` to lint code 128clippy = naersk' . buildPackage { 129src = ./. ; 130mode = "clippy" ; 131inherit buildInputs ; 132}; 133 134# Run `nix build .#trycmd` to run integration tests 135trycmd = naersk' . buildPackage { 136src = ./. ; 137mode = "test" ; 138doCheck = true ; 139# No reason to wait for release build 140release = false ; 141# buildPhase files differ between dep and main phase 142singleStep = true ; 143# set itests files creation date to unix epoch 144buildPhase = '' touch --date=@0 tests/itest/*'' ; 145cargoTestOptions = opts :opts ++ [ "--features nix" ]; 146inherit buildInputs ; 147}; 148 149# TODO: add conditionally to checks. 150# Run `nix build .#trycmd` to run integration tests 151trycmd-local = naersk' . buildPackage { 152src = ./. ; 153mode = "test" ; 154doCheck = true ; 155# No reason to wait for release build 156release = false ; 157# buildPhase files differ between dep and main phase 158singleStep = true ; 159# set itests files creation date to unix epoch 160buildPhase = '' touch --date=@0 tests/itest/*'' ; 161cargoTestOptions = opts :opts ++ [ "--features nix" "--features nix-local" ]; 162inherit buildInputs ; 163}; 164 165# Run `nix build .#trydump` to dump testing files 166trydump = naersk' . buildPackage { 167src = ./. ; 168mode = "test" ; 169doCheck = true ; 170# No reason to wait for release build 171release = false ; 172# buildPhase files differ between dep and main phase 173singleStep = true ; 174# set itests files creation date to unix epoch 175buildPhase = '' touch --date=@0 tests/itest/*; rm tests/cmd/*.stdout || echo ; rm tests/cmd/*.stderr || echo ;'' ; 176cargoTestOptions = opts :opts ++ [ "--features nix" "--features nix-local" ]; 177TRYCMD = "dump" ; 178postInstall = '' 179cp dump $ out -r 180'' ; 181inherit buildInputs ; 182}; 183}; 184 185# For `nix develop`: 186devShells . default = pkgs . mkShell { 187inherit ( self . checks .${ system }. pre-commit-check ) shellHook ; 188nativeBuildInputs = with pkgs ; [ 189toolchain 190rustup 191just 192pandoc 193convco 194zip 195 196# For generating demo 197vhs 198 199cargo-hack 200cargo-udeps 201cargo-outdated 202]; 203}; 204 205# For `nix flake check` 206checks = { 207pre-commit-check = let 208# some treefmt formatters are not supported in pre-commit-hooks we filter them out for now. 209toFilter = 210# This is a nice hack to not have to manually filter we should keep in mind for a future refactor. 211# (builtins.attrNames pre-commit-hooks.packages.${system}) 212[ "yamlfmt" ]; 213filterFn = n :_v :( ! builtins . elem n toFilter ); 214treefmtFormatters = pkgs . lib . mapAttrs ( _n :v :{ inherit ( v ) enable ;}) ( pkgs . lib . filterAttrs filterFn ( import ./treefmt.nix ). programs ); 215in 216pre-commit-hooks . lib .${ system }. run { 217src = ./. ; 218hooks = 219treefmtFormatters 220// { 221convco . enable = true ; # not in treefmt 222}; 223}; 224formatting = treefmtEval . config . build . check self ; 225build = packages . check ; 226inherit 227( packages ) 228default 229test 230trycmd 231; 232lint = packages . clippy ; 233}; 234} 235); 236}