mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-12-23 06:21:30 +03:00
lib: move to /lib from /modules/flake-parts/lib
This commit is contained in:
parent
0ed0a765d6
commit
1f680838ab
@ -47,5 +47,9 @@
|
||||
"x86_64-darwin"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
flake.lib = import ./lib {
|
||||
inherit (inputs.nixpkgs) lib;
|
||||
dream2nix = inputs.self;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -1,13 +1,9 @@
|
||||
{
|
||||
self,
|
||||
lib,
|
||||
inputs,
|
||||
dream2nix,
|
||||
...
|
||||
}: {
|
||||
flake.options.lib = lib.mkOption {
|
||||
type = lib.types.lazyAttrsOf lib.types.raw;
|
||||
};
|
||||
flake.config.lib.importPackages = args @ {
|
||||
}: rec {
|
||||
importPackages = args @ {
|
||||
projectRoot,
|
||||
projectRootFile,
|
||||
packagesDir,
|
||||
@ -28,7 +24,7 @@
|
||||
lib.mapAttrs
|
||||
(
|
||||
module: type:
|
||||
self.lib.evalModules (forwardedArgs
|
||||
evalModules (forwardedArgs
|
||||
// {
|
||||
modules =
|
||||
args.modules
|
||||
@ -45,7 +41,7 @@
|
||||
)
|
||||
(builtins.readDir packagesDirPath);
|
||||
|
||||
flake.config.lib.evalModules = args @ {
|
||||
evalModules = args @ {
|
||||
packageSets,
|
||||
modules,
|
||||
# If set, returns the result coming form nixpkgs.lib.evalModules as is,
|
||||
@ -67,15 +63,16 @@
|
||||
modules =
|
||||
args.modules
|
||||
++ [
|
||||
self.modules.dream2nix.core
|
||||
dream2nix.modules.dream2nix.core
|
||||
];
|
||||
specialArgs =
|
||||
specialArgs
|
||||
// {
|
||||
inherit packageSets;
|
||||
dream2nix.modules.dream2nix = self.modules.dream2nix;
|
||||
dream2nix.overrides = self.overrides;
|
||||
dream2nix.lib.evalModules = self.lib.evalModules;
|
||||
dream2nix.modules.dream2nix = dream2nix.modules.dream2nix;
|
||||
dream2nix.overrides = dream2nix.overrides;
|
||||
dream2nix.lib.evalModules = evalModules;
|
||||
dream2nix.inputs = dream2nix.inputs;
|
||||
};
|
||||
}
|
||||
);
|
@ -1 +0,0 @@
|
||||
../modules/flake-parts/lib/internal
|
@ -9,7 +9,7 @@
|
||||
|
||||
inherit (config.deps) fetchurl;
|
||||
|
||||
nodejsLockUtils = import ../../flake-parts/lib/internal/nodejsLockUtils.nix {inherit lib;};
|
||||
nodejsLockUtils = import ../../../lib/internal/nodejsLockUtils.nix {inherit lib;};
|
||||
|
||||
isLink = plent: plent ? link && plent.link;
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
l = lib // builtins;
|
||||
t = l.types;
|
||||
|
||||
dreamTypes = import ../../flake-parts/lib/types {
|
||||
dreamTypes = import ../../../lib/types {
|
||||
inherit dream2nix lib specialArgs;
|
||||
};
|
||||
|
||||
|
@ -11,31 +11,31 @@
|
||||
sourceRoot = config.mkDerivation.src;
|
||||
|
||||
fetchDreamLockSources =
|
||||
import ../../flake-parts/lib/internal/fetchDreamLockSources.nix
|
||||
import ../../../lib/internal/fetchDreamLockSources.nix
|
||||
{inherit lib;};
|
||||
getDreamLockSource = import ../../flake-parts/lib/internal/getDreamLockSource.nix {inherit lib;};
|
||||
readDreamLock = import ../../flake-parts/lib/internal/readDreamLock.nix {inherit lib;};
|
||||
hashPath = import ../../flake-parts/lib/internal/hashPath.nix {
|
||||
getDreamLockSource = import ../../../lib/internal/getDreamLockSource.nix {inherit lib;};
|
||||
readDreamLock = import ../../../lib/internal/readDreamLock.nix {inherit lib;};
|
||||
hashPath = import ../../../lib/internal/hashPath.nix {
|
||||
inherit lib;
|
||||
inherit (config.deps) runCommandLocal nix;
|
||||
};
|
||||
hashFile = import ../../flake-parts/lib/internal/hashFile.nix {
|
||||
hashFile = import ../../../lib/internal/hashFile.nix {
|
||||
inherit lib;
|
||||
inherit (config.deps) runCommandLocal nix;
|
||||
};
|
||||
|
||||
# fetchers
|
||||
fetchers = {
|
||||
git = import ../../flake-parts/lib/internal/fetchers/git {
|
||||
git = import ../../../lib/internal/fetchers/git {
|
||||
inherit hashPath;
|
||||
inherit (config.deps) fetchgit;
|
||||
};
|
||||
http = import ../../flake-parts/lib/internal/fetchers/http {
|
||||
http = import ../../../lib/internal/fetchers/http {
|
||||
inherit hashFile lib;
|
||||
inherit (config.deps.stdenv) mkDerivation;
|
||||
inherit (config.deps) fetchurl;
|
||||
};
|
||||
crates-io = import ../../flake-parts/lib/internal/fetchers/crates-io {
|
||||
crates-io = import ../../../lib/internal/fetchers/crates-io {
|
||||
inherit hashFile;
|
||||
inherit (config.deps) fetchurl runCommandLocal;
|
||||
};
|
||||
@ -71,7 +71,7 @@
|
||||
defaultPackageVersion
|
||||
;
|
||||
|
||||
toTOML = import ../../flake-parts/lib/internal/toTOML.nix {inherit lib;};
|
||||
toTOML = import ../../../lib/internal/toTOML.nix {inherit lib;};
|
||||
|
||||
utils = import ./utils.nix {
|
||||
inherit dreamLock getSource lib toTOML sourceRoot;
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
common-options = import ../builtins-derivation/derivation-common/options.nix {inherit lib;};
|
||||
|
||||
dreamTypes = import ../../flake-parts/lib/types {
|
||||
dreamTypes = import ../../../lib/types {
|
||||
inherit dream2nix lib specialArgs;
|
||||
};
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
...
|
||||
}: let
|
||||
t = lib.types;
|
||||
dreamTypes = import ../../flake-parts/lib/types {
|
||||
dreamTypes = import ../../../lib/types {
|
||||
inherit dream2nix lib specialArgs;
|
||||
};
|
||||
in {
|
||||
|
@ -8,12 +8,12 @@
|
||||
|
||||
cfg = config.nodejs-granular-v3;
|
||||
|
||||
extractSource = import ../../flake-parts/lib/internal/fetchers/extractSource.nix {
|
||||
extractSource = import ../../../lib/internal/fetchers/extractSource.nix {
|
||||
inherit lib;
|
||||
inherit (config.deps.stdenv) mkDerivation;
|
||||
};
|
||||
|
||||
findCycles = import ../../flake-parts/lib/internal/findCycles.nix {
|
||||
findCycles = import ../../../lib/internal/findCycles.nix {
|
||||
inherit lib;
|
||||
};
|
||||
|
||||
|
@ -9,26 +9,26 @@
|
||||
cfg = config.nodejs-granular;
|
||||
|
||||
fetchDreamLockSources =
|
||||
import ../../flake-parts/lib/internal/fetchDreamLockSources.nix
|
||||
import ../../../lib/internal/fetchDreamLockSources.nix
|
||||
{inherit lib;};
|
||||
getDreamLockSource = import ../../flake-parts/lib/internal/getDreamLockSource.nix {inherit lib;};
|
||||
readDreamLock = import ../../flake-parts/lib/internal/readDreamLock.nix {inherit lib;};
|
||||
hashPath = import ../../flake-parts/lib/internal/hashPath.nix {
|
||||
getDreamLockSource = import ../../../lib/internal/getDreamLockSource.nix {inherit lib;};
|
||||
readDreamLock = import ../../../lib/internal/readDreamLock.nix {inherit lib;};
|
||||
hashPath = import ../../../lib/internal/hashPath.nix {
|
||||
inherit lib;
|
||||
inherit (config.deps) runCommandLocal nix;
|
||||
};
|
||||
hashFile = import ../../flake-parts/lib/internal/hashFile.nix {
|
||||
hashFile = import ../../../lib/internal/hashFile.nix {
|
||||
inherit lib;
|
||||
inherit (config.deps) runCommandLocal nix;
|
||||
};
|
||||
|
||||
# fetchers
|
||||
fetchers = {
|
||||
git = import ../../flake-parts/lib/internal/fetchers/git {
|
||||
git = import ../../../lib/internal/fetchers/git {
|
||||
inherit hashPath;
|
||||
inherit (config.deps) fetchgit;
|
||||
};
|
||||
http = import ../../flake-parts/lib/internal/fetchers/http {
|
||||
http = import ../../../lib/internal/fetchers/http {
|
||||
inherit hashFile lib;
|
||||
inherit (config.deps.stdenv) mkDerivation;
|
||||
inherit (config.deps) fetchurl;
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
inherit (config.deps) fetchurl;
|
||||
|
||||
nodejsLockUtils = import ../../flake-parts/lib/internal/nodejsLockUtils.nix {inherit lib;};
|
||||
nodejsLockUtils = import ../../../lib/internal/nodejsLockUtils.nix {inherit lib;};
|
||||
|
||||
isLink = plent: plent ? link && plent.link;
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
t = l.types;
|
||||
cfg = config.nodejs-package-lock-v3;
|
||||
|
||||
dreamTypes = import ../../flake-parts/lib/types {
|
||||
dreamTypes = import ../../../lib/types {
|
||||
inherit dream2nix lib specialArgs;
|
||||
};
|
||||
|
||||
|
@ -7,10 +7,10 @@
|
||||
l = lib // builtins;
|
||||
cfg = config.nodejs-package-lock;
|
||||
|
||||
nodejsUtils = import ../../flake-parts/lib/internal/nodejsUtils.nix {inherit lib parseSpdxId;};
|
||||
parseSpdxId = import ../../flake-parts/lib/internal/parseSpdxId.nix {inherit lib;};
|
||||
prepareSourceTree = import ../../flake-parts/lib/internal/prepareSourceTree.nix {inherit lib;};
|
||||
simpleTranslate = import ../../flake-parts/lib/internal/simpleTranslate.nix {inherit lib;};
|
||||
nodejsUtils = import ../../../lib/internal/nodejsUtils.nix {inherit lib parseSpdxId;};
|
||||
parseSpdxId = import ../../../lib/internal/parseSpdxId.nix {inherit lib;};
|
||||
prepareSourceTree = import ../../../lib/internal/prepareSourceTree.nix {inherit lib;};
|
||||
simpleTranslate = import ../../../lib/internal/simpleTranslate.nix {inherit lib;};
|
||||
|
||||
translate = import ./translate.nix {
|
||||
inherit lib nodejsUtils parseSpdxId simpleTranslate;
|
||||
|
@ -7,11 +7,11 @@
|
||||
l = lib // builtins;
|
||||
cfg = config.php-composer-lock;
|
||||
|
||||
dreamLockUtils = import ../../flake-parts/lib/internal/dreamLockUtils.nix {inherit lib;};
|
||||
nodejsUtils = import ../../flake-parts/lib/internal/nodejsUtils.nix {inherit lib parseSpdxId;};
|
||||
parseSpdxId = import ../../flake-parts/lib/internal/parseSpdxId.nix {inherit lib;};
|
||||
prepareSourceTree = import ../../flake-parts/lib/internal/prepareSourceTree.nix {inherit lib;};
|
||||
simpleTranslate2 = import ../../flake-parts/lib/internal/simpleTranslate2.nix {inherit lib;};
|
||||
dreamLockUtils = import ../../../lib/internal/dreamLockUtils.nix {inherit lib;};
|
||||
nodejsUtils = import ../../../lib/internal/nodejsUtils.nix {inherit lib parseSpdxId;};
|
||||
parseSpdxId = import ../../../lib/internal/parseSpdxId.nix {inherit lib;};
|
||||
prepareSourceTree = import ../../../lib/internal/prepareSourceTree.nix {inherit lib;};
|
||||
simpleTranslate2 = import ../../../lib/internal/simpleTranslate2.nix {inherit lib;};
|
||||
|
||||
translate = import ./translate.nix {
|
||||
inherit lib dreamLockUtils nodejsUtils parseSpdxId simpleTranslate2;
|
||||
|
@ -17,7 +17,7 @@
|
||||
...
|
||||
}: let
|
||||
inherit
|
||||
(import ../../flake-parts/lib/internal/php-semver.nix {inherit lib;})
|
||||
(import ../../../lib/internal/php-semver.nix {inherit lib;})
|
||||
satisfies
|
||||
multiSatisfies
|
||||
;
|
||||
|
@ -11,22 +11,22 @@
|
||||
dreamLock = config.php-composer-lock.dreamLock;
|
||||
|
||||
fetchDreamLockSources =
|
||||
import ../../flake-parts/lib/internal/fetchDreamLockSources.nix
|
||||
import ../../../lib/internal/fetchDreamLockSources.nix
|
||||
{inherit lib;};
|
||||
getDreamLockSource = import ../../flake-parts/lib/internal/getDreamLockSource.nix {inherit lib;};
|
||||
readDreamLock = import ../../flake-parts/lib/internal/readDreamLock.nix {inherit lib;};
|
||||
hashPath = import ../../flake-parts/lib/internal/hashPath.nix {
|
||||
getDreamLockSource = import ../../../lib/internal/getDreamLockSource.nix {inherit lib;};
|
||||
readDreamLock = import ../../../lib/internal/readDreamLock.nix {inherit lib;};
|
||||
hashPath = import ../../../lib/internal/hashPath.nix {
|
||||
inherit lib;
|
||||
inherit (config.deps) runCommandLocal nix;
|
||||
};
|
||||
|
||||
# fetchers
|
||||
fetchers = {
|
||||
git = import ../../flake-parts/lib/internal/fetchers/git {
|
||||
git = import ../../../lib/internal/fetchers/git {
|
||||
inherit hashPath;
|
||||
inherit (config.deps) fetchgit;
|
||||
};
|
||||
path = import ../../flake-parts/lib/internal/fetchers/path {
|
||||
path = import ../../../lib/internal/fetchers/path {
|
||||
inherit hashPath;
|
||||
};
|
||||
};
|
||||
@ -53,7 +53,7 @@
|
||||
packageVersions
|
||||
;
|
||||
|
||||
inherit (import ../../flake-parts/lib/internal/php-semver.nix {inherit lib;}) satisfies;
|
||||
inherit (import ../../../lib/internal/php-semver.nix {inherit lib;}) satisfies;
|
||||
|
||||
selectExtensions = all:
|
||||
l.attrValues (
|
||||
|
@ -6,11 +6,11 @@
|
||||
}: let
|
||||
l = lib // builtins;
|
||||
cfg = config.rust-cargo-lock;
|
||||
parseSpdxId = import ../../flake-parts/lib/internal/parseSpdxId.nix {inherit lib;};
|
||||
sanitizePath = import ../../flake-parts/lib/internal/sanitizePath.nix {inherit lib;};
|
||||
sanitizeRelativePath = import ../../flake-parts/lib/internal/sanitizeRelativePath.nix {inherit lib;};
|
||||
prepareSourceTree = import ../../flake-parts/lib/internal/prepareSourceTree.nix {inherit lib;};
|
||||
simpleTranslate2 = import ../../flake-parts/lib/internal/simpleTranslate2.nix {inherit lib;};
|
||||
parseSpdxId = import ../../../lib/internal/parseSpdxId.nix {inherit lib;};
|
||||
sanitizePath = import ../../../lib/internal/sanitizePath.nix {inherit lib;};
|
||||
sanitizeRelativePath = import ../../../lib/internal/sanitizeRelativePath.nix {inherit lib;};
|
||||
prepareSourceTree = import ../../../lib/internal/prepareSourceTree.nix {inherit lib;};
|
||||
simpleTranslate2 = import ../../../lib/internal/simpleTranslate2.nix {inherit lib;};
|
||||
|
||||
translate = import ./translate.nix {
|
||||
inherit lib parseSpdxId sanitizePath sanitizeRelativePath simpleTranslate2;
|
||||
|
@ -13,30 +13,30 @@
|
||||
sourceRoot = config.mkDerivation.src;
|
||||
|
||||
fetchDreamLockSources =
|
||||
import ../../flake-parts/lib/internal/fetchDreamLockSources.nix
|
||||
import ../../../lib/internal/fetchDreamLockSources.nix
|
||||
{inherit lib;};
|
||||
getDreamLockSource = import ../../flake-parts/lib/internal/getDreamLockSource.nix {inherit lib;};
|
||||
readDreamLock = import ../../flake-parts/lib/internal/readDreamLock.nix {inherit lib;};
|
||||
hashPath = import ../../flake-parts/lib/internal/hashPath.nix {
|
||||
getDreamLockSource = import ../../../lib/internal/getDreamLockSource.nix {inherit lib;};
|
||||
readDreamLock = import ../../../lib/internal/readDreamLock.nix {inherit lib;};
|
||||
hashPath = import ../../../lib/internal/hashPath.nix {
|
||||
inherit lib;
|
||||
inherit (config.deps) runCommandLocal nix;
|
||||
};
|
||||
hashFile = import ../../flake-parts/lib/internal/hashFile.nix {
|
||||
hashFile = import ../../../lib/internal/hashFile.nix {
|
||||
inherit lib;
|
||||
inherit (config.deps) runCommandLocal nix;
|
||||
};
|
||||
|
||||
# fetchers
|
||||
fetchers = {
|
||||
git = import ../../flake-parts/lib/internal/fetchers/git {
|
||||
git = import ../../../lib/internal/fetchers/git {
|
||||
inherit hashPath;
|
||||
inherit (config.deps) fetchgit;
|
||||
};
|
||||
crates-io = import ../../flake-parts/lib/internal/fetchers/crates-io {
|
||||
crates-io = import ../../../lib/internal/fetchers/crates-io {
|
||||
inherit hashFile;
|
||||
inherit (config.deps) fetchurl runCommandLocal;
|
||||
};
|
||||
path = import ../../flake-parts/lib/internal/fetchers/path {
|
||||
path = import ../../../lib/internal/fetchers/path {
|
||||
inherit hashPath;
|
||||
};
|
||||
};
|
||||
@ -60,7 +60,7 @@
|
||||
|
||||
getSource = getDreamLockSource fetchedSources;
|
||||
|
||||
toTOML = import ../../flake-parts/lib/internal/toTOML.nix {inherit lib;};
|
||||
toTOML = import ../../../lib/internal/toTOML.nix {inherit lib;};
|
||||
|
||||
utils = import ./utils.nix {
|
||||
inherit dreamLock getSource lib toTOML sourceRoot;
|
||||
|
@ -3,7 +3,7 @@
|
||||
lib ? import <nixpkgs/lib>,
|
||||
...
|
||||
}: let
|
||||
findCycles = import ../../../modules/flake-parts/lib/internal/findCycles.nix {inherit lib;};
|
||||
findCycles = import ../../../lib/internal/findCycles.nix {inherit lib;};
|
||||
in {
|
||||
test_simple = {
|
||||
expr = findCycles {
|
||||
|
@ -1,5 +1,5 @@
|
||||
{lib ? import <nixpkgs/lib>, ...}: let
|
||||
util = import ../../../modules/flake-parts/lib/internal/graphUtils.nix {inherit lib;};
|
||||
util = import ../../../lib/internal/graphUtils.nix {inherit lib;};
|
||||
in {
|
||||
test_simple = {
|
||||
expr = util.sanitizeGraph {
|
||||
|
@ -22,7 +22,7 @@
|
||||
specialArgs,
|
||||
...
|
||||
}: let
|
||||
dreamTypes = import ../../../modules/flake-parts/lib/types {
|
||||
dreamTypes = import ../../../lib/types {
|
||||
inherit dream2nix lib specialArgs;
|
||||
};
|
||||
in {
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
# pkgs ? import <nixpkgs> {},
|
||||
lib ? import <nixpkgs/lib>,
|
||||
nodejsLockUtils ? import ../../../modules/flake-parts/lib/internal/nodejsLockUtils.nix {inherit lib;},
|
||||
nodejsLockUtils ? import ../../../lib/internal/nodejsLockUtils.nix {inherit lib;},
|
||||
}: {
|
||||
# test the path strip function
|
||||
test_nodejsLockUtils_stripPath_simple = let
|
||||
|
Loading…
Reference in New Issue
Block a user