change phone config

This commit is contained in:
2023-09-23 17:39:34 +02:00
parent 2ec5d2e743
commit c69e0e2c7c
2 changed files with 64 additions and 4 deletions

View File

@@ -4,10 +4,10 @@
imports = [ imports = [
(import <mobile-nixos/lib/configuration.nix> { device = "pine64-pinephone"; }) (import <mobile-nixos/lib/configuration.nix> { device = "pine64-pinephone"; })
./hardware-configuration.nix ./hardware-configuration.nix
<mobile-nixos/examples/phosh/phosh.nix> # <mobile-nixos/examples/phosh/phosh.nix>
# ./modules/sway ./modules/sway
#
# ./utils/bento.nix ./modules/bento.nix
]; ];
networking.hostName = "mobile-nixos"; networking.hostName = "mobile-nixos";

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