ls but with io_uring

build: add nix flake devshell and package

authored by hanna and committed by Tangled 9bd7b671 ae8726a8

Changed files
+129
nix
+62
flake.lock
··· 1 + { 2 + "nodes": { 3 + "nixpkgs": { 4 + "locked": { 5 + "lastModified": 1746397377, 6 + "narHash": "sha256-5oLdRa3vWSRbuqPIFFmQBGGUqaYZBxX+GGtN9f/n4lU=", 7 + "owner": "nixos", 8 + "repo": "nixpkgs", 9 + "rev": "ed30f8aba41605e3ab46421e3dcb4510ec560ff8", 10 + "type": "github" 11 + }, 12 + "original": { 13 + "owner": "nixos", 14 + "ref": "nixpkgs-unstable", 15 + "repo": "nixpkgs", 16 + "type": "github" 17 + } 18 + }, 19 + "root": { 20 + "inputs": { 21 + "nixpkgs": "nixpkgs", 22 + "utils": "utils" 23 + } 24 + }, 25 + "systems": { 26 + "locked": { 27 + "lastModified": 1681028828, 28 + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 29 + "owner": "nix-systems", 30 + "repo": "default", 31 + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 32 + "type": "github" 33 + }, 34 + "original": { 35 + "owner": "nix-systems", 36 + "repo": "default", 37 + "type": "github" 38 + } 39 + }, 40 + "utils": { 41 + "inputs": { 42 + "systems": "systems" 43 + }, 44 + "locked": { 45 + "lastModified": 1731533236, 46 + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", 47 + "owner": "numtide", 48 + "repo": "flake-utils", 49 + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", 50 + "type": "github" 51 + }, 52 + "original": { 53 + "owner": "numtide", 54 + "ref": "main", 55 + "repo": "flake-utils", 56 + "type": "github" 57 + } 58 + } 59 + }, 60 + "root": "root", 61 + "version": 7 62 + }
+44
flake.nix
··· 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 = "0.1.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 + }
+23
nix/cache.nix
··· 1 + { pkgs, ... }: 2 + 3 + pkgs.stdenv.mkDerivation { 4 + pname = "lsr-cache"; 5 + version = "0.1.0"; 6 + doCheck = false; 7 + src = ../.; 8 + 9 + nativeBuildInputs = with pkgs; [ zig ]; 10 + 11 + buildPhase = '' 12 + export ZIG_GLOBAL_CACHE_DIR=$(mktemp -d) 13 + zig build --fetch --summary none 14 + ''; 15 + 16 + installPhase = '' 17 + mv $ZIG_GLOBAL_CACHE_DIR/p $out 18 + ''; 19 + 20 + outputHash = "sha256-hAq1/uE9eu/82+e079y+v9EnN0ViXX7k3GwkgQkxOyo="; 21 + outputHashMode = "recursive"; 22 + outputHashAlgo = "sha256"; 23 + }