ref: merge dev into lib

This commit is contained in:
David Arnold 2021-04-17 20:35:05 -05:00
parent fb6c6ba4cf
commit 16b3fad559
15 changed files with 46 additions and 47 deletions

View file

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

View file

@ -1,4 +1,4 @@
{ lib, dev, nixpkgs, inputs, userSelf, ... }:
{ lib, nixpkgs, inputs, userSelf, ... }:
{ dir, extern, suites, overrides, multiPkgs, ... }:
let
@ -90,13 +90,13 @@ let
};
};
in
dev.os.devosSystem {
lib.os.devosSystem {
inherit specialArgs;
system = defaultSystem;
modules = modules // { inherit local lib; };
};
hosts = dev.os.recImport
hosts = lib.os.recImport
{
inherit dir;
_import = mkHostConfig;

View file

@ -1,10 +1,10 @@
{ lib, dev, userSelf, ... }:
{ lib, userSelf, ... }:
{ pkgs }:
let
inherit (userSelf) overlay overlays;
packagesNames = lib.attrNames (overlay null null)
++ lib.attrNames (dev.concatAttrs
++ lib.attrNames (lib.concatAttrs
(lib.attrValues
(lib.mapAttrs (_: v: v null null) overlays)
)

View file

@ -1,16 +1,16 @@
{ lib, dev, nixpkgs, userSelf, inputs, ... }:
{ lib, nixpkgs, userSelf, inputs, ... }:
{ extern, overrides }:
(inputs.utils.lib.eachDefaultSystem
(system:
let
overridePkgs = dev.os.pkgImport inputs.override [ ] system;
overridePkgs = lib.os.pkgImport inputs.override [ ] system;
overridesOverlay = overrides.packages;
overlays = [
(final: prev: {
lib = prev.lib.extend (lfinal: lprev: {
inherit dev;
inherit lib;
inherit (lib) nixosSystem;
utils = inputs.utils.lib;
@ -22,6 +22,6 @@
++ extern.overlays
++ (lib.attrValues userSelf.overlays);
in
{ pkgs = dev.os.pkgImport nixpkgs overlays system; }
{ pkgs = lib.os.pkgImport nixpkgs overlays system; }
)
).pkgs

View file

@ -1,4 +1,4 @@
{ lib, dev, ... }:
{ lib, ... }:
let mkProfileAttrs =
/**
@ -16,7 +16,7 @@ let mkProfileAttrs =
let
imports =
let
files = dev.safeReadDir dir;
files = lib.safeReadDir dir;
p = n: v:
v == "directory"

View file

@ -1,8 +1,8 @@
{ lib, dev, ... }:
{ lib, ... }:
{ users, profiles, userProfiles, suites } @ args:
let
inherit (dev) os;
inherit (lib) os;
definedSuites = suites {
inherit (args) users profiles userProfiles;

View file

@ -1,7 +1,7 @@
{ lib, dev, ... }:
{ lib, ... }:
{ dir, _import ? base: import "${dir}/${base}.nix" }:
dev.mapFilterAttrs
lib.mapFilterAttrs
(_: v: v != null)
(n: v:
if n != "default.nix" && lib.hasSuffix ".nix" n && v == "regular"
@ -9,4 +9,4 @@ dev.mapFilterAttrs
let name = lib.removeSuffix ".nix" n; in lib.nameValuePair (name) (_import name)
else
lib.nameValuePair ("") (null))
(dev.safeReadDir dir)
(lib.safeReadDir dir)

View file

@ -21,7 +21,6 @@
let callLibs = file: import file
({
lib = final;
dev = final;
inputs = inputs;
} // inputs);
in

View file

@ -1,8 +1,8 @@
{ lib, dev, ... }:
{ lib, ... }:
{
pathsIn = dir:
let
fullPath = name: "${toString dir}/${name}";
in
map fullPath (lib.attrNames (dev.safeReadDir dir));
map fullPath (lib.attrNames (lib.safeReadDir dir));
}

View file

@ -1,4 +1,4 @@
{ dev, inputs, ... }:
{ lib, inputs, ... }:
let
inherit (dev) os;
inherit (inputs) utils deploy;
@ -9,7 +9,7 @@ let
userSelf = self;
cfg = (dev.mkFlake.evalOldArgs { inherit args; }).config;
cfg = (lib.mkFlake.evalOldArgs { inherit args; }).config;
multiPkgs = os.mkPkgs { inherit (cfg) extern overrides; };
@ -35,7 +35,7 @@ let
systemOutputs = utils.lib.eachDefaultSystem (system:
let
pkgs = multiPkgs.${system};
pkgs-lib = dev.pkgs-lib.${system};
pkgs-lib = lib.pkgs-lib.${system};
# all packages that are defined in ./pkgs
legacyPackages = os.mkPackages { inherit pkgs; };
in
@ -47,7 +47,7 @@ let
};
inherit legacyPackages;
packages = dev.filterPackages system legacyPackages;
packages = lib.filterPackages system legacyPackages;
devShell = pkgs-lib.shell;
});

View file

@ -1,10 +1,10 @@
{ userSelf, dev, lib, inputs, utils, ... }:
{ userSelf, lib, inputs, utils, ... }:
{ args }:
let
argOpts = with lib; { config, ... }:
let
inherit (dev) os;
inherit (lib) os;
inherit (config) self;
@ -146,7 +146,7 @@ let
modules = mkOption {
type = pathTo (listOf moduleType);
default = [ ];
apply = dev.pathsToImportedAttrs;
apply = lib.pathsToImportedAttrs;
description = ''
list of modules to include in confgurations and export in '${name}Modules' output
'';
@ -154,7 +154,7 @@ let
externalModules = mkOption {
type = pathTo (listOf moduleType);
default = [ ];
apply = dev.pathsToImportedAttrs;
apply = lib.pathsToImportedAttrs;
description = ''
list of modules to include in confguration but these are not exported to the '${name}Modules' output
'';

View file

@ -1,10 +1,10 @@
{ userSelf, dev, lib, inputs, ... }:
{ userSelf, lib, inputs, ... }:
{ args }:
let
argOpts = with lib; { config, options, ... }:
let
inherit (dev) os;
inherit (lib) os;
inherit (config) self;
@ -48,7 +48,7 @@ let
modules = mkOption {
type = listOf moduleType;
default = [ ];
apply = dev.pathsToImportedAttrs;
apply = lib.pathsToImportedAttrs;
description = ''
list of modules to include in confgurations and export in 'nixosModules' output
'';
@ -56,7 +56,7 @@ let
userModules = mkOption {
type = listOf moduleType;
default = [ ];
apply = dev.pathsToImportedAttrs;
apply = lib.pathsToImportedAttrs;
description = ''
list of modules to include in home-manager configurations and export in
'homeModules' output
@ -133,7 +133,7 @@ let
type = path;
default = "${userSelf}/overlays";
defaultText = "\${userSelf}/overlays";
apply = x: dev.pathsToImportedAttrs (dev.pathsIn (toString x));
apply = x: lib.pathsToImportedAttrs (lib.pathsIn (toString x));
description = ''
path to folder containing overlays which will be applied to pkgs and exported in
the 'overlays' output

View file

@ -1,4 +1,4 @@
args@{ lib, dev, utils, nixpkgs, ... }:
args@{ lib, utils, nixpkgs, ... }:
lib.genAttrs utils.lib.defaultSystems (system:
lib.makeExtensible (final:
let

View file

@ -1,4 +1,4 @@
{ lib, dev, inputs, system, nixpkgs, ... }:
{ lib, inputs, system, nixpkgs, ... }:
let
overlays = [
inputs.devshell.overlay
@ -8,7 +8,7 @@ let
})
];
pkgs = dev.os.pkgImport nixpkgs overlays system;
pkgs = lib.os.pkgImport nixpkgs overlays system;
flk = pkgs.callPackage ./flk.nix { };

View file

@ -1,5 +1,5 @@
{ pkgs, lib, dev, ... }:
with dev;
{ pkgs, lib, ... }:
with lib;
lib.runTests {
testConcatAttrs = {
expr = concatAttrs [{ foo = 1; } { bar = 2; } { baz = 3; }];