mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-12-01 18:16:14 +02:00
Remove 'name' attribute from flakes
This is no longer needed since flakes are given an identity in the 'inputs' attribute.
This commit is contained in:
parent
30ccf4e52d
commit
80c36d4562
6 changed files with 6 additions and 41 deletions
|
@ -1,13 +1,10 @@
|
||||||
{
|
{
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"id": "nixpkgs",
|
|
||||||
"inputs": {},
|
"inputs": {},
|
||||||
"narHash": "sha256-AndIaZrFFIT+VFhVtQHsS90I5SWfjTDTxzs9Hx9ZxZA=",
|
"narHash": "sha256-TrLhI3xPkTTznE9gcMHhkHirGNN7N02zM4DxJ/U3WRs=",
|
||||||
"nonFlakeInputs": {},
|
"uri": "github:edolstra/nixpkgs/24bf27fc215e8300877dfa1c426b9966bbfbd150"
|
||||||
"uri": "github:edolstra/nixpkgs/9bd2e2c96ddeec64e9ad37540412263fdb78458d"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nonFlakeInputs": {},
|
|
||||||
"version": 2
|
"version": 2
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
{
|
{
|
||||||
name = "nix";
|
|
||||||
|
|
||||||
description = "The purely functional package manager";
|
description = "The purely functional package manager";
|
||||||
|
|
||||||
edition = 201909;
|
edition = 201909;
|
||||||
|
|
|
@ -239,11 +239,6 @@ Flake getFlake(EvalState & state, const FlakeRef & flakeRef)
|
||||||
} else
|
} else
|
||||||
throw Error("flake '%s' lacks attribute 'edition'", flakeRef);
|
throw Error("flake '%s' lacks attribute 'edition'", flakeRef);
|
||||||
|
|
||||||
if (auto name = vInfo.attrs->get(state.sName))
|
|
||||||
flake.id = state.forceStringNoCtx(*(**name).value, *(**name).pos);
|
|
||||||
else
|
|
||||||
throw Error("flake '%s' lacks attribute 'name'", flakeRef);
|
|
||||||
|
|
||||||
if (auto description = vInfo.attrs->get(state.sDescription))
|
if (auto description = vInfo.attrs->get(state.sDescription))
|
||||||
flake.description = state.forceStringNoCtx(*(**description).value, *(**description).pos);
|
flake.description = state.forceStringNoCtx(*(**description).value, *(**description).pos);
|
||||||
|
|
||||||
|
@ -292,7 +287,6 @@ Flake getFlake(EvalState & state, const FlakeRef & flakeRef)
|
||||||
for (auto & attr : *vInfo.attrs) {
|
for (auto & attr : *vInfo.attrs) {
|
||||||
if (attr.name != sEdition &&
|
if (attr.name != sEdition &&
|
||||||
attr.name != sEpoch &&
|
attr.name != sEpoch &&
|
||||||
attr.name != state.sName &&
|
|
||||||
attr.name != state.sDescription &&
|
attr.name != state.sDescription &&
|
||||||
attr.name != sInputs &&
|
attr.name != sInputs &&
|
||||||
attr.name != sOutputs)
|
attr.name != sOutputs)
|
||||||
|
|
|
@ -67,7 +67,6 @@ struct FlakeInput
|
||||||
|
|
||||||
struct Flake
|
struct Flake
|
||||||
{
|
{
|
||||||
FlakeId id;
|
|
||||||
FlakeRef originalRef;
|
FlakeRef originalRef;
|
||||||
std::string description;
|
std::string description;
|
||||||
SourceInfo sourceInfo;
|
SourceInfo sourceInfo;
|
||||||
|
|
|
@ -103,7 +103,6 @@ static void sourceInfoToJson(const SourceInfo & sourceInfo, nlohmann::json & j)
|
||||||
|
|
||||||
static void printFlakeInfo(const Flake & flake)
|
static void printFlakeInfo(const Flake & flake)
|
||||||
{
|
{
|
||||||
std::cout << fmt("ID: %s\n", flake.id);
|
|
||||||
std::cout << fmt("Description: %s\n", flake.description);
|
std::cout << fmt("Description: %s\n", flake.description);
|
||||||
std::cout << fmt("Edition: %s\n", flake.edition);
|
std::cout << fmt("Edition: %s\n", flake.edition);
|
||||||
printSourceInfo(flake.sourceInfo);
|
printSourceInfo(flake.sourceInfo);
|
||||||
|
@ -112,7 +111,6 @@ static void printFlakeInfo(const Flake & flake)
|
||||||
static nlohmann::json flakeToJson(const Flake & flake)
|
static nlohmann::json flakeToJson(const Flake & flake)
|
||||||
{
|
{
|
||||||
nlohmann::json j;
|
nlohmann::json j;
|
||||||
j["id"] = flake.id;
|
|
||||||
j["description"] = flake.description;
|
j["description"] = flake.description;
|
||||||
j["edition"] = flake.edition;
|
j["edition"] = flake.edition;
|
||||||
sourceInfoToJson(flake.sourceInfo, j);
|
sourceInfoToJson(flake.sourceInfo, j);
|
||||||
|
@ -120,12 +118,6 @@ static nlohmann::json flakeToJson(const Flake & flake)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
static void printNonFlakeInfo(const NonFlake & nonFlake)
|
|
||||||
{
|
|
||||||
std::cout << fmt("ID: %s\n", nonFlake.alias);
|
|
||||||
printSourceInfo(nonFlake.sourceInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: merge info CmdFlakeInfo?
|
// FIXME: merge info CmdFlakeInfo?
|
||||||
struct CmdFlakeDeps : FlakeCommand
|
struct CmdFlakeDeps : FlakeCommand
|
||||||
{
|
{
|
||||||
|
@ -148,9 +140,6 @@ struct CmdFlakeDeps : FlakeCommand
|
||||||
auto resFlake = std::move(todo.front());
|
auto resFlake = std::move(todo.front());
|
||||||
todo.pop();
|
todo.pop();
|
||||||
|
|
||||||
for (auto & nonFlake : resFlake.nonFlakeDeps)
|
|
||||||
printNonFlakeInfo(nonFlake);
|
|
||||||
|
|
||||||
for (auto & info : resFlake.flakeDeps) {
|
for (auto & info : resFlake.flakeDeps) {
|
||||||
printFlakeInfo(info.second.flake);
|
printFlakeInfo(info.second.flake);
|
||||||
todo.push(info.second);
|
todo.push(info.second);
|
||||||
|
|
|
@ -29,8 +29,6 @@ done
|
||||||
|
|
||||||
cat > $flake1Dir/flake.nix <<EOF
|
cat > $flake1Dir/flake.nix <<EOF
|
||||||
{
|
{
|
||||||
name = "flake1";
|
|
||||||
|
|
||||||
edition = 201909;
|
edition = 201909;
|
||||||
|
|
||||||
description = "Bla bla";
|
description = "Bla bla";
|
||||||
|
@ -48,8 +46,6 @@ git -C $flake1Dir commit -m 'Initial'
|
||||||
|
|
||||||
cat > $flake2Dir/flake.nix <<EOF
|
cat > $flake2Dir/flake.nix <<EOF
|
||||||
{
|
{
|
||||||
name = "flake2";
|
|
||||||
|
|
||||||
edition = 201909;
|
edition = 201909;
|
||||||
|
|
||||||
description = "Fnord";
|
description = "Fnord";
|
||||||
|
@ -65,8 +61,6 @@ git -C $flake2Dir commit -m 'Initial'
|
||||||
|
|
||||||
cat > $flake3Dir/flake.nix <<EOF
|
cat > $flake3Dir/flake.nix <<EOF
|
||||||
{
|
{
|
||||||
name = "flake3";
|
|
||||||
|
|
||||||
edition = 201909;
|
edition = 201909;
|
||||||
|
|
||||||
description = "Fnord";
|
description = "Fnord";
|
||||||
|
@ -118,12 +112,12 @@ EOF
|
||||||
(( $(nix flake list --flake-registry $registry | wc -l) == 5 ))
|
(( $(nix flake list --flake-registry $registry | wc -l) == 5 ))
|
||||||
|
|
||||||
# Test 'nix flake info'.
|
# Test 'nix flake info'.
|
||||||
nix flake info --flake-registry $registry flake1 | grep -q 'ID: *flake1'
|
nix flake info --flake-registry $registry flake1 | grep -q 'URI: .*flake1.*'
|
||||||
|
|
||||||
# Test 'nix flake info' on a local flake.
|
# Test 'nix flake info' on a local flake.
|
||||||
(cd $flake1Dir && nix flake info --flake-registry $registry) | grep -q 'ID: *flake1'
|
(cd $flake1Dir && nix flake info --flake-registry $registry) | grep -q 'URI: .*flake1.*'
|
||||||
(cd $flake1Dir && nix flake info --flake-registry $registry .) | grep -q 'ID: *flake1'
|
(cd $flake1Dir && nix flake info --flake-registry $registry .) | grep -q 'URI: .*flake1.*'
|
||||||
nix flake info --flake-registry $registry $flake1Dir | grep -q 'ID: *flake1'
|
nix flake info --flake-registry $registry $flake1Dir | grep -q 'URI: .*flake1.*'
|
||||||
|
|
||||||
# Test 'nix flake info --json'.
|
# Test 'nix flake info --json'.
|
||||||
json=$(nix flake info --flake-registry $registry flake1 --json | jq .)
|
json=$(nix flake info --flake-registry $registry flake1 --json | jq .)
|
||||||
|
@ -183,8 +177,6 @@ rm $flake3Dir/flake.nix
|
||||||
|
|
||||||
cat > $flake3Dir/flake.nix <<EOF
|
cat > $flake3Dir/flake.nix <<EOF
|
||||||
{
|
{
|
||||||
name = "flake3";
|
|
||||||
|
|
||||||
edition = 201909;
|
edition = 201909;
|
||||||
|
|
||||||
description = "Fnord";
|
description = "Fnord";
|
||||||
|
@ -236,8 +228,6 @@ rm $flake3Dir/flake.nix
|
||||||
|
|
||||||
cat > $flake3Dir/flake.nix <<EOF
|
cat > $flake3Dir/flake.nix <<EOF
|
||||||
{
|
{
|
||||||
name = "flake3";
|
|
||||||
|
|
||||||
edition = 201909;
|
edition = 201909;
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
|
@ -305,8 +295,6 @@ rm $flake3Dir/flake.nix
|
||||||
|
|
||||||
cat > $flake3Dir/flake.nix <<EOF
|
cat > $flake3Dir/flake.nix <<EOF
|
||||||
{
|
{
|
||||||
name = "flake3";
|
|
||||||
|
|
||||||
edition = 201909;
|
edition = 201909;
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
|
|
Loading…
Reference in a new issue