modularize configs

This commit is contained in:
death916 2025-06-30 14:32:30 -07:00
parent bc5649390f
commit f4565fcd86
16 changed files with 1045 additions and 651 deletions

View file

@ -1,3 +1,4 @@
# ~/Documents/nix-config/flake.nix
{
description = "NixOS configurations for laptop and homelab server";
@ -35,41 +36,11 @@
let
system = "x86_64-linux";
hmLib = home-manager.lib;
primaryUser = "death916";
# pkgs for the 'nixos' (laptop) configuration
pkgsForLaptop = import nixpkgs {
inherit system;
overlays = [
rust-overlay.overlays.default
(import ./overlays/halloy-overlay.nix) # Assuming this overlay is general
];
config = {
# Global config for laptop pkgs
allowUnfree = true; # Example, add if needed
};
};
# pkgs for the 'homelab' configuration (main system pkgs)
pkgsForHomelab = import nixpkgs {
# Using the stable nixpkgs for homelab base
inherit system;
overlays = [
];
config = {
# Global config for homelab pkgs
allowUnfree = true; # Example, add if needed
};
};
# Unstable pkgs specifically for Home Assistant on homelab
pkgsUnstableForHA = import nixpkgs-unstable {
inherit system;
config = {
# Global config for unstable pkgs
allowUnfree = true; # Example
# If HA from unstable needs OpenSSL 1.1
permittedInsecurePackages = [ "openssl-1.1.1w" ];
};
overlays = {
rust = rust-overlay.overlays.default;
halloy = import ./overlays/halloy-overlay.nix;
};
in
@ -77,16 +48,8 @@
nixosConfigurations = {
nixos = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = { inherit inputs system; }; # pkgs will be set via module below
specialArgs = { inherit inputs system overlays primaryUser; }; # pkgs will be set via module below
modules = [
{
nixpkgs.pkgs = pkgsForLaptop; # Use the pkgs definition with overlays for 'nixos'
# nix.settings = {
# substituters = [ "https://cosmic.cachix.org/" ];
# trusted-public-keys = [ "cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE=" ];
# };
}
#: nixos-cosmic.nixosModules.default
./nixos/configuration.nix
home-manager.nixosModules.home-manager
{
@ -104,15 +67,11 @@
inherit system;
# Pass the unstable pkgs set for HA to the homelab configuration
specialArgs = {
inherit inputs system;
unstablePkgsHA = pkgsUnstableForHA;
inherit inputs system overlays primaryUser;
unstablePkgsHA = import nixpkgs-unstable { inherit system; };
};
modules = [
{ nixpkgs.pkgs = pkgsForHomelab; } # Use the base pkgs definition for 'homelab'
# Import the unstable Home Assistant module
./nixos/homelab.nix # Your main homelab config
./nixos/hardware-homelab.nix
# ./modules/home-assistant.nix # Your HA configuration module
home-manager.nixosModules.home-manager
{