Skip to content

Commit

Permalink
Merge branch 'main' into feat/graph-utils
Browse files Browse the repository at this point in the history
  • Loading branch information
hsjobeki authored Oct 13, 2023
2 parents 491dc74 + 1caf997 commit 48bba65
Show file tree
Hide file tree
Showing 67 changed files with 272 additions and 274 deletions.
1 change: 0 additions & 1 deletion docs/.gitignore

This file was deleted.

6 changes: 0 additions & 6 deletions docs/book.toml

This file was deleted.

12 changes: 0 additions & 12 deletions docs/src/SUMMARY.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/src/intro.md

This file was deleted.

6 changes: 0 additions & 6 deletions docs/theme/highlight.js

This file was deleted.

8 changes: 6 additions & 2 deletions examples/packages/multi-language/python-nodejs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,17 @@ in {
fetchFromGitHub = nixpkgs.fetchFromGitHub;
};

mkDerivation = {
src = config.deps.fetchFromGitHub {
nodejs-package-lock = {
source = config.deps.fetchFromGitHub {
owner = "posativ";
repo = config.name;
rev = "refs/tags/${config.version}";
sha256 = "sha256-kZNf7Rlb1DZtQe4dK1B283OkzQQcCX+pbvZzfL65gsA=";
};
};

mkDerivation = {
src = config.nodejs-package-lock.source;

propagatedBuildInputs = [
# isso implicitly assumes that pkg_resources, which is
Expand Down
13 changes: 9 additions & 4 deletions examples/packages/single-language/nodejs-devshell/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@
}: {
imports = [
dream2nix.modules.dream2nix.nodejs-devshell
dream2nix.modules.dream2nix.nodejs-package-lock
];

mkDerivation = {
src = config.deps.fetchFromGitHub {
nodejs-package-lock = {
source = config.deps.fetchFromGitHub {
owner = "piuccio";
repo = "cowsay";
rev = "v1.5.0";
sha256 = "sha256-TZ3EQGzVptNqK3cNrkLnyP1FzBd81XaszVucEnmBy4Y=";
};
# allow devshell to be built -> CI pipeline happy
buildPhase = "mkdir $out";
};

deps = {nixpkgs, ...}: {
Expand All @@ -31,4 +30,10 @@

name = "cowsay";
version = "1.5.0";

mkDerivation = {
src = config.nodejs-package-lock.source;
# allow devshell to be built -> CI pipeline happy
buildPhase = "mkdir $out";
};
}
22 changes: 13 additions & 9 deletions examples/packages/single-language/nodejs-node-modules/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,9 @@
}: {
imports = [
dream2nix.modules.dream2nix.nodejs-node-modules
dream2nix.modules.dream2nix.nodejs-package-lock
];

mkDerivation = {
src = config.deps.fetchFromGitHub {
owner = "piuccio";
repo = "cowsay";
rev = "v1.5.0";
sha256 = "sha256-TZ3EQGzVptNqK3cNrkLnyP1FzBd81XaszVucEnmBy4Y=";
};
};

deps = {nixpkgs, ...}: {
inherit
(nixpkgs)
Expand All @@ -26,6 +18,18 @@
;
};

nodejs-package-lock = {
source = config.deps.fetchFromGitHub {
owner = "piuccio";
repo = "cowsay";
rev = "v1.5.0";
sha256 = "sha256-TZ3EQGzVptNqK3cNrkLnyP1FzBd81XaszVucEnmBy4Y=";
};
};

name = "cowsay";
version = "1.5.0";
mkDerivation = {
src = config.nodejs-package-lock.source;
};
}
8 changes: 6 additions & 2 deletions examples/packages/single-language/nodejs-package/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
dream2nix.modules.dream2nix.nodejs-granular
];

mkDerivation = {
src = config.deps.fetchFromGitHub {
nodejs-package-lock = {
source = config.deps.fetchFromGitHub {
owner = "piuccio";
repo = "cowsay";
rev = "v1.5.0";
Expand All @@ -28,4 +28,8 @@

name = "cowsay";
version = "1.5.0";

mkDerivation = {
src = config.nodejs-package-lock.source;
};
}
33 changes: 19 additions & 14 deletions examples/packages/single-language/nodejs-project/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,20 @@
in {
imports = [
dream2nix.modules.dream2nix.nodejs-package-json
dream2nix.modules.dream2nix.nodejs-package-lock
dream2nix.modules.dream2nix.nodejs-granular
];

mkDerivation = {
src = lib.cleanSource ./.;
checkPhase = ''
./app.js | ${config.deps.gnugrep}/bin/grep -q "Hello, World!"
'';
doCheck = true;
deps = {nixpkgs, ...}: {
inherit
(nixpkgs)
gnugrep
stdenv
;
};

nodejs-package-lock = {
source = lib.cleanSource ./.;
};

nodejs-granular = {
Expand All @@ -30,17 +35,17 @@ in {
'';
};

deps = {nixpkgs, ...}: {
inherit
(nixpkgs)
gnugrep
stdenv
;
};

name = lib.mkForce "app";
version = lib.mkForce "1.0.0";

lock.lockFileRel =
lib.mkForce "/locks/example-package-nodejs-no-lock/lock-${system}.json";

mkDerivation = {
src = config.nodejs-package-lock.source;
checkPhase = ''
./app.js | ${config.deps.gnugrep}/bin/grep -q "Hello, World!"
'';
doCheck = true;
};
}
22 changes: 13 additions & 9 deletions examples/packages/single-language/php-package/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,6 @@
dream2nix.modules.dream2nix.php-granular
];

mkDerivation = {
src = config.deps.fetchFromGitHub {
owner = "Gipetto";
repo = "CowSay";
rev = config.version;
sha256 = "sha256-jriyCzmvT2pPeNQskibBg0Bsh+h64cAEO+yOOfX2wbA=";
};
};

deps = {nixpkgs, ...}: {
inherit
(nixpkgs)
Expand All @@ -28,4 +19,17 @@

name = "cowsay";
version = "1.2.0";

php-composer-lock = {
source = config.deps.fetchFromGitHub {
owner = "Gipetto";
repo = "CowSay";
rev = config.version;
sha256 = "sha256-jriyCzmvT2pPeNQskibBg0Bsh+h64cAEO+yOOfX2wbA=";
};
};

mkDerivation = {
src = config.php-composer-lock.source;
};
}
15 changes: 0 additions & 15 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -134,21 +134,6 @@
};
};
};

packages = {
docs =
pkgs.runCommand
"dream2nix-docs"
{nativeBuildInputs = [pkgs.bash pkgs.mdbook];}
''
bash -c "
errors=$(mdbook build -d $out ${./.}/docs |& grep ERROR)
if [ \"$errors\" ]; then
exit 1
fi
"
'';
};
};
in
flake-parts.lib.mkFlake {inherit inputs;} {
Expand Down
17 changes: 16 additions & 1 deletion modules/dream2nix/buildPythonPackage/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
{
config,
dream2nix,
lib,
...
}: let
l = lib // builtins;
in {
imports = [
./implementation.nix
./interface.nix
../mkDerivation
];
config = {
package-func.func = config.deps.python.pkgs.buildPythonPackage;
package-func.args = config.buildPythonPackage;

deps = {nixpkgs, ...}: {
python = l.mkOptionDefault nixpkgs.python3;
};
};
}
16 changes: 0 additions & 16 deletions modules/dream2nix/buildPythonPackage/implementation.nix

This file was deleted.

2 changes: 1 addition & 1 deletion modules/dream2nix/builtins-derivation/implementation.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
in {
imports = [
../core
../package-func/implementation.nix
../package-func
];

config.package-func.outputs = cfg.outputs;
Expand Down
3 changes: 3 additions & 0 deletions modules/dream2nix/core/docs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@
'';
};
in {
imports = [
../deps
];
options = {
public.docs = l.mkOption {
type = t.package;
Expand Down
1 change: 1 addition & 0 deletions modules/dream2nix/core/eval-cache/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
in {
imports = [
./interface.nix
../deps
];

config = l.mkMerge [configIfEnabled configIfDisabled];
Expand Down
1 change: 1 addition & 0 deletions modules/dream2nix/core/paths/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
}: {
imports = [
./interface.nix
../deps
];
deps = {nixpkgs, ...}: {
python3 = nixpkgs.python3;
Expand Down
1 change: 1 addition & 0 deletions modules/dream2nix/core/public/interface.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ in {
The final result of the evaluated package.
Contains everything that nix expects from a derivation.
Contains fields like name, outputs, drvPath, outPath, etc.
Can be build with nix-build or `nix build`.
'';
};
}
1 change: 1 addition & 0 deletions modules/dream2nix/core/ui/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{config, ...}: {
imports = [
./interface.nix
../public
];

config.public.name = config.name;
Expand Down
9 changes: 0 additions & 9 deletions modules/dream2nix/mkDerivation-sane-defaults/default.nix

This file was deleted.

2 changes: 1 addition & 1 deletion modules/dream2nix/mkDerivation/implementation.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
in {
imports = [
../core
../package-func/implementation.nix
../package-func
];

config.package-func.outputs = cfg.outputs;
Expand Down
17 changes: 9 additions & 8 deletions modules/dream2nix/nixpkgs-overrides/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
config,
dream2nix,
lib,
options,
...
Expand Down Expand Up @@ -50,15 +51,16 @@
in {
imports = [
./interface.nix
dream2nix.modules.dream2nix.buildPythonPackage
];

config = l.mkMerge [
(l.mkIf cfg.enable {
mkDerivation = extractedMkDerivation;
buildPythonPackage = extractedBuildPythonPackage;
env = extractedEnv;
})
config =
{
mkDerivation = lib.mkIf cfg.enable extractedMkDerivation;
buildPythonPackage = lib.mkIf cfg.enable extractedBuildPythonPackage;
env = lib.mkIf cfg.enable extractedEnv;
}
// {
nixpkgs-overrides.lib = {inherit extractOverrideAttrs extractPythonAttrs;};
nixpkgs-overrides.exclude = [
"all"
Expand All @@ -70,6 +72,5 @@ in {
"src"
"outputs"
];
}
];
};
}
1 change: 1 addition & 0 deletions modules/dream2nix/nixpkgs-overrides/interface.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ in {
type = t.nullOr t.package;
description = "package from which to extract the attributes";
default = config.deps.python.pkgs.${config.name} or null;
defaultText = "config.deps.python.pkgs.\${config.name} or null";
};

lib.extractOverrideAttrs = l.mkOption {
Expand Down
Loading

0 comments on commit 48bba65

Please sign in to comment.