add nix flake for development (#1233)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Chores**
- Refined repository settings to auto-exclude environment and
build-related files.
- Introduced a new configuration that streamlines local development and
displays key tool versions on setup.
- **Documentation**
- Expanded contribution guidelines with a dedicated developer resources
section linking to guides on development practices and repository
structure.
- Updated workflow instructions to better assist developers in setting
up their environment, especially for those using Nix.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Pujit Mehrotra
2025-03-18 11:15:57 -04:00
committed by GitHub
parent 8cd7376db0
commit 7aa55883e2
6 changed files with 136 additions and 1 deletions

6
.gitignore vendored
View File

@@ -95,3 +95,9 @@ fb_keepalive
# pnpm store
.pnpm-store
# Nix
result
result-*
.direnv/
.envrc

View File

@@ -58,6 +58,14 @@ We use GitHub to host code, to track issues and feature requests, as well as acc
**Note:** Direct pushes to the main branch are not allowed. All changes must go through the PR process.
## Developer Documentation
For detailed information about development workflows, repository organization, and other technical details, please refer to our developer documentation:
- [Development Guide](api/docs/developer/development.md) - Setup, building, and debugging instructions
- [Development Workflows](api/docs/developer/workflows.md) - Detailed workflows for local development, building, and deployment
- [Repository Organization](api/docs/developer/repo-organization.md) - High-level architecture and project structure
## Bug Reports and Feature Requests
We use GitHub issues to track bugs and feature requests:

View File

@@ -215,3 +215,5 @@ unraid-api --help
5. Test your changes: `pnpm test`
6. Deploy to a development server: `pnpm unraid:deploy <SERVER_IP>`
7. Verify your changes on the Unraid server
If using nix, run `nix develop` from the root of the repo before Step 2.

61
flake.lock generated Normal file
View File

@@ -0,0 +1,61 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1742069588,
"narHash": "sha256-C7jVfohcGzdZRF6DO+ybyG/sqpo1h6bZi9T56sxLy+k=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c80f6a7e10b39afcc1894e02ef785b1ad0b0d7e5",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

47
flake.nix Normal file
View File

@@ -0,0 +1,47 @@
{
description = "Unraid Connect Monorepo Development Environment";
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
{
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
# Node.js and pnpm
nodejs_22
nodePackages.pnpm
# Development tools
just
git
# libvirt (for development)
libvirt
# Docker (for development)
docker
];
shellHook = ''
echo "🚀 Unraid API Development Environment"
echo ""
echo " BASH version: $BASH_VERSION"
echo " Node.js version: $(node --version)"
echo " pnpm version: $(pnpm --version)"
echo " just version: $(just --version)"
echo " git version: $(git --version)"
echo " docker version: $(docker --version)"
echo " libvirt version: $(virsh --version)"
echo ""
'';
};
}
);
}

View File

@@ -130,7 +130,8 @@ Once you have your key pair, add your public SSH key to your Unraid server:
Navigate to Plugins->Install and install the local plugin file that is output to the console.
## View other workflows (local dev, etc.) in the [Developer Workflows](./api/docs/developer/workflows.md)
> [!TIP]
> View other workflows (local dev, etc.) in the [Developer Workflows](./api/docs/developer/workflows.md)
<p align="right">(<a href="#readme-top">back to top</a>)</p>
@@ -158,6 +159,16 @@ See the [open issues](https://github.com/unraid/api/issues) for a full list of p
<!-- CONTRIBUTING -->
## Contributing
For a complete guide on contributing to the project, including our code of conduct and development process, please see our [Contributing Guide](./CONTRIBUTING.md). Please read this before contributing.
### Developer Documentation
For more information about development workflows, repository organization, and other technical details, please refer to the developer documentation inside this repository:
* [Development Guide](./api/docs/developer/development.md) - Setup, building, and debugging instructions
* [Development Workflows](./api/docs/developer/workflows.md) - Detailed workflows for local development, building, and deployment
* [Repository Organization](./api/docs/developer/repo-organization.md) - High-level architecture and project structure
### Work Intent Process
Before starting development work on this project, you must submit a Work Intent and have it approved by a core developer. This helps prevent duplicate work and ensures changes align with the project's goals.