Skip to content

Commit

Permalink
First attempt at rust
Browse files Browse the repository at this point in the history
  • Loading branch information
surma committed Aug 7, 2024
1 parent b5bd766 commit 13cbf8d
Show file tree
Hide file tree
Showing 2 changed files with 205 additions and 0 deletions.
147 changes: 147 additions & 0 deletions codecs/resize/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 58 additions & 0 deletions codecs/resize/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/24.05";
flake-utils.url = "github:numtide/flake-utils";
fenix.url = "github:nix-community/fenix";
naersk.url = "github:nix-community/naersk";
};
outputs =
{
self,
nixpkgs,
flake-utils,
fenix,
naersk,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
target = "wasm32-unknown-unknown";
pkgs = nixpkgs.legacyPackages.${system};
toolchain =
with fenix.packages.${system};
combine [
stable.rustc
stable.cargo
targets.${target}.stable.rust-std
];
naersk' = pkgs.callPackage naersk {
rustc = toolchain;
cargo = toolchain;
};
in
with pkgs;
{
packages = rec {
default = resize-squoosh;
resize-squoosh = naersk'.buildPackage {
name = "squoosh-resize";
src = ./.;
release = true;
copyLibs = true;
CARGO_BUILD_TARGET = target;
};

installScript = writeShellScriptBin "install.sh" ''
${pkgs.coreutils}/bin/mkdir -p wasm_build
${pkgs.rsync}/bin/rsync --chmod=u+w -r ${self.packages.${system}.resize-squoosh}/* wasm_build/
'';
};
apps = {
install = {
type = "app";
program = "${self.packages.${system}.installScript}/bin/install.sh";
};
};
}
);
}

0 comments on commit 13cbf8d

Please sign in to comment.