From 60ebc273c92edae796931649e83bf753e72b3ef4 Mon Sep 17 00:00:00 2001 From: Nicolas Berbiche Date: Wed, 6 Oct 2021 16:32:13 +0200 Subject: [PATCH] nix-darwin,nixos: add osConfig module argument (#2302) Having either argument defined based on the OS is a problem when trying to write generic Nix code. The current workaround is to use accept both and specify a default value for each argument: ``` { config, lib, nixosConfig ? {}, darwinConfig ? {}, ... }: let osConfig = nixosConfig // darwinConfig; in { # Do something with `osConfig` } ``` With this commit, it becomes possible to do the following: ``` { config, lib, osConfig, ... }: { # Do something with `osConfig` } ``` --- nix-darwin/default.nix | 1 + nixos/default.nix | 1 + 2 files changed, 2 insertions(+) diff --git a/nix-darwin/default.nix b/nix-darwin/default.nix index 9e37f3582..5966826ce 100644 --- a/nix-darwin/default.nix +++ b/nix-darwin/default.nix @@ -12,6 +12,7 @@ let specialArgs = { lib = extendedLib; darwinConfig = config; + osConfig = config; } // cfg.extraSpecialArgs; modules = [ ({ name, ... }: { diff --git a/nixos/default.nix b/nixos/default.nix index ef51ac280..55016111d 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -12,6 +12,7 @@ let specialArgs = { lib = extendedLib; nixosConfig = config; + osConfig = config; modulesPath = ../modules; } // cfg.extraSpecialArgs; modules = [