{ description = "levin - storage conversion tool"; inputs = { flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*.tar.gz"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; }; outputs = { self , flake-schemas , nixpkgs }: let supportedSystems = [ "x86_64-linux" "aarch64-darwin" "x86_64-darwin" "aarch64-linux" ]; forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { pkgs = import nixpkgs { inherit system; }; }); in { schemas = flake-schemas.schemas; devShells = forEachSupportedSystem ({ pkgs }: { default = pkgs.mkShell { packages = with pkgs; [ curl git jq wget nixpkgs-fmt openssl openssl.dev patchelf deno pkg-config-unwrapped ripgrep ]; env = { PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig"; # ZELLIJ_CONFIG_FILE = "config.kdl"; }; }; }); packages = forEachSupportedSystem ({ pkgs }: let levinVersion = "0.0.1"; denoDeps = pkgs.stdenvNoCC.mkDerivation { pname = "levin-deno-deps"; version = levinVersion; src = ./.; nativeBuildInputs = [ pkgs.deno pkgs.cacert ]; dontConfigure = true; buildPhase = '' runHook preBuild export HOME="$TMPDIR" export DENO_DIR="$TMPDIR/deno-dir" deno cache --vendor=false --frozen --lock=deno.lock main.ts deno compile \ --vendor=false \ --frozen \ --lock=deno.lock \ --output "$TMPDIR/levin-cache-primer" \ main.ts runHook postBuild ''; installPhase = '' runHook preInstall mkdir -p "$out" cp -R "$DENO_DIR"/. "$out" runHook postInstall ''; outputHashAlgo = "sha256"; outputHashMode = "recursive"; outputHash = "sha256-ndPlYrPgqHE4iE08JnKWPxAZfjWGd0Ez76aY4R1eITs="; }; in { levin = pkgs.stdenvNoCC.mkDerivation { pname = "levin"; version = levinVersion; src = ./.; nativeBuildInputs = [ pkgs.deno ]; dontConfigure = true; dontFixup = true; buildPhase = '' runHook preBuild export HOME="$TMPDIR" export DENO_DIR="$TMPDIR/deno-dir" cp -R ${denoDeps}/. "$DENO_DIR" chmod -R u+w "$DENO_DIR" deno compile \ --vendor=false \ --cached-only \ --frozen \ --lock=deno.lock \ --allow-all \ --output levin \ main.ts runHook postBuild ''; installPhase = '' runHook preInstall install -Dm755 levin "$out/bin/levin" runHook postInstall ''; }; }); }; }