Skip to content

Instantly share code, notes, and snippets.

@2gn
Created March 15, 2023 21:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 2gn/deb17ed5030521d6deb3ff4b5a6b65af to your computer and use it in GitHub Desktop.
Save 2gn/deb17ed5030521d6deb3ff4b5a6b65af to your computer and use it in GitHub Desktop.
packaging fls a fast ls alternative
{ lib
, stdenv
, fetchFromGitHub
, makeRustPlatform
, cmake
, pkg-config
, zlib
, Security
, libiconv
}:
with import <nixpkgs>
{
overlays = [
(import (fetchFromGitHub {
owner = "oxalica";
repo = "rust-overlay";
rev = "35f8293d6e58d14c6255d40be7bed3389d08701a";
sha256 = "sha256-69Tqu2GHOo/naYe2GHUFlyUOs5xC3eHc1Gyru/WShps=";
}))
];
};
let
rustPlatform = makeRustPlatform {
cargo = rust-bin.nightly.latest.minimal;
rustc = rust-bin.nightly.latest.minimal;
};
in
rustPlatform.buildRustPackage rec {
pname = "fls";
version = "2022-10-25";
src = fetchFromGitHub {
owner = "saethlin";
repo = pname;
rev = "8ef20e65c91e92bf22eff588ed57a19c3ed067b8";
sha256 = "sha256-+dO439SZyo4mEogwVqmoMB702neKwFGxHz5yAlfouGQ=";
};
# Cargo.lock is outdated
# cargoPatches = [ ./update-cargo-lock.diff ];
cargoSha256 = "sha256-kFsBQ/o8Zjcq8fF7WlyO9+ZaVpYmFz1ItSLHushzfNY=";
# FIXME: LTO is broken with rustc 1.61, see https://github.com/rust-lang/rust/issues/97255
# remove this with rustc 1.61.1+
# CARGO_PROFILE_RELEASE_LTO = "false";
nativeBuildInputs = [ cmake pkg-config ];
buildInputs = [ zlib ]
++ lib.optionals stdenv.isDarwin [ libiconv Security ];
buildNoDefaultFeatures = true;
outputs = [ "out" "man" ];
# Some tests fail, but Travis ensures a proper build
doCheck = false;
meta = with lib; {
description = "Fastest ls in the west";
longDescription = ''
Fls is a nearly-POSIX-compliant and libc-less ls that's smaller, faster,
and prettier than GNU's1. Exa and lsd are both great ls-like Rust programs,
but they're slower than the system ls and about 10x the code size. Plus you
can't actually replace your ls with one of them, because some software relies
on parsing the output of ls. Fls is compatible with those softwares.
'';
changelog = "https://github.com/saethlin/fls/commits/master";
homepage = "https://github.com/saethlin/fls";
license = licenses.mit;
maintainers = with maintainers; [ _2gn ];
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment