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

View File

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

View File

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

View File

@ -45,6 +45,8 @@ let
''; '';
fileSystems."/".neededForBoot = true; fileSystems."/".neededForBoot = true;
fileSystems."/boot/efi".neededForBoot = true;
services.gvfs.enable = true; services.gvfs.enable = true;
networking.firewall = { networking.firewall = {
@ -63,7 +65,11 @@ let
id = [ "24571728" "24571700" ]; 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 { }; lxsameer = pkgs.callPackage ../users/lxsameer/default.nix { };
@ -76,6 +82,7 @@ in
{ {
installer = import ./installer.nix (params // { installer = import ./installer.nix (params // {
inherit host;
diskModule = (modules.disk-installer diskModule = (modules.disk-installer
host host
(if inVM then ./x1/vm.disk.nix else ./x1/disks.nix)); (if inVM then ./x1/vm.disk.nix else ./x1/disks.nix));

View File

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