diff --git a/README.md b/README.md index 7e84fc6..acb760e 100644 --- a/README.md +++ b/README.md @@ -146,6 +146,14 @@ have more complex tasks to accomplish within the flake. # Whether the nixpkgs used in lite-config should also be set as the `pkgs` arg for # the perSystem module. setPerSystemPkgs = true; + # Useful for using a pinned nixpkgs for a particular platform. To + # workaround broken packages in the latest commit. + perSystemOverrides = { + "aarch64-darwin" = { + nixpkgs = inputs.nixpkgs-darwin; + config = {}; + }; + }; }; # The home-manager flake to use. diff --git a/flake-module.nix b/flake-module.nix index 120691f..f5a1226 100644 --- a/flake-module.nix +++ b/flake-module.nix @@ -53,6 +53,44 @@ toplevel @ { { allowUnfree = true; } ''; }; + perSystemOverrides = mkOption { + default = {}; + type = types.attrsOf (types.submodule { + options = { + nixpkgs = mkOption { + type = types.path; + default = inputs.nixpkgs; + defaultText = literalExpression "inputs.nixpkgs"; + description = '' + The nixpkgs flake to use for this system. + ''; + }; + config = mkOption { + default = {}; + type = types.attrs; + description = '' + The configuration of the Nix Packages collection for this system. + ''; + example = + literalExpression + '' + { allowUnfree = true; } + ''; + }; + }; + }); + description = '' + Overrides for the nixpkgs used in a particular system. Useful for choosing + a pinned nixpkgs commit for some platform. + ''; + example = + literalExpression + '' + { + "aarch64-darwin" = inputs.nixpkgs-darwin; + } + ''; + }; overlays = mkOption { default = []; type = types.listOf overlayType; @@ -343,7 +381,8 @@ in { }: { _file = ./.; config = let - selectedPkgs = import cfg.nixpkgs.nixpkgs { + systemNixpkgs = cfg.nixpkgs.perSystemOverrides.${system} or cfg.nixpkgs; + selectedPkgs = import systemNixpkgs.nixpkgs { inherit system; overlays = cfg.nixpkgs.overlays; config = cfg.nixpkgs.config;