Skip to content

Commit

Permalink
refactor(nixosModules): WIP dmerge with mkMerge
Browse files Browse the repository at this point in the history
  • Loading branch information
GTrunSec committed Sep 21, 2023
1 parent 5dcf2e7 commit 902f479
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions examples/nixos/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ in

# --custom profiles
exporter.nixosProfiles.customProfiles.nix
exporter.nixosModules.customModules.boot
exporter.nixosProfiles.customProfiles.boot

exporter.srvos.default.common.nix
Expand Down
11 changes: 10 additions & 1 deletion examples/nixos/pops/nixosModules.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
.addExporters
[
(POP.extendPop flops.haumea.pops.exporter (
self: super: { exports.customModules = { }; }
self: super: {
exports.customModules.boot =
self.outputsForTarget.dmerge
{
config.loader = {
timeout = 10;
};
}
[ "boot" ];
}
))
]
5 changes: 4 additions & 1 deletion nixos/nixosModules/boot/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ with lib; {
# do we need to import the submodules automatically in imports?
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
(modulesPath + "/virtualisation/google-compute-image.nix")
# (modulesPath + "/virtualisation/google-compute-image.nix")
(loadSubmodule ./systemd-initrd.nix)
({ environment.systemPackages = [ nixpkgs.hello ]; })
];

config = mkMerge [
(mkIf cfg.__profiles__.systemd-boot.enable {
loader = {
Expand All @@ -16,6 +17,8 @@ with lib; {
})
];

# config.loader.timeout = 1;

options = {
__profiles__.speedup = mkOption {
type = types.bool;
Expand Down
3 changes: 2 additions & 1 deletion nixos/nixosProfiles/presets/boot.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
imports = [ POS.nixosModules.boot ];
# imports = [ POS.nixosModules.boot ];
boot.__profiles__.systemd-boot.enable = true;
boot.__profiles__.speedup = true;
}

0 comments on commit 902f479

Please sign in to comment.