stockholm/lass/2configs/rebuild-on-boot.nix
2018-01-05 20:59:29 +01:00

19 lines
465 B
Nix

{ 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";
};
};
}