- Remove Syncthing service and configurations from users/jsutter.nix - Remove OpenVPN configurations and delete users/openvpn/ folder - Move Android development (programs.adb.enable) to desktop/dev.nix - Remove syncthing and adbusers groups from user extraGroups - Organize documentation: move README-hybrid-packages.md to docs/ folder - Keep main README.md in root for project overview Result: Cleaner, more focused user configuration with development features properly organized in desktop modules and documentation structured in dedicated docs folder.
3 KiB
3 KiB
Hybrid Package Management: Stable + Unstable
This NixOS configuration uses a hybrid approach where the system runs on the stable NixOS 24.05 branch but can selectively use packages from the unstable branch when needed.
How It Works
The flake.nix includes both stable and unstable nixpkgs inputs:
inputs = {
nixpkgs.url = "nixpkgs/nixos-24.05"; # Stable base
nixpkgs-unstable.url = "nixpkgs/nixos-unstable"; # Unstable packages
# ... other inputs
};
The unstable packages are made available to all system configurations via specialArgs:
nixosConfigurations = {
framework = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
pkgs-unstable = import nixpkgs-unstable {
system = "x86_64-linux";
config.allowUnfree = true;
};
};
modules = [ /* ... */ ];
};
};
Using Unstable Packages
In System Configuration Files
To use an unstable package in any .nix configuration file:
-
Add
pkgs-unstableto the function parameters:{ config, pkgs, pkgs-unstable, ... }: -
Use the unstable package:
environment.systemPackages = with pkgs; [ # Stable packages firefox git # Unstable packages pkgs-unstable.windsurf pkgs-unstable.some-other-package ];
Example: Current Usage
See desktop/dev.nix for a working example:
{ config, pkgs, pkgs-unstable, ... }:
{
environment.systemPackages = with pkgs; [
# Stable packages
nodejs
rpi-imager
# Unstable packages
pkgs-unstable.windsurf # Use windsurf from unstable
];
}
When to Use Unstable Packages
Use unstable packages when:
- A package is not available in the stable branch
- You need a newer version with specific features or bug fixes
- You're developing with cutting-edge tools
Benefits of This Approach
- System Stability: Core system components use stable, well-tested packages
- Package Availability: Access to the latest packages when needed
- Selective Updates: Choose which packages to get from unstable
- Easy Maintenance: Clear separation between stable and unstable dependencies
Adding New Unstable Packages
To add a new unstable package:
- Find the configuration file where you want to add the package
- Ensure the file accepts
pkgs-unstableparameter - Add
pkgs-unstable.package-nameto the appropriate list - Test with
nixos-rebuild dry-run --flake .#framework - Apply with
nixos-rebuild switch --flake .#framework
Updating Packages
- Stable packages: Updated when you update the flake lock
- Unstable packages: Updated when you run
nix flake update
To update only unstable packages:
nix flake lock --update-input nixpkgs-unstable
Current Unstable Packages in Use
windsurf- Modern code editor (indesktop/dev.nix)
This hybrid approach gives you the stability of NixOS stable with the flexibility to use cutting-edge packages when needed.