Skip to content

Commit

Permalink
refactor: reorg the path struct -4
Browse files Browse the repository at this point in the history
  • Loading branch information
GTrunSec committed Nov 5, 2023
1 parent 9388173 commit c5d0f3c
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 17 deletions.
2 changes: 1 addition & 1 deletion lib/errors/requiredInputs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ let
);

noSysNixpkgs =
if (lib.elem "nixpkgs" listNames) then
if (lib.elem "nixpkgs" listNames && inputs' ? nixpkgs) then
if (lib.hasAttr "path" inputs'.nixpkgs) then true else false
else
true;
Expand Down
1 change: 1 addition & 0 deletions lib/flakeOutputs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ let
outputs = root.mapPopsExports super.pops;
in
{
inherit (super) load;
inherit (outputs)
srvos
nixosModules
Expand Down
6 changes: 6 additions & 0 deletions lib/load.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{ root }:
let
load = root.pops.load;
in
loadCfg:
(load loadCfg).exports.default
6 changes: 5 additions & 1 deletion lib/mapPopsExports'.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{ lib }:
pops:
lib.mapAttrsRecursiveCond ((as: !(as ? "exports"))) (_: v: v.exports) pops
let
cond = (as: !(as ? "exports" && as.exports ? "default"));
pops' = if !cond pops then pops.exports else pops;
in
lib.mapAttrsRecursiveCond cond (_: v: v.exports) pops'
10 changes: 5 additions & 5 deletions lib/mapPopsExports.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{ lib }:
pops:
let
in
# mapAttrsRecursiveCond' =
# cond: f: set:
# let
Expand All @@ -23,6 +21,8 @@ in
# lib.foldl' (a: b: a // b) { } (
# map (attr: f attr set.${attr}) (lib.attrNames set)
# );
lib.mapAttrsRecursiveCond ((as: !(as ? "exports" && as.exports ? "default")))
(_: v: v.exports.default or v)
pops
let
cond = (as: !(as ? "exports" && as.exports ? "default"));
pops' = if !cond pops then pops.exports.default else pops;
in
lib.mapAttrsRecursiveCond cond (_: v: v.exports.default or v) pops'
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/pops/devshellProfiles.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
super.nixosProfiles.addLoadExtender {
load = {
src = inputs.self.outPath + "/units/devshell/profiles";
loaders =
loader =
with haumea;
[ (matchers.nix loaders.default) ]
++ lib.optionals (inputs ? devshell) [
Expand Down
17 changes: 12 additions & 5 deletions lib/pops/scripts.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
let
inherit (inputs) nixpkgs;
in
(super.load {
inputs = {
inherit (inputs) nixpkgs;
inherit (root) makes;
inherit (root.makes) makeScript;
};
inputs =
{
inherit nixpkgs;
inherit (root) makes;
inherit (root.makes) makeScript;
}
// lib.optionalAttrs (inputs ? climod) {
climod = nixpkgs.callPackage inputs.climod { pkgs = nixpkgs; };
};
loader = with haumea; [ (matchers.nix loaders.scoped) ];
transformer = [ (_cursor: dir: if dir ? default then dir.default else dir) ];
})
23 changes: 20 additions & 3 deletions local/lock/flake.lock

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

5 changes: 5 additions & 0 deletions local/lock/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,10 @@
# nixfmt.inputs.nixpkgs.follows = "nixpkgs";
nixfmt.inputs.flake-compat.follows = "";
};

inputs = {
climod.url = "github:nixosbrasil/climod";
climod.flake = false;
};
outputs = _: { };
}
3 changes: 2 additions & 1 deletion units/configs/treefmt.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ let
nixpkgs
nixfmt
;
inherit (dmerge) prepend;
in
with dmerge; {
{
default = {
packages = [
nixfmt.packages.default
Expand Down

0 comments on commit c5d0f3c

Please sign in to comment.