add timesync in initrd
All checks were successful
Hydra nixosConfigurations.not522 Hydra build #22730 of nixos-config:pr618:nixosConfigurations.not522
Hydra nixosConfigurations.container-default-x86_64-linux Hydra build #22729 of nixos-config:pr618:nixosConfigurations.container-default-x86_64-linux
Hydra nixosConfigurations.not522-installer Hydra build #22731 of nixos-config:pr618:nixosConfigurations.not522-installer
Hydra checks.x86_64-linux.containers-default Hydra build #22726 of nixos-config:pr618:checks.x86_64-linux.containers-default
Hydra nixosConfigurations.container-default-riscv64-linux Hydra build #22728 of nixos-config:pr618:nixosConfigurations.container-default-riscv64-linux
Hydra nixosConfigurations.container-default-aarch64-linux Hydra build #22727 of nixos-config:pr618:nixosConfigurations.container-default-aarch64-linux
All checks were successful
Hydra nixosConfigurations.not522 Hydra build #22730 of nixos-config:pr618:nixosConfigurations.not522
Hydra nixosConfigurations.container-default-x86_64-linux Hydra build #22729 of nixos-config:pr618:nixosConfigurations.container-default-x86_64-linux
Hydra nixosConfigurations.not522-installer Hydra build #22731 of nixos-config:pr618:nixosConfigurations.not522-installer
Hydra checks.x86_64-linux.containers-default Hydra build #22726 of nixos-config:pr618:checks.x86_64-linux.containers-default
Hydra nixosConfigurations.container-default-riscv64-linux Hydra build #22728 of nixos-config:pr618:nixosConfigurations.container-default-riscv64-linux
Hydra nixosConfigurations.container-default-aarch64-linux Hydra build #22727 of nixos-config:pr618:nixosConfigurations.container-default-aarch64-linux
This commit is contained in:
parent
b112633c98
commit
d2e0858e28
5 changed files with 40 additions and 0 deletions
|
@ -12,4 +12,5 @@
|
|||
];
|
||||
system.stateVersion = "24.11";
|
||||
nixpkgs.config.allowUnsupportedSystem = true;
|
||||
boot.initrd.timesync.enable = true;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ in {
|
|||
"${nixos-config}/machine/not522/cross-packages.nix"
|
||||
./disko.nix
|
||||
];
|
||||
boot.initrd.timesync.enable = true;
|
||||
|
||||
system.stateVersion = config.system.nixos.version;
|
||||
|
||||
|
|
36
modules/boot/timesync.nix
Normal file
36
modules/boot/timesync.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; {
|
||||
options.boot.initrd.timesync = {
|
||||
enable = mkEnableOption "Enables time synchronization in initrd";
|
||||
};
|
||||
|
||||
config = mkIf config.boot.initrd.timesync.enable {
|
||||
boot.initrd.systemd.network = {
|
||||
enable = true;
|
||||
wait-online.enable = true;
|
||||
};
|
||||
boot.initrd.systemd.services.sync-time = {
|
||||
description = "Network Time Synchronization";
|
||||
wantedBy = [
|
||||
"initrd.target"
|
||||
"rootfs-cleanup.service"
|
||||
];
|
||||
wants = [
|
||||
"network-online.target"
|
||||
];
|
||||
after = [
|
||||
"network-online.target"
|
||||
];
|
||||
before = [
|
||||
"rootfs-cleanup.service"
|
||||
];
|
||||
unitConfig.DefaultDependencies = "no";
|
||||
environment.SYSTEMD_NSS_RESOLVE_VALIDATE = "0";
|
||||
serviceConfig.ExecStart = "${config.boot.initrd.systemd.package}/lib/systemd/systemd-timesyncd";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
{disko, ...}: {
|
||||
imports = [
|
||||
./boot/timesync.nix
|
||||
./riscv.nix
|
||||
./containers/autoconfig.nix
|
||||
./nix
|
||||
|
|
|
@ -18,6 +18,7 @@ with lib; {
|
|||
}
|
||||
(mkIf config.environment.impermanence {
|
||||
boot.initrd.systemd.services.rootfs-cleanup = {
|
||||
description = "Clean file system root";
|
||||
wantedBy = [
|
||||
"initrd.target"
|
||||
];
|
||||
|
|
Loading…
Reference in a new issue