Skip to content

Commit 0943c93

Browse files
authored
Merge pull request #153 from f0rdprefect/master
Add flake support to make this easy to consume for nixos and nix enabled devices
2 parents f955351 + eb4f5c9 commit 0943c93

File tree

3 files changed

+130
-0
lines changed

3 files changed

+130
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,20 @@ then execute this command `sudo dnf install p7zip p7zip-plugins adb curl newt pv
4949
2. [Download](https://github.com/mrrfv/open-android-backup/releases/latest) the Open Android Backup bundle, which contains the script and companion app in one package. You can also grab an experimental build (heavily discouraged) by clicking on [this link](https://github.com/mrrfv/open-android-backup/archive/refs/heads/master.zip) or cloning.
5050
3. Enable [developer options](https://developer.android.com/studio/debug/dev-options#enable) and USB debugging on your device, then run `backup.sh` in a terminal.
5151

52+
**Alternative: Using Nix (recommended for Nix/NixOS users)**
53+
54+
If you use Nix or NixOS, you can get a complete environment with all dependencies:
55+
56+
```bash
57+
# Enter the development shell
58+
# Retry with --extra-experimental-features 'nix-command flakes' if this doesn't work
59+
nix develop
60+
# Then run the backup script
61+
./backup.sh
62+
```
63+
64+
This will automatically provide all required dependencies without affecting your system packages.
65+
5266
### macOS
5367

5468
Warning: macOS testing is limited, please report any issues you encounter.

flake.lock

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
description = "Open Android Backup development environment";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
};
8+
9+
outputs = { self, nixpkgs, flake-utils }:
10+
flake-utils.lib.eachDefaultSystem (system:
11+
let
12+
pkgs = nixpkgs.legacyPackages.${system};
13+
in
14+
{
15+
devShells.default = pkgs.mkShell {
16+
buildInputs = with pkgs; [
17+
# Core dependencies for open-android-backup
18+
p7zip # For compression/decompression
19+
android-tools # Provides adb
20+
curl # For downloading files
21+
newt # Provides whiptail for dialogs
22+
pv # Progress viewer
23+
bc # Calculator for shell scripts
24+
srm # Secure file deletion (replaces secure-delete)
25+
zenity # GUI dialogs
26+
gnutar # GNU tar
27+
coreutils # Essential utilities (ls, cp, mv, etc.)
28+
findutils # find, xargs, etc.
29+
dos2unix # Convert line endings
30+
31+
# Additional useful tools
32+
bash # Ensure we have bash
33+
wget # Alternative to curl
34+
unzip # For extracting archives
35+
file # File type detection
36+
which # Locate commands
37+
38+
# Development tools (optional but useful)
39+
git # Version control
40+
tree # Directory structure visualization
41+
];
42+
43+
shellHook = ''
44+
echo "Open Android Backup Nix shell ready."
45+
echo ""
46+
echo "Usage:"
47+
echo " 1. Enable USB debugging on your Android device"
48+
echo " 2. Run: ./backup.sh"
49+
echo ""
50+
echo "For automation options and advanced usage, see README.md"
51+
'';
52+
};
53+
}
54+
);
55+
}

0 commit comments

Comments
 (0)