Commit Graph

314 Commits

Author SHA1 Message Date
Joerie de Gram
7bd84b6685 systemd-boot: add 'graceful' configuration option
On some systems bootctl cannot write the `LoaderSystemToken` EFI variable
during installation, which results in a failure to install the boot
loader. Upstream provides a flag (--graceful) to ignore such write failures -
this change exposes it as a configuration option.

As the exact semantics of this option appear to be somewhat volatile it
should be used only if systemd-boot otherwise fails to install.
2021-10-11 15:14:33 +02:00
Naïm Favier
2ddc335e6f
nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
SrTobi
eff8d3bdb1 nixos/grub: implements GRUB_SAVEDEFAULT feature
Grub will remember the configuration that was booted and
select it as default menu entry the next time (#108206).
2021-07-28 18:57:08 +02:00
Ben Siraphob
b63a54f81c
Merge pull request #110742 from siraben/deprecate-fold 2021-07-27 15:13:31 +07:00
Max
2cf6f9e5bd
nixos/systemd-boot: Use os.path.realpath to fully resolve symlinks
os.readlink only resolves one layer of symlinks. This script explicitly relies on the real path of a file for deduplication, hence symlink resolution should recurse.
2021-06-24 17:52:03 +02:00
Luke Granger-Brown
2136e90fa3
Merge pull request #114637 from KaiHa/pr/fix-systemd-boot-builder
systemd-boot-builder.py: ignore profile names with invalid chars
2021-04-25 11:35:00 +01:00
rnhmjoj
61b7cab481
treewide: use perl.withPackages when possible
Since 03eaa48 added perl.withPackages, there is a canonical way to
create a perl interpreter from a list of libraries, for use in script
shebangs or generic build inputs. This method is declarative (what we
are doing is clear), produces short shebangs[1] and needs not to wrap
existing scripts.

Unfortunately there are a few exceptions that I've found:

  1. Scripts that are calling perl with the -T switch. This makes perl
  ignore PERL5LIB, which is what perl.withPackages is using to inform
  the interpreter of the library paths.

  2. Perl packages that depends on libraries in their own path. This
  is not possible because perl.withPackages works at build time. The
  workaround is to add `-I $out/${perl.libPrefix}` to the shebang.

In all other cases I propose to switch to perl.withPackages.

[1]: https://lwn.net/Articles/779997/
2021-03-31 21:35:37 +02:00
Jörg Thalheim
1fc14408ae
Merge pull request #108952 from Mic92/systemd-builder
nixos/systemd-boot: add typechecking
2021-03-20 16:05:27 +00:00
Kai Harries
e2be5dc1f4 systemd-boot-builder: gracefully ignore errors during entry creation
Catch and ignore errors during writing of the boot entries.  These
errors could stem from profile names that are not valid filenames on
vfat filesystems.

fixes #114552
2021-03-02 20:17:57 +01:00
Dominik Xaver Hörl
0e8d7f9b3d nixos/install-grub: normalize whitespace 2021-02-18 20:51:34 +01:00
Dominik Xaver Hörl
61d746a7d3 nixos: don't set systemConfig for stage-2
Since c4f910f550, this is no longer
needed, because stage-2 is already generated with the path hard wired anyway.
2021-02-18 12:48:08 +01:00
Arian van Putten
5276ebb5ee nixos: Get rid of systemConfig kernel parameter
It was introduced in c10fe14 but removed in c4f910f.

It remained such that people with older generations in their boot
entries could still boot those. Given that the parameter hasn't had any
use in quite some years, it seems safe to remove now.

Fixes #60184
2021-02-18 12:48:08 +01:00
Matthew Bauer
6307346fd9
Merge pull request #98858 from sorki/cross/rpifw
raspberrypi-builder: allow passing firmware package as argument
2021-01-29 10:21:32 -06:00
Ben Siraphob
1c2a2b0a08 treewide: fold -> foldr 2021-01-26 10:57:07 +07:00
John Ericson
63b02e55db nixos treewide: Fix references to linux-kernel.target
Thanks @ajs124 in
https://github.com/NixOS/nixpkgs/pull/110544#discussion_r563828722 for
catching this. According to:

    git grep 'inherit.*Platform.*platform'
    git grep ' linux-kernel'

We now don't have any remaining problems of this sort, thankfully.
2021-01-25 13:06:12 -05:00
volth
bc0d605cf1 treewide: fix double quoted strings in meta.description
Signed-off-by: Ben Siraphob <bensiraphob@gmail.com>
2021-01-24 19:56:59 +07:00
John Ericson
12881a7aa7
Merge pull request #110544 from Ericson2314/no-platform
top-level, lib: Remove platform attribute of platforms
2021-01-23 16:32:36 -05:00
Jörg Thalheim
17da58acca
Merge pull request #108242 from GovanifY/grub-additional
boot.loader.grub: add extraInstallCommands option
2021-01-23 16:18:22 +00:00
John Ericson
9c213398b3 lib: Clean up how linux and gcc config is specified
Second attempt of 8929989614589ee3acd070a6409b2b9700c92d65; see that
commit for details.

This reverts commit 0bc275e634.
2021-01-23 10:01:28 -05:00
Jonathan Ringer
0bc275e634
Revert "lib: Clean up how linux and gcc config is specified"
This is a stdenv-rebuild, and should not be merged
into master

This reverts commit 8929989614.
2021-01-22 14:07:06 -08:00
John Ericson
8929989614 lib: Clean up how linux and gcc config is specified
The `platform` field is pointless nesting: it's just stuff that happens
to be defined together, and that should be an implementation detail.

This instead makes `linux-kernel` and `gcc` top level fields in platform
configs. They join `rustc` there [all are optional], which was put there
and not in `platform` in anticipation of a change like this.

`linux-kernel.arch` in particular also becomes `linuxArch`, to match the
other `*Arch`es.

The next step after is this to combine the *specific* machines from
`lib.systems.platforms` with `lib.systems.examples`, keeping just the
"multiplatform" ones for defaulting.
2021-01-21 22:44:09 -05:00
Jörg Thalheim
ceda1a5eee
nixos/systemd-boot: add typechecking 2021-01-10 21:13:59 +01:00
Dominik Xaver Hörl
25bef2d8f9 treewide: simplify pkgs.stdenv.lib -> pkgs.lib
The library does not depend on stdenv, that `stdenv` exposes `lib` is
an artifact of the ancient origins of nixpkgs.
2021-01-10 20:12:06 +01:00
Gauvain 'GovanifY' Roussel-Tarbouriech
771ba47d56
boot.loader.grub: add extraInstallCommands option 2021-01-03 09:31:51 +01:00
Linus Heckemann
c14f14eeaf
Merge pull request #97505 from mayflower/grub-efi-mirroredboot
nixos/grub: allow multiple "nodev" devices for mirroredBoots
2020-12-04 18:37:50 +01:00
Graham Christensen
bc49a0815a
utillinux: rename to util-linux 2020-11-24 12:42:06 -05:00
Florian Klink
30ddfe6b95 Revert "nixos/systemd-boot: Temporarily ignore errors"
This reverts commit b32701bc54.

That fix has been included upstream in 246.5.
2020-09-27 16:45:27 +02:00
Richard Marko
9b06e9856b raspberrypi-builder: allow passing firmware package as argument 2020-09-26 14:26:16 +02:00
Tethys Svensson
b32701bc54 nixos/systemd-boot: Temporarily ignore errors
This is a temporary fix for #97433. A more proper fix has been
implemented upstream in systemd/systemd#17001, however until it gets
backported, we are stuck with ignoring the error.

After the backport lands, this commit should be reverted.
2020-09-10 20:56:04 +02:00
Linus Heckemann
fdd944526c nixos/grub: allow multiple "nodev" devices for mirroredBoots
For UEFI setups, "device" will generally be the special value "nodev"
which represents not running grub-install at all. Using "nodev" for
boot mirrors should therefore be allowed.
2020-09-09 07:40:08 +02:00
Christian Kampka
2c6753f9d0
Revert "nixos/raspberrypi-builder: fix cross using buildPackages"
The commit enforces buildPackages in the builder but neglects
the fact that the builder is intended to run on the target system.
Because of that, the builder will fail when remotely building a
configuration eg. with nixops or nix-copy-closure.

This reverts commit a6ac6d00f9.
2020-09-08 20:14:13 +02:00
zowoq
8fb410c0ad nixos/*: editorconfig fixes 2020-08-08 10:54:16 +10:00
Jörg Thalheim
ba930d8679
nixos/modules: remove trailing whitespace
This leads to ci failure otherwise if the file gets changed.
git-blame can ignore whitespace changes.
2020-08-07 14:45:39 +01:00
Maciej Krüger
a7a0d79ef3
boot.loader.grub: add theme option
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>

Co-authored-by: Samuel Dionne-Riel <samuel@dionne-riel.com>
2020-08-02 04:03:45 +02:00
Niklas Hambüchen
45325b1d24
install-grub.pl: Fix GRUB always reinstalling. (#92756)
See https://github.com/NixOS/nixpkgs/pull/92520#issuecomment-655157990.

In #85895 I accidentally introduced a comparison between an array reference
and an array, which can never be true. Fixed by dereferencing.
2020-07-13 02:16:43 +02:00
Niklas Hambüchen
e8c1ff9ef8
grub: Fix incorrect upgrade to new jsonStateLine. See #85895. (#92520)
Fixes error

    Can't use an undefined value as an ARRAY reference at /nix/store/...-install-grub.pl line 642, <FILE> line 5.

with `/boot/grub/state` being:

```
grub
2.04
no
/dev/sda
/boot

```

I am not sure where the trailing empty line can come from; the script does not
seem to write it. In any case, now we handle that situation as well.

Further, ensure that `extraGrubInstallArgs` defaults to the empty array
if its key is not present in the `jsonState`.
2020-07-07 00:53:55 +02:00
Niklas Hambüchen
a90ae331ec install-grub.pl: Add errno messages to all or die errors.
For example, turns the error

    cannot copy /nix/store/g24xsmmsz46hzi6whv7qwwn17myn3jfq-grub-2.04/share/grub/unicode.pf2 to /boot

into the more useful

    cannot copy /nix/store/g24xsmmsz46hzi6whv7qwwn17myn3jfq-grub-2.04/share/grub/unicode.pf2 to /boot: Read-only file system
2020-07-06 22:07:46 +02:00
Niklas Hambüchen
8665b5ab91 grub: Add boot.loader.grub.extraGrubInstallArgs option.
Useful for when you need to build grub modules into your grub kernel
to get a working boot, as shown in the added example.

To store this new value, we switch to more structural JSON approach.

Using one line per value to store in `/boot/grub/state` gets really messy when
the values are arrays, or even worse, can contain newlines (escaping would be
needed). Further, removing a value from the file would get extra messy
(empty lines we'd have to keep for backwards compatibility).

Thus, from now on we use JSON to store all values we'll need in the future.
2020-07-06 22:07:46 +02:00
Niklas Hambüchen
81c15742ce install-grub.pl: Write state file atomically.
Other files were already written atomically, but not this one.
2020-07-06 22:07:46 +02:00
Niklas Hambüchen
0dcad215fe install-grub.pl: Refactor: Extract getList() 2020-07-06 22:07:46 +02:00
Michele Guerini Rocco
dab676b2d7
Merge pull request #65231 from buckley310/grub-password
grub: add support for passwords
2020-07-01 09:04:30 +02:00
Fabian Möller
c07a6f8743
nixos/generic-extlinux-compatible: fix docbook syntax 2020-06-23 20:51:02 +02:00
Sean Buckley
37ec7c488a
grub: add support for passwords
This patch adds support for user accounts/passwords in GRUB 2.
When configured, everything but the default option is password-protected.
2020-06-23 19:01:43 +02:00
Florian Klink
387f3b58d2 hardware.deviceTree: add name
This can be used to explicitly specify a specific dtb file, relative to
the dtb base.

Update the generic-extlinux-compatible module to make use of this option.
2020-06-21 13:48:22 +02:00
Florian Klink
bd8137aef1 extlinux-conf-builder.sh: allow a custom FDT to be specified
Some bootloaders might not properly detect the model.
If the specific model is known by configuration, provide a way to
explicitly point to a specific dtb in the extlinux.conf.
2020-06-21 13:48:22 +02:00
Florian Klink
54129e72b4 nixos/generic-extlinux-compatible: introduce boot.loader.generic-extlinux-compatible.populateCmd
This option exposes the builder command used to populate an image,
honoring all options except the -c <path-to-default-configuration>
argument.

Useful to have for sdImage.populateRootCommands.

Special care needs to be taken w.r.t cross - the populate command runs
on the host platform, the activation script on the build platform (so
the builders differ)
2020-06-21 13:41:22 +02:00
Samuel Dionne-Riel
f203b8b277
Merge pull request #90119 from samueldr/feature/rpi4-fixups
Fix some pitfalls from the Raspberry Pi 4 specific sd image
2020-06-20 17:02:51 -04:00
Daniel Fullmer
1d4dc149df nixos/systemd-boot: fix incorrect string formatting
Currently, this always writes "default nixos-generation-%d.conf" without
replacing the "%d" in the string.
Python .format() is not equivalent to "%"
2020-06-18 19:58:50 -04:00
Florian Klink
42b92250b9 nixos/systemd-boot: fix default boot entry selection
6cd12ebcfe
changed behaviour - now the "default" entry needs to identity an entry
with its full name, including the ".conf".

Reported-In: https://github.com/NixOS/nixpkgs/issues/86422
2020-06-15 20:22:45 -04:00
Daniel Fullmer
7e3519a7cf nixos/systemd-boot: update bootloader if needed 2020-06-15 20:22:45 -04:00