Fix the X1 bootloader issue

This commit is contained in:
Sameer Rahmani 2024-04-21 14:13:21 +01:00
parent 374733e40f
commit d53cd1b0d8
Signed by: lxsameer
GPG Key ID: 8741FACBF412FFA5
5 changed files with 66 additions and 55 deletions

View File

@ -17,14 +17,14 @@ params:
rec {
# A single nixos config outputting multiple formats.
# Alternatively put this in a configuration.nix.
generator = {config, ...}: {
generator = { config, ... }: {
imports = [
params.nixos-generators.nixosModules.all-formats
];
nixpkgs.hostPlatform = "x86_64-linux";
# customize an existing format
formatConfigs.iso = {config, ...}: {
formatConfigs.iso = { config, ... }: {
services.openssh.enable = true;
};
@ -32,19 +32,22 @@ rec {
git = import ./git;
base = {config, lib, pkgs, inputs, ...}:
base = { config, lib, pkgs, inputs, ... }:
let
universePkg = pkgs.callPackage ../derivations/universe.nix {};
in {
universePkg = pkgs.callPackage ../derivations/universe.nix { };
in
{
# point the system nixpkgs to this flake by indirecting through
# /etc so it changes when the system switches without having to
# restart all the terminals. thanks ElvishJerricco
nix.registry = builtins.mapAttrs (n: flake: { inherit flake; }) inputs;
environment.etc = lib.mapAttrs' (name: flake: {
name = "nix/inputs/${name}";
value.source = flake.outPath;
}) inputs;
environment.etc = lib.mapAttrs'
(name: flake: {
name = "nix/inputs/${name}";
value.source = flake.outPath;
})
inputs;
nix.nixPath = [ "/etc/nix/inputs" ];
@ -86,17 +89,17 @@ rec {
# Some compression/archiver tools.
pkgs.unzip
pkgs.zip
pkgs.ripgrep
pkgs.bat
pkgs.ripgrep
pkgs.bat
pkgs.wget
pkgs.curl
pkgs.htop
pkgs.man
pkgs.man-pages
pkgs.man-pages-posix
pkgs.man
pkgs.man-pages
pkgs.man-pages-posix
pkgs.git
@ -111,8 +114,8 @@ rec {
documentation.dev.enable = true;
documentation.man = {
man-db.enable = true;
enable = true;
generateCaches = false;
enable = true;
generateCaches = false;
};
nix.settings = {
experimental-features = lib.mkDefault "nix-command flakes";
@ -190,7 +193,7 @@ rec {
networking.networkmanager.enable = true;
};
installerUser = {config, pkgs, ...}: {
installerUser = { config, pkgs, ... }: {
users = {
users.universe = {
password = "universe";
@ -207,7 +210,7 @@ rec {
};
};
bootable = { lib, pkgs, ...}: {
bootable = { lib, pkgs, ... }: {
boot = {
kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
loader = {
@ -217,24 +220,24 @@ rec {
};
disk-installer = host: diskFile: { lib, pkgs, inputs, hostBuilderConfig, ... }: {
imports = [];
imports = [ ];
environment.systemPackages = [
pkgs.disko
(pkgs.writeShellScriptBin "install-universe" ''
# if /etc/universe_release
export NIX_PATH=/etc/nix/inputs/
echo "Partitioning the disk..."
echo "${diskFile}"
cp "${diskFile}" /etc/sdisk.nix
${pkgs.disko}/bin/disko -m disko /etc/disks.nix
mkdir -p /mnt/etc/nix
ln -s /mnt/etc/nix/inputs/ /etc/nix/inputs/
cd /mnt
echo "running installer"
nixos-install --impure --flake self#${host} --root /mnt -v --show-trace
echo "done"
# if /etc/universe_release
export NIX_PATH=/etc/nix/inputs/
echo "Partitioning the disk..."
echo "${diskFile}"
cp "${diskFile}" /etc/sdisk.nix
${pkgs.disko}/bin/disko -m disko /etc/disks.nix
mkdir -p /mnt/etc/nix
ln -s /mnt/etc/nix/inputs/ /etc/nix/inputs/
cd /mnt
echo "running installer"
nixos-install --impure --flake self#${host} --root /mnt -v --show-trace
echo "done"
'')
];
@ -249,26 +252,26 @@ rec {
disk = diskFile: { lib, pkgs, inputs, hostBuilderConfig, ... }:
let diskDesc = import diskFile; in {
imports = [
"${inputs.disko}/module.nix"
];
imports = [
"${inputs.disko}/module.nix"
];
environment.systemPackages = [
pkgs.disko
];
environment.systemPackages = [
pkgs.disko
];
disko = lib.optionalAttrs (!hostBuilderConfig.inVM) diskDesc.disko;
disko = lib.optionalAttrs (!hostBuilderConfig.inVM) diskDesc.disko;
environment.etc = {
"disks.nix".source = diskFile;
environment.etc = {
"disks.nix".source = diskFile;
};
boot.loader.grub.device = "nodev";
boot.loader.grub.efiSupport = true;
boot.loader.grub.efiInstallAsRemovable = lib.mkDefault true;
};
boot.loader.grub.device = "nodev";
boot.loader.grub.efiSupport = true;
boot.loader.grub.efiInstallAsRemovable = true;
};
styles = { lib, pkgs, inputs, ...}: {
styles = { lib, pkgs, inputs, ... }: {
imports = [
inputs.stylix.nixosModules.stylix
@ -307,7 +310,7 @@ rec {
};
yubikey = { config, lib, pkgs, ...}: {
yubikey = { config, lib, pkgs, ... }: {
services.pcscd.enable = true;
services.udev.packages = [ pkgs.yubikey-personalization ];
environment.systemPackages = [
@ -315,6 +318,6 @@ rec {
];
};
virtualisation = import ./virtualisation {};
udev = import ./udev {};
virtualisation = import ./virtualisation { };
udev = import ./udev { };
}

View File

@ -25,12 +25,12 @@
;; Uncomment this line for debugging
;; (setq debug-on-error t)
(eval-when-compile
(defvar fg42/font nil))
(defvar fg42/config/font-size nil))
(setq fg42/font '("Fira Code" 10))
(when-wm
(setq fg42/font '("Fira Code" 10)))
(setq fg42/font/font-size 8))
(fg42/setup-font)
(provide '.fg42)
;;; .fg42.el ends here

View File

@ -77,6 +77,7 @@ in
{
installer = import ./installer.nix (params // {
inherit host;
diskModule = (modules.disk-installer
host
(if inVM then ./majin/vm.disk.nix else ./majin/disks.nix));

View File

@ -45,6 +45,8 @@ let
'';
fileSystems."/".neededForBoot = true;
fileSystems."/boot/efi".neededForBoot = true;
services.gvfs.enable = true;
networking.firewall = {
@ -63,7 +65,11 @@ let
id = [ "24571728" "24571700" ];
};
};
boot.loader.efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot/efi"; # ← use the same mount point here.
};
boot.loader.grub.efiInstallAsRemovable = lib.mkForce false;
};
lxsameer = pkgs.callPackage ../users/lxsameer/default.nix { };
@ -76,6 +82,7 @@ in
{
installer = import ./installer.nix (params // {
inherit host;
diskModule = (modules.disk-installer
host
(if inVM then ./x1/vm.disk.nix else ./x1/disks.nix));

View File

@ -9,12 +9,12 @@
type = "gpt";
partitions = {
ESP = {
size = "1G";
size = "10M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountpoint = "/boot/efi";
};
};
swap = {