mirror of
https://github.com/hercules-ci/flake-parts.git
synced 2025-03-31 04:04:55 +00:00
(workingTest (nixpkgsFlakeOverlays [mkFlake perSystem]))
This commit is contained in:
parent
12c40901ba
commit
9c9ec49c19
1 changed files with 18 additions and 17 deletions
|
@ -3,32 +3,33 @@
|
|||
#
|
||||
# Provides a `pkgs` argument in `perSystem`.
|
||||
#
|
||||
# Arguably, this shouldn't be in flake-parts, but in nixpkgs.
|
||||
# Nixpkgs could define its own module that does this, which would be
|
||||
# a more consistent UX, but for now this will do.
|
||||
#
|
||||
# The existence of this module does not mean that other flakes' logic
|
||||
# will be accepted into flake-parts, because it's against the
|
||||
# spirit of Flakes.
|
||||
#
|
||||
topLevel@{ config, options, inputs, lib, flake-parts-lib, ... }:
|
||||
let
|
||||
inherit (flake-parts-lib)
|
||||
mkPerSystemOption
|
||||
;
|
||||
|
||||
in
|
||||
{
|
||||
imports = [ inputs.nixpkgs.flakeModules.default ];
|
||||
|
||||
options = {
|
||||
perSystem = mkPerSystemOption ({ config, system, ... }: {
|
||||
_file = ./nixpkgs.nix;
|
||||
imports = [{ inherit (topLevel.config) nixpkgs; }];
|
||||
options = { inherit (options) nixpkgs; };
|
||||
config = {
|
||||
_module.args.pkgs = lib.mkDefault (config.nixpkgs.allPkgsPerSystem.${system});
|
||||
};
|
||||
});
|
||||
};
|
||||
perSystem = mkPerSystemOption ({ config, system, ... }:
|
||||
let
|
||||
finalOverlay = lib.composeManyExtensions
|
||||
# Last element has priority, so `perSystem` overlays rule
|
||||
(topLevel.config.nixpkgs.overlays ++ config.nixpkgs.overlays);
|
||||
|
||||
finalPkgs = config.nixpkgs.mkPkgsFromArgs
|
||||
{ inherit system; overlays = [ finalOverlay ]; };
|
||||
|
||||
in
|
||||
{
|
||||
imports = [ inputs.nixpkgs.flakeModules.default ];
|
||||
_file = ./nixpkgs.nix;
|
||||
config = {
|
||||
_module.args.pkgs = lib.mkForce finalPkgs;
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue