mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-11-26 09:46:04 +03:00
remove dream2nix-legacy drv-part... (#549)
as it's currently broken in requiring IFD during nix flake show.
This commit is contained in:
parent
76fba001f3
commit
07a24630e1
@ -1,168 +0,0 @@
|
||||
{
|
||||
config,
|
||||
options,
|
||||
extendModules,
|
||||
lib,
|
||||
drv-parts,
|
||||
...
|
||||
}: let
|
||||
l = lib // builtins;
|
||||
|
||||
cfg = config.dream2nix-legacy;
|
||||
|
||||
pkgs = drv-parts.inputs.nixpkgs.legacyPackages.x86_64-linux;
|
||||
|
||||
dlib =
|
||||
(l.evalModules {
|
||||
modules = [
|
||||
../../../../../src/modules/dlib
|
||||
../../../../../src/modules/dlib.construct
|
||||
../../../../../src/modules/dlib.parsing
|
||||
../../../../../src/modules/dlib.simpleTranslate2
|
||||
libModule
|
||||
];
|
||||
})
|
||||
.config
|
||||
.dlib;
|
||||
|
||||
utils =
|
||||
(l.evalModules {
|
||||
modules = [
|
||||
../../../../../src/modules/functions.fetchers
|
||||
../../../../../src/modules/utils
|
||||
../../../../../src/modules/utils.override
|
||||
../../../../../src/modules/utils.toTOML
|
||||
../../../../../src/modules/utils.translator
|
||||
../../../../../src/modules/dlib
|
||||
libModule
|
||||
];
|
||||
})
|
||||
.config
|
||||
.utils;
|
||||
|
||||
legacy-interface =
|
||||
(l.evalModules {
|
||||
modules = [
|
||||
../../../../../src/modules/dream2nix-interface
|
||||
../../../../../src/modules/dlib
|
||||
../../../../../src/modules/fetchers
|
||||
../../../../../src/modules/functions.default-fetcher
|
||||
../../../../../src/modules/functions.fetchers
|
||||
../../../../../src/modules/utils
|
||||
../../../../../src/modules/utils.dream-lock
|
||||
../../../../../src/modules/utils.override
|
||||
buildersModule
|
||||
configModule
|
||||
libModule
|
||||
pkgsModule
|
||||
];
|
||||
})
|
||||
.config
|
||||
.dream2nix-interface;
|
||||
|
||||
buildersModule = {
|
||||
options.buildersBySubsystem = l.mkOption {type = l.types.raw;};
|
||||
config.buildersBySubsystem = buildersBySubsystem;
|
||||
};
|
||||
|
||||
configModule = {
|
||||
options.dream2nixConfig = l.mkOption {type = l.types.raw;};
|
||||
config.dream2nixConfig = {
|
||||
overridesDirs = [../../../../../overrides];
|
||||
};
|
||||
};
|
||||
|
||||
libModule = {
|
||||
options.lib = l.mkOption {type = l.types.raw;};
|
||||
config.lib = lib // builtins;
|
||||
};
|
||||
|
||||
pkgsModule = {
|
||||
options.pkgs = l.mkOption {type = l.types.raw;};
|
||||
config.pkgs = pkgs;
|
||||
};
|
||||
|
||||
buildersBySubsystem.${cfg.subsystem}.default = import (../../../../.. + "/src/subsystems/${cfg.subsystem}/builders/${cfg.builder}/default.nix") {
|
||||
inherit lib pkgs utils;
|
||||
dlib = {};
|
||||
};
|
||||
|
||||
translator =
|
||||
(l.evalModules {
|
||||
modules = [
|
||||
../../../../../src/modules/interfaces.translator/interface.nix
|
||||
(../../../../.. + "/src/subsystems/${cfg.subsystem}/translators/${cfg.translator}")
|
||||
libModule
|
||||
];
|
||||
specialArgs = {
|
||||
inherit dlib utils;
|
||||
};
|
||||
})
|
||||
.config;
|
||||
|
||||
tree = dlib.prepareSourceTree {inherit (cfg) source;};
|
||||
|
||||
project = {
|
||||
inherit (config) name;
|
||||
relPath = cfg.relPath;
|
||||
subsystemInfo = cfg.subsystemInfo;
|
||||
};
|
||||
|
||||
result =
|
||||
translator.translate
|
||||
(cfg.subsystemInfo
|
||||
// {
|
||||
inherit project tree;
|
||||
inherit (cfg) source;
|
||||
});
|
||||
|
||||
dreamLock = result.result or result;
|
||||
|
||||
defaultSourceOverride = dreamLock: let
|
||||
defaultPackage = dreamLock._generic.defaultPackage;
|
||||
defaultPackageVersion =
|
||||
dreamLock._generic.packages."${defaultPackage}";
|
||||
in {
|
||||
"${defaultPackage}"."${defaultPackageVersion}" = "${cfg.source}/${dreamLock._generic.location}";
|
||||
};
|
||||
|
||||
dreamOverrides = let
|
||||
overridesDirs = [../../../../../overrides];
|
||||
in
|
||||
utils.loadOverridesDirs overridesDirs pkgs;
|
||||
|
||||
outputs = legacy-interface.makeOutputsForDreamLock {
|
||||
inherit dreamLock;
|
||||
sourceRoot = cfg.source;
|
||||
sourceOverrides = oldSources:
|
||||
dlib.recursiveUpdateUntilDepth
|
||||
1
|
||||
(defaultSourceOverride dreamLock)
|
||||
(cfg.sourceOverrides oldSources);
|
||||
packageOverrides =
|
||||
l.recursiveUpdate
|
||||
(dreamOverrides."${dreamLock._generic.subsystem}" or {})
|
||||
(cfg.packageOverrides or {});
|
||||
};
|
||||
|
||||
drvModule = drv-parts.lib.makeModule {
|
||||
packageFunc = outputs.packages.default;
|
||||
};
|
||||
|
||||
# hacky call drvModule manually to prevent infinite recursions
|
||||
eval = drvModule {
|
||||
inherit config options extendModules;
|
||||
};
|
||||
|
||||
public =
|
||||
eval.config.public
|
||||
// l.optionalAttrs (outputs ? devShells.default) {
|
||||
devShell = outputs.devShells.default;
|
||||
};
|
||||
in {
|
||||
imports = [
|
||||
./interface.nix
|
||||
];
|
||||
|
||||
public = l.mkForce public;
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
l = lib // builtins;
|
||||
t = l.types;
|
||||
in {
|
||||
options.dream2nix-legacy = {
|
||||
builder = l.mkOption {
|
||||
description = "Builder to use";
|
||||
example = ["build-rust-package"];
|
||||
type = t.str;
|
||||
};
|
||||
relPath = l.mkOption {
|
||||
default = "";
|
||||
description = "Relative path to project tree from source";
|
||||
type = t.str;
|
||||
};
|
||||
source = l.mkOption {
|
||||
type = t.either t.path t.package;
|
||||
description = "Source of the package to build with dream2nix";
|
||||
};
|
||||
subsystem = l.mkOption {
|
||||
description = ''Name of subsystem to use. Examples: rust, python, nodejs'';
|
||||
example = "nodejs";
|
||||
type = t.str;
|
||||
};
|
||||
subsystemInfo = l.mkOption {
|
||||
default = {};
|
||||
description = "Translator specific arguments";
|
||||
type = t.lazyAttrsOf (t.anything);
|
||||
};
|
||||
translator = l.mkOption {
|
||||
description = "Translator to use";
|
||||
example = ["yarn-lock" "package-json"];
|
||||
type = t.str;
|
||||
};
|
||||
|
||||
# overrides
|
||||
packageOverrides = l.mkOption {
|
||||
default = {};
|
||||
type = t.lazyAttrsOf t.attrs;
|
||||
description = "Overrides to customize build logic for dependencies or top-level packages";
|
||||
};
|
||||
sourceOverrides = l.mkOption {
|
||||
default = old: {};
|
||||
type = t.functionTo (t.lazyAttrsOf (t.listOf t.package));
|
||||
description = ''
|
||||
Override the sources of dependencies or top-level packages.
|
||||
For more details, refer to
|
||||
https://nix-community.github.io/dream2nix/intro/override-system.html
|
||||
'';
|
||||
example = l.literalExpression ''
|
||||
oldSources: {
|
||||
bar."13.2.0" = builtins.fetchTarball {
|
||||
url = "https://example.com/example.tar.gz";
|
||||
sha256 = "sha256-0000000000000000000000000000000000000000000=";
|
||||
};
|
||||
baz."1.0.0" = builtins.fetchTarball {
|
||||
url = "https://example2.com/example2.tar.gz";
|
||||
sha256 = "sha256-0000000000000000000000000000000000000000000=";
|
||||
};
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
drv-parts,
|
||||
...
|
||||
}: let
|
||||
l = lib // builtins;
|
||||
in {
|
||||
imports = [
|
||||
drv-parts.modules.drv-parts.mkDerivation
|
||||
../../drv-parts/dream2nix-legacy
|
||||
];
|
||||
|
||||
dream2nix-legacy = {
|
||||
subsystem = "nodejs";
|
||||
translator = "yarn-lock";
|
||||
builder = "granular-nodejs";
|
||||
subsystemInfo = {
|
||||
nodejs = "16";
|
||||
noDev = false;
|
||||
};
|
||||
source = config.deps.fetchFromGitHub {
|
||||
owner = "prettier";
|
||||
repo = "prettier";
|
||||
rev = config.version;
|
||||
sha256 = "sha256-gHFzUjTHsEcxTJtFflqSOCthKW4Wa+ypuTeGxodmh0o=";
|
||||
};
|
||||
};
|
||||
|
||||
deps = {nixpkgs, ...}: {
|
||||
inherit (nixpkgs) fetchFromGitHub;
|
||||
inherit (nixpkgs) stdenv;
|
||||
};
|
||||
|
||||
name = l.mkForce "prettier";
|
||||
version = l.mkForce "2.8.7";
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
drv-parts,
|
||||
...
|
||||
}: let
|
||||
l = lib // builtins;
|
||||
in {
|
||||
imports = [
|
||||
drv-parts.modules.drv-parts.mkDerivation
|
||||
../../drv-parts/dream2nix-legacy
|
||||
];
|
||||
|
||||
dream2nix-legacy = {
|
||||
subsystem = "rust";
|
||||
translator = "cargo-lock";
|
||||
builder = "build-rust-package";
|
||||
source = config.deps.fetchFromGitHub {
|
||||
owner = "BurntSushi";
|
||||
repo = "ripgrep";
|
||||
rev = config.version;
|
||||
sha256 = "sha256-udEh+Re2PeO3DnX4fQThsaT1Y3MBHFfrX5Q5EN2XrF0=";
|
||||
};
|
||||
};
|
||||
|
||||
deps = {nixpkgs, ...}: {
|
||||
inherit (nixpkgs) fetchFromGitHub;
|
||||
inherit (nixpkgs) stdenv;
|
||||
};
|
||||
|
||||
name = l.mkForce "ripgrep";
|
||||
version = l.mkForce "13.0.0";
|
||||
}
|
Loading…
Reference in New Issue
Block a user