1 { config, pkgs, lib, ... }:
3 systemd.services."nixos-fallback" = {
4 after = [ "sshd.service" ];
5 #wantedBy = [ "multi-user.target" ];
7 ExecStart = pkgs.writeShellScript "nixos-fallback-start" ''
9 # Note that even if switch-to-configuration test
10 # restarts nixos-fallback.service,
11 # it does not change the system profile.
12 profile=/nix/var/nix/profiles/system
13 fallback=$(readlink -e /root/nixos-fallback || readlink -e $profile)
15 nix-env --profile $profile --set $fallback
16 $fallback/bin/switch-to-configuration switch