Merge pull request #193502 from phaer/systemd-portabled

Support systemd-portabled

authored by Florian Klink and committed by GitHub 72911a27 9b630a26

+61 -2
+3
nixos/modules/system/boot/systemd.nix
··· 151 ] ++ optionals cfg.package.withHostnamed [ 152 "dbus-org.freedesktop.hostname1.service" 153 "systemd-hostnamed.service" 154 ] ++ [ 155 "systemd-exit.service" 156 "systemd-update-done.service"
··· 151 ] ++ optionals cfg.package.withHostnamed [ 152 "dbus-org.freedesktop.hostname1.service" 153 "systemd-hostnamed.service" 154 + ] ++ optionals cfg.package.withPortabled [ 155 + "dbus-org.freedesktop.portable1.service" 156 + "systemd-portabled.service" 157 ] ++ [ 158 "systemd-exit.service" 159 "systemd-update-done.service"
+2
nixos/modules/system/boot/systemd/logind.nix
··· 82 "dbus-org.freedesktop.import1.service" 83 ] ++ optionals config.systemd.package.withMachined [ 84 "dbus-org.freedesktop.machine1.service" 85 ] ++ [ 86 "dbus-org.freedesktop.login1.service" 87 "user@.service"
··· 82 "dbus-org.freedesktop.import1.service" 83 ] ++ optionals config.systemd.package.withMachined [ 84 "dbus-org.freedesktop.machine1.service" 85 + ] ++ optionals config.systemd.package.withPortabled [ 86 + "dbus-org.freedesktop.portable1.service" 87 ] ++ [ 88 "dbus-org.freedesktop.login1.service" 89 "user@.service"
+1
nixos/modules/system/boot/systemd/tmpfiles.nix
··· 79 80 ln -s "${systemd}/example/tmpfiles.d/home.conf" 81 ln -s "${systemd}/example/tmpfiles.d/journal-nocow.conf" 82 ln -s "${systemd}/example/tmpfiles.d/static-nodes-permissions.conf" 83 ln -s "${systemd}/example/tmpfiles.d/systemd.conf" 84 ln -s "${systemd}/example/tmpfiles.d/systemd-nologin.conf"
··· 79 80 ln -s "${systemd}/example/tmpfiles.d/home.conf" 81 ln -s "${systemd}/example/tmpfiles.d/journal-nocow.conf" 82 + ln -s "${systemd}/example/tmpfiles.d/portables.conf" 83 ln -s "${systemd}/example/tmpfiles.d/static-nodes-permissions.conf" 84 ln -s "${systemd}/example/tmpfiles.d/systemd.conf" 85 ln -s "${systemd}/example/tmpfiles.d/systemd-nologin.conf"
+1
nixos/tests/all-tests.nix
··· 610 systemd-no-tainted = handleTest ./systemd-no-tainted.nix {}; 611 systemd-nspawn = handleTest ./systemd-nspawn.nix {}; 612 systemd-oomd = handleTest ./systemd-oomd.nix {}; 613 systemd-shutdown = handleTest ./systemd-shutdown.nix {}; 614 systemd-timesyncd = handleTest ./systemd-timesyncd.nix {}; 615 systemd-misc = handleTest ./systemd-misc.nix {};
··· 610 systemd-no-tainted = handleTest ./systemd-no-tainted.nix {}; 611 systemd-nspawn = handleTest ./systemd-nspawn.nix {}; 612 systemd-oomd = handleTest ./systemd-oomd.nix {}; 613 + systemd-portabled = handleTest ./systemd-portabled.nix {}; 614 systemd-shutdown = handleTest ./systemd-shutdown.nix {}; 615 systemd-timesyncd = handleTest ./systemd-timesyncd.nix {}; 616 systemd-misc = handleTest ./systemd-misc.nix {};
+51
nixos/tests/systemd-portabled.nix
···
··· 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 5 + done 6 + ''; 7 + demo-service = pkgs.writeText "demo.service" '' 8 + [Unit] 9 + Description=demo service 10 + Requires=demo.socket 11 + After=demo.socket 12 + 13 + [Service] 14 + Type=simple 15 + ExecStart=${demo-program}/bin/demo 16 + Restart=always 17 + 18 + [Install] 19 + WantedBy=multi-user.target 20 + Also=demo.socket 21 + ''; 22 + demo-socket = pkgs.writeText "demo.socket" '' 23 + [Unit] 24 + Description=demo socket 25 + 26 + [Socket] 27 + ListenStream=/run/demo.sock 28 + SocketMode=0666 29 + 30 + [Install] 31 + WantedBy=sockets.target 32 + ''; 33 + demo-portable = pkgs.portableService { 34 + pname = "demo"; 35 + version = "1.0"; 36 + description = ''A demo "Portable Service" for a shell program built with nix''; 37 + units = [ demo-service demo-socket ]; 38 + }; 39 + in { 40 + 41 + name = "systemd-portabled"; 42 + nodes.machine = {}; 43 + testScript = '' 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") 50 + ''; 51 + })
+2 -2
pkgs/os-specific/linux/systemd/default.nix
··· 92 , withOomd ? true 93 , withPCRE2 ? true 94 , withPolkit ? true 95 - , withPortabled ? false 96 , withRemote ? !stdenv.hostPlatform.isMusl 97 , withResolved ? true 98 , withShellCompletions ? true ··· 679 # runtime; otherwise we can't and we need to reboot. 680 interfaceVersion = 2; 681 682 - inherit withCryptsetup withHostnamed withImportd withLocaled withMachined withTimedated withUtmp util-linux kmod kbd; 683 684 tests = { 685 inherit (nixosTests) switchTest;
··· 92 , withOomd ? true 93 , withPCRE2 ? true 94 , withPolkit ? true 95 + , withPortabled ? true 96 , withRemote ? !stdenv.hostPlatform.isMusl 97 , withResolved ? true 98 , withShellCompletions ? true ··· 679 # runtime; otherwise we can't and we need to reboot. 680 interfaceVersion = 2; 681 682 + inherit withCryptsetup withHostnamed withImportd withLocaled withMachined withPortabled withTimedated withUtmp util-linux kmod kbd; 683 684 tests = { 685 inherit (nixosTests) switchTest;
+1
pkgs/top-level/all-packages.nix
··· 25305 withOomd = false; 25306 withPCRE2 = false; 25307 withPolkit = false; 25308 withRemote = false; 25309 withResolved = false; 25310 withShellCompletions = false;
··· 25305 withOomd = false; 25306 withPCRE2 = false; 25307 withPolkit = false; 25308 + withPortabled = false; 25309 withRemote = false; 25310 withResolved = false; 25311 withShellCompletions = false;