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.
This commit is contained in:
Michael Marquez
2025-08-21 21:18:00 -04:00
parent 6240ed0b1f
commit 6927cf868d
6 changed files with 187 additions and 1 deletions

2
.envrc Normal file
View File

@@ -0,0 +1,2 @@
use flake

34
.gitignore vendored Normal file
View File

@@ -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

102
README.md Normal file
View File

@@ -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]

27
flake.lock generated Normal file
View File

@@ -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
}

21
flake.nix Normal file
View File

@@ -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
];
};
};
}

2
go.mod
View File

@@ -1,3 +1,3 @@
module github.com/MikeyYeahYeah/arr-go-client
go 1.24.1
go 1.23