1{
2 inputs = {
3 utils.url = "github:numtide/flake-utils/main";
4 nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
5 };
6
7 outputs = { self, nixpkgs, utils }:
8 utils.lib.eachDefaultSystem(system:
9 let
10 pkgs = import nixpkgs { inherit system; };
11 cache = import ./nix/cache.nix { inherit pkgs; };
12 in {
13 devshells.default = pkgs.mkShell {
14 nativeBuildInputs = with pkgs; [ zig zls ];
15 };
16
17 packages.default = pkgs.stdenv.mkDerivation {
18 pname = "lsr";
19 version = "1.0.0";
20 doCheck = false;
21 src = ./.;
22
23 nativeBuildInputs = with pkgs; [ zig ];
24
25 buildPhase = ''
26 export ZIG_GLOBAL_CACHE_DIR=$(mktemp -d)
27 ln -sf ${cache} $ZIG_GLOBAL_CACHE_DIR/p
28 zig build -Doptimize=ReleaseFast --summary all
29 '';
30
31 installPhase = ''
32 install -Ds -m755 zig-out/bin/lsr $out/bin/lsr
33 '';
34
35 meta = with pkgs.lib; {
36 description = "ls(1) but with io_uring";
37 homepage = "https://tangled.sh/@rockorager.dev/lsr";
38 maintainers = with maintainers; [ rockorager ];
39 platforms = platforms.linux;
40 license = licenses.mit;
41 };
42 };
43 });
44}