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 -> Pkgs
pkgImport = nixpkgs: overlays: system: pkgImport = nixpkgs: overlays: system:
@ -9,22 +9,22 @@
profileMap = map (profile: profile.default); 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, ... }: { dir, extern, suites, overrides, multiPkgs, ... }:
let let
@ -90,13 +90,13 @@ let
}; };
}; };
in in
dev.os.devosSystem { lib.os.devosSystem {
inherit specialArgs; inherit specialArgs;
system = defaultSystem; system = defaultSystem;
modules = modules // { inherit local lib; }; modules = modules // { inherit local lib; };
}; };
hosts = dev.os.recImport hosts = lib.os.recImport
{ {
inherit dir; inherit dir;
_import = mkHostConfig; _import = mkHostConfig;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,8 +1,8 @@
{ lib, dev, ... }: { lib, ... }:
{ {
pathsIn = dir: pathsIn = dir:
let let
fullPath = name: "${toString dir}/${name}"; fullPath = name: "${toString dir}/${name}";
in 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 let
inherit (dev) os; inherit (dev) os;
inherit (inputs) utils deploy; inherit (inputs) utils deploy;
@ -9,7 +9,7 @@ let
userSelf = self; userSelf = self;
cfg = (dev.mkFlake.evalOldArgs { inherit args; }).config; cfg = (lib.mkFlake.evalOldArgs { inherit args; }).config;
multiPkgs = os.mkPkgs { inherit (cfg) extern overrides; }; multiPkgs = os.mkPkgs { inherit (cfg) extern overrides; };
@ -35,7 +35,7 @@ let
systemOutputs = utils.lib.eachDefaultSystem (system: systemOutputs = utils.lib.eachDefaultSystem (system:
let let
pkgs = multiPkgs.${system}; pkgs = multiPkgs.${system};
pkgs-lib = dev.pkgs-lib.${system}; pkgs-lib = lib.pkgs-lib.${system};
# all packages that are defined in ./pkgs # all packages that are defined in ./pkgs
legacyPackages = os.mkPackages { inherit pkgs; }; legacyPackages = os.mkPackages { inherit pkgs; };
in in
@ -47,7 +47,7 @@ let
}; };
inherit legacyPackages; inherit legacyPackages;
packages = dev.filterPackages system legacyPackages; packages = lib.filterPackages system legacyPackages;
devShell = pkgs-lib.shell; devShell = pkgs-lib.shell;
}); });

View File

@ -1,10 +1,10 @@
{ userSelf, dev, lib, inputs, utils, ... }: { userSelf, lib, inputs, utils, ... }:
{ args }: { args }:
let let
argOpts = with lib; { config, ... }: argOpts = with lib; { config, ... }:
let let
inherit (dev) os; inherit (lib) os;
inherit (config) self; inherit (config) self;
@ -146,7 +146,7 @@ let
modules = mkOption { modules = mkOption {
type = pathTo (listOf moduleType); type = pathTo (listOf moduleType);
default = [ ]; default = [ ];
apply = dev.pathsToImportedAttrs; apply = lib.pathsToImportedAttrs;
description = '' description = ''
list of modules to include in confgurations and export in '${name}Modules' output list of modules to include in confgurations and export in '${name}Modules' output
''; '';
@ -154,7 +154,7 @@ let
externalModules = mkOption { externalModules = mkOption {
type = pathTo (listOf moduleType); type = pathTo (listOf moduleType);
default = [ ]; default = [ ];
apply = dev.pathsToImportedAttrs; apply = lib.pathsToImportedAttrs;
description = '' description = ''
list of modules to include in confguration but these are not exported to the '${name}Modules' output 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 }: { args }:
let let
argOpts = with lib; { config, options, ... }: argOpts = with lib; { config, options, ... }:
let let
inherit (dev) os; inherit (lib) os;
inherit (config) self; inherit (config) self;
@ -48,7 +48,7 @@ let
modules = mkOption { modules = mkOption {
type = listOf moduleType; type = listOf moduleType;
default = [ ]; default = [ ];
apply = dev.pathsToImportedAttrs; apply = lib.pathsToImportedAttrs;
description = '' description = ''
list of modules to include in confgurations and export in 'nixosModules' output list of modules to include in confgurations and export in 'nixosModules' output
''; '';
@ -56,7 +56,7 @@ let
userModules = mkOption { userModules = mkOption {
type = listOf moduleType; type = listOf moduleType;
default = [ ]; default = [ ];
apply = dev.pathsToImportedAttrs; apply = lib.pathsToImportedAttrs;
description = '' description = ''
list of modules to include in home-manager configurations and export in list of modules to include in home-manager configurations and export in
'homeModules' output 'homeModules' output
@ -133,7 +133,7 @@ let
type = path; type = path;
default = "${userSelf}/overlays"; default = "${userSelf}/overlays";
defaultText = "\${userSelf}/overlays"; defaultText = "\${userSelf}/overlays";
apply = x: dev.pathsToImportedAttrs (dev.pathsIn (toString x)); apply = x: lib.pathsToImportedAttrs (lib.pathsIn (toString x));
description = '' description = ''
path to folder containing overlays which will be applied to pkgs and exported in path to folder containing overlays which will be applied to pkgs and exported in
the 'overlays' output 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.genAttrs utils.lib.defaultSystems (system:
lib.makeExtensible (final: lib.makeExtensible (final:
let let

View File

@ -1,4 +1,4 @@
{ lib, dev, inputs, system, nixpkgs, ... }: { lib, inputs, system, nixpkgs, ... }:
let let
overlays = [ overlays = [
inputs.devshell.overlay 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 { }; flk = pkgs.callPackage ./flk.nix { };

View File

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