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 -> Pkgs
pkgImport = nixpkgs: overlays: system: pkgImport = nixpkgs: overlays: system:
@ -9,22 +9,22 @@
profileMap = map (profile: profile.default); 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: { modules, ... } @ args:
lib.nixosSystem (args // { lib.nixosSystem (args // {
@ -13,7 +15,7 @@ lib.nixosSystem (args // {
(args // { (args // {
modules = moduleList ++ [ 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, ... }: { ({ config, suites, ... }: {

View file

@ -1,4 +1,6 @@
{ lib, userFlakeSelf, ... }: { lib }:
{ userFlakeSelf }:
with lib; with lib;
let 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 let
defaultSystem = "x86_64-linux"; defaultSystem = "x86_64-linux";
@ -36,7 +36,7 @@ let
hardware.enableRedistributableFirmware = lib.mkDefault true; hardware.enableRedistributableFirmware = lib.mkDefault true;
nix.nixPath = [ nix.nixPath = [
"nixpkgs=${nixpkgs}" "nixpkgs=${userFlakeNixOS}"
"nixos-config=${userFlakeSelf}/compat/nixos" "nixos-config=${userFlakeSelf}/compat/nixos"
"home-manager=${userFlakeInputs.home}" "home-manager=${userFlakeInputs.home}"
]; ];
@ -45,7 +45,7 @@ let
nix.registry = { nix.registry = {
devos.flake = userFlakeSelf; devos.flake = userFlakeSelf;
nixos.flake = nixpkgs; nixos.flake = userFlakeNixOS;
override.flake = userFlakeInputs.override; override.flake = userFlakeInputs.override;
}; };

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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