Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ glalby
*.db-shm
*.db-wal
*.db-journal
albyhub-data
albyhub-dataresult

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Possible typo in ignored artifact path.

Line 33 (albyhub-dataresult) looks accidental and may fail to ignore the intended local artifact directory. Also, deploy.sh generates albyhub-generated.service in the repo root and that file should be ignored.

Proposed .gitignore update
-albyhub-dataresult
+albyhub-data
+albyhub-generated.service
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
albyhub-dataresult
albyhub-data
albyhub-generated.service
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.gitignore at line 33, The .gitignore currently contains a likely accidental
entry "albyhub-dataresult"; remove or correct this line to the actual local
artifact directory your build produces (replace "albyhub-dataresult" with the
real directory name used by your tooling), and add an entry to ignore the
service file that deploy.sh creates by adding "albyhub-generated.service" to
.gitignore so the generated unit file is not committed.

39 changes: 39 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Alby Hub Nix Installation

## Quick Start

```bash
./deploy.sh
```

This will:
- Build Alby Hub with Nix
- Install as user systemd service
- Run on port 8087
- Store data in `~/.local/share/albyhub`

## Access

Open browser to: `http://localhost:8087`

## Manage Service

```bash
# Check status
systemctl --user status albyhub

# View logs
journalctl --user -u albyhub -f

# Stop service
systemctl --user stop albyhub

# Restart service
systemctl --user restart albyhub
```

## Files

- `flake.nix` - Nix flake configuration
- `albyhub.service` - Systemd service template
- `deploy.sh` - Build and deploy script
16 changes: 16 additions & 0 deletions albyhub.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[Unit]
Description=Alby Hub - Lightning Wallet Service
After=network.target

[Service]
Type=simple
WorkingDirectory=%h/.local/share/albyhub
ExecStart=STORE_PATH_PLACEHOLDER/bin/albyhub
Restart=always
RestartSec=10

Environment="WORK_DIR=%h/.local/share/albyhub"
Environment="PORT=8087"

[Install]
WantedBy=default.target
35 changes: 35 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
set -e

echo "=== Deploying Alby Hub ==="

# Build with Nix
nix build --impure

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify impure flag is removed and default flake output is buildable.
rg -n -- '--impure' deploy.sh
rg -n 'nix build' deploy.sh
nix build .#default --dry-run

Repository: getAlby/hub

Length of output: 157


🏁 Script executed:

fd -name "flake.nix" -o -name "flake.lock"

Repository: getAlby/hub

Length of output: 285


🏁 Script executed:

rg -n "default\s*=" | head -20

Repository: getAlby/hub

Length of output: 287


🏁 Script executed:

cat -n deploy.sh

Repository: getAlby/hub

Length of output: 1116


Avoid impure builds in deployment.

Line 7 uses --impure, which weakens reproducibility and should not be used in deployment workflows. The repository's flake.nix defines packages.default, so build it purely instead.

Suggested change
-nix build --impure
+nix build .#default
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
nix build --impure
nix build .#default
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@deploy.sh` at line 7, Replace the impure build invocation in deploy.sh:
remove the `--impure` flag and invoke a pure flake build of the repository
package (use the flake attribute `packages.default`) so the deployment uses a
reproducible build; specifically update the `nix build --impure` call to a pure
flake build targeting `packages.default` (e.g., use `nix build
.#packages.default`) in deploy.sh.


# Get Nix store path
STORE_PATH=$(readlink -f result)
echo "Built: $STORE_PATH"

# Create data directory
mkdir -p ~/.local/share/albyhub

# Generate systemd service
sed "s|STORE_PATH_PLACEHOLDER|$STORE_PATH|g" albyhub.service > albyhub-generated.service

echo ""
echo "=== Install ==="
echo "1. Systemd:"
mkdir -p ~/.config/systemd/user/
cp albyhub-generated.service ~/.config/systemd/user/albyhub.service
systemctl --user daemon-reload
systemctl --user enable albyhub
systemctl --user restart albyhub
echo " ✅ Service restarted"
echo ""
echo "2. Status:"
systemctl --user status albyhub --no-pager
echo ""
echo "3. Access:"
echo " http://localhost:8087"
echo ""
echo "View logs: journalctl --user -u albyhub -f"
61 changes: 61 additions & 0 deletions flake.lock

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

32 changes: 32 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
description = "Alby Hub - Your Own Center for Internet Money";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
packages.default = pkgs.callPackage /mnt/data1/time2/time/2023/07/06/nixpkgs/pkgs/by-name/al/albyhub/package.nix { };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify no absolute callPackage path remains, and default package is exposed.
rg -n 'callPackage\s+/' flake.nix
nix flake show . | rg -n 'packages\..*\.default'

Repository: getAlby/hub

Length of output: 242


🏁 Script executed:

# Check the full flake.nix structure to understand nixpkgs setup
cat -n flake.nix

Repository: getAlby/hub

Length of output: 1089


🏁 Script executed:

# Search for albyhub references in the repo
rg -i albyhub --type nix

Repository: getAlby/hub

Length of output: 270


🏁 Script executed:

# Check if package.nix exists at the referenced path (or any package.nix in repo)
fd -name 'package.nix' -type f

Repository: getAlby/hub

Length of output: 285


🌐 Web query:

albyhub nixpkgs package NixOS

💡 Result:

albyhub is already packaged in nixpkgs, so you can install it directly on NixOS as a normal package (there doesn’t appear to be an official services.albyhub.* NixOS module in nixpkgs—just the package). The nixpkgs package description is “Control lightning wallets over nostr”, and MyNixOS currently shows version 1.21.0. (mynixos.com)

Install on NixOS (system-wide)

Add to your configuration (e.g., /etc/nixos/configuration.nix):

{ pkgs, ... }:
{
  environment.systemPackages = [
    pkgs.albyhub
  ];
}

Then:

sudo nixos-rebuild switch

Install ad-hoc (flakes / CLI)

nix shell nixpkgs#albyhub
# or
nix profile install nixpkgs#albyhub

Notes

  • Package homepage is getAlby/hub. (mynixos.com)
  • If you want it to run as a background daemon on NixOS, you’ll typically create your own systemd.services.<name> unit (since nixpkgs doesn’t expose a dedicated services.albyhub module). (mynixos.com)

Citations:


🏁 Script executed:

# Check if there's a local package.nix or similar in the repo
fd package.nix

Repository: getAlby/hub

Length of output: 37


🏁 Script executed:

# Check git history to see if the absolute path was recently added
git log --oneline -20 flake.nix

Repository: getAlby/hub

Length of output: 112


Replace machine-local package path with nixpkgs package reference.

Line 15 hardcodes a host-specific absolute path, which will break on any other machine/CI. Since albyhub is available in nixpkgs, use the upstream package attribute instead.

Portable fix
-        packages.default = pkgs.callPackage /mnt/data1/time2/time/2023/07/06/nixpkgs/pkgs/by-name/al/albyhub/package.nix { };
+        packages.default = pkgs.albyhub;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
packages.default = pkgs.callPackage /mnt/data1/time2/time/2023/07/06/nixpkgs/pkgs/by-name/al/albyhub/package.nix { };
packages.default = pkgs.albyhub;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@flake.nix` at line 15, The package reference uses a machine-local absolute
path (packages.default = pkgs.callPackage /mnt/.../albyhub/package.nix {}) which
is not portable; replace this with the nixpkgs attribute for that package (use
pkgs.albyhub or the appropriate pkgs.<albyhub-attribute> directly) so the flake
uses the upstream nixpkgs package instead of a host-specific file; update the
expression in the packages.default assignment to reference pkgs.albyhub (or the
correct attribute name) and remove the absolute callPackage path.


devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
go
nodejs
yarn
wails
];
};

apps.default = {
type = "app";
program = "${self.packages.${system}.default}/bin/albyhub";
};
}
);
}