From cba8b52942c5ab38c90b7d7425e4c8acc360656e Mon Sep 17 00:00:00 2001 From: oxalica Date: Sat, 17 Jul 2021 01:55:00 +0800 Subject: [PATCH] Check and create /etc/NIXOS during activation --- nixos/modules/system/etc/setup-etc.pl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nixos/modules/system/etc/setup-etc.pl b/nixos/modules/system/etc/setup-etc.pl index eed20065087f..be6b2d9ae71e 100644 --- a/nixos/modules/system/etc/setup-etc.pl +++ b/nixos/modules/system/etc/setup-etc.pl @@ -138,3 +138,9 @@ foreach my $fn (@oldCopied) { # Rewrite /etc/.clean. close CLEAN; write_file("/etc/.clean", map { "$_\n" } @copied); + +# Create /etc/NIXOS tag if not exists. +# When /etc is not on a persistent filesystem, it will be wiped after reboot, +# so we need to check and re-create it during activation. +open TAG, ">>/etc/NIXOS"; +close TAG;