Hi,
On 26.11.24 16:55, Ludovic Courtès wrote:
Toggle quote (17 lines)
> Hi,
>
> Dariqq <dariqq@posteo.net> skribis:
>
>>
>> How should this work? should this be a (public?) procedure? Should it
>> rebuild shepherd or just copy the output with trivial-build-system?
>
> My understanding of this proposal is that there would be a
> “shepherd-foreign” package, which is like “shepherd” but without
> ‘reboot’ and ‘halt’.
>
> That package could be implemented with ‘trivial-build-system’ or
> ‘copy-build-system’ indeed, and it would symlink all of ‘shepherd’,
> except its ‘sbin’ directory.
>
Imo it would make sense to have the sbinless shepherd be the default
shepherd for home-shepherd s.t. the home environment never provides
shutdown/halt by default. Those are commands are for the system to take
care of (whether that is the shepherd coming from root-shepherd or the
init from the foreign system).
On my foreign distro setup i am currently using this (apologies if the
formatting turns out weird):
Toggle snippet (25 lines)
(define shepherd-for-home
(package
(inherit shepherd)
(name "shepherd-for-home")
(source #f)
(build-system trivial-build-system)
(arguments
(list
#:modules '((guix build union)
(guix build utils))
#:builder
#~(begin
(use-modules (guix build union)
(guix build utils))
(union-build #$output
(list #$(this-package-input "shepherd"))
#:create-all-directories? #t)
(delete-file-recursively (string-append #$output "/sbin"))
(delete-file-recursively (string-append #$output
"/share/man/man8")))))
(native-inputs '())
(inputs (list shepherd))))
If we don't want to care about the manpages then the
(#:create-all-directories? #t) can be omitted in union-build.
Toggle quote (16 lines)
>> I just thought of a more elegant solution, but this would be a lot
>> harder to implement properly:
>>
>> - Move the sbin stuff into a seperate output
>> - Home shepherd service only adds the main output to the profile and
>> shepherd-root-service both
>> - Will need adjustments some packages that currently reference
>> shutdown/reboot ( -> lots of rebuilds because logind) and the same
>> change for the shepherd packages in the shepherd module.
>
> The advantage is that no extra step would be needed when using a foreign
> distro. But yeah, it’s relatively intrusive, and not my favorite
> solution, FWIW. Dunno.
>
If this would be possible without rebuilding I'd really like it because
it makes clear what part of the shepherd something depends on (service
manager stuff vs generic init stuff) and avoids an extra package that is
just shepherd minus sbindir. But the 3300 dependants of logind makes
this really unattractive.
Toggle quote (4 lines)
> WDYT?
>
> Ludo’.