From 6927cf868d06ce014346b192481dfa71ed4661a1 Mon Sep 17 00:00:00 2001 From: Michael Marquez Date: Thu, 21 Aug 2025 21:18:00 -0400 Subject: [PATCH] Add Nix and environment configuration files - Created `.envrc` for Direnv integration to manage Nix environment. - Added `.gitignore` to exclude build artifacts and IDE files. - Introduced `flake.nix` for Nix flake configuration and development shell setup. - Generated `flake.lock` to lock dependencies for the Nix environment. - Updated `go.mod` to specify Go version 1.23. - Added `README.md` with project overview, development instructions, and troubleshooting tips. --- .envrc | 2 ++ .gitignore | 34 ++++++++++++++++++ README.md | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.lock | 27 ++++++++++++++ flake.nix | 21 +++++++++++ go.mod | 2 +- 6 files changed, 187 insertions(+), 1 deletion(-) create mode 100644 .envrc create mode 100644 .gitignore create mode 100644 README.md create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..e3fecb3 --- /dev/null +++ b/.envrc @@ -0,0 +1,2 @@ +use flake + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d510de5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,34 @@ +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Dependency directories (remove the comment below to include it) +# vendor/ + +# Go workspace file +go.work + +# Nix +result +result-* +.direnv/ + +# IDE +.vscode/ +.idea/ +*.swp +*.swo + +# OS +.DS_Store +Thumbs.db + diff --git a/README.md b/README.md new file mode 100644 index 0000000..814a5ef --- /dev/null +++ b/README.md @@ -0,0 +1,102 @@ +# ARR Go Client + +A Go client for ARR applications (Radarr, Sonarr, etc.). + +## Development with Nix + +This project uses Nix for dependency management and development environment setup. + +### Prerequisites + +- [Nix](https://nixos.org/download.html) installed on your system +- [direnv](https://direnv.net/) (optional, for automatic environment activation) + +### Quick Start + +1. **Enter the development shell:** + ```bash + nix develop + ``` + +2. **Run the application:** + ```bash + go run . + ``` + +### Development Commands + +Once in the Nix shell, you can use standard Go commands: + +```bash +# Run the application +go run . + +# Run tests +go test ./... + +# Clean up dependencies +go mod tidy + +# Download dependencies +go mod download + +# Build the binary +go build -o arr-go-client . +``` + +### Available Tools + +The Nix development environment includes: + +- **Go 1.23** - Latest stable Go version available in Nix + +### Project Structure + +``` +arr-go-client/ +├── flake.nix # Nix flake configuration +├── .envrc # Direnv configuration (auto-loads Nix environment) +├── go.mod # Go module file +├── main.go # Main application +├── client.go # Client implementation +├── interfaces.go # Interface definitions +├── types.go # Type definitions +└── radarr.go # Radarr-specific code +``` + +### Troubleshooting + +#### Flake Lock Issues + +If you need to update the flake lock: + +```bash +nix flake update +``` + +#### Experimental Features Disabled + +If you get errors about experimental features being disabled, you can enable them globally: + +1. **Edit your global Nix config:** + ```bash + mkdir -p ~/.config/nix + echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf + ``` + +2. **Or run with explicit experimental features:** + ```bash + nix --extra-experimental-features 'nix-command flakes' develop + ``` + +### Contributing + +1. Fork the repository +2. Create a feature branch +3. Make your changes +4. Test with `nix develop` and `go test ./...` +5. Submit a pull request + +### License + +[Add your license here] diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..f418c37 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1755615617, + "narHash": "sha256-HMwfAJBdrr8wXAkbGhtcby1zGFvs+StOp19xNsbqdOg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "20075955deac2583bb12f07151c2df830ef346b4", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..0281f41 --- /dev/null +++ b/flake.nix @@ -0,0 +1,21 @@ +{ + description = "ARR Go Client - A Go client for ARR applications"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + }; + + outputs = { self, nixpkgs }: + let + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; + in + { + devShells.${system}.default = pkgs.mkShell { + buildInputs = with pkgs; [ + go_1_23 + ]; + }; + }; +} + diff --git a/go.mod b/go.mod index 96e75c5..b4258e8 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/MikeyYeahYeah/arr-go-client -go 1.24.1 +go 1.23