Skip to content

Commit

Permalink
refactor(pops/nixos&homeProfiles): add exports.omnibus -> exportsOmni…
Browse files Browse the repository at this point in the history
…busProfiles
  • Loading branch information
GTrunSec committed Nov 10, 2023
1 parent 35eec70 commit 4d7a847
Show file tree
Hide file tree
Showing 8 changed files with 110 additions and 18 deletions.
4 changes: 4 additions & 0 deletions docs/org/homeProfiles.org
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

* Suites
** shell
:PROPERTIES:
:ID: cbe34da3-ffbb-423c-aee4-d0cd71af51e4
:END:

#+begin_src nix :tangle (concat (org-entry-get nil "PRJ-DIR" t) "/shell.nix")
{
Expand All @@ -36,6 +39,7 @@ with presets; {
self.utils
# ------------------------------
zoxide
atuin
fzf
starship.default
dircolors.default
Expand Down
19 changes: 10 additions & 9 deletions docs/org/nixosProfiles.org
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,21 @@
omnibus,
POP,
flops,
inputs,
}:
let
srvosCustom =
(omnibus.pops.srvos.addExporters [
(POP.extendPop flops.haumea.pops.exporter (
self: super: {
exports.srvosCustom = self.outputs [ {
value = { selfModule }: removeAttrs selfModule [ "imports" ];
path = [
"common"
"default"
];
} ];
self: _super: {
exports.srvosCustom = self.outputs [
{
value = { selfModule }: removeAttrs selfModule [ "imports" ];
path = [
"common"
"default"
];
}
];
}
))
]).layouts.srvosCustom;
Expand Down
50 changes: 50 additions & 0 deletions docs/org/omnibus.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
:PROPERTIES:
:ID: 4fc2b30f-8b6a-4cbc-a04f-24140296639b
:END:
#+title: Omnibus







* POPS Interface

** [[id:55e5de92-922e-4e91-aa8c-c8121545aac8][nixosProfiles]] :style:

In the style of nixos/homeProfiles in OmniBus, the "toplevel" directory is used to store the categorized suites, while the "presets" folder is to store the themes, Each theme is named based on the *file name/folder name* for configuration purposes. The *folders/files* within this theme folder can contain one or more profiles associated with that theme. These profiles are then collected and further categorized within the attributes of the "toplevel" directory.



#+begin_src sh :exports both
tree $PRJ_ROOT/units/nixos/nixosProfiles -L 1
#+end_src

#+RESULTS:
| /home/guangtao/ghq/github.com/GTrunSec/omnibus/units/nixos/nixosProfiles | | | |
| ├── | bootstrap.nix | | |
| ├── | cloud.nix | | |
| ├── | dev.nix | | |
| ├── | hardware.nix | | |
| └── | presets | | |
| | | | |
| 2 | directories, | 4 | files |


- layouts
- suites: [[id:cbe34da3-ffbb-423c-aee4-d0cd71af51e4][shell]]

- exports
- omnibus (outputs the profiles with our style principle)
- default (vanilla nixosProfiles layouts)

#+begin_src nix
# theme-related profile
homeProfiles.default.presets.bat
# can be stored more than one profiles under this topic/theme
homeProfiles.default.presets.bat.default
homeProfiles.default.presets.bat."<custom>"
# suite type
homeProfiles.exports.omnibus.shell.default
#+end_src
1 change: 1 addition & 0 deletions local/cells/repo/shells.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ in
nixpkgs.d2
nixpkgs.statix
nixpkgs.deadnix
nixpkgs.tree
];

commands = [ ];
Expand Down
19 changes: 19 additions & 0 deletions src/pops/_exportsOmnibusProfiles.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{ lib }:
self:
(self.addLoadExtender {
load = {
transformer = [
(
cursor: mod:
let
trace = x: lib.trace x x;
toplevel = cursor == [ ];
in
if toplevel then
lib.mapAttrs (n: v: (if lib.isAttrs v then v else v { })) mod
else
mod
)
];
};
}).exports.default
11 changes: 10 additions & 1 deletion src/pops/homeProfiles.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,13 @@
type = "nixosProfiles";
transformer = [ (_: _: _) ];
};
})
}).addExporters
[
(POP.extendPop flops.haumea.pops.exporter (
_self: _super: {
exports = {
omnibus = super.exportsOmnibusProfiles self;
};
}
))
]
11 changes: 10 additions & 1 deletion src/pops/nixosProfiles.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,13 @@
type = "nixosProfiles";
transformer = [ (_: _: _) ];
};
})
}).addExporters
[
(POP.extendPop flops.haumea.pops.exporter (
_self: _super: {
exports = {
omnibus = super.exportsOmnibusProfiles self;
};
}
))
]
13 changes: 6 additions & 7 deletions tests/nixos/__fixture/layouts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,12 @@ in
)
];

homeSuites =
[
# exporter.homeProfiles.default.presets.bat
# # The parent directory of "presets" is categorized as a list type of "suites"
# (exporter.homeProfiles.default.shell { }).default
# super.pops.homeModules.exports.default.wayland.windowManager.hyprland
];
homeSuites = [
# exporter.homeProfiles.default.presets.bat
# # The parent directory of "presets" is categorized as a list type of "suites"
outputs.homeProfiles.omnibus.shell.default
# super.pops.homeModules.exports.default.wayland.windowManager.hyprland
];

nixosConfiguration =
module:
Expand Down

0 comments on commit 4d7a847

Please sign in to comment.