Something went wrong. Try again.
ALPHA: wire is a tool to deploy nixos systems (contribution fork) forked from althaea.zone/wire
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980# SPDX-License-Identifier: AGPL-3.0-or-later# Copyright 2024-2025 wire Contributors
{ pkgs, lib, config, ...}:{ config = { systemd = { paths = lib.mapAttrs' ( _name: value: lib.nameValuePair "${value.name}-key" { description = "Monitor changes to ${value.path}. You should Require ${value.service} instead of this."; pathConfig = { PathExists = value.path; PathChanged = value.path; Unit = "${value.name}-key.service"; }; } ) config.deployment.keys;
services = lib.mapAttrs' ( _name: value: lib.nameValuePair "${value.name}-key" { description = "Service that requires ${value.path}"; path = [ pkgs.inotify-tools pkgs.coreutils pkgs.systemd ]; script = '' MSG="Key ${value.path} exists." systemd-notify --ready --status="$MSG"
echo "waiting to fail if the key is removed..."
inotifywait -e delete_self "${value.path}"
MSG="Key ${value.path} no longer exists."
systemd-notify --status="$MSG" echo $MSG exit 1 ''; unitConfig = { AssertPathExists = value.path; }; serviceConfig = { Type = "notify"; Restart = "no"; NotifyAccess = "all"; RemainAfterExit = "yes"; }; } ) config.deployment.keys; };
deployment = { _keys = lib.mapAttrsToList ( _: value: value // { source = { # Attach type to internally tag serde enum t = builtins.replaceStrings [ "path" "string" "list" ] [ "Path" "String" "Command" ] ( builtins.typeOf value.source ); c = value.source; }; } ) config.deployment.keys;
_hostPlatform = config.nixpkgs.hostPlatform.system; }; };}