forked from auxolotl/labs
feat: expose capabilities in top-level config
This commit is contained in:
parent
b90aeab27f
commit
c46d759e87
4 changed files with 60 additions and 38 deletions
|
|
@ -49,6 +49,7 @@ let
|
|||
};
|
||||
in
|
||||
new [
|
||||
./src/capabilities
|
||||
./src/packages
|
||||
./src/builders/foundation/basic.nix
|
||||
]
|
||||
|
|
|
|||
18
tidepool/src/capabilities/default.nix
Normal file
18
tidepool/src/capabilities/default.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{ config }:
|
||||
let
|
||||
inherit (config) lib;
|
||||
in
|
||||
{
|
||||
includes = [
|
||||
./make.nix
|
||||
];
|
||||
|
||||
options = {
|
||||
capabilities = lib.options.create {
|
||||
description = "A set of capabilities that can be added to packages to provide build functionality.";
|
||||
# TODO: define proper type
|
||||
type = lib.types.attrs.of (lib.types.function lib.types.any);
|
||||
default.value = { };
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,40 +1,42 @@
|
|||
{ config, global }:
|
||||
|
||||
let
|
||||
inherit (global)
|
||||
lib
|
||||
packages
|
||||
;
|
||||
in
|
||||
{
|
||||
options.make = {
|
||||
flags = lib.options.create {
|
||||
description = "List of flags to pass to make.";
|
||||
type = lib.types.list.of lib.types.string;
|
||||
default.value = [ ];
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
deps.build.build = {
|
||||
gnumake =
|
||||
if (config.platform.build == "i686-linux") then
|
||||
packages.foundation.gnumake.versions."4.4.1-bootstrap"
|
||||
else
|
||||
packages.foundation.gnumake.versions."4.4.1-stage1-passthrough";
|
||||
};
|
||||
|
||||
phases =
|
||||
let
|
||||
makeFlags = builtins.concatStringsSep " " config.make.flags;
|
||||
in
|
||||
{
|
||||
makeBuild = lib.dag.entry.before [ "build" ] ''
|
||||
make -j $NIX_BUILD_CORES ${makeFlags}
|
||||
'';
|
||||
makeInstall = lib.dag.entry.before [ "install" ] ''
|
||||
make -j $NIX_BUILD_CORES install ${makeFlags}
|
||||
'';
|
||||
config.capabilities.make =
|
||||
{ config, global, ... }:
|
||||
let
|
||||
inherit (global)
|
||||
lib
|
||||
packages
|
||||
;
|
||||
in
|
||||
{
|
||||
options.make = {
|
||||
flags = lib.options.create {
|
||||
description = "List of flags to pass to make.";
|
||||
type = lib.types.list.of lib.types.string;
|
||||
default.value = [ ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
deps.build.build = {
|
||||
gnumake =
|
||||
if (config.platform.build == "i686-linux") then
|
||||
packages.foundation.gnumake.versions."4.4.1-bootstrap"
|
||||
else
|
||||
packages.foundation.gnumake.versions."4.4.1-stage1-passthrough";
|
||||
};
|
||||
|
||||
phases =
|
||||
let
|
||||
makeFlags = builtins.concatStringsSep " " config.make.flags;
|
||||
in
|
||||
{
|
||||
makeBuild = lib.dag.entry.before [ "build" ] ''
|
||||
make -j $NIX_BUILD_CORES ${makeFlags}
|
||||
'';
|
||||
makeInstall = lib.dag.entry.before [ "install" ] ''
|
||||
make -j $NIX_BUILD_CORES install ${makeFlags}
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
let
|
||||
inherit (global)
|
||||
lib
|
||||
capabilities
|
||||
packages
|
||||
builders
|
||||
mirrors
|
||||
|
|
@ -17,7 +18,7 @@ let
|
|||
in
|
||||
{
|
||||
includes = [
|
||||
../../../../capabilities/make.nix
|
||||
capabilities.make
|
||||
];
|
||||
|
||||
config = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue