I’m super interested in your comment about nix but am not following your example.
Would you mind elaborating why (presumably) nixos (since you gave a Debian example), doesn’t help with this.