Skip to content

feat(filesystems/swap): add discardPolicy, finit-managed randomEncryption, and boot.resumeDevice#125

Open
FixeQD wants to merge 4 commits into
finix-community:mainfrom
FixeQD:feat-swap
Open

feat(filesystems/swap): add discardPolicy, finit-managed randomEncryption, and boot.resumeDevice#125
FixeQD wants to merge 4 commits into
finix-community:mainfrom
FixeQD:feat-swap

Conversation

@FixeQD

@FixeQD FixeQD commented Jul 7, 2026

Copy link
Copy Markdown

Ported standard NixOS swap and hibernation options to work seamlessly within the finix architecture, replacing systemd components with native finit configuration

Changes:

  1. Swap Discard Policy: Backported the swapDevices.*.discardPolicy option (once, pages, both), mapping it correctly to standard swap mount options
  2. Finit-Managed Random Encryption: Reimplemented NixOS-style random swap encryption without relying on systemd-cryptsetup targets. Instead of using static /etc/fstab lines, encrypted swaps are now generated imperatively via dedicated stage-1 finit.tasks. The tasks execute a lightweight script shell sequence on every boot.Added an assertion to ensure these devices use stable persistent paths rather than volatile labels or UUIDs
  3. Hibernation Support: Added the boot.resumeDevice option to inject the resume= string into boot.kernelParams

Copilot AI review requested due to automatic review settings July 7, 2026 00:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR ports several NixOS swap/hibernation-related options into finix, adapting them to finix’s finit-based boot architecture (including imperative swap setup for random-encrypted swap).

Changes:

  • Add swapDevices.*.discardPolicy and map it to swap options (discard, discard=once|pages).
  • Add swapDevices.*.randomEncryption and create finit-managed encrypted swap tasks instead of generating static /etc/fstab swap entries.
  • Add boot.resumeDevice and inject resume=<device> into boot.kernelParams.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
modules/filesystems/options.nix Adds new swap options (discardPolicy, randomEncryption) to the swap device option schema.
modules/filesystems/default.nix Implements discard policy mapping and adds finit tasks + assertions for random-encrypted swap handling.
modules/boot/kernel.nix Introduces boot.resumeDevice and conditionally adds resume= to the kernel cmdline.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread modules/filesystems/default.nix Outdated
Comment thread modules/filesystems/default.nix Outdated
Comment thread modules/filesystems/default.nix
Comment thread modules/filesystems/default.nix
Comment thread modules/boot/kernel.nix
…s usage

fix(filesystems): simplify comment on randomEncryption swap entries and escape shell arguments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants