regressed lab-tool to 0.10-dev to make it again

This commit is contained in:
Geir Okkenhaug Jerstad 2025-07-04 19:32:22 +02:00
parent 2fdf7e4b0c
commit b8c5cf2fb4
4 changed files with 30 additions and 100 deletions

View file

@ -95,6 +95,9 @@
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
}; };
# Set the default package to lab
defaultPackage.${system} = self.packages.${system}.lab;
# Development shells for different projects # Development shells for different projects
devShells.${system} = { devShells.${system} = {
default = nixpkgs.legacyPackages.${system}.mkShell { default = nixpkgs.legacyPackages.${system}.mkShell {

View file

@ -2,7 +2,7 @@
# Custom packages for Home-lab infrastructure # Custom packages for Home-lab infrastructure
# Home-lab administration command-line tool # Home-lab administration command-line tool
lab = pkgs.callPackage ./lab-tool {}; lab = (pkgs.callPackage ./lab-tools.nix {}).lab;
# Claude Task Master AI package # Claude Task Master AI package
claude-task-master-ai = pkgs.callPackage ./claude-task-master-ai.nix {}; claude-task-master-ai = pkgs.callPackage ./claude-task-master-ai.nix {};

View file

@ -67,6 +67,9 @@
# Packages # Packages
packages = { packages = {
# Lab tool package
lab = (pkgs.callPackage ./lab-tools.nix {}).lab;
# Guile MCP Server package # Guile MCP Server package
guile-mcp-server = pkgs.stdenv.mkDerivation { guile-mcp-server = pkgs.stdenv.mkDerivation {
pname = "guile-mcp-server"; pname = "guile-mcp-server";

View file

@ -3,53 +3,44 @@
stdenv, stdenv,
guile, guile,
makeWrapper, makeWrapper,
writeShellScriptBin,
}: let }: let
# Lab Tool - K.I.S.S Refactored Implementation # Lab - K.I.S.S Refactored Implementation
lab-tool = stdenv.mkDerivation { lab = stdenv.mkDerivation {
pname = "lab-tool"; pname = "lab";
version = "2.0.0-kiss"; version = "0.1.0-dev";
src = ./lab-tool; src = ./lab-tool;
nativeBuildInputs = [makeWrapper]; nativeBuildInputs = [makeWrapper];
buildInputs = [ buildInputs = [guile];
guile
# Runtime dependencies for auto-update functionality will be in PATH
];
installPhase = '' installPhase = ''
mkdir -p $out/share/lab-tool set -e
cp -r . $out/share/lab-tool/ echo "Current directory: $(pwd)"
ls -l
mkdir -p $out/share/lab
cp -r core main deploy $out/share/lab/
cp main.scm $out/share/lab/
echo "After copy:"
find $out/share/lab
mkdir -p $out/bin mkdir -p $out/bin
cat > $out/bin/lab << EOF
# Create the main lab tool executable
cat > $out/bin/lab << 'EOF'
#!/usr/bin/env bash #!/usr/bin/env bash
export GUILE_LOAD_PATH="$out/share/lab-tool:$GUILE_LOAD_PATH" export GUILE_LOAD_PATH="$out/share/lab:\$GUILE_LOAD_PATH"
exec ${guile}/bin/guile "$out/share/lab-tool/main.scm" "$@" exec ${guile}/bin/guile "$out/share/lab/main.scm" "\$@"
EOF EOF
chmod +x $out/bin/lab chmod +x $out/bin/lab
# Create aliases for convenience
ln -s $out/bin/lab $out/bin/lab-tool
''; '';
meta = with lib; { meta = with lib; {
description = "K.I.S.S refactored home lab management tool"; description = "Minimal, functional home lab management tool in Guile Scheme";
longDescription = '' longDescription = ''
A modular, functional home lab management tool following K.I.S.S principles: A modular, functional home lab management tool following K.I.S.S principles:
- Modular: Each module has single responsibility
- Functional: Pure functions separated from side effects
- Small: Individual modules under 50 lines
- Simple: One function does one thing well
Features:
- Infrastructure status checking - Infrastructure status checking
- Machine management and deployment - Machine management and deployment
- SSH connectivity testing - SSH connectivity testing and extension
- Modular architecture for easy extension - Pure functions separated from side effects
- Simple, single-responsibility modules
''; '';
homepage = "https://github.com/geirda/Home-lab"; homepage = "https://github.com/geirda/Home-lab";
license = licenses.mit; license = licenses.mit;
@ -57,75 +48,8 @@
platforms = platforms.unix; platforms = platforms.unix;
}; };
}; };
# MCP Server placeholder (for future implementation)
mcp-server = writeShellScriptBin "mcp-server" ''
echo "MCP Server - Coming Soon!"
echo "This will provide Model Context Protocol integration"
exit 0
'';
# RAG System placeholder (for future implementation)
rag-system = writeShellScriptBin "rag-system" ''
echo "RAG System - Coming Soon!"
echo "This will provide Retrieval-Augmented Generation capabilities"
exit 0
'';
in { in {
# Export individual tools # Export only the lab tool
inherit lab-tool mcp-server rag-system; lab = lab;
default = lab;
# Main package combines all tools
default = stdenv.mkDerivation {
pname = "home-lab-tools";
version = "2.0.0-kiss";
dontUnpack = true;
nativeBuildInputs = [makeWrapper];
installPhase = ''
mkdir -p $out/bin
# Link all tools
ln -s ${lab-tool}/bin/* $out/bin/
ln -s ${mcp-server}/bin/* $out/bin/
ln -s ${rag-system}/bin/* $out/bin/
# Create main entry point that shows all available tools
cat > $out/bin/home-lab-tools << 'EOF'
#!/usr/bin/env bash
echo "🏠 Home Lab Tools - K.I.S.S Edition"
echo "=================================="
echo ""
echo "Available Tools:"
echo " lab - Lab management tool (K.I.S.S refactored)"
echo " mcp-server - Model Context Protocol server"
echo " rag-system - Retrieval-Augmented Generation system"
echo ""
echo "Examples:"
echo " lab status # Show infrastructure status"
echo " lab machines # List all machines"
echo " lab deploy machine # Deploy to machine"
echo " lab auto-update # Automatic system update"
echo " mcp-server # Start MCP server"
echo " rag-system # Start RAG system"
echo ""
echo "For detailed help: lab help"
EOF
chmod +x $out/bin/home-lab-tools
'';
meta = with lib; {
description = "Complete home lab tooling suite";
longDescription = ''
Comprehensive home lab management tooling following K.I.S.S principles.
Includes lab tool, MCP server, and RAG system components.
'';
homepage = "https://github.com/geirda/Home-lab";
license = licenses.mit;
maintainers = ["geir"];
platforms = platforms.unix;
};
};
} }