From 16b3fad559b6f44eda5068eb369d1dd83827de7f Mon Sep 17 00:00:00 2001 From: David Arnold Date: Sat, 17 Apr 2021 20:35:05 -0500 Subject: [PATCH] ref: merge dev into lib --- lib/devos/default.nix | 20 ++++++++++---------- lib/devos/mkHosts.nix | 6 +++--- lib/devos/mkPackages.nix | 4 ++-- lib/devos/mkPkgs.nix | 8 ++++---- lib/devos/mkProfileAttrs.nix | 4 ++-- lib/devos/mkSuites.nix | 4 ++-- lib/devos/recImport.nix | 6 +++--- lib/flake.nix | 1 - lib/lists.nix | 4 ++-- lib/mkFlake/default.nix | 8 ++++---- lib/mkFlake/evalArgs.nix | 8 ++++---- lib/mkFlake/evalOldArgs.nix | 10 +++++----- lib/pkgs-lib/default.nix | 2 +- lib/pkgs-lib/shell/default.nix | 4 ++-- lib/pkgs-lib/tests/lib.nix | 4 ++-- 15 files changed, 46 insertions(+), 47 deletions(-) diff --git a/lib/devos/default.nix b/lib/devos/default.nix index 68517251..fb9e990f 100644 --- a/lib/devos/default.nix +++ b/lib/devos/default.nix @@ -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; } diff --git a/lib/devos/mkHosts.nix b/lib/devos/mkHosts.nix index 1bc6bf98..056c4e78 100644 --- a/lib/devos/mkHosts.nix +++ b/lib/devos/mkHosts.nix @@ -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; diff --git a/lib/devos/mkPackages.nix b/lib/devos/mkPackages.nix index 1b3404a1..a9d37bb0 100644 --- a/lib/devos/mkPackages.nix +++ b/lib/devos/mkPackages.nix @@ -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) ) diff --git a/lib/devos/mkPkgs.nix b/lib/devos/mkPkgs.nix index d2d07db1..fda3cad3 100644 --- a/lib/devos/mkPkgs.nix +++ b/lib/devos/mkPkgs.nix @@ -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 diff --git a/lib/devos/mkProfileAttrs.nix b/lib/devos/mkProfileAttrs.nix index d89c6ba2..7168b291 100644 --- a/lib/devos/mkProfileAttrs.nix +++ b/lib/devos/mkProfileAttrs.nix @@ -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" diff --git a/lib/devos/mkSuites.nix b/lib/devos/mkSuites.nix index a3a32944..0a5950bb 100644 --- a/lib/devos/mkSuites.nix +++ b/lib/devos/mkSuites.nix @@ -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; diff --git a/lib/devos/recImport.nix b/lib/devos/recImport.nix index d7f2aa82..e9e5da68 100644 --- a/lib/devos/recImport.nix +++ b/lib/devos/recImport.nix @@ -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) diff --git a/lib/flake.nix b/lib/flake.nix index 25e451ca..75bfb89c 100644 --- a/lib/flake.nix +++ b/lib/flake.nix @@ -21,7 +21,6 @@ let callLibs = file: import file ({ lib = final; - dev = final; inputs = inputs; } // inputs); in diff --git a/lib/lists.nix b/lib/lists.nix index b6530f13..74cf9bd4 100644 --- a/lib/lists.nix +++ b/lib/lists.nix @@ -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)); } diff --git a/lib/mkFlake/default.nix b/lib/mkFlake/default.nix index 6fdca16f..eadb7e4d 100644 --- a/lib/mkFlake/default.nix +++ b/lib/mkFlake/default.nix @@ -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; }); diff --git a/lib/mkFlake/evalArgs.nix b/lib/mkFlake/evalArgs.nix index ad866ea6..9836b25d 100644 --- a/lib/mkFlake/evalArgs.nix +++ b/lib/mkFlake/evalArgs.nix @@ -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 ''; diff --git a/lib/mkFlake/evalOldArgs.nix b/lib/mkFlake/evalOldArgs.nix index f728b480..68a0d5fe 100644 --- a/lib/mkFlake/evalOldArgs.nix +++ b/lib/mkFlake/evalOldArgs.nix @@ -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 diff --git a/lib/pkgs-lib/default.nix b/lib/pkgs-lib/default.nix index cf74b7f8..ae448a45 100644 --- a/lib/pkgs-lib/default.nix +++ b/lib/pkgs-lib/default.nix @@ -1,4 +1,4 @@ -args@{ lib, dev, utils, nixpkgs, ... }: +args@{ lib, utils, nixpkgs, ... }: lib.genAttrs utils.lib.defaultSystems (system: lib.makeExtensible (final: let diff --git a/lib/pkgs-lib/shell/default.nix b/lib/pkgs-lib/shell/default.nix index 6a3e4bf4..e5c2d7ca 100644 --- a/lib/pkgs-lib/shell/default.nix +++ b/lib/pkgs-lib/shell/default.nix @@ -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 { }; diff --git a/lib/pkgs-lib/tests/lib.nix b/lib/pkgs-lib/tests/lib.nix index 68baa9f5..586eac31 100644 --- a/lib/pkgs-lib/tests/lib.nix +++ b/lib/pkgs-lib/tests/lib.nix @@ -1,5 +1,5 @@ -{ pkgs, lib, dev, ... }: -with dev; +{ pkgs, lib, ... }: +with lib; lib.runTests { testConcatAttrs = { expr = concatAttrs [{ foo = 1; } { bar = 2; } { baz = 3; }];