From 9dc47df5ea23ce03bea03a7c742d15b82d4a1a0d Mon Sep 17 00:00:00 2001 From: imxyy_soope_ Date: Mon, 24 Nov 2025 18:04:11 +0800 Subject: [PATCH] flake, overlays: move stable and master overlays to host config Defining the `stable` and `master` package overlays directly in `flake/hosts.nix` allows them to properly inherit `config.nixpkgs.config` from the specific host. --- flake/hosts.nix | 20 ++++++++++++++++++-- overlays/default.nix | 15 +-------------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/flake/hosts.nix b/flake/hosts.nix index 41a7ec9..0e0c744 100644 --- a/flake/hosts.nix +++ b/flake/hosts.nix @@ -9,8 +9,24 @@ }: let vars = import ../vars.nix; - pkgsModule = { - nixpkgs = pkgsParams; + pkgsModule = { config, ... }: { + nixpkgs = lib.mkMerge [ + pkgsParams + { + overlays = [ + (final: _prev: { + stable = import inputs.nixpkgs-stable { + inherit (final.stdenv.hostPlatform) system; + inherit (config.nixpkgs) config; + }; + master = import inputs.nixpkgs-master { + inherit (final.stdenv.hostPlatform) system; + inherit (config.nixpkgs) config; + }; + }) + ]; + } + ]; }; hmModule = { home-manager = { diff --git a/overlays/default.nix b/overlays/default.nix index 875e871..e33cc07 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,16 +1,7 @@ { - inputs, lib, ... }: -let - mkPkgs = type: final: _prev: { - ${type} = import inputs."nixpkgs-${type}" { - system = final.stdenv.hostPlatform.system; - config.allowUnfree = true; - }; - }; -in { flake.overlays = { modifications = @@ -28,9 +19,5 @@ in "LANDLOCK_ACCESS_FS_READ_FILE | LANDLOCK_ACCESS_FS_READ_DIR | LANDLOCK_ACCESS_FS_EXECUTE" ''; }; - } - // - # this allows us to access specific version of nixpkgs - # by `pkgs.unstable`, `pkgs.stable` and `pkgs.master` - lib.genAttrs [ "stable" "unstable" "master" ] mkPkgs; + }; }