Skip to content

Commit

Permalink
fix: Resolve error on build caused by systemd-machine-id-commit.servi…
Browse files Browse the repository at this point in the history
…ce trigger

The bind mount creation for `/etc/machine-id` by `impermanence` is unintentionally triggering `systemd-machine-id-commit.service`, causing an error.
This commit resolves this issue, see: nix-community/impermanence#229.
And NixOS/nixpkgs#351151 for details.
  • Loading branch information
Enkaiyuegure committed Nov 2, 2024
1 parent 24d587b commit 6bb60b8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#================================Nix Packages collection & NixOS==============================#
#-----------Official NixOS package source, using nixos's unstable branch by default-----------#
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
#-------------------------Simplify Nix Flakes with the module system--------------------------#
#=========================Simplify Nix Flakes with the module system==========================#
flake-parts.url = "github:hercules-ci/flake-parts";
#===================Declarative disk partitioning and formatting using nix====================#
disko = {
Expand Down
11 changes: 10 additions & 1 deletion impermanence.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ in
pkgs.ncdu
];

# issue: https://github.com/nix-community/impermanence/issues/229
# Use symlink
systemd.tmpfiles.rules = [
"L /etc/machine-id - - - - /persist/etc/machine-id"
];
# Or
# boot.initrd.systemd.suppressedUnits = [ "systemd-machine-id-commit.service" ];
# systemd.suppressedSystemUnits = [ "systemd-machine-id-commit.service" ];

# There are two ways to clear the root filesystem on every boot:
## 1. use tmpfs for /
## 2. (btrfs/zfs only)take a blank snapshot of the root filesystem and revert to it on every boot via:
Expand Down Expand Up @@ -45,7 +54,7 @@ in
# "/usr/share/icons"
];
files = [
"/etc/machine-id"
#"/etc/machine-id"
"/etc/create-ap.conf"
];

Expand Down

0 comments on commit 6bb60b8

Please sign in to comment.