basic exteral system module

This commit is contained in:
UGA Innovation Factory
2025-12-16 15:31:47 -05:00
commit 258b6ff934
3 changed files with 150 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
result
result-*
.direnv/

86
README.md Normal file
View File

@@ -0,0 +1,86 @@
# USDA Dashboard System Configuration
External NixOS module configuration for the usda-dash LXC container.
## Overview
This repository contains the system configuration for the USDA Dashboard, managed as an external module for the nixos-systems fleet.
## Usage
### From nixos-systems inventory.nix
Replace the inline configuration with this external module:
```nix
nix-lxc = {
devices = {
"usda-dash" = builtins.fetchGit {
url = "https://github.com/UGA-Innovation-Factory/usda-dash-config";
rev = "abc123..."; # Commit hash for reproducibility
};
};
overrides = {
ugaif.host.useHostPrefix = false;
extraUsers = [ "sv22900" "hdh20267" ]; # Users remain in inventory
};
};
```
### Local Development
For testing changes locally before pushing:
```nix
nix-lxc = {
devices = {
"usda-dash" = /path/to/local/usda-dash-config;
};
};
```
## Configuration Structure
```
usda-dash-config/
├── default.nix # Main module configuration
├── README.md # This file
└── services/ # Optional: Additional service modules
```
## Module Contents
The `default.nix` module includes:
- Base system packages
- SSH configuration
- Service configurations (nginx, postgresql, etc.)
- Firewall rules
- Dashboard-specific settings
## Integration
This module:
- Receives the same flake inputs as nixos-systems (nixpkgs, home-manager, etc.)
- Can use ugaif.* options from the host type module
- Is merged with inventory.nix overrides and extraUsers
- Works with all build methods (LXC, Proxmox, ISO)
## Development Workflow
1. Make changes to `default.nix`
2. Test locally by pointing inventory.nix to local path
3. Build: `nix build .#nixosConfigurations.usda-dash.config.system.build.toplevel`
4. Commit and push changes
5. Update inventory.nix with new commit hash
## Deployment
After updating the configuration:
```bash
cd /path/to/nixos-systems
# Update the rev in inventory.nix
nix flake lock --update-input usda-dash-config # If using flake input
# Or just update the rev in the fetchGit call
./deploy usda-dash
```

61
default.nix Normal file
View File

@@ -0,0 +1,61 @@
{ inputs, ... }:
# ============================================================================
# USDA Dashboard External System Module
# ============================================================================
# External system configuration for usda-dash
# This module can be referenced from nixos-systems/inventory.nix using:
#
# nix-lxc = {
# devices = {
# "usda-dash" = builtins.fetchGit {
# url = "https://github.com/UGA-Innovation-Factory/usda-dash-config";
# rev = "commit-hash";
# };
# };
# };
{
config,
lib,
pkgs,
...
}:
{
# ========== Module Configuration ==========
config = {
# System packages specific to usda-dash
environment.systemPackages = with pkgs; [
# Add any dashboard-specific tools here
git
vim
htop
curl
wget
];
# Enable SSH for remote access
services.openssh = {
enable = true;
settings = {
PermitRootLogin = "no";
PasswordAuthentication = false;
};
};
# Configure users (these will be added via inventory.nix extraUsers)
# ugaif.users.sv22900.enable = true;
# ugaif.users.hdh20267.enable = true;
# Dashboard-specific services could go here
# Example:
# services.nginx.enable = true;
# services.postgresql.enable = true;
# Firewall configuration
# networking.firewall.allowedTCPPorts = [ 80 443 ];
# Any other usda-dash specific configuration
};
}