Skip to content

Commit

Permalink
chore: rename pops.{...}
Browse files Browse the repository at this point in the history
  • Loading branch information
GTrunSec committed Oct 17, 2023
1 parent 2a1ce85 commit 294c2a9
Show file tree
Hide file tree
Showing 27 changed files with 94 additions and 92 deletions.
58 changes: 31 additions & 27 deletions lib/exporter/flakeOutputs.nix
Original file line number Diff line number Diff line change
@@ -1,38 +1,42 @@
let
outputs =
let
f = p: lib.mapAttrs (_: v: v.layouts.default) (lib.removeAttrs p [ ]);
in
f super.pops
// {
flake-parts = f super.pops.flake-parts;
devshell = f super.pops.devshell;
}
;
outputs = root.mapPopsLayouts super.pops;
in
{
inherit (outputs) srvos;
inherit (outputs)
srvos
nixosModules
nixosProfiles
darwinModules
darwinProfiles
homeProfiles
homeModules
devshellModules
devshellProfiles
;

units = {
inherit (outputs) configs;
nixos = {
inherit (outputs) nixosProfiles nixosModules;
};
darwin = {
inherit (outputs) darwinProfiles darwinModules;
};
home-manager = {
inherit (outputs) homeProfiles homeModules;
};
flake-parts = {
inherit (outputs.flake-parts) profiles modules;
};
devshell = {
inherit (outputs) devshellProfiles devshellModules;
};
};

__inputs__ = super.pops.loadInputs.outputs;

dotfiles = inputs.self.outPath + "/dotfiles";

devshellModules = outputs.devshell.loadModules;
devshellProfiles = outputs.devshell.loadProfiles;

flakePartsProfiles = outputs.flake-parts.loadProfiles;
flakePartsModules = outputs.flake-parts.loadModules;

nixosModules = outputs.loadNixOSModules;
nixosProfiles = outputs.loadNixOSProfiles;

darwinModules = outputs.loadDarwinModules;
darwinProfiles = outputs.loadDarwinProfiles;

homeProfiles = outputs.loadHomeProfiles;
homeModules = outputs.loadHomeModules;
# aliases
__inputs__ = outputs.loadInputs;
flakeModules = outputs.flake-parts.profiles;
flakeProfiles = outputs.flake-parts.modules;
}
51 changes: 31 additions & 20 deletions lib/exporter/pops.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,35 @@ in
inputs.self.outPath + "/local/lock"
);

loadData = flops.haumea.pops.default.setInit {
data = flops.haumea.pops.default.setInit {
loader = with haumea; [
matchers.json
matchers.toml
];
};
loadNixOSModules = flops.haumea.pops.default.setInit {
dataAll =
(self.data.addLoadExtender {
load = {
loader = with haumea; [
(matchers.regex "^(.+)\\.(yaml|yml)$" (
_: _: path:
root.readYAML path
))
];
};
});

nixosModules = flops.haumea.pops.default.setInit {
src = inputs.self.outPath + "/units/nixos/nixosModules";
type = "nixosModules";
inputs = baseInputs;
};
loadHomeModules = flops.haumea.pops.default.setInit {
homeModules = flops.haumea.pops.default.setInit {
src = inputs.self.outPath + "/units/nixos/homeModules";
type = "nixosModules";
inputs = baseInputs;
};
loadHomeProfiles = self.loadHomeModules.addLoadExtender {
homeProfiles = self.homeModules.addLoadExtender {
load = {
src = inputs.self.outPath + "/units/nixos/homeProfiles";
loader = haumea.loaders.scoped;
Expand All @@ -37,21 +49,21 @@ in
};
};

loadNixOSProfiles = self.loadNixOSModules.addLoadExtender {
nixosProfiles = self.nixosModules.addLoadExtender {
load = {
src = inputs.self.outPath + "/units/nixos/nixosProfiles";
type = "nixosProfiles";
transformer = [ (_: _: _) ];
};
};

loadDarwinProfiles = self.loadNixOSProfiles.addLoadExtender {
darwinProfiles = self.nixosProfiles.addLoadExtender {
load = {
src = inputs.self.outPath + "/units/nixos/darwinProfiles";
};
};

loadDarwinModules = self.loadNixOSModules.addLoadExtender {
darwinModules = self.nixosModules.addLoadExtender {
load.src = inputs.self.outPath + "/units/nixos/darwinModules";
};

Expand All @@ -67,27 +79,26 @@ in
transformer = [ (_: _: _) ];
};
flake-parts = {
loadModules = self.loadNixOSModules.addLoadExtender {
modules = self.nixosModules.addLoadExtender {
load.src = inputs.self.outPath + "/units/flake-parts/modules";
};
loadProfiles = self.loadNixOSProfiles.addLoadExtender {
profiles = self.nixosProfiles.addLoadExtender {
load = {
src = inputs.self.outPath + "/units/flake-parts/profiles";
};
};
};
devshell = rec {
loadModules = self.loadNixOSModules.addLoadExtender {
load = {
src = inputs.self.outPath + "/units/devshell/modules";
type = "nixosModules";
};

devshellModules = self.nixosModules.addLoadExtender {
load = {
src = inputs.self.outPath + "/units/devshell/modules";
type = "nixosModules";
};
loadProfiles = self.loadNixOSProfiles.addLoadExtender {
load = {
src = inputs.self.outPath + "/units/devshell/profiles";
type = "nixosProfiles";
};
};
devshellProfiles = self.nixosProfiles.addLoadExtender {
load = {
src = inputs.self.outPath + "/units/devshell/profiles";
type = "nixosProfiles";
};
};

Expand Down
10 changes: 0 additions & 10 deletions lib/loadDataAll.nix

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
inputs,
}:
name:
(omnibus.pops.loadNixOSModules.addLoadExtender {
(omnibus.pops.nixosModules.addLoadExtender {
load = {
src =
root.filterPopsSrc (inputs.self.outPath + "/nixos/hosts/${name}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
inputs,
}:
name:
(omnibus.pops.loadNixOSModules.addLoadExtender {
(omnibus.pops.nixosModules.addLoadExtender {
load = {
src =
root.filterPopsSrc (inputs.self.outPath + "/nixos/hosts/${name}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
inputs,
}:
name:
(omnibus.pops.loadHomeModules.addLoadExtender {
(omnibus.pops.homeModules.addLoadExtender {
load = {
src =
root.filterPopsSrc (inputs.self.outPath + "/nixos/hosts/${name}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
inputs,
}:
name:
(omnibus.pops.loadHomeProfiles.addLoadExtender {
(omnibus.pops.homeProfiles.addLoadExtender {
load = {
src =
root.filterPopsSrc (inputs.self.outPath + "/nixos/hosts/${name}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
inputs,
}:
name:
(omnibus.pops.loadNixOSModules.addLoadExtender {
(omnibus.pops.nixosModules.addLoadExtender {
load = {
src =
root.filterPopsSrc (inputs.self.outPath + "/nixos/hosts/${name}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
inputs,
}:
name:
(omnibus.pops.loadNixOSProfiles.addLoadExtender {
(omnibus.pops.nixosProfiles.addLoadExtender {
load = {
src =
root.filterPopsSrc (inputs.self.outPath + "/nixos/hosts/${name}")
Expand Down
2 changes: 1 addition & 1 deletion templates/nixos/nix/lib/exporter/pops/darwinModules.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(omnibus.pops.loadNixOSModules.addLoadExtender {
(omnibus.pops.nixosModules.addLoadExtender {
load = {
src = inputs.self.outPath + "/nixos/darwinModules";
inputs = {
Expand Down
2 changes: 1 addition & 1 deletion templates/nixos/nix/lib/exporter/pops/darwinProfiles.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(omnibus.pops.loadNixOSModules.addLoadExtender {
(omnibus.pops.nixosModules.addLoadExtender {
load = {
src = inputs.self.outPath + "/nixos/darwinProfiles";
inputs = {
Expand Down
2 changes: 1 addition & 1 deletion templates/nixos/nix/lib/exporter/pops/homeModules.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(omnibus.pops.loadHomeModules.addLoadExtender {
(omnibus.pops.homeModules.addLoadExtender {
load = {
src = inputs.self.outPath + "/nixos/homeModules";
inputs = {
Expand Down
2 changes: 1 addition & 1 deletion templates/nixos/nix/lib/exporter/pops/homeProfiles.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(omnibus.pops.loadHomeProfiles.addLoadExtender {
(omnibus.pops.homeProfiles.addLoadExtender {
load = {
src = inputs.self.outPath + "/nixos/homeProfiles";
inputs = {
Expand Down
2 changes: 1 addition & 1 deletion templates/nixos/nix/lib/exporter/pops/nixosModules.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(omnibus.pops.loadNixOSModules.addLoadExtender {
(omnibus.pops.nixosModules.addLoadExtender {
load = {
src = inputs.self.outPath + "/nixos/nixosModules";
inputs = {
Expand Down
2 changes: 1 addition & 1 deletion templates/nixos/nix/lib/exporter/pops/nixosProfiles.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(omnibus.pops.loadNixOSProfiles.addLoadExtender {
(omnibus.pops.nixosProfiles.addLoadExtender {
load = {
src = inputs.self.outPath + "/nixos/nixosProfiles";
inputs = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
(omnibus.pops.loadHomeModules.addLoadExtender { load = { }; })
(omnibus.pops.homeModules.addLoadExtender { load = { }; })
Original file line number Diff line number Diff line change
@@ -1 +1 @@
(omnibus.pops.loadHomeProfiles.addLoadExtender { load = { }; })
(omnibus.pops.homeProfiles.addLoadExtender { load = { }; })
Original file line number Diff line number Diff line change
@@ -1 +1 @@
(omnibus.pops.loadNixOSModules.addLoadExtender { load = { }; })
(omnibus.pops.nixosModules.addLoadExtender { load = { }; })
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(omnibus.pops.loadNixOSProfiles.addLoadExtender { load = { }; }).addExporters [
(omnibus.pops.nixosProfiles.addLoadExtender { load = { }; }).addExporters [
(POP.extendPop flops.haumea.pops.exporter (
self: super: {
exports.customModules = self.outputs [ {
Expand Down
6 changes: 3 additions & 3 deletions tests/data/expr.nix
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{ omnibus }:
let
inherit (omnibus.__inputs__) nixpkgs;
loadDataAll =
dataAll =
(omnibus.pops.lib.addLoadExtender {
load = {
inputs = {
inputs.nixpkgs = nixpkgs.legacyPackages.x86_64-linux;
};
};
}).layouts.default.loadDataAll;
}).layouts.default.exporter.pops.dataAll;
in
(loadDataAll.addLoadExtender {
(dataAll.addLoadExtender {
load = {
src = ./__fixture;
};
Expand Down
10 changes: 5 additions & 5 deletions tests/devshell/expr.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
let
inputs =
let
loadInputs = omnibus.pops.loadInputs.setInitInputs ./__lock;
baseInputs = omnibus.pops.loadInputs.setInitInputs ./__lock;
in
((loadInputs.addInputsExtender (
((baseInputs.addInputsExtender (
POP.lib.extendPop flops.lib.flake.pops.inputsExtender (
self: super: {
inputs = {
devshell = loadInputs.outputs.devshell.legacyPackages;
nixpkgs = loadInputs.outputs.nixpkgs.legacyPackages;
devshell = baseInputs.outputs.devshell.legacyPackages;
nixpkgs = baseInputs.outputs.nixpkgs.legacyPackages;
};
}
)
Expand All @@ -23,7 +23,7 @@ let
).outputs;

devshellProfiles =
(omnibus.pops.devshell.loadProfiles.addLoadExtender {
(omnibus.pops.devshellProfiles.addLoadExtender {
load.inputs = {
inputs = {
inherit (inputs) fenix nixpkgs;
Expand Down
7 changes: 3 additions & 4 deletions tests/flake-parts/expr.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ let
system
).outputs;

flakePartsProfiles =
(omnibus.pops.flake-parts.loadProfiles.addLoadExtender {
flakeProfiles =
(omnibus.pops.flake-parts.profiles.addLoadExtender {
load = {
inputs = {
inputs = {
Expand All @@ -45,8 +45,7 @@ let
{
systems = [ system ];
imports = [ __inputs__.process-compose-flake.flakeModule ];
perSystem =
{ self', ... }: { imports = [ flakePartsProfiles.sqlite-example ]; };
perSystem = { self', ... }: { imports = [ flakeProfiles.sqlite-example ]; };
};
in
lib.mapAttrs (_: builtins.unsafeDiscardStringContext) {
Expand Down
2 changes: 1 addition & 1 deletion tests/nixos/__fixture/pops/homeModules.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
let
inherit (inputs) dmerge;
in
(omnibus.pops.loadHomeModules.addLoadExtender {
(omnibus.pops.homeModules.addLoadExtender {
load.inputs = {
__misc__ = {
inherit (super.inputs.outputs) catppuccin-bat;
Expand Down
2 changes: 1 addition & 1 deletion tests/nixos/__fixture/pops/homeProfiles.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
let
inherit (inputs) dmerge;
in
(omnibus.pops.loadHomeProfiles.addLoadExtender {
(omnibus.pops.homeProfiles.addLoadExtender {
load.inputs = super.inputs.outputs // {
omnibus = {
homeModules = super.homeModules.layouts.nixosModules;
Expand Down
2 changes: 1 addition & 1 deletion tests/nixos/__fixture/pops/nixosModules.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
let
inherit (inputs) dmerge;
in
(omnibus.pops.loadNixOSModules.addLoadExtender {
(omnibus.pops.nixosModules.addLoadExtender {
load.inputs = super.inputs.outputs // { };
}).addExporters
[
Expand Down
2 changes: 1 addition & 1 deletion tests/nixos/__fixture/pops/nixosProfiles.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
let
inherit (inputs) dmerge;
in
(omnibus.pops.loadNixOSProfiles.addLoadExtender {
(omnibus.pops.nixosProfiles.addLoadExtender {
load = {
inputs = super.inputs.outputs // {
omnibus = {
Expand Down
Loading

0 comments on commit 294c2a9

Please sign in to comment.