Skip to content

Commit

Permalink
refac(build): #919 cleaner bootstrap
Browse files Browse the repository at this point in the history
- Bootstrap building makes with makes in a more
  makes-ified way

Signed-off-by: Kevin Amado <[email protected]>
  • Loading branch information
kamadorueda committed Sep 25, 2022
1 parent ce31055 commit 55e3cf8
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 39 deletions.
47 changes: 12 additions & 35 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,17 @@
#
# SPDX-License-Identifier: MIT
{system ? builtins.currentSystem}: let
args = import ./src/args/agnostic.nix {inherit system;};
makesVersion = "22.10";
agnostic = import ./src/args/agnostic.nix {inherit system;};

inherit (args) __nixpkgs__;
inherit (args) makeScript;
in
makeScript {
aliases = [
"m-v${makesVersion}"
"makes"
"makes-v${makesVersion}"
];
replace = {
__argMakesSrc__ = ./.;
__argNixStable__ = __nixpkgs__.nixStable;
__argNixUnstable__ = __nixpkgs__.nixUnstable;
};
entrypoint = ''
__MAKES_SRC__=__argMakesSrc__ \
__NIX_STABLE__=__argNixStable__ \
__NIX_UNSTABLE__=__argNixUnstable__ \
python -u __argMakesSrc__/src/cli/main/__main__.py "$@"
'';
searchPaths = {
bin = [
__nixpkgs__.cachix
__nixpkgs__.git
__nixpkgs__.gnutar
__nixpkgs__.gzip
__nixpkgs__.nixStable
];
source = [
(import ./makes/cli/pypi/main.nix args)
];
args =
agnostic
// {
outputs."/cli/env/runtime" =
import ./makes/cli/env/runtime/main.nix args;
outputs."/cli/env/runtime/pypi" =
import ./makes/cli/env/runtime/pypi/main.nix args;
projectPath = import ./src/args/project-path args;
projectSrc = ./.;
};
name = "m";
}
in
import ./makes/main.nix args
2 changes: 1 addition & 1 deletion makes.nix
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
inputs.nixpkgs.mdbook-mermaid
inputs.nixpkgs.reuse
];
source = [outputs."/cli/pypi"];
source = [outputs."/cli/env/runtime"];
};
};
envVars = {
Expand Down
21 changes: 21 additions & 0 deletions makes/cli/env/runtime/main.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# SPDX-FileCopyrightText: 2022 Fluid Attacks and Makes contributors
#
# SPDX-License-Identifier: MIT
{
__nixpkgs__,
makeSearchPaths,
outputs,
...
}:
makeSearchPaths {
bin = [
__nixpkgs__.cachix
__nixpkgs__.git
__nixpkgs__.gnutar
__nixpkgs__.gzip
__nixpkgs__.nixStable
];
source = [
outputs."/cli/env/runtime/pypi"
];
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
# SPDX-License-Identifier: MIT
{makePythonPypiEnvironment, ...}:
makePythonPypiEnvironment {
name = "cli-pypi";
name = "cli-env-runtime-pypi";
sourcesYaml = ./pypi-sources.yaml;
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
33 changes: 31 additions & 2 deletions makes/main.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
# SPDX-FileCopyrightText: 2022 Fluid Attacks and Makes contributors
#
# SPDX-License-Identifier: MIT
{projectPath, ...}:
import (projectPath "/") {}
{
__nixpkgs__,
makeScript,
outputs,
projectPath,
...
}: let
makesVersion = "22.10";
in
makeScript {
aliases = [
"m-v${makesVersion}"
"makes"
"makes-v${makesVersion}"
];
replace = {
__argMakesSrc__ = projectPath "/";
__argNixStable__ = __nixpkgs__.nixStable;
__argNixUnstable__ = __nixpkgs__.nixUnstable;
};
entrypoint = ''
__MAKES_SRC__=__argMakesSrc__ \
__NIX_STABLE__=__argNixStable__ \
__NIX_UNSTABLE__=__argNixUnstable__ \
python -u __argMakesSrc__/src/cli/main/__main__.py "$@"
'';
searchPaths.source = [
outputs."/cli/env/runtime"
];
name = "m";
}

0 comments on commit 55e3cf8

Please sign in to comment.