forked from DGNum/colmena
Disallow uninitialized meta.nixpkgs in Flakes
This commit is contained in:
parent
765f42fa24
commit
f7eb121260
3 changed files with 27 additions and 6 deletions
|
@ -143,7 +143,9 @@ Here is a short example:
|
||||||
outputs = { nixpkgs, ... }: {
|
outputs = { nixpkgs, ... }: {
|
||||||
colmena = {
|
colmena = {
|
||||||
meta = {
|
meta = {
|
||||||
inherit nixpkgs;
|
nixpkgs = import nixpkgs {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Also see the non-Flakes hive.nix example above.
|
# Also see the non-Flakes hive.nix example above.
|
||||||
|
|
|
@ -291,15 +291,32 @@ let
|
||||||
};
|
};
|
||||||
in mergedHive // meta;
|
in mergedHive // meta;
|
||||||
|
|
||||||
mkNixpkgs = configName: pkgConf:
|
mkNixpkgs = configName: pkgConf: let
|
||||||
|
uninitializedError = typ: ''
|
||||||
|
Passing ${typ} is no longer accepted with Flakes. Please initialize Nixpkgs like the following:
|
||||||
|
|
||||||
|
{
|
||||||
|
# ...
|
||||||
|
outputs = { nixpkgs, ... }: {
|
||||||
|
colmena = {
|
||||||
|
meta = {
|
||||||
|
nixpkgs = import nixpkgs {
|
||||||
|
system = "${currentSystem}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
in
|
||||||
if typeOf pkgConf == "path" then
|
if typeOf pkgConf == "path" then
|
||||||
|
if hermetic then throw (uninitializedError "a path to Nixpkgs")
|
||||||
# The referenced file might return an initialized Nixpkgs attribute set directly
|
# The referenced file might return an initialized Nixpkgs attribute set directly
|
||||||
mkNixpkgs configName (import pkgConf)
|
else mkNixpkgs configName (import pkgConf)
|
||||||
else if typeOf pkgConf == "lambda" then
|
else if typeOf pkgConf == "lambda" then
|
||||||
pkgConf {}
|
pkgConf {}
|
||||||
else if typeOf pkgConf == "set" then
|
else if typeOf pkgConf == "set" then
|
||||||
# FIXME: Allow configuring `system`
|
if pkgConf ? outputs then throw (uninitializedError "an uninitialized Nixpkgs input")
|
||||||
if pkgConf ? outputs then mkNixpkgs configName pkgConf.outputs.legacyPackages.${currentSystem}.path
|
|
||||||
else pkgConf
|
else pkgConf
|
||||||
else throw ''
|
else throw ''
|
||||||
${configName} must be one of:
|
${configName} must be one of:
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
outputs = { nixpkgs, ... }: {
|
outputs = { nixpkgs, ... }: {
|
||||||
colmena = {
|
colmena = {
|
||||||
meta = {
|
meta = {
|
||||||
inherit nixpkgs;
|
nixpkgs = import nixpkgs {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
host-a = { name, nodes, pkgs, ... }: {
|
host-a = { name, nodes, pkgs, ... }: {
|
||||||
|
|
Loading…
Reference in a new issue