nixosConfiguration: preSwitchCkeck: nvd
This commit is contained in:
parent
01106110fe
commit
d1e661df5d
1 changed files with 18 additions and 0 deletions
|
|
@ -10,6 +10,23 @@
|
||||||
{ ... }@inputs:
|
{ ... }@inputs:
|
||||||
{ host, ... }@imports:
|
{ host, ... }@imports:
|
||||||
let
|
let
|
||||||
|
pre-switch-check =
|
||||||
|
{ pkgs, lib, config, ... }:
|
||||||
|
{
|
||||||
|
config.system.preSwitchChecks.nvd = ''
|
||||||
|
nvd_check=y
|
||||||
|
if [[ -d /run/current-system ]]
|
||||||
|
then
|
||||||
|
${lib.getExe pkgs.nvd} --nix-bin-dir ${config.nix.package}/bin diff /run/current-system "''${1}"
|
||||||
|
if [[ -t 0 ]]; then
|
||||||
|
printf 'really %s to %s? [y]es/[N]o ' "''${2}" "''${1}"
|
||||||
|
read -r nvd_check
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
[[ "''${nvd_check}" == y ]]
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
system =
|
system =
|
||||||
hostname:
|
hostname:
|
||||||
{
|
{
|
||||||
|
|
@ -28,6 +45,7 @@ let
|
||||||
++ map (class: {
|
++ map (class: {
|
||||||
imports = map (input: input.${namespace}.${class} or { }) (builtins.attrValues inputs);
|
imports = map (input: input.${namespace}.${class} or { }) (builtins.attrValues inputs);
|
||||||
}) classes
|
}) classes
|
||||||
|
++ [ pre-switch-check ]
|
||||||
++ [ { config.networking.hostName = hostname; } ]
|
++ [ { config.networking.hostName = hostname; } ]
|
||||||
++ [ nixosModules.default ]
|
++ [ nixosModules.default ]
|
||||||
++ inputs.${nixpkgs}.lib.optional (inputs ? home-manager) {
|
++ inputs.${nixpkgs}.lib.optional (inputs ? home-manager) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue