Update env
This commit is contained in:
parent
37baf240ab
commit
4ccddab132
5 changed files with 196 additions and 0 deletions
43
flake.lock
generated
43
flake.lock
generated
|
|
@ -68,6 +68,27 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"double-minegrub-menu": {
|
||||||
|
"inputs": {
|
||||||
|
"minegrub-world-sel-theme": "minegrub-world-sel-theme",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1792109327,
|
||||||
|
"narHash": "sha256-VhZ4Jw6xmvnIo+thPoWIr7SOILDVPkWTWMqlbB30doE=",
|
||||||
|
"owner": "Lxtharia",
|
||||||
|
"repo": "double-minegrub-menu",
|
||||||
|
"rev": "c10fd20713db2f002645a4c709b153964cac77cd",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "Lxtharia",
|
||||||
|
"repo": "double-minegrub-menu",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"firefox-gnome-theme": {
|
"firefox-gnome-theme": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
|
@ -291,6 +312,27 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"minegrub-world-sel-theme": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"double-minegrub-menu",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1791975566,
|
||||||
|
"narHash": "sha256-4zW6sdKTDLX599XR4elbEa3jUySDD0j3y3EMJdyorKg=",
|
||||||
|
"owner": "Lxtharia",
|
||||||
|
"repo": "minegrub-world-sel-theme",
|
||||||
|
"rev": "556211de8a2de580d6cb9a14f0bf3b85c851df1f",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "Lxtharia",
|
||||||
|
"repo": "minegrub-world-sel-theme",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"mkdocs-catppuccin": {
|
"mkdocs-catppuccin": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
|
@ -554,6 +596,7 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"double-minegrub-menu": "double-minegrub-menu",
|
||||||
"flake-parts": "flake-parts",
|
"flake-parts": "flake-parts",
|
||||||
"hardware": "hardware",
|
"hardware": "hardware",
|
||||||
"helix-plugins": "helix-plugins",
|
"helix-plugins": "helix-plugins",
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,12 @@
|
||||||
# nix hardware - https://github.com/NixOS/nixos-hardware
|
# nix hardware - https://github.com/NixOS/nixos-hardware
|
||||||
hardware.url = "github:nixos/nixos-hardware";
|
hardware.url = "github:nixos/nixos-hardware";
|
||||||
|
|
||||||
|
# Minecraft-themed GRUB double-menu module
|
||||||
|
double-minegrub-menu = {
|
||||||
|
url = "github:Lxtharia/double-minegrub-menu";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
# dendritic stuff - https://github.com/mightyiam/dendritic
|
# dendritic stuff - https://github.com/mightyiam/dendritic
|
||||||
# flake parts - https://github.com/hercules-ci/flake-parts
|
# flake parts - https://github.com/hercules-ci/flake-parts
|
||||||
# import tree - https://github.com/denful/import-tree
|
# import tree - https://github.com/denful/import-tree
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,8 @@
|
||||||
# machine hardware and settings
|
# machine hardware and settings
|
||||||
fractal-configuration
|
fractal-configuration
|
||||||
fractal-hardware
|
fractal-hardware
|
||||||
|
inputs.double-minegrub-menu.inputs.minegrub-world-sel-theme.nixosModules.default
|
||||||
|
double-minegrub-menu
|
||||||
|
|
||||||
# selected features for this desktop
|
# selected features for this desktop
|
||||||
network-proxy
|
network-proxy
|
||||||
|
|
@ -45,12 +47,20 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
device = "nodev";
|
device = "nodev";
|
||||||
efiSupport = true;
|
efiSupport = true;
|
||||||
|
double-minegrub-menu = {
|
||||||
|
enable = true;
|
||||||
|
main_menu_background = "random";
|
||||||
|
splash_text = "100% Declarative";
|
||||||
|
world_selection_background_scaled = "1920x1080";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
efi.canTouchEfiVariables = true;
|
efi.canTouchEfiVariables = true;
|
||||||
timeout = lib.mkDefault 5;
|
timeout = lib.mkDefault 5;
|
||||||
};
|
};
|
||||||
initrd.systemd.enable = true;
|
initrd.systemd.enable = true;
|
||||||
};
|
};
|
||||||
|
# Minegrub supplies its own GRUB theme; don't layer Stylix's GRUB theme over it.
|
||||||
|
stylix.targets.grub.enable = false;
|
||||||
|
|
||||||
hardware.enableRedistributableFirmware = true;
|
hardware.enableRedistributableFirmware = true;
|
||||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||||
|
|
|
||||||
117
modules/system/hosts/fractal/double-minegrub-menu.nix
Normal file
117
modules/system/hosts/fractal/double-minegrub-menu.nix
Normal file
|
|
@ -0,0 +1,117 @@
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
flake.nixosModules.double-minegrub-menu =
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.boot.loader.grub.double-minegrub-menu;
|
||||||
|
|
||||||
|
backgroundArg =
|
||||||
|
if cfg.main_menu_background == "random" then ""
|
||||||
|
else "backgrounds/${cfg.main_menu_background}";
|
||||||
|
splashTextArg = if cfg.splash_text == "random" then "" else cfg.splash_text;
|
||||||
|
|
||||||
|
minegrubTheme = pkgs.fetchFromGitHub {
|
||||||
|
owner = "Lxtharia";
|
||||||
|
repo = "minegrub-theme";
|
||||||
|
rev = "v3.1.0";
|
||||||
|
# Correct source hash for v3.1.0 (the upstream module's hash is stale).
|
||||||
|
hash = "sha256-+7b0jXVVAyIAtYKeZZONZv2qzfESjwITSng1TVjyAfQ=";
|
||||||
|
};
|
||||||
|
|
||||||
|
pythonEnv = pkgs.python313.withPackages (pythonPackages: [ pythonPackages.pillow ]);
|
||||||
|
fakeFastfetch = pkgs.writeShellScriptBin "fastfetch" ''
|
||||||
|
package_count=$(ls -d /nix/var/nix/profiles/system/sw/bin/* 2>/dev/null | wc -l)
|
||||||
|
echo "Packages: $package_count (nix)"
|
||||||
|
'';
|
||||||
|
|
||||||
|
minegrubUpdate = pkgs.writeShellScriptBin "minegrub-update" ''
|
||||||
|
cd /boot/grub/themes/minegrub
|
||||||
|
export PATH="${fakeFastfetch}/bin:${pythonEnv}/bin:$PATH"
|
||||||
|
exec ${pythonEnv}/bin/python3 update_theme.py \
|
||||||
|
${lib.escapeShellArg backgroundArg} \
|
||||||
|
${lib.escapeShellArg splashTextArg}
|
||||||
|
'';
|
||||||
|
|
||||||
|
themeDir = "${minegrubTheme}/minegrub";
|
||||||
|
backgroundDir = "${minegrubTheme}/background_options";
|
||||||
|
themeFiles = builtins.listToAttrs (map
|
||||||
|
(file: {
|
||||||
|
name = builtins.unsafeDiscardStringContext
|
||||||
|
("grub/themes/minegrub" + lib.removePrefix (toString themeDir) (toString file));
|
||||||
|
value = file;
|
||||||
|
})
|
||||||
|
(lib.filesystem.listFilesRecursive themeDir));
|
||||||
|
backgroundFiles = builtins.listToAttrs (map
|
||||||
|
(file: {
|
||||||
|
name = builtins.unsafeDiscardStringContext
|
||||||
|
("grub/themes/minegrub/backgrounds" + lib.removePrefix (toString backgroundDir) (toString file));
|
||||||
|
value = file;
|
||||||
|
})
|
||||||
|
(lib.filesystem.listFilesRecursive backgroundDir));
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.boot.loader.grub.double-minegrub-menu = {
|
||||||
|
enable = lib.mkEnableOption "the Minegrub double menu";
|
||||||
|
main_menu_background = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "random";
|
||||||
|
description = "Main menu background asset, or random.";
|
||||||
|
};
|
||||||
|
splash_text = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "random";
|
||||||
|
description = "Main menu splash text, or random.";
|
||||||
|
};
|
||||||
|
world_selection_custom_icons = lib.mkOption {
|
||||||
|
type = lib.types.listOf (lib.types.attrsOf lib.types.anything);
|
||||||
|
default = [ ];
|
||||||
|
description = "Custom icons for the world-selection menu.";
|
||||||
|
};
|
||||||
|
world_selection_background_scaled = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "1920x1080";
|
||||||
|
description = "World-selection background resolution.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
boot.loader.grub = {
|
||||||
|
minegrub-world-sel = {
|
||||||
|
enable = true;
|
||||||
|
customIcons = cfg.world_selection_custom_icons;
|
||||||
|
background = "assets/background-scaled/background-${cfg.world_selection_background_scaled}.png";
|
||||||
|
};
|
||||||
|
extraFiles = {
|
||||||
|
"grub/mainmenu.cfg" = ./mainmenu.cfg;
|
||||||
|
} // themeFiles // backgroundFiles;
|
||||||
|
extraConfig = ''
|
||||||
|
if [ -z "$chosen" ] ; then
|
||||||
|
if [ "''${config_file}" ] ; then
|
||||||
|
configfile $prefix/$config_file
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = [ minegrubUpdate ];
|
||||||
|
systemd.services.minegrub-update = {
|
||||||
|
description = "Update Minegrub splash text and background";
|
||||||
|
after = [ "local-fs.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
ExecStart = "${minegrubUpdate}/bin/minegrub-update";
|
||||||
|
User = "root";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Set the GRUB environment variable needed to select the main menu.
|
||||||
|
system.activationScripts.minegrub-menu = {
|
||||||
|
deps = [ "specialfs" ];
|
||||||
|
text = ''
|
||||||
|
${pkgs.grub2}/bin/grub-editenv - set config_file=mainmenu.cfg
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
20
modules/system/hosts/fractal/mainmenu.cfg
Normal file
20
modules/system/hosts/fractal/mainmenu.cfg
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
loadfont $prefix/themes/minegrub/Minecraft30.pf2
|
||||||
|
loadfont $prefix/themes/minegrub/Monocraft22.pf2
|
||||||
|
insmod png
|
||||||
|
set theme=$prefix/themes/minegrub/theme.txt
|
||||||
|
export theme
|
||||||
|
|
||||||
|
set timeout_style=menu
|
||||||
|
set timeout=15
|
||||||
|
|
||||||
|
menuentry " Singlebooter" {
|
||||||
|
configfile $prefix/grub.cfg
|
||||||
|
}
|
||||||
|
|
||||||
|
menuentry " Onlinebooter" {
|
||||||
|
echo "I don't know how network boot works"
|
||||||
|
}
|
||||||
|
|
||||||
|
menuentry " Uefi Setting Realm" $menuentry_id_option 'uefi-firmware' {
|
||||||
|
fwsetup
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue