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