
- Add modular flake-based NixOS configuration - Implement GitOps foundation with CI/CD pipeline - Create comprehensive documentation and branching strategy - Add modular desktop environments (GNOME, Cosmic, Sway) - Configure virtualization stack (Incus, Libvirt, Podman) - Set up development tools and hardware-specific modules - Establish user configuration with literate programming support This commit represents the completion of Phase 1: Flakes Migration with modular configuration, virtualization, and GitOps foundation.
3.3 KiB
3.3 KiB
Packages Directory
This directory contains custom package definitions and overlays for the Home-lab NixOS infrastructure.
Directory Purpose
The packages/
directory is used for:
- Custom package derivations not available in nixpkgs
- Modified versions of existing packages
- Home-lab specific applications and utilities
- Package overlays and customizations
Structure
Custom Packages
my-package/
- Individual package directoriesdefault.nix
- Package collection and exportsflake-module.nix
- Flake integration for packages
Package Categories
applications/
- Custom applications and GUIsscripts/
- Shell scripts and automation toolsconfigs/
- Configuration packages and templatesoverlays/
- Package overlays and modifications
Usage
In Flake Configuration
# flake.nix
{
outputs = { self, nixpkgs, ... }: {
packages.x86_64-linux = import ./packages {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
};
overlays.default = import ./packages/overlays;
};
}
In Machine Configuration
# machine configuration
{
nixpkgs.overlays = [ inputs.self.overlays.default ];
environment.systemPackages = with pkgs; [
# Custom packages from this directory
my-custom-tool
home-lab-scripts
];
}
Package Development
Creating New Package
- Create package directory:
packages/my-package/
- Write
default.nix
with package derivation - Add to
packages/default.nix
exports - Test with
nix build .#my-package
Package Template
{ lib, stdenv, fetchFromGitHub, ... }:
stdenv.mkDerivation rec {
pname = "my-package";
version = "1.0.0";
src = fetchFromGitHub {
owner = "user";
repo = "repo";
rev = "v${version}";
sha256 = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
};
meta = with lib; {
description = "Description of my package";
homepage = "https://github.com/user/repo";
license = licenses.mit;
maintainers = [ "geir" ];
platforms = platforms.linux;
};
}
Overlay Examples
Package Modification
# overlays/default.nix
final: prev: {
# Modify existing package
vim = prev.vim.override {
features = "huge";
};
# Add custom package
home-lab-tools = final.callPackage ../tools { };
}
Home-lab Specific Packages
CongenitalOptimist Packages
- Development environment customizations
- Workstation-specific tools
- Desktop application modifications
sleeper-service Packages
- File server utilities
- Monitoring tools
- Backup scripts
- Network service tools
Best Practices
- Versioning: Pin package versions for reproducibility
- Documentation: Include clear descriptions and usage
- Testing: Test packages across target machines
- Licensing: Respect upstream licenses and attributions
- Maintenance: Keep packages updated and functional
Integration with Modules
Packages can be integrated with NixOS modules:
# modules/development/tools.nix
{ config, pkgs, ... }: {
environment.systemPackages = with pkgs; [
# Reference custom packages
home-lab-dev-tools
custom-editor-config
];
}
Flake Outputs
Custom packages are exported as flake outputs:
packages.x86_64-linux.package-name
overlays.default
apps.x86_64-linux.script-name