Skip to content

Commit

Permalink
chore: update flops
Browse files Browse the repository at this point in the history
  • Loading branch information
GTrunSec committed Oct 17, 2023
1 parent 294c2a9 commit 87a84f5
Show file tree
Hide file tree
Showing 30 changed files with 72 additions and 93 deletions.
6 changes: 3 additions & 3 deletions flake.lock

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

2 changes: 1 addition & 1 deletion lib/exporter/flakeOutputs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ in
homeModules
devshellModules
devshellProfiles
flake
;

units = {
Expand All @@ -36,7 +37,6 @@ in
dotfiles = inputs.self.outPath + "/dotfiles";

# aliases
__inputs__ = outputs.loadInputs;
flakeModules = outputs.flake-parts.profiles;
flakeProfiles = outputs.flake-parts.modules;
}
4 changes: 2 additions & 2 deletions lib/exporter/pops.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let
};
in
{
loadInputs = flops.flake.pops.default.setInitInputs (
flake = flops.flake.pops.default.setInitInputs (
inputs.self.outPath + "/local/lock"
);

Expand Down Expand Up @@ -73,7 +73,7 @@ in
};

srvos = flops.haumea.pops.default.setInit {
src = self.loadInputs.outputs.srvos + "/nixos";
src = self.flake.inputs.srvos + "/nixos";
type = "nixosProfiles";
# reset the transformer to the default
transformer = [ (_: _: _) ];
Expand Down
4 changes: 1 addition & 3 deletions lib/mapPopsLayouts'.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{ lib }:
pops:
lib.mapAttrsRecursiveCond ((as: !(as ? "layouts" || as ? "outputs")))
(_: v: v.layouts or v.outputs)
pops
lib.mapAttrsRecursiveCond ((as: !(as ? "layouts"))) (_: v: v.layouts or v) pops
5 changes: 2 additions & 3 deletions lib/mapPopsLayouts.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{ lib }:
pops:
lib.mapAttrsRecursiveCond
((as: !(as ? "layouts" && as.layouts ? "default" || as ? "outputs")))
(_: v: v.layouts.default or v.outputs)
lib.mapAttrsRecursiveCond ((as: !(as ? "layouts" && as.layouts ? "default")))
(_: v: v.layouts.default or v)
pops
2 changes: 1 addition & 1 deletion local/cells/repo/shells.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let
inherit (inputs) nixpkgs;
devshellProfiles =
let
__inptus__ = (inputs.omnibus.pops.loadInputs.setSystem nixpkgs.system).outputs;
__inptus__ = (inputs.omnibus.pops.flake.setSystem nixpkgs.system).inputs;
in
(inputs.omnibus.devshell.loadProfiles.addLoadExtender {
inputs = {
Expand Down
12 changes: 6 additions & 6 deletions templates/nixos/flake.lock

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

12 changes: 9 additions & 3 deletions templates/nixos/nix/lib/exporter/flakeOutputs.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{
lib,
super,
omnibus,
eachSystem,
}:
let
filterConfigs =
config:
Expand All @@ -17,13 +23,13 @@ in
system:
let
inputs' = (super.inputs.setSystem system).outputs;
loadDataAll =
dataAll =
(super.pops.omnibus.lib.addLoadExtender { load.inputs.inputs = inputs'; })
.layouts.default.loadDataAll;
.layouts.default.exporter.pops.loadDataAll;
in
{
data =
(loadDataAll.addLoadExtender { load.src = projectDir + "/local/data"; })
(dataAll.addLoadExtender { load.src = projectDir + "/local/data"; })
.layouts.default;
}
);
Expand Down
2 changes: 1 addition & 1 deletion templates/nixos/nix/lib/exporter/hosts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
load = {
src = inputs.self.outPath + "/nixos/hosts";
inputs = {
inputs = inputs // root.exporter.inputs;
inputs = inputs // root.exporter.pops.flake.inputs;
omnibus = inputs.omnibus // {
self = root.omnibus.lib.layouts.default;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
omnibus,
root,
inputs,
}:
{ root, inputs }:
name:
(omnibus.pops.nixosModules.addLoadExtender {
(root.exporter.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
@@ -1,10 +1,6 @@
{
omnibus,
root,
inputs,
}:
{ root, inputs }:
name:
(omnibus.pops.nixosModules.addLoadExtender {
(root.exporter.nixosModules.addLoadExtender {
load = {
src =
root.filterPopsSrc (inputs.self.outPath + "/nixos/hosts/${name}")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
omnibus,
root,
inputs,
}:
{ root, inputs }:
name:
(omnibus.pops.homeModules.addLoadExtender {
(root.exporter.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
@@ -1,10 +1,6 @@
{
omnibus,
root,
inputs,
}:
{ root, inputs }:
name:
(omnibus.pops.homeProfiles.addLoadExtender {
(root.exporter.homeProfiles.addLoadExtender {
load = {
src =
root.filterPopsSrc (inputs.self.outPath + "/nixos/hosts/${name}")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
omnibus,
root,
inputs,
}:
{ root, inputs }:
name:
(omnibus.pops.nixosModules.addLoadExtender {
(root.exporter.nixosModules.addLoadExtender {
load = {
src =
root.filterPopsSrc (inputs.self.outPath + "/nixos/hosts/${name}")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
omnibus,
root,
inputs,
}:
{ root, inputs }:
name:
(omnibus.pops.nixosProfiles.addLoadExtender {
(root.exporter.pops.nixosProfiles.addLoadExtender {
load = {
src =
root.filterPopsSrc (inputs.self.outPath + "/nixos/hosts/${name}")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
(omnibus.pops.loadInputs.addInputsExtender (
(omnibus.pops.flake.addInputsExtender (
POP.extendPop flops.flake.pops.inputsExtender (
self: super:
let
selfInputs = omnibus.pops.loadInputs.setInitInputs ../__lock;
selfInputs = omnibus.pops.flake.setInitInputs ../../__lock;
in
{
inputs = {
nixpkgs = inputs.nixpkgs.legacyPackages;
} // selfInputs.outputs;
} // selfInputs.inputs;
}
)
))
2 changes: 1 addition & 1 deletion templates/nixos/nix/lib/exporter/pops/omnibus/lib.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
omnibus.pops.lib.addLoadExtender {
load.inputs = {
inputs = inputs // root.exporter.inputs.outputs;
inputs = inputs // root.exporter.pops.flake.inputs;
};
}
2 changes: 1 addition & 1 deletion templates/nixos/nix/lib/filterPopsSrc.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ lib, root }:
src: dir:
let
inherit (root.exporter.inputs.outputs) nix-filter;
inherit (root.exporter.pops.flake.inputs) nix-filter;
popsDirs = lib.attrNames (
lib.removeAttrs root.exporter.pops [
"hosts"
Expand Down
4 changes: 2 additions & 2 deletions templates/nixos/nixos/hosts/nixos/layouts.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
let
outputs = inputs.self;
host = inputs.self.hosts.nixos;
self' = inputs.self.hosts.nixos;
in
{
system = "x86_64-linux";

data = outputs.data.default;

nixosSuites = lib.flatten [
host.nixosProfiles.bootstrap
self'.nixosProfiles.bootstrap

outputs.nixosProfiles.presets.boot
# outputs.nixosModules.default.programs.git
Expand Down
2 changes: 1 addition & 1 deletion tests/data/expr.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ omnibus }:
let
inherit (omnibus.__inputs__) nixpkgs;
inherit (omnibus.flake.inputs) nixpkgs;
dataAll =
(omnibus.pops.lib.addLoadExtender {
load = {
Expand Down
8 changes: 4 additions & 4 deletions tests/devshell/expr.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
let
inputs =
let
baseInputs = omnibus.pops.loadInputs.setInitInputs ./__lock;
baseInputs = omnibus.pops.flake.setInitInputs ./__lock;
in
((baseInputs.addInputsExtender (
POP.lib.extendPop flops.lib.flake.pops.inputsExtender (
self: super: {
inputs = {
devshell = baseInputs.outputs.devshell.legacyPackages;
nixpkgs = baseInputs.outputs.nixpkgs.legacyPackages;
devshell = baseInputs.inputs.devshell.legacyPackages;
nixpkgs = baseInputs.inputs.nixpkgs.legacyPackages;
};
}
)
)).setSystem
"x86_64-linux"
).outputs;
).inputs;

devshellProfiles =
(omnibus.pops.devshellProfiles.addLoadExtender {
Expand Down
18 changes: 9 additions & 9 deletions tests/flake-parts/expr.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,44 @@
}:
let
system = "x86_64-linux";
__inputs__ =
flake.inputs =
let
loadInputs = omnibus.pops.loadInputs.setInitInputs ./__lock;
flake = omnibus.pops.flake.setInitInputs ./__lock;
in
((loadInputs.addInputsExtender (
((flake.addInputsExtender (
POP.lib.extendPop flops.lib.flake.pops.inputsExtender (
self: super: {
inputs = {
nixpkgs = loadInputs.outputs.nixpkgs.legacyPackages;
nixpkgs = flake.inputs.nixpkgs.legacyPackages;
};
}
)
)).setSystem
system
).outputs;
).inputs;

flakeProfiles =
(omnibus.pops.flake-parts.profiles.addLoadExtender {
load = {
inputs = {
inputs = {
inherit (__inputs__) chinookDb;
inherit (flake.inputs) chinookDb;
};
};
};
}).layouts.default.process-compose;

mkFlake =
__inputs__.flake-parts.lib.mkFlake
flake.inputs.flake-parts.lib.mkFlake
{
inputs = __inputs__ // {
inputs = flake.inputs // {
# fake self argument to make sure that the flake is
self = inputs.self;
};
}
{
systems = [ system ];
imports = [ __inputs__.process-compose-flake.flakeModule ];
imports = [ flake.inputs.process-compose-flake.flakeModule ];
perSystem = { self', ... }: { imports = [ flakeProfiles.sqlite-example ]; };
};
in
Expand Down
2 changes: 1 addition & 1 deletion tests/makes/expr.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ omnibus, lib }:
let
inherit (omnibus.__inputs__) nixpkgs makes;
inherit (omnibus.flake.inputs) nixpkgs makes;
makesLib =
(omnibus.pops.lib.addLoadExtender {
load = {
Expand Down
2 changes: 1 addition & 1 deletion tests/nixos/__fixture/pops/homeModules.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ in
(omnibus.pops.homeModules.addLoadExtender {
load.inputs = {
__misc__ = {
inherit (super.inputs.outputs) catppuccin-bat;
inherit (super.inputs.inputs) catppuccin-bat;
};
};
}).addExporters
Expand Down
4 changes: 2 additions & 2 deletions tests/nixos/__fixture/pops/homeProfiles.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ let
inherit (inputs) dmerge;
in
(omnibus.pops.homeProfiles.addLoadExtender {
load.inputs = super.inputs.outputs // {
load.inputs = super.inputs.inputs // {
omnibus = {
homeModules = super.homeModules.layouts.nixosModules;
};
inputs = {
inherit (omnibus.__inputs__) nur;
inherit (omnibus.flake.inputs) nur;
};
};
}).addExporters
Expand Down
Loading

0 comments on commit 87a84f5

Please sign in to comment.