From 2cdaf65fb561df47f032b04ba50b388df60aff48 Mon Sep 17 00:00:00 2001 From: Bloxx12 Date: Wed, 9 Apr 2025 15:31:18 +0200 Subject: [PATCH 1/4] boot/module.nix: add timeout option On desktop systems, it is convenient to have the timeout at zero, and just spam space when trying to start a previous generation. On servers however, it is preferable to have some time to choose the generation, which is quite convenient if you have to acess is remotely via a web interface, which tend to be quite slow and unresponsive. --- modules/system/boot/module.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/system/boot/module.nix b/modules/system/boot/module.nix index 275fa5d..bc3eeb1 100644 --- a/modules/system/boot/module.nix +++ b/modules/system/boot/module.nix @@ -5,13 +5,21 @@ ... }: let inherit (lib.modules) mkForce; - inherit (lib.options) mkEnableOption; + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.types) int; cfg = config.modules.system.boot; in { options.modules.system.boot = { grub.enable = mkEnableOption "Grub, a bloated boot loader"; systemd-boot.enable = mkEnableOption "Poetteringboot"; + timeout = mkOption { + description = '' + Set the boot loader's timeout. This is 0 by default, but preferably longer on remote servers to make switching to previous generations easier. + ''; + type = int; + default = 0; + }; }; config = { assertions = [ @@ -33,7 +41,7 @@ in { loader = { efi.canTouchEfiVariables = true; # I love spamming space - timeout = 0; + timeout = cfg.timeout; systemd-boot = { enable = cfg.systemd-boot.enable; editor = mkForce false; From 9be6884e47ea7946f3c325482fe476c7079e6d38 Mon Sep 17 00:00:00 2001 From: Bloxx12 Date: Wed, 9 Apr 2025 15:31:18 +0200 Subject: [PATCH 2/4] tower/configuration.nix: set timeout duration of 30 --- hosts/tower/configuration.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hosts/tower/configuration.nix b/hosts/tower/configuration.nix index 7dfad78..4f5d649 100644 --- a/hosts/tower/configuration.nix +++ b/hosts/tower/configuration.nix @@ -29,8 +29,10 @@ locate.enable = true; }; system = { - boot.grub.enable = true; - services.forgejo.enable = true; + boot = { + grub.enable = true; + timeout = 30; + }; programs = { editors = { helix.enable = true; From 4cfde7f4ff8380bc4bb1b0727ae7fdb8177162ba Mon Sep 17 00:00:00 2001 From: Bloxx12 Date: Wed, 9 Apr 2025 15:31:18 +0200 Subject: [PATCH 3/4] tower/configuration.nix: enable grafana --- hosts/tower/configuration.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hosts/tower/configuration.nix b/hosts/tower/configuration.nix index 4f5d649..daf0937 100644 --- a/hosts/tower/configuration.nix +++ b/hosts/tower/configuration.nix @@ -33,6 +33,10 @@ grub.enable = true; timeout = 30; }; + services = { + forgejo.enable = true; + grafana.enable = true; + }; programs = { editors = { helix.enable = true; From 007093abe2ff2f8ae1c2581e7a30b7e5129b66cf Mon Sep 17 00:00:00 2001 From: Bloxx12 Date: Wed, 9 Apr 2025 15:31:18 +0200 Subject: [PATCH 4/4] forgejo/module.nix: inherit mkEnableOption --- modules/services/forgejo/module.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/services/forgejo/module.nix b/modules/services/forgejo/module.nix index 079441c..95d06c2 100644 --- a/modules/services/forgejo/module.nix +++ b/modules/services/forgejo/module.nix @@ -6,6 +6,7 @@ }: let inherit (pkgs) fetchurl; inherit (lib.modules) mkIf; + inherit (lib.options) mkEnableOption; inherit (config.services.forgejo) customDir user group; cfg = config.modules.system.services.forgejo; @@ -16,7 +17,7 @@ acmeRoot = "/var/lib/acme/challenges-forgejo"; dataDir = "/srv/data/forgejo"; in { - options.modules.system.services.forgejo.enable = lib.mkEnableOption "forgejo"; + options.modules.system.services.forgejo.enable = mkEnableOption "forgejo"; config = mkIf cfg.enable { modules.system.services = {