pkgs.uvms: init
...with some basic optional persistence and without having to rebuild images for every app nix run -f . pkgs.uvms -- --persist-home librewolf alacritty --run librewolf --run alacritty
This commit is contained in:
parent
22b613d157
commit
384b45bdef
15 changed files with 1155 additions and 452 deletions
39
pkgs/mkSystemdDropin.nix
Normal file
39
pkgs/mkSystemdDropin.nix
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
lib,
|
||||
runCommand,
|
||||
writeShellScriptBin,
|
||||
}:
|
||||
{
|
||||
name,
|
||||
prefix ? "10-all-",
|
||||
dirs ? [
|
||||
"service"
|
||||
"mount"
|
||||
"socket"
|
||||
"timer"
|
||||
"target"
|
||||
],
|
||||
|
||||
dropinText ? null,
|
||||
extraCommands ? "",
|
||||
...
|
||||
}@args:
|
||||
|
||||
runCommand "${name}-dropin"
|
||||
(
|
||||
lib.removeAttrs args [
|
||||
"name"
|
||||
]
|
||||
// {
|
||||
inherit dirs dropinText extraCommands;
|
||||
}
|
||||
)
|
||||
''
|
||||
set -euo pipefail
|
||||
root=$out/lib/systemd/system
|
||||
for dir in $dirs ; do
|
||||
mkdir -p "$root/$dir".d
|
||||
printf "%s" "$dropinText" > "$root/$dir.d/${prefix}${name}.conf"
|
||||
done
|
||||
runHook extraCommands
|
||||
''
|
||||
Loading…
Add table
Add a link
Reference in a new issue