forked from rarias/bscpkgs
Split xeon specific configuration from base
To accomodate the raccoon knights workstation, some of the configuration pulled by m/common/main.nix has to be removed. To solve it, the xeon specific parts are placed into m/common/xeon.nix and only the common configuration is at m/common/base.nix. Reviewed-by: Aleix Roca Nonell <aleix.rocanonell@bsc.es>
This commit is contained in:
21
m/common/base/rev.nix
Normal file
21
m/common/base/rev.nix
Normal file
@@ -0,0 +1,21 @@
|
||||
{ theFlake, ... }:
|
||||
|
||||
let
|
||||
# Prevent building a configuration without revision
|
||||
rev = if theFlake ? rev then theFlake.rev
|
||||
else throw ("Refusing to build from a dirty Git tree!");
|
||||
in {
|
||||
# Save the commit of the config in /etc/configrev
|
||||
environment.etc.configrev.text = rev + "\n";
|
||||
|
||||
# Keep a log with the config over time
|
||||
system.activationScripts.configRevLog.text = ''
|
||||
BOOTED=$(cat /run/booted-system/etc/configrev 2>/dev/null || echo unknown)
|
||||
CURRENT=$(cat /run/current-system/etc/configrev 2>/dev/null || echo unknown)
|
||||
NEXT=${rev}
|
||||
DATENOW=$(date --iso-8601=seconds)
|
||||
echo "$DATENOW booted=$BOOTED current=$CURRENT next=$NEXT" >> /var/configrev.log
|
||||
'';
|
||||
|
||||
system.configurationRevision = rev;
|
||||
}
|
||||
Reference in New Issue
Block a user