From 2d7868490c1b9591913dc456676dda8140702aee Mon Sep 17 00:00:00 2001 From: James Patrick Date: Wed, 15 Dec 2021 00:04:57 -0500 Subject: [PATCH] Refactored boot --- modules/boot.nix | 10 ---------- modules/default.nix | 1 - modules/profiles/graphical.nix | 1 - modules/profiles/laptop.nix | 3 ++- modules/system/boot.nix | 22 ++++++++++++++++++++++ modules/system/default.nix | 4 +++- 6 files changed, 27 insertions(+), 14 deletions(-) delete mode 100644 modules/boot.nix create mode 100644 modules/system/boot.nix diff --git a/modules/boot.nix b/modules/boot.nix deleted file mode 100644 index 354607f..0000000 --- a/modules/boot.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ config, lib, ... }: { - boot = { - # Enable bootloader & clear /tmp on boot. - cleanTmpDir = true; - loader = { - systemd-boot.enable = true; - efi.canTouchEfiVariables = true; - }; - }; -} diff --git a/modules/default.nix b/modules/default.nix index ea175cf..fef1693 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -13,7 +13,6 @@ ./system ./applications # TODO Refactor everything after this. - ./boot.nix ./cli.nix ./fonts.nix ./zfs.nix diff --git a/modules/profiles/graphical.nix b/modules/profiles/graphical.nix index fd50e17..427ca15 100644 --- a/modules/profiles/graphical.nix +++ b/modules/profiles/graphical.nix @@ -5,7 +5,6 @@ in { imports = [ ../applications/firefox.nix ../applications/nextcloud.nix - ../boot.nix ../cli.nix ../fonts.nix ../system/gtk.nix diff --git a/modules/profiles/laptop.nix b/modules/profiles/laptop.nix index 1c61f21..6072560 100644 --- a/modules/profiles/laptop.nix +++ b/modules/profiles/laptop.nix @@ -1,6 +1,7 @@ -{ config, lib, pkgs, modulesPath, ... }: { +{ config, lib, pkgs, ... }: { imports = [ ./graphical.nix ]; + this.systems.boot.enable = true; networking.networkmanager.enable = true; users.users.james.extraGroups = [ "networkmanager" ]; } diff --git a/modules/system/boot.nix b/modules/system/boot.nix new file mode 100644 index 0000000..19f4ae6 --- /dev/null +++ b/modules/system/boot.nix @@ -0,0 +1,22 @@ +{ config, lib, pkgs, ... }: +let cfg = config.this.systems.boot; +in with lib; { + options.this.systems.boot = { + enable = mkOption { + default = true; + type = with types; bool; + description = "Is there a physical power button?"; + }; + }; + + config = mkIf cfg.enable { + boot = { + # Enable bootloader & clear /tmp on boot. + cleanTmpDir = true; + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + }; + }; +} diff --git a/modules/system/default.nix b/modules/system/default.nix index ef5efd2..b139094 100644 --- a/modules/system/default.nix +++ b/modules/system/default.nix @@ -1 +1,3 @@ -{ config, pkgs, ... }: { imports = [ ./gtk.nix ./xdg.nix ./flatpak.nix ]; } +{ config, pkgs, ... }: { + imports = [ ./gtk.nix ./boot.nix ./xdg.nix ./flatpak.nix ]; +}