Skip to content

Commit

Permalink
refactor: layputs.default -> exports
Browse files Browse the repository at this point in the history
  • Loading branch information
GTrunSec committed Nov 2, 2023
1 parent 3a9d5ce commit 5b45da0
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 36 deletions.
2 changes: 1 addition & 1 deletion lib/flakeOutputs.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
let
outputs = root.mapPopsLayouts super.pops;
outputs = root.mapPopsExports super.pops;
in
{
inherit (outputs)
Expand Down
3 changes: 3 additions & 0 deletions lib/mapPopsExports'.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{ lib }:
pops:
lib.mapAttrsRecursiveCond ((as: !(as ? "exports"))) (_: v: v.exports) pops
2 changes: 1 addition & 1 deletion lib/mapPopsLayouts.nix → lib/mapPopsExports.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ in
# lib.foldl' (a: b: a // b) { } (
# map (attr: f attr set.${attr}) (lib.attrNames set)
# );
lib.mapAttrsRecursiveCond ((as: !(as ? "layouts" && as.layouts ? "default")))
lib.mapAttrsRecursiveCond ((as: !(as ? "exports" && as.exports ? "default")))
(_: v: v.exports.default or v)
pops
3 changes: 0 additions & 3 deletions lib/mapPopsLayouts'.nix

This file was deleted.

2 changes: 1 addition & 1 deletion local/cells/repo/devshellProfiles.nix
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cell.pops.devshellProfiles.exports.self.exports.default
cell.pops.devshellProfiles.exports.self
5 changes: 3 additions & 2 deletions local/cells/repo/pops.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ in
load.inputs.inputs = inputs';
}).addExporter
{
exports = {
self =
exports = rec {
self = pops.self.exports.default;
pops.self =
(inputs.omnibus.pops.devshellProfiles.addLoadExtender {
load.inputs = {
inputs = inputs';
Expand Down
4 changes: 2 additions & 2 deletions templates/hivebus/nix/lib/flakeOutputs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ let
(lib.filterAttrs (_: v: v ? "${config}"))
(lib.mapAttrs (_: v: v.${config}))
];
inherit (omnibus.lib) mapPopsLayouts;
inherit (omnibus.lib) mapPopsExports;
in
(mapPopsLayouts super.pops)
(mapPopsExports super.pops)
// {
nixosConfigurations = filterConfigs "nixosConfiguration";

Expand Down
30 changes: 10 additions & 20 deletions templates/nixos/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions templates/nixos/nix/lib/flakeOutputs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ let
(lib.filterAttrs (_: v: v ? "${config}"))
(lib.mapAttrs (_: v: v.${config}))
];
inherit (omnibus.lib) mapPopsLayouts;
inherit (omnibus.lib) mapPopsExports;
in
(mapPopsLayouts super.pops)
(mapPopsExports super.pops)
// {
nixosConfigurations = filterConfigs "nixosConfiguration";

Expand Down
4 changes: 2 additions & 2 deletions templates/simple/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@
}
);
};
inherit (inputs.omnibus.lib) mapPopsLayouts;
inherit (inputs.omnibus.lib) mapPopsExports;
in
mapPopsLayouts pops
mapPopsExports pops
// {
inherit pops;
nixosConfigurations.simple = inputs.nixos-unstable.lib.nixosSystem {
Expand Down
4 changes: 2 additions & 2 deletions tests/nixos/__fixture/layouts.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
let
inherit (inputs) nixpkgs darwin nixos;
# exports.default to be default
outputs = omnibus.lib.mapPopsLayouts' super.pops;
outputs = omnibus.lib.mapPopsExports' super.pops;
# with multi-layout
outputs' = omnibus.lib.mapPopsLayouts super.pops;
outputs' = omnibus.lib.mapPopsExports super.pops;
in
{
system = "x86_64-linux";
Expand Down

0 comments on commit 5b45da0

Please sign in to comment.