summaryrefslogtreecommitdiffstats
path: root/lass/2configs/rebuild-on-boot.nix
blob: 60198be7be81b3fe5588f8fa49c573636639e3ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{ config, pkgs, ... }:
with import <stockholm/lib>;
{
  systemd.services.rebuild-on-boot = {
    wantedBy = [ "multi-user.target" ];
    environment = {
      NIX_REMOTE = "daemon";
      HOME = "/var/empty";
    };
    serviceConfig = {
      ExecStart = pkgs.writeScript "rebuild" ''
        #!${pkgs.bash}/bin/bash
        (/run/current-system/sw/bin/nixos-rebuild -I /var/src switch) &
      '';
      ExecStop = "${pkgs.coreutils}/bin/sleep 10";
    };
  };
}