Skip to content

Commit

Permalink
feat: WIP add nixos example
Browse files Browse the repository at this point in the history
  • Loading branch information
GTrunSec committed Oct 4, 2023
1 parent f35be63 commit c2b9c06
Show file tree
Hide file tree
Showing 13 changed files with 73 additions and 62 deletions.
9 changes: 8 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}@inputs:
let
omnibus = self.lib // {
lib = self.lib.lib;
lib = lib.outputs.default;
};
lib = flops.lib.haumea.pops.default.setInit {
src = ./lib;
Expand Down Expand Up @@ -124,5 +124,12 @@
inherit omnibus;
};
};
templates.nixos = {
path = ./templates/nixos;
description = "Omnibus & nixos";
welcomeText = ''
You have created a Omnibus.nixos template!
'';
};
};
}
4 changes: 1 addition & 3 deletions templates/nixos/lib/exporters.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ in
(inputs.omnibus.exporters.addLoadExtender {
src = ../nixos/hosts;
inputs = inputs // {
self' = {
inherit (super) inputs;
};
self'.lib = super;
omnibus = inputs.omnibus.lib // {
lib = super.omnibus.lib.outputs.default;
};
Expand Down
14 changes: 12 additions & 2 deletions templates/nixos/lib/nixos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,20 @@
(omnibus.loadHomeModules.addLoadExtender { src = ../nixos/homeModules; });

loadHomeProfiles =
(omnibus.loadHomeProfiles.addLoadExtender { src = ../nixos/homeProfiles; });
(omnibus.loadHomeProfiles.addLoadExtender {
src = ../nixos/homeProfiles;
inputs = {
homeModules = self.loadHomeModules.outputs.default;
};
});

loadNixOSProfiles =
(omnibus.loadNixOSProfiles.addLoadExtender { src = ../nixos/nixosProfiles; });
(omnibus.loadNixOSProfiles.addLoadExtender {
src = ../nixos/nixosProfiles;
inputs = {
nixosModules = self.loadNixOSModules.outputs.default;
};
});

loadNixOSModules =
(omnibus.loadNixOSModules.addLoadExtender { src = ../nixos/nixosModules; });
Expand Down
1 change: 1 addition & 0 deletions templates/nixos/nixos/darwinModules/services/yabai.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ }
1 change: 1 addition & 0 deletions templates/nixos/nixos/darwinProfiles/presets/yabai.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ servcies.yabai.enable = true; }
8 changes: 8 additions & 0 deletions templates/nixos/nixos/homeModules/programs/emacs.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
options.__profiles__ = with lib; {
test = mkOption {
type = types.str;
default = "test";
};
};
}
4 changes: 4 additions & 0 deletions templates/nixos/nixos/homeProfiles/presets/emacs.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
imports = [ homeModules.programs.emacs ];
programs.emacs.__profiles__.test = "profile.test";
}
17 changes: 8 additions & 9 deletions templates/nixos/nixos/hosts/nixos/layouts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ in
nixosSuites = lib.flatten [
# outputs.selfNixOSProfiles.default.bootstrap

# # self.nixosProfiles.default.presets.boot
outputs.nixosProfiles.default.presets.boot
# outputs.nixosModules.default.programs.git

# # # --custom profiles
Expand All @@ -34,12 +34,11 @@ in
)
];

homeSuites =
[
# outputs.homeProfiles.customProfiles.presets.hyprland
# outputs.homeProfiles.default.presets.bat
# # # The parent directory of "presets" is categorized as a list type of "suites"
# (outputs.homeProfiles.default.shell { }).default
# super.pops.homeModules.outputs.default.wayland.windowManager.hyprland
];
homeSuites = [
outputs.homeProfiles.default.presets.emacs
# outputs.homeProfiles.default.presets.bat
# # # The parent directory of "presets" is categorized as a list type of "suites"
# (outputs.homeProfiles.default.shell { }).default
# super.pops.homeModules.outputs.default.wayland.windowManager.hyprland
];
}
9 changes: 2 additions & 7 deletions templates/nixos/nixos/hosts/nixos/pops/homeProfiles.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
(omnibus.loadHomeProfiles.addLoadExtender {
inputs = super.inputs.outputs // {
omnibus = {
homeModules = super.homeModules.outputs.nixosModules;
};
};
}).addExporters
(self'.lib.nixos.loadHomeProfiles.addLoadExtender { inputs = { }; })
.addExporters
[
(POP.extendPop flops.haumea.pops.exporter (
self: super: {
Expand Down
7 changes: 2 additions & 5 deletions templates/nixos/nixos/hosts/nixos/pops/inputs.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
(self'.inputs.loadInputs.addInputsExtender (
(self'.lib.inputs.addInputsExtender (
POP.extendPop flops.flake.pops.inputsExtender (
self: super:
let
selfInputs = omnibus.loadInputs.setInitInputs ../__lock;
in
{
inputs = {
std = local.outputs.std;
nixpkgs = omnibus.loadInputs.outputs.nixpkgs.legacyPackages;
} // selfInputs.outputs;
inputs = { } // selfInputs.outputs;
}
)
)).setSystem
Expand Down
49 changes: 14 additions & 35 deletions templates/nixos/nixos/hosts/nixos/pops/nixosProfiles.nix
Original file line number Diff line number Diff line change
@@ -1,41 +1,20 @@
(omnibus.loadNixOSProfiles.addLoadExtender {
inputs = super.inputs.outputs // {
omnibus = {
nixosModules = super.nixosModules.outputs.nixosModules;
};
};
}).addExporters
(self'.lib.nixos.loadNixOSProfiles.addLoadExtender { inputs = { }; })
.addExporters
[
(POP.extendPop flops.haumea.pops.exporter (
self: super: {
exports.customProfiles = self.outputs.__extenders [
{
value =
{ selfModule' }:
selfModule' (
m:
dmerge m {
nix.extraOptions = ''
allowed-uris = https://github.com/
'';
}
);
path = [
"presets"
"nix"
];
}
{
# boot.__profiles__.systemd-initrd.enable = true;
value =
{ selfModule' }:
selfModule' (m: dmerge m { boot.__profiles__.systemd-boot.enable = true; });
path = [
"presets"
"boot"
];
}
];
exports.customProfiles = self.outputs.__extenders [ {
# boot.__profiles__.systemd-initrd.enable = true;
value =
{ selfModule' }:
selfModule' (
m: dmerge m { boot.__profiles__.test = "nixosProfiles.test with Dmerge"; }
);
path = [
"presets"
"boot"
];
} ];
}
))
]
8 changes: 8 additions & 0 deletions templates/nixos/nixos/nixosModules/boot.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
options.__profiles__ = with lib; {
test = mkOption {
type = types.str;
default = "test";
};
};
}
4 changes: 4 additions & 0 deletions templates/nixos/nixos/nixosProfiles/presets/boot.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
imports = [ nixosModules.boot ];
boot.__profiles__.test = "nixosProfiles.boot";
}

0 comments on commit c2b9c06

Please sign in to comment.