Skip to content

Commit

Permalink
refactor: simplify lib and clean path
Browse files Browse the repository at this point in the history
  • Loading branch information
GTrunSec committed Oct 19, 2023
1 parent dca17d9 commit da531ef
Show file tree
Hide file tree
Showing 24 changed files with 65 additions and 89 deletions.
4 changes: 2 additions & 2 deletions lib/mkHome.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
inputs,
root,
}:
userSet: shell: suites:
module: userSet: shell: suites:
let
inherit (root.errors.requiredInputs inputs "lib" [ "home-manager" ])
home-manager
Expand All @@ -18,7 +18,7 @@ in
{
imports =
[
home-manager.nixosModules.default
home-manager.${module}
{ users.users = userSet; }
(
{ pkgs, lib, ... }:
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{ root, inputs }:
name:
(root.exporter.pops.nixosModules.addLoadExtender {
load = {
src =
root.filterPopsSrc (inputs.self.outPath + "/units/nixos/hosts/${name}")
"darwinModules";
inputs = {
inputs = inputs;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{ root, inputs }:
(root.exporter.pops.nixosModules.addLoadExtender {
load = {
inputs = {
inputs = inputs;
};
};
})
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
name:
(root.exporter.pops.homeModules.addLoadExtender {
load = {
src =
root.filterPopsSrc (inputs.self.outPath + "/units/nixos/hosts/${name}")
"homeModules";
inputs = {
inputs = inputs;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{ root, inputs }:
name:
(root.exporter.pops.homeProfiles.addLoadExtender {
load = {
src =
root.filterPopsSrc (inputs.self.outPath + "/units/nixos/hosts/${name}")
"homeProfiles";
inputs = {
inputs = inputs;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
name:
(root.exporter.pops.nixosModules.addLoadExtender {
load = {
src =
root.filterPopsSrc (inputs.self.outPath + "/units/nixos/hosts/${name}")
"nixosModules";
inputs = {
inputs = inputs;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{ root, inputs }:
name:
(root.exporter.pops.nixosProfiles.addLoadExtender {
load = {
src =
root.filterPopsSrc (inputs.self.outPath + "/units/nixos/hosts/${name}")
"nixosProfiles";
inputs = {
inputs = inputs;
};
Expand Down
13 changes: 12 additions & 1 deletion templates/hivebus/nix/lib/exporter/pops/hosts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
lib,
inputs,
super,
root,
}:
let
hostsDir = lib.attrNames (
Expand All @@ -12,7 +13,17 @@ lib.listToAttrs (
map
(name: {
inherit name;
value = lib.mapAttrs (_: v: v name) super.hostsFun;
value =
lib.mapAttrs
(
n: v:
v.addLoadExtender {
load.src =
root.filterPopsSrc (inputs.self.outPath + "/units/nixos/hosts/${name}")
n;
}
)
super.hostsLoad;
})
hostsDir
)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
let
inherit (inputs) nixpkgs;
inherit (inputs) nixpkgs darwin;
in
darwin.lib.darwinSystem rec {
system = super.layouts.system;
Expand Down
19 changes: 9 additions & 10 deletions templates/hivebus/units/nixos/hosts/darwin/layouts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,14 @@ in
};

darwinSuites = lib.flatten [
outputs.hosts.nixos.nixosProfiles.bootstrap

outputs.darwinModules.layouts.default.homebrew
# outputs.darwinModules.layouts.default.homebrew
# # # --custom profiles
# outputs.pops.nixosProfiles.layouts.customProfiles.presets.nix
# outputs.pops.nixosProfiles.layouts.customProfiles.presets.boot
# outputs.pops.nixosModules.layouts.customModules.boot

# outputs.srvos.default.common.nix
(outputs.omnibus.lib.mkHome
(outputs.omnibus.lib.mkHome "darwinModule"
{
admin = {
uid = 1000;
Expand All @@ -39,10 +37,11 @@ in
)
];

homeSuites = [
outputs.homeProfiles.presets.emacs
# outputs.homeProfiles.presets.bat
# # # The parent directory of "presets" is categorized as a list type of "suites"
# (outputs.homeProfiles.shell { }).default
];
homeSuites =
[
# outputs.homeProfiles.presets.emacs
# outputs.homeProfiles.presets.bat
# # # The parent directory of "presets" is categorized as a list type of "suites"
# (outputs.homeProfiles.shell { }).default
];
}
2 changes: 1 addition & 1 deletion templates/hivebus/units/nixos/hosts/nixos/layouts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ in
# outputs.pops.nixosModules.layouts.customModules.boot

# outputs.srvos.default.common.nix
(outputs.omnibus.lib.mkHome
(outputs.omnibus.lib.mkHome "nixosModule"
{
admin = {
uid = 1000;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{ root, inputs }:
name:
(root.exporter.pops.nixosModules.addLoadExtender {
load = {
src =
root.filterPopsSrc (inputs.self.outPath + "/units/nixos/hosts/${name}")
"darwinModules";
inputs = {
inputs = inputs;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{ root, inputs }:
(root.exporter.pops.nixosModules.addLoadExtender {
load = {
inputs = {
inputs = inputs;
};
};
})
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
name:
(root.exporter.pops.homeModules.addLoadExtender {
load = {
src =
root.filterPopsSrc (inputs.self.outPath + "/units/nixos/hosts/${name}")
"homeModules";
inputs = {
inputs = inputs;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{ root, inputs }:
name:
(root.exporter.pops.homeProfiles.addLoadExtender {
load = {
src =
root.filterPopsSrc (inputs.self.outPath + "/units/nixos/hosts/${name}")
"homeProfiles";
inputs = {
inputs = inputs;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
name:
(root.exporter.pops.nixosModules.addLoadExtender {
load = {
src =
root.filterPopsSrc (inputs.self.outPath + "/units/nixos/hosts/${name}")
"nixosModules";
inputs = {
inputs = inputs;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{ root, inputs }:
name:
(root.exporter.pops.nixosProfiles.addLoadExtender {
load = {
src =
root.filterPopsSrc (inputs.self.outPath + "/units/nixos/hosts/${name}")
"nixosProfiles";
inputs = {
inputs = inputs;
};
Expand Down
13 changes: 12 additions & 1 deletion templates/nixos/nix/lib/exporter/pops/hosts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
lib,
inputs,
super,
root,
}:
let
hostsDir = lib.attrNames (
Expand All @@ -12,7 +13,17 @@ lib.listToAttrs (
map
(name: {
inherit name;
value = lib.mapAttrs (_: v: v name) super.hostsFun;
value =
lib.mapAttrs
(
n: v:
v.addLoadExtender {
load.src =
root.filterPopsSrc (inputs.self.outPath + "/units/nixos/hosts/${name}")
n;
}
)
super.hostsLoad;
})
hostsDir
)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
let
inherit (inputs) nixpkgs;
inherit (inputs) nixpkgs darwin;
in
darwin.lib.darwinSystem rec {
system = super.layouts.system;
Expand Down
19 changes: 9 additions & 10 deletions templates/nixos/units/nixos/hosts/darwin/layouts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,14 @@ in
};

darwinSuites = lib.flatten [
outputs.hosts.nixos.nixosProfiles.bootstrap

outputs.darwinModules.layouts.default.homebrew
# outputs.darwinModules.layouts.default.homebrew
# # # --custom profiles
# outputs.pops.nixosProfiles.layouts.customProfiles.presets.nix
# outputs.pops.nixosProfiles.layouts.customProfiles.presets.boot
# outputs.pops.nixosModules.layouts.customModules.boot

# outputs.srvos.default.common.nix
(outputs.omnibus.lib.mkHome
(outputs.omnibus.lib.mkHome "darwinModule"
{
admin = {
uid = 1000;
Expand All @@ -39,10 +37,11 @@ in
)
];

homeSuites = [
outputs.homeProfiles.presets.emacs
# outputs.homeProfiles.presets.bat
# # # The parent directory of "presets" is categorized as a list type of "suites"
# (outputs.homeProfiles.shell { }).default
];
homeSuites =
[
# outputs.homeProfiles.presets.emacs
# outputs.homeProfiles.presets.bat
# # # The parent directory of "presets" is categorized as a list type of "suites"
# (outputs.homeProfiles.shell { }).default
];
}
2 changes: 1 addition & 1 deletion templates/nixos/units/nixos/hosts/nixos/layouts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ in
# outputs.pops.nixosModules.layouts.customModules.boot

# outputs.srvos.default.common.nix
(outputs.omnibus.lib.mkHome
(outputs.omnibus.lib.mkHome "nixosModule"
{
admin = {
uid = 1000;
Expand Down
2 changes: 1 addition & 1 deletion tests/nixos/__fixture/layouts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ in
# # exporter.nixosProfiles.customProfiles.presets.boot
# outputs.srvos.default.common.nix

(outputs'.omnibus.lib.mkHome
(outputs'.omnibus.lib.mkHome "nixosModule"
{
admin = {
uid = 1000;
Expand Down

0 comments on commit da531ef

Please sign in to comment.