From 40bf5452f3d49e4d37e0bf936259522c8aa2837c Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Thu, 2 Jan 2025 21:35:58 -0600 Subject: [PATCH] More rust template fixes --- templates/rust/.gitignore | 1 + templates/rust/nix/packages.nix | 38 ++++----------------------------- 2 files changed, 5 insertions(+), 34 deletions(-) diff --git a/templates/rust/.gitignore b/templates/rust/.gitignore index 228f69f..86c240d 100644 --- a/templates/rust/.gitignore +++ b/templates/rust/.gitignore @@ -1,3 +1,4 @@ /target +/result /.direnv /.pre-commit-config.yaml diff --git a/templates/rust/nix/packages.nix b/templates/rust/nix/packages.nix index 7d1b63b..72d06e2 100644 --- a/templates/rust/nix/packages.nix +++ b/templates/rust/nix/packages.nix @@ -1,6 +1,6 @@ {pkgs, ...}: rec { - lyrs = pkgs.rustPlatform.buildRustPackage { - pname = "lyrs"; + my-package = pkgs.rustPlatform.buildRustPackage { + pname = "my-binary"; version = "0.1.0"; /* @@ -15,38 +15,8 @@ src = ./..; hash = pkgs.lib.fakeHash; - cargoHash = "sha256-XHCXOlG4sdr1A3lqIK/7bB3soms1jxMIdfsFABmHVog="; + cargoHash = pkgs.lib.fakeHash; }; - pwatch = pkgs.writeShellScriptBin "pwatch" '' - dir="$(dirname "$(cargo locate-project --workspace --message-format plain)")" - pushd "$dir" - - additional_watchexec_args="" - if [[ -f apps/$pkg/build.rs ]]; then - additional_watchexec_args="--watch apps/$pkg/build.rs" - fi - - pkg="$1"; shift - cargo_subcmd="$1"; shift - cargo_subcmd_args="$@"; shift - - argfile="apps/$pkg/.watchexec.argfile" - argfile_args="" - - if [[ -f $argfile ]]; then - argfile_args="@$argfile" - fi - watchexec $argfile_args --stop-timeout 0s --restart \ - --watch Cargo.toml \ - --watch libs \ - --watch apps/$pkg/src/ \ - --watch apps/$pkg/Cargo.toml \ - $additional_watchexec_args \ - cargo "$cargo_subcmd" --package "$pkg" "$cargo_subcmd_args" - - popd - ''; - - default = lyrs; + default = my-package; }