From 0f7638ad401c1e800cce174e002e4a8b0c3b1fdf Mon Sep 17 00:00:00 2001 From: Julia Lange Date: Tue, 24 Dec 2024 17:06:05 -0800 Subject: [PATCH] OS, add Non-EFI Support --- nixosModules/automatic/default.nix | 98 ++++++++++++++++-------------- 1 file changed, 53 insertions(+), 45 deletions(-) diff --git a/nixosModules/automatic/default.nix b/nixosModules/automatic/default.nix index a61ce29..007bfc3 100644 --- a/nixosModules/automatic/default.nix +++ b/nixosModules/automatic/default.nix @@ -4,60 +4,68 @@ options = { system.timezone = lib.mkOption { default = "America/Los_Angeles"; }; system.extraFonts = lib.mkOption { default = []; }; + system.isNonEFI = lib.mkEnableOption + "Enable if you are running a non-EFI system"; system.users.bigWheels = lib.mkOption { default = []; }; }; + + config = lib.mkMerge [ + (lib.mkIf config.system.isNonEFI { + boot.loader.grub.enable = false; + boot.loader.generic-extlinux-compatible.enable = true; + }) + (lib.mkIf (!config.system.isNonEFI) { + boot.kernelPackages = pkgs.linuxPackages_latest; + boot.loader.systemd-boot.enable = true; + boot.loader.timeout = 1; + boot.loader.efi.canTouchEfiVariables = true; + }) + { + networking.hostName = hostname; + system.stateVersion = "23.05"; - config = { - # Use the systemd-boot EFI boot loader. - boot.kernelPackages = pkgs.linuxPackages_latest; - boot.loader.systemd-boot.enable = true; - boot.loader.timeout = 1; - boot.loader.efi.canTouchEfiVariables = true; + time.timeZone = config.system.timezone; + i18n.defaultLocale = "en_US.UTF-8"; - networking.hostName = hostname; - system.stateVersion = "23.05"; + # Packages & Default Packages + nixpkgs.config.allowUnfree = true; + environment.systemPackages = with pkgs; [ + git + neovim + nnn + xdg-user-dirs + ]; - time.timeZone = config.system.timezone; - i18n.defaultLocale = "en_US.UTF-8"; + # XDG Compliance + nix.settings.use-xdg-base-directories = true; - # Packages & Default Packages - nixpkgs.config.allowUnfree = true; - environment.systemPackages = with pkgs; [ - git - neovim - nnn - xdg-user-dirs - ]; - - # XDG Compliance - nix.settings.use-xdg-base-directories = true; - - users = { - users = builtins.listToAttrs (map ( - user: { - name = user; - value = { + users = { + users = builtins.listToAttrs (map ( + user: { name = user; - isNormalUser = true; - extraGroups = [ "network" ]; + value = { + name = user; + isNormalUser = true; + extraGroups = [ "network" ]; + }; + } + ) usernameList); + groups = { + wheel = { + members = config.system.users.bigWheels; }; - } - ) usernameList); - groups = { - wheel = { - members = config.system.users.bigWheels; + network = { }; }; - network = { }; }; - }; - fonts = { - enableDefaultPackages = true; - packages = with pkgs; [ - cascadia-code - (nerdfonts.override { fonts = [ "CascadiaCode" ]; }) - source-han-sans # Pan-CJK font - ] ++ config.system.extraFonts; - }; - }; + fonts = { + enableDefaultPackages = true; + packages = with pkgs; [ + cascadia-code + (nerdfonts.override { fonts = [ "CascadiaCode" ]; }) + source-han-sans # Pan-CJK font + ] ++ config.system.extraFonts; + }; + } + ]; }