change phone config
This commit is contained in:
@@ -4,10 +4,10 @@
|
||||
imports = [
|
||||
(import <mobile-nixos/lib/configuration.nix> { device = "pine64-pinephone"; })
|
||||
./hardware-configuration.nix
|
||||
<mobile-nixos/examples/phosh/phosh.nix>
|
||||
# ./modules/sway
|
||||
#
|
||||
# ./utils/bento.nix
|
||||
# <mobile-nixos/examples/phosh/phosh.nix>
|
||||
./modules/sway
|
||||
|
||||
./modules/bento.nix
|
||||
];
|
||||
|
||||
networking.hostName = "mobile-nixos";
|
||||
|
||||
60
hosts/phone/modules/bento.nix
Normal file
60
hosts/phone/modules/bento.nix
Normal file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
timer = "*:0/15";
|
||||
in {
|
||||
environment.sessionVariables = rec {
|
||||
NIX_PATH = [
|
||||
"nixos-config=/var/bento/configuration.nix"
|
||||
];
|
||||
};
|
||||
|
||||
systemd.services.bento-upgrade = {
|
||||
enable = true;
|
||||
startAt = lib.mkDefault "${timer}";
|
||||
path = with pkgs; [openssh git nixos-rebuild nix gzip];
|
||||
serviceConfig.Type = "oneshot";
|
||||
script = ''
|
||||
cd /var/bento
|
||||
/bin/sh update.sh
|
||||
sed -i 's/ --upgrade//g' bootstrap.sh
|
||||
'';
|
||||
restartIfChanged = false;
|
||||
};
|
||||
|
||||
systemd.services.bento-reboot = {
|
||||
# this is disabled by default
|
||||
# to avoid wrong expectations from users
|
||||
enable = false;
|
||||
startAt = "04:00";
|
||||
path = with pkgs; [coreutils systemd];
|
||||
serviceConfig.Type = "oneshot";
|
||||
script = ''
|
||||
booted="$(readlink /run/booted-system/{initrd,kernel,kernel-modules})"
|
||||
built="$(readlink /nix/var/nix/profiles/system/{initrd,kernel,kernel-modules})"
|
||||
if [ ! "$booted" = "$built" ]
|
||||
then
|
||||
systemctl kexec || systemctl reboot
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
systemd.sockets.listen-update = {
|
||||
enable = true;
|
||||
wantedBy = ["sockets.target"];
|
||||
requires = ["network.target"];
|
||||
listenStreams = ["51337"];
|
||||
socketConfig.Accept = "yes";
|
||||
};
|
||||
|
||||
systemd.services."listen-update@" = {
|
||||
path = with pkgs; [systemd];
|
||||
enable = true;
|
||||
serviceConfig.StandardInput = "socket";
|
||||
serviceConfig.ExecStart = "${pkgs.systemd.out}/bin/systemctl start bento-upgrade.service";
|
||||
serviceConfig.ExecStartPost = "${pkgs.systemd.out}/bin/journalctl -f --no-pager -u bento-upgrade.service";
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user