1 import ./make-test-python.nix ({pkgs, lib, ...}: let
2 demo-program = pkgs.writeShellScriptBin "demo" ''
3 while ${pkgs.coreutils}/bin/sleep 3; do
4 echo Hello World > /dev/null
7 demo-service = pkgs.writeText "demo.service" ''
9 Description=demo service
15 ExecStart=${demo-program}/bin/demo
19 WantedBy=multi-user.target
22 demo-socket = pkgs.writeText "demo.socket" ''
24 Description=demo socket
27 ListenStream=/run/demo.sock
31 WantedBy=sockets.target
33 demo-portable = pkgs.portableService {
36 description = ''A demo "Portable Service" for a shell program built with nix'';
37 units = [ demo-service demo-socket ];
41 name = "systemd-portabled";
44 machine.succeed("portablectl")
45 machine.wait_for_unit("systemd-portabled.service")
46 machine.succeed("portablectl attach --now --runtime ${demo-portable}/demo_1.0.raw")
47 machine.wait_for_unit("demo.service")
48 machine.succeed("portablectl detach --now --runtime demo_1.0")
49 machine.fail("systemctl status demo.service")