Skip to content

Commit 32ef3eb

Browse files
committed
refactor: isolate custom flake inputs to minimize upstream divergence
Implements best-practice pattern for managing custom package sources: - Main nixpkgs now uses upstream NixOS/nixpkgs/nixos-unstable - nixpkgs-docling isolated for ONLY docling-parse fix (temporary until PR #184 merges) - home-manager-wsl isolated for WSL hosts (windows-terminal feature WIP) - Upstream home-manager for non-WSL hosts (mbp, potato, nixvim-minimal) Benefits: - 99% of packages now from upstream (easier debugging, faster updates) - Custom fixes isolated to specific packages via overlays - Clear migration path when upstream PRs merge - Reduced system closure duplication Technical changes: - flake.nix: Split nixpkgs into upstream + nixpkgs-docling - overlays/default.nix: Import nixpkgs-docling only for docling package - flake-modules/overlays.nix: Pass inputs to overlay function - flake-modules/home-configurations.nix: WSL hosts use home-manager-wsl Note: Using local path for home-manager-wsl until branch is pushed to GitHub Related to docling-parse PR: docling-project/docling-parse#184
1 parent 654805f commit 32ef3eb

4 files changed

Lines changed: 39 additions & 22 deletions

File tree

flake-modules/home-configurations.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
);
3939

4040
"tim@thinky-ubuntu" = withSystem "x86_64-linux" ({ pkgs, ... }:
41-
inputs.home-manager.lib.homeManagerConfiguration {
41+
inputs.home-manager-wsl.lib.homeManagerConfiguration {
4242
inherit pkgs;
4343
modules = [
4444
{ nixpkgs.config.allowUnfree = true; }
@@ -78,7 +78,7 @@
7878
);
7979

8080
"tim@pa161878-nixos" = withSystem "x86_64-linux" ({ pkgs, ... }:
81-
inputs.home-manager.lib.homeManagerConfiguration {
81+
inputs.home-manager-wsl.lib.homeManagerConfiguration {
8282
inherit pkgs;
8383
modules = [
8484
{ nixpkgs.config.allowUnfree = true; }
@@ -169,7 +169,7 @@
169169
);
170170

171171
"tim@thinky-nixos" = withSystem "x86_64-linux" ({ pkgs, ... }:
172-
inputs.home-manager.lib.homeManagerConfiguration {
172+
inputs.home-manager-wsl.lib.homeManagerConfiguration {
173173
inherit pkgs;
174174
modules = [
175175
{ nixpkgs.config.allowUnfree = true; }

flake-modules/overlays.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
flake = {
1010
# Export overlays for other flakes to use
1111
overlays = {
12-
default = import ../overlays;
12+
default = import ../overlays { inherit inputs; };
1313
};
1414
};
1515
}

flake.nix

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22
description = "Unified Nix configuration for all systems";
33

44
inputs = {
5-
# nixpkgs.url = "github:timblaktu/nixpkgs/writers-auto-detection";
6-
nixpkgs.url = "github:timblaktu/nixpkgs/docling-parse-fix"; # Includes docling-parse PR #184 fix
7-
# nixpkgs.url = "git+file:///home/tim/src/nixpkgs?ref=docling-parse-fix&shallow=true"; # For local dev
5+
# MAIN NIXPKGS - upstream, used for 99% of packages
6+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
87
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.11";
9-
# nixpkgs-unstable for nixvim (has postgres-lsp and other recent packages)
8+
9+
# CUSTOM NIXPKGS - isolated inputs for packages needing specific fixes
10+
# Temporary: Only for docling-parse until PR #184 merges upstream
11+
nixpkgs-docling.url = "github:timblaktu/nixpkgs/docling-parse-fix";
12+
# nixpkgs-docling.url = "git+file:///home/tim/src/nixpkgs?ref=docling-parse-fix&shallow=true"; # For local dev
13+
14+
# For nixvim (needs postgres-lsp and other recent packages)
1015
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
1116

1217
# flake-parts for modular flake organization
@@ -19,18 +24,20 @@
1924
inputs.nixpkgs.follows = "nixpkgs-unstable";
2025
};
2126

22-
home-manager = {
23-
# url = "github:timblaktu/home-manager/wsl-windows-terminal";
24-
url = "git+file:///home/tim/src/home-manager?ref=wsl-windows-terminal";
25-
inputs.nixpkgs.follows = "nixpkgs";
26-
};
27+
# HOME-MANAGER - upstream for non-WSL hosts
28+
home-manager.url = "github:nix-community/home-manager";
29+
home-manager.inputs.nixpkgs.follows = "nixpkgs";
2730

28-
nixos-wsl = {
29-
url = "github:timblaktu/NixOS-WSL/plugin-shim-integration";
30-
# url = "github:timblaktu/NixOS-WSL/feature/bare-mount-support";
31-
# url = "git+file:///home/tim/src/NixOS-WSL";
32-
inputs.nixpkgs.follows = "nixpkgs";
33-
};
31+
# HOME-MANAGER CUSTOM - WSL-specific fork for windows-terminal feature (WIP)
32+
# home-manager-wsl.url = "github:timblaktu/home-manager/wsl-windows-terminal"; # Use after pushing branch
33+
home-manager-wsl.url = "git+file:///home/tim/src/home-manager?ref=wsl-windows-terminal"; # For local dev
34+
home-manager-wsl.inputs.nixpkgs.follows = "nixpkgs";
35+
36+
# NIXOS-WSL - custom fork for plugin-shim-integration (WIP)
37+
nixos-wsl.url = "github:timblaktu/NixOS-WSL/plugin-shim-integration";
38+
# nixos-wsl.url = "github:timblaktu/NixOS-WSL/feature/bare-mount-support";
39+
# nixos-wsl.url = "git+file:///home/tim/src/NixOS-WSL"; # For local dev
40+
nixos-wsl.inputs.nixpkgs.follows = "nixpkgs";
3441

3542
darwin = {
3643
url = "github:lnl7/nix-darwin";
@@ -50,7 +57,6 @@
5057
inputs.nixpkgs.follows = "nixpkgs";
5158
};
5259

53-
5460
nix-writers.url = "github:timblaktu/nix-writers";
5561
};
5662

@@ -76,12 +82,12 @@
7682

7783
# Per-system configuration
7884
perSystem = { config, self', inputs', pkgs, system, ... }: {
79-
# Configure nixpkgs for this system
85+
# Configure nixpkgs for this system (now uses upstream nixpkgs)
8086
_module.args.pkgs = import inputs.nixpkgs {
8187
inherit system;
8288
config.allowUnfree = true;
8389
overlays = [
84-
(import ./overlays)
90+
(import ./overlays { inherit inputs; })
8591
];
8692
};
8793
};

overlays/default.nix

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
# Overlays for the Nix configuration
2+
{ inputs }:
23
final: prev:
34
let
45
customPkgs = import ../pkgs { pkgs = prev; };
6+
7+
# Import nixpkgs-docling ONLY for docling-parse fix (isolated)
8+
# This ensures only docling packages use the custom fork
9+
pkgsDocling = import inputs.nixpkgs-docling {
10+
inherit (prev) system;
11+
config.allowUnfree = true;
12+
};
513
in
614
{
715
# Custom packages and overrides go here
816
markitdown = customPkgs.markitdown;
917
marker-pdf = customPkgs.marker-pdf;
1018

19+
# ISOLATED: docling from custom nixpkgs (temporary until PR #184 merges)
20+
docling = pkgsDocling.docling;
21+
1122
# Fix watchfiles test failure that affects MCP servers
1223
# Fallback: Disable problematic tests while working on version update
1324
pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [

0 commit comments

Comments
 (0)