diff --git a/default.nix b/default.nix index 2b1516a0..8af7f78f 100644 --- a/default.nix +++ b/default.nix @@ -6,10 +6,8 @@ let packages = { config, lib, pkgs, ... }: { config = { - _module.args.pkgs = import nixpkgs { - inherit system; - inherit (config.nixpkgs) config; - }; + _module.args.pkgs = import nixpkgs config.nixpkgs; + nixpkgs.system = system; }; }; diff --git a/modules/nix/nixpkgs.nix b/modules/nix/nixpkgs.nix index 2b2ce49a..f1998071 100644 --- a/modules/nix/nixpkgs.nix +++ b/modules/nix/nixpkgs.nix @@ -34,11 +34,16 @@ let merge = args: fold (def: mergeConfig def.value) {}; }; + overlayType = mkOptionType { + name = "nixpkgs-overlay"; + description = "nixpkgs overlay"; + check = builtins.isFunction; + merge = lib.mergeOneOption; + }; in { options = { - nixpkgs.config = mkOption { default = {}; example = literalExample @@ -63,6 +68,39 @@ in ''; }; + nixpkgs.overlays = mkOption { + type = types.listOf overlayType; + default = []; + example = literalExample '' + [ (self: super: { + openssh = super.openssh.override { + hpnSupport = true; + withKerberos = true; + kerberos = self.libkrb5; + }; + }; + ) ] + ''; + description = '' + List of overlays to use with the Nix Packages collection. + (For details, see the Nixpkgs documentation.) It allows + you to override packages globally. This is a function that + takes as an argument the <emphasis>original</emphasis> Nixpkgs. + The first argument should be used for finding dependencies, and + the second should be used for overriding recipes. + ''; + }; + + nixpkgs.system = mkOption { + type = types.str; + example = "x86_64-darwin"; + description = '' + Specifies the Nix platform type for which NixOS should be built. + If unset, it defaults to the platform type of your host system. + Specifying this option is useful when doing distributed + multi-platform deployment, or when building virtual machines. + ''; + }; }; config = {