Commit graph

499 commits

Author SHA1 Message Date
Raito Bezarius
139bfb5b5e nixos/system/activation/bootspec: generalize the bootspec tooling package
After RFC-0125 implementation, Determinate Systems was pinged multiple
times to transfer the repository ownership of the tooling to a
vendor-neutral repository.

Unfortunately, this never manifested. Additionally, the leadership of
the NixOS project was too dysfunctional to deal with this sort of
problem. It might even still be the case up to this day.

Nonetheless, nixpkgs is about enabling end users to enact their own
policies. It would be better to live in a world where there is one
obvious choice of bootspec tooling, in the meantime, we can live in a
world where people can choose their bootspec tooling.

The Lix forge possess one fork of the Bootspec tooling:
https://git.lix.systems/lix-community/bootspec which will live its own
life from now on.

Change-Id: I00c4dd64e00b4c24f6641472902e7df60ed13b55
Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
2025-04-24 18:22:02 +02:00
Silvan Mosberger
374e6bcc40 treewide: Format all Nix files
Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:

  nix-build ci -A fmt.check

This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).

This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).

Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase).

If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
2025-04-01 20:10:43 +02:00
Luj
e21904681e
nixos/systemd-boot: strip newline from machine-id (#375298) 2025-03-24 11:06:53 +01:00
Angelo Bulfone
9ed29c65a4
nixos/limine: Fix reading generations and specialisations
Previously, all generations for the primary system profile
read their data from the currently active one rather than
their own path, and specialisations in general all used
their parent bootspec rather than their own. This fixes both issues.

This commit still uses the parent path's build date for
specialisations, but this is more minor issue and the times
shouldn't be meaningfully different in most cases anyways.
2025-03-19 15:19:41 -07:00
programmerlexi
1a830fe9d9 nixos/limine: fix the install script 2025-03-18 01:06:55 +05:30
Rane
2cc1d33489
nixos/limine: cast partition index to string (#390732) 2025-03-18 01:01:15 +05:30
programmerlexi
12779dc091
nixos/limine: init module
Co-Authored-By: Gabriel Waksmundzki <czapek1337@gmail.com>
2025-03-06 08:05:08 +01:00
Samuel Dionne-Riel
6ec6eae586
Revert "nixos/grub: generate BLS entries" 2025-02-28 14:30:10 -05:00
rnhmjoj
435a72e469
nixos/grub: generate BLS entries 2025-02-28 09:51:20 +01:00
nixpkgs-ci[bot]
3a870eb511
Merge master into staging-next 2025-02-19 18:04:49 +00:00
Jörg Thalheim
39dd19122f install-grub: add missing rmtree 2025-02-19 14:33:46 +07:00
nixpkgs-ci[bot]
83f409d731
Merge master into staging-next 2025-02-18 06:04:52 +00:00
Jörg Thalheim
5be6db6b3d
grub modernize (#374844) 2025-02-18 13:03:24 +07:00
Jared Baur
3de7bccd4a
nixos/systemd-boot: strip newline from machine-id
To make each line in the entry file consistent, strip the newline from
the machine-id content.
2025-02-13 18:52:14 -08:00
Wolfgang Walther
b19d0f6d3d
treewide: replace substituteAll with replaceVars 2025-02-10 22:51:56 +01:00
Franz Pletz
ca0a9a0ed6
nixos/grub: Remove > from submenu title, unbreak grub-reboot (#284987) 2025-01-29 09:23:46 +01:00
Wolfgang Walther
b9ea481784
nixos/systemd-boot: replace substituteAll with replaceVarsWith 2025-01-28 22:30:26 +01:00
Yureka
3b6f658130
init-script-builder: fix build (#375160)
Change-Id: I244160844aad5fcfcab323dd721cfd87e4b8ddc0
2025-01-20 08:29:57 +01:00
Jörg Thalheim
33c2472b69 nixos/install-grub: don't use bare file handles and 3 argument open
this is not best practice perl since a long time.

<!-- ps-id: 225e1b18-348c-412f-8ecd-394f3ba9a32d -->
2025-01-18 17:33:53 +01:00
Jörg Thalheim
8d5abcd1bb nixos/install-grub: use more modern make_path
mkpath is a legacy interface.

<!-- ps-id: 0f1e0583-9cc5-4006-a4a2-fd413fe8117e -->
2025-01-18 17:33:53 +01:00
K900
914d17e050 nixos/boot/loader/generic-extlinux-compatible: fix eval on cross as well 2025-01-11 20:47:19 +03:00
K900
fbb4d057d1 nixos/boot/loader/generic-extlinux-compatible: fix eval 2025-01-11 20:42:58 +03:00
K900
936f4e016d Merge remote-tracking branch 'origin/staging-next' into staging 2025-01-02 19:21:56 +03:00
Julien Malka
fa99ba3c13
nixos/systemd-boot: Don't write to /etc/machine-id (#347493) 2025-01-02 11:47:20 +01:00
Wolfgang Walther
e58e0c158e
various: replace substituteAll with replaceVarsWith
This covers cases which need to use replaceVarsWith because the use
isExecutable = true.
2024-12-15 13:35:30 +01:00
Arne Keller
8bbf8450e4
extlinux-conf-builder: don't emit MENU when timeout is zero (#318778) 2024-12-12 16:31:02 +01:00
Silvan Mosberger
4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00
Wolfgang Walther
8ca24a7a2b
nixos: remove boot.loader.raspberryPi
This has been announced for 24.11 in #241534, so let's follow through.
2024-11-17 12:33:57 +01:00
K900
c42028339a nixos/systemd-boot: fix substituteAll usage
Missed this one :(
2024-10-20 21:45:57 +03:00
Felix Uhl
73011ba96f nixos/systemd-boot: add windows option for easy dual-booting
When installing NixOS on a machine with Windows, the "easiest" solution
to dual-boot is re-using the existing EFI System Partition (ESP), which
allows systemd-boot to detect Windows automatically.

However, if there are multiple ESPs, maybe even on multiple disks,
systemd-boot is unable to detect the other OSes, and you either have to
use Grub and os-prober, or do a tedious manual configuration as
described in the wiki:
https://wiki.nixos.org/w/index.php?title=Dual_Booting_NixOS_and_Windows&redirect=no#EFI_with_multiple_disks

This commit automates and documents this properly so only a single line
like

    boot.loader.systemd-boot.windows."10".efiDeviceHandle = "HD0c2";

is required.

In the future, we might want to try automatically detecting this
during installation, but finding the correct device handle while the
kernel is running is tricky.
2024-10-11 10:56:02 +02:00
Felix Uhl
f2e5b04c4e nixos/systemd-boot: add edk2-uefi-shell boot option
We already have a edk2-uefi-shell package in nixpkgs, but adding it to
systemd-boot was somewhat tedious. Now it's a single line of nix.
2024-10-11 10:53:42 +02:00
Felix Uhl
548206583d nixos/systemd-boot: autoformat 2024-10-11 10:53:38 +02:00
Arian van Putten
a4008da2d4 nixos/systemd-boot: Don't write to /etc/machine-id
This reverts commit 4daccf208f

The reverted commit claims that bootctl fails if machine-id is not set.
I can not reproduce this. I think this has since been fixed now that
bootctl has support for arbtirary entry-tokens and not just machine-id.

In the case of NixOS the entry-token is the string "nixos"
2024-10-09 15:34:34 +02:00
Jörg Thalheim
d66f976cee
nixos/generic-extlinux-compatible: add mirroredBoots option (#335131) 2024-09-18 14:08:31 +02:00
Felix Buehler
2f7c0a170f nixos/boot.loader.efi: remove with lib; 2024-09-15 10:43:58 +02:00
Jean-François Roche
251b0c958f nixos/systemd-boot: Fix regression in builder script
Avoid running Python scripts in the root of the package, as this
triggers `os.listdir` on the Nix store directory during import. This
operation can be time-consuming on large store directories
(see issue #283795 for more details).

The issue was initially fixed in #284153 but was reverted in #306339.

Co-authored-by: Sönke Hahn <soenkehahn@gmail.com>
2024-09-12 01:29:32 +02:00
Petr Hodina
a9f77c2fb0 systemd-boot: Add option for consoleMode to support SteamDeck 2024-09-08 22:48:21 +02:00
Luflosi
93fb96ecde
nixos/generic-extlinux-compatible: add mirroredBoots option
Analogous to `boot.loader.grub.mirroredBoots`.
This allows installing the configuration files to multiple locations.
2024-09-04 12:02:57 +02:00
zimbatm
1ea32d4f69 nixos/grub: fix value precendence with optional -> mkIf
When using `lib.optionals`, the return value of both branches of the
condition get set as a value to the option.

When using `lib.mkIf`, only the positive condition gets set as a value
to the option.

This small distinction is important when dealing with precedence. For
example here, we wanted to set a boot.grub.devices default value with
lib.mkDefault, and that was getting overridden with the empty value of
`lib.optional (cfg.device != "") cfg.device`.

See https://github.com/nix-community/srvos/pull/491#discussion_r1738827651

The general conclusion is that using `lib.mkIf` is preferable to
`lib.optional` or `lib.optionals` when setting values in the NixOS
module system.
2024-09-01 12:13:15 +02:00
Jared Baur
05aefd6f05
nixos/systemd-boot: remove semicolon 2024-08-24 12:50:26 -07:00
Jared Baur
6327b07b25
nixos/systemd-boot: use unique path for devicetree blob
Use the store directory for the devicetree package containing the
desired DTB when installing to the ESP. This allows for more than one
NixOS generation containing differing DTBs to coexist on the same ESP
(similar to how we can have multiple kernels & initrds). This change
removes the assumption that the filepath passed to `copy_from_file` is a
file that lives at the toplevel of a nix output path (which prior to the
systemd-boot DTB support was the case for the kernel and initrd
derivations).
2024-08-24 12:50:24 -07:00
Will Fancher
0637303ca8 Revert "Merge pull request #330017 from Mic92/boot-counting"
This reverts commit 3d3c0f4d34, reversing
changes made to 47f7e25a77.
2024-08-13 23:11:18 -04:00
Will Fancher
b78bd2f912 Revert "Merge pull request #333952 from r-vdp/specialisation-name-regex"
This reverts commit fc35704bc8, reversing
changes made to c67d90d517.
2024-08-13 21:33:15 -04:00
r-vdp
d38257b024
systemd-boot-builder: allow underscores in the specialisation name 2024-08-11 23:33:18 +02:00
Franz Pletz
481d7272d1
Merge pull request #201202 from m-bdf/sdboot-infinite-timeout 2024-08-06 16:25:25 +02:00
Franz Pletz
97ebf11501
Merge pull request #319422 from jmbaur/systemd-boot-devicetree 2024-08-06 13:39:29 +02:00
Thibault Polge
a68b81c429 nixos/systemd-boot: Add reboot-for-bitlocker support
Windows with BitLocker and TPM enabled doesn't support boot chaining.
This option activates a special experimental mode in systemd-boot that
tries to detect such systems and, if detected and selected by the user
at the boot menu, set the BootNext EFI variable to it before resetting.
2024-08-05 13:17:25 +03:00
Maëlys Bras de fer
7ae6219163 nixos/systemd-boot: fix infinite timeout 2024-08-05 08:48:54 +00:00
Jared Baur
fca8ee915d
nixos/systemd-boot: add support for devicetree entry
The [Boot Loader Specification](https://uapi-group.org/specifications/specs/boot_loader_specification/)
allows for using a key called "devicetree" for specifying which
devicetree the bootloader should use during boot. With regards to
systemd-boot, this key is used to specify which file should be picked up
from the ESP to install to the EFI DTB Configuration Table. Linux then uses
this Configuration Table to setup the machine. This change is similar to
the one done in https://github.com/NixOS/nixpkgs/pull/295096, where that
change was for adding DTB support to systemd-stub, and this is for
systemd-boot.
2024-08-01 11:15:15 -07:00
Julien Malka
64edc7f00f nixos/systemd-boot: init boot counting
Update nixos/modules/system/boot/loader/systemd-boot/boot-counting.md

Co-authored-by: Moritz Sanft <58110325+msanft@users.noreply.github.com>
2024-07-26 20:04:37 +02:00