Skip to content

install-grub.pl: support bindmounts#374398

Open
kira-bruneau wants to merge 2 commits intoNixOS:masterfrom
kira-bruneau:install-grub
Open

install-grub.pl: support bindmounts#374398
kira-bruneau wants to merge 2 commits intoNixOS:masterfrom
kira-bruneau:install-grub

Conversation

@kira-bruneau
Copy link
Contributor

@kira-bruneau kira-bruneau commented Jan 16, 2025

Specifically, this fixes grub generation when bind-mounting your /nix & /boot directory with NixOS impermanence.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@kira-bruneau kira-bruneau requested review from nh2 and roberth January 16, 2025 23:09
@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Jan 16, 2025
@kira-bruneau
Copy link
Contributor Author

kira-bruneau commented Jan 16, 2025

@pluiedev Just a heads-up, you'll probably want to port this in #317026 once this PR is merged.

@github-actions github-actions bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Jan 16, 2025
@kira-bruneau
Copy link
Contributor Author

kira-bruneau commented Jan 16, 2025

It looks like the code in GetFs was originally added in #3961 to replace df -T. findmnt uses /proc/self/mountinfo internally though, so it shouldn't have the same problem df -T originally did.

See:

@kira-bruneau kira-bruneau force-pushed the install-grub branch 3 times, most recently from ca00777 to 277371b Compare January 17, 2025 19:38
@kira-bruneau kira-bruneau changed the title install-grub.pl: use findmnt to get the boot filesystem install-grub.pl: support bindmounts and btrfs subvolumes Jan 17, 2025
@ofborg ofborg bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Jan 17, 2025
@github-actions github-actions bot added 6.topic: python Python is a high-level, general-purpose programming language. 6.topic: GNOME GNOME desktop environment and its underlying platform 6.topic: haskell General-purpose, statically typed, purely functional programming language 8.has: documentation This PR adds or changes documentation 8.has: changelog This PR adds or changes release notes 6.topic: emacs Text editor 6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. 6.topic: policy discussion Discuss policies to work in and around Nixpkgs 6.topic: vim Advanced text editor 6.topic: hardware Drivers, Firmware and Kernels 6.topic: TeX Issues regarding texlive and TeX in general 6.topic: testing Tooling for automated testing of packages and modules 6.topic: module system About "NixOS" module system internals 6.topic: jitsi VoIP and instant messaging application with video conferencing capabilities and removed 2.status: merge conflict This PR has merge conflicts with the target branch labels Jan 17, 2025
@github-actions github-actions bot added 8.has: documentation This PR adds or changes documentation 8.has: changelog This PR adds or changes release notes 6.topic: emacs Text editor 6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. 6.topic: policy discussion Discuss policies to work in and around Nixpkgs 6.topic: vim Advanced text editor 6.topic: hardware Drivers, Firmware and Kernels 6.topic: TeX Issues regarding texlive and TeX in general 6.topic: testing Tooling for automated testing of packages and modules 6.topic: module system About "NixOS" module system internals 6.topic: jitsi VoIP and instant messaging application with video conferencing capabilities 6.topic: java Including JDK, tooling, other languages, other VMs 6.topic: flakes The experimental Nix feature 6.topic: lib The Nixpkgs function library 6.topic: jupyter Interactive computing tooling: kernels, notebook, jupyterlab 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` 6.topic: deepin 6.topic: dotnet Language: .NET 6.topic: nvidia Nvidia-specific issues and fixes 6.topic: continuous integration Affects continuous integration (CI) in Nixpkgs, including Ofborg and GitHub Actions 6.topic: haskell General-purpose, statically typed, purely functional programming language and removed 6.topic: jitsi VoIP and instant messaging application with video conferencing capabilities labels Jan 17, 2025
The current implementation of GetFS uses heuristics to find the best
filesystem for the given boot path. Using findmnt is more robust.
Comment on lines 220 to 243
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btrfs no longer needs to be treated specially here since $fs->root will contain the subvolume path and will be resolved the same way bind mounts are resolved.

Specifically this allows bind-mounting your `/boot` directory with
NixOS impermanence.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge conflict This PR has merge conflicts with the target branch 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants