1
1
forked from extern/flakelight

Propagate nixpkgs.config to NixOS and HM

This commit is contained in:
Archit Gupta 2024-04-06 17:53:50 -07:00
parent c70ffe0ddd
commit fb530e878f
2 changed files with 12 additions and 5 deletions

View File

@ -954,7 +954,8 @@ or a function that takes `moduleArgs` and returns one of the prior.
When using a set of `nixpkgs.lib.nixosSystem` args, NixOS modules will have
access to a `flake` module arg equivalent to `moduleArgs` plus `inputs'` and
`outputs'`. Flakelight's pkgs attributes, `withOverlays`, and `packages` will
also be available in the NixOS instance's pkgs.
also be available in the NixOS instance's pkgs, and Flakelight's
`nixpkgs.config` will apply to it as well.
When using the result of calling `nixpkgs.lib.nixosSystem`, the
`config.propagationModule` value can be used as a NixOS module to gain the above

View File

@ -18,10 +18,16 @@ in
config.propagationModule =
{ lib, pkgs, options, config, ... }:
let inherit (pkgs.stdenv.hostPlatform) system; in {
config = (optionalAttrs (options ? nixpkgs.overlays) {
# Apply flakelight overlays to NixOS/home-manager configurations
nixpkgs.overlays = lib.mkOrder 10
(flakeConfig.withOverlays ++ [ flakeConfig.packageOverlay ]);
config = (optionalAttrs (options ? nixpkgs) {
nixpkgs = (optionalAttrs (options ? nixpkgs.overlays) {
# Forward overlays to NixOS/home-manager configurations
overlays = lib.mkOrder 10
(flakeConfig.withOverlays ++ [ flakeConfig.packageOverlay ]);
})
// (optionalAttrs (options ? nixpkgs.config) {
# Forward nixpkgs.config to NixOS/home-manager configurations
inherit (flakeConfig.nixpkgs) config;
});
})
// (optionalAttrs (options ? home-manager.sharedModules) {
# Propagate module to home-manager when using its nixos module