use: makeExtensible

This commit is contained in:
David Arnold 2021-04-18 21:45:08 -05:00
parent be924bcb27
commit 40acfd13e3
11 changed files with 57 additions and 51 deletions

View File

@ -1,4 +1,4 @@
{ lib }:
{ lib, utils }:
{
# pkgImport :: Nixpkgs -> Overlays -> System -> Pkgs
pkgImport = nixpkgs: overlays: system:
@ -9,22 +9,22 @@
profileMap = map (profile: profile.default);
mkNodes = lib.callLibs ./mkNodes.nix;
mkNodes = import ./mkNodes.nix { inherit lib; };
mkHosts = lib.callLibs ./mkHosts.nix;
mkHosts = import ./mkHosts.nix { inherit lib; };
mkSuites = lib.callLibs ./mkSuites.nix;
mkSuites = import ./mkSuites.nix { inherit lib; };
mkProfileAttrs = lib.callLibs ./mkProfileAttrs.nix;
mkProfileAttrs = import ./mkProfileAttrs.nix { inherit lib; };
mkPkgs = lib.callLibs ./mkPkgs.nix;
mkPkgs = import ./mkPkgs.nix { inherit lib utils; };
recImport = lib.callLibs ./recImport.nix;
recImport = import ./recImport.nix { inherit lib; };
devosSystem = lib.callLibs ./devosSystem.nix;
devosSystem = import ./devosSystem.nix { inherit lib; };
mkHomeConfigurations = lib.callLibs ./mkHomeConfigurations.nix;
mkHomeConfigurations = import ./mkHomeConfigurations.nix { inherit lib; };
mkPackages = lib.callLibs ./mkPackages.nix;
mkPackages = import ./mkPackages.nix { inherit lib; };
}

View File

@ -1,4 +1,6 @@
{ lib, nixpkgs, userFlakeSelf, userFlakeInputs, ... }:
{ lib }:
{ userFlakeNixos, userFlakeSelf, userFlakeInputs }:
{ modules, ... } @ args:
lib.nixosSystem (args // {
@ -13,7 +15,7 @@ lib.nixosSystem (args // {
(args // {
modules = moduleList ++ [
"${nixpkgs}/${modpath}/installer/cd-dvd/installation-cd-minimal-new-kernel.nix"
"${userFlakeNixos}/${modpath}/installer/cd-dvd/installation-cd-minimal-new-kernel.nix"
({ config, suites, ... }: {

View File

@ -1,4 +1,6 @@
{ lib, userFlakeSelf, ... }:
{ lib }:
{ userFlakeSelf }:
with lib;
let

View File

@ -1,6 +1,6 @@
{ lib, nixpkgs, userFlakeInputs, userFlakeSelf, ... }:
{ lib }:
{ dir, extern, suites, overrides, multiPkgs, ... }:
{ dir, extern, suites, overrides, multiPkgs, userFlakeNixOS, userFlakeInputs, userFlakeSelf }:
let
defaultSystem = "x86_64-linux";
@ -36,7 +36,7 @@ let
hardware.enableRedistributableFirmware = lib.mkDefault true;
nix.nixPath = [
"nixpkgs=${nixpkgs}"
"nixpkgs=${userFlakeNixOS}"
"nixos-config=${userFlakeSelf}/compat/nixos"
"home-manager=${userFlakeInputs.home}"
];
@ -45,7 +45,7 @@ let
nix.registry = {
devos.flake = userFlakeSelf;
nixos.flake = nixpkgs;
nixos.flake = userFlakeNixOS;
override.flake = userFlakeInputs.override;
};

View File

@ -1,4 +1,4 @@
{ lib, ... }:
{ lib }:
/**
Synopsis: mkNodes _nixosConfigurations_

View File

@ -1,4 +1,6 @@
{ lib, userFlakeSelf, ... }:
{ lib }:
{ userFlakeSelf }:
{ pkgs }:
let

View File

@ -1,6 +1,6 @@
{ lib, nixpkgs, userFlakeSelf, utils, userFlakeInputs, ... }:
{ lib, utils }:
{ extern, overrides }:
{ extern, overrides, userFlakeNixOS, userFlakeSelf, userFlakeInputs }:
(utils.lib.eachDefaultSystem
(system:
let
@ -20,6 +20,6 @@
++ extern.overlays
++ (lib.attrValues userFlakeSelf.overlays);
in
{ pkgs = lib.os.pkgImport nixpkgs overlays system; }
{ pkgs = lib.os.pkgImport userFlakeNixOS overlays system; }
)
).pkgs

View File

@ -1,4 +1,4 @@
{ lib, ... }:
{ lib }:
let mkProfileAttrs =
/**

View File

@ -1,4 +1,4 @@
{ lib, ... }:
{ lib }:
{ users, profiles, userProfiles, suites } @ args:
let

View File

@ -1,4 +1,4 @@
{ lib, ... }:
{ lib }:
{ dir, _import ? base: import "${dir}/${base}.nix" }:
lib.mapFilterAttrs

View File

@ -14,24 +14,19 @@
outputs = inputs@{ self, nixpkgs, deploy, devshell, utils, ... }: let
inherit (nixpkgs) lib;
# We work with a combined lib, internally ...
combinedLib = lib.extend (final: prev:
let callLibs = file: import file
({
lib = final;
userFlakeNixos = {};
userFlakeSelf = {};
userFlakeInputs = {}; # TODO: Erm, theese must become proper arguments to mkFlake
} // inputs);
in
with final;
lib = nixpkgs.lib.makeExtensible (self:
let
callLibs = file: import file
({
lib = self;
userFlakeNixos = {};
userFlakeSelf = {};
userFlakeInputs = {}; # TODO: Erm, theese must become proper arguments to mkFlake
} // inputs);
attrs = import ./attrs.nix { lib = prev; };
lists = import ./lists.nix { lib = prev; };
strings = import ./strings.nix { lib = prev; };
attrs = import ./attrs.nix { lib = nixpkgs.lib // self; };
lists = import ./lists.nix { lib = nixpkgs.lib // self; };
strings = import ./strings.nix { lib = nixpkgs.lib // self; };
in
utils.lib
@ -39,9 +34,10 @@
//
{
inherit callLibs;
os = import ./devos { lib = final; };
os = import ./devos {
lib = nixpkgs.lib // self;
inherit utils;
};
mkFlake = {
__functor = callLibs ./mkFlake;
@ -50,12 +46,17 @@
};
pkgs-lib = import ./pkgs-lib {
lib = final;
lib = nixpkgs.lib // self;
inherit nixpkgs deploy devshell;
};
inherit (attrs) mapFilterAttrs genAttrs' safeReadDir
pathsToImportedAttrs concatAttrs filterPackages;
inherit (attrs)
mapFilterAttrs
genAttrs'
safeReadDir
pathsToImportedAttrs
concatAttrs
filterPackages;
inherit (lists) pathsIn;
inherit (strings) rgxToString;
}
@ -65,10 +66,9 @@
{
# ... but don't force that choice onto the user
lib = utils.lib // {
mkFlake = combinedLib.mkFlake;
pkgs-lib = combinedLib.pkgs-lib;
inherit (lib)
mkFlake;
};
}
@ -83,7 +83,7 @@
checks = {
tests = import ./tests {
inherit (nixpkgs') pkgs;
lib = combinedLib;
lib = nixpkgs.lib // lib;
};
};
}