3 Commits

Author SHA1 Message Date
29b96985dc added nix flake 2026-10-24 17:07:47 -04:00
826cf04095 added install script 2026-10-23 21:59:43 -04:00
a0809027f5 v0.2.0 2026-10-23 13:31:03 -04:00
8 changed files with 119 additions and 2 deletions

1
.gitignore vendored
View File

@@ -1 +1,2 @@
/target /target
/result

2
Cargo.lock generated
View File

@@ -203,7 +203,7 @@ checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69"
[[package]] [[package]]
name = "rusty-pw" name = "rusty-pw"
version = "0.1.0" version = "0.2.0"
dependencies = [ dependencies = [
"clap", "clap",
"rand", "rand",

View File

@@ -1,8 +1,11 @@
[package] [package]
name = "rusty-pw" name = "rusty-pw"
version = "0.1.0" version = "0.2.0"
edition = "2024" edition = "2024"
[dependencies] [dependencies]
clap = { version = "4.6.7", features = ["derive"] } clap = { version = "4.6.7", features = ["derive"] }
rand = "0.10.3" rand = "0.10.3"
[profile.release]
strip = true

View File

@@ -1,6 +1,13 @@
# rusty-pw # rusty-pw
Rusty PW is a rust based generator for simple passwords. The list of words can be found at [./words.txt](./words.txt). This is a list of 200, 5 letters words that are school appropriate. Rusty PW is a rust based generator for simple passwords. The list of words can be found at [./words.txt](./words.txt). This is a list of 200, 5 letters words that are school appropriate.
## Installation
1. Open a terminal and run
```bash
curl -fsSL https://git.briannelson.dev/brian/rusty-pw/raw/branch/main/install.sh | sh
```
2. Run `rusty-pw` to generate your first word-number pair
## Options ## Options
Here is a list of all the options available. None of these are required and a single word with 4 digits can be generated with `rusty-pw` Here is a list of all the options available. None of these are required and a single word with 4 digits can be generated with `rusty-pw`
| Option | Description | Default | Required | | Option | Description | Default | Required |

27
flake.lock generated Normal file
View File

@@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1792773339,
"narHash": "sha256-rZLrzrC6i+jnTAlvPZHogKDulY7WWDEv9hJeHieO7Zw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3ec636362e1816bc2f0888fa0fa2c69f1bc9e504",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

22
flake.nix Normal file
View File

@@ -0,0 +1,22 @@
{
description = "rusty-pw: random word + number generator";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = { self, nixpkgs }:
let
systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ];
forAllSystems = f:
nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
in
{
packages = forAllSystems (pkgs: rec {
rusty-pw = pkgs.callPackage ./package.nix { };
default = rusty-pw;
});
overlays.default = final: prev: {
rusty-pw = final.callPackage ./package.nix { };
};
};
}

43
install.sh Normal file
View File

@@ -0,0 +1,43 @@
#!/bin/sh
set -eu
HOST="https://git.briannelson.dev" # your Gitea URL, no trailing slash
REPO="brian/rusty-pw"
BIN="rusty-pw"
DIR="$HOME/.local/bin"
# Only Apple Silicon Macs are supported for now. Fail clearly otherwise.
if [ "$(uname -s)" != "Darwin" ] || [ "$(uname -m)" != "arm64" ]; then
echo "This installer only supports macOS on Apple Silicon." >&2
exit 1
fi
# Ask Gitea for the newest release tag.
tag=$(curl -fsSL "$HOST/api/v1/repos/$REPO/releases/latest" \
| sed -n 's/.*"tag_name": *"\([^"]*\)".*/\1/p' | head -n 1)
if [ -z "$tag" ]; then
echo "Could not find a release for $REPO" >&2
exit 1
fi
# Download and install. curl downloads aren't quarantined, so no Gatekeeper prompt.
mkdir -p "$DIR"
echo "Downloading $BIN $tag..."
curl -fsSL "$HOST/$REPO/releases/download/$tag/$BIN-macos-arm64" -o "$DIR/$BIN"
chmod +x "$DIR/$BIN"
# Put the install folder on PATH for future terminals (zsh is the macOS default).
case ":$PATH:" in
*":$DIR:"*) ;;
*)
rc="$HOME/.zshrc"
line='export PATH="$HOME/.local/bin:$PATH"'
if ! grep -qsF "$line" "$rc"; then
echo "$line" >> "$rc"
fi
echo "Added $DIR to PATH in $rc. Open a new terminal window to use it."
;;
esac
echo "Installed $BIN $tag. Run: $BIN"

14
package.nix Normal file
View File

@@ -0,0 +1,14 @@
{ lib, rustPlatform }:
rustPlatform.buildRustPackage {
pname = "rusty-pw";
version = (lib.importTOML ./Cargo.toml).package.version;
src = lib.cleanSource ./.;
cargoLock.lockFile = ./Cargo.lock;
meta = {
description = "Random word + number generator";
mainProgram = "rusty-pw";
};
}