migrate moonlight/sunshine to vars
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{ pkgs, config, ... }:
|
||||
let
|
||||
ms-accept = pkgs.callPackage ../pkgs/moonlight-sunshine-accept { };
|
||||
ms-accept = pkgs.callPackage ../../pkgs/moonlight-sunshine-accept { };
|
||||
defaultPort = 48011;
|
||||
in
|
||||
{
|
||||
@@ -13,10 +13,10 @@ in
|
||||
systemd.tmpfiles.rules = [
|
||||
"d '/var/lib/moonlight' 0770 'user' 'users' - -"
|
||||
"C '/var/lib/moonlight/moonlight.cert' 0644 'user' 'users' - ${
|
||||
config.clan.core.facts.services.moonlight.secret."moonlight.cert".path or ""
|
||||
config.clan.core.vars.generators.moonlight.files."moonlight.cert".path or ""
|
||||
}"
|
||||
"C '/var/lib/moonlight/moonlight.key' 0644 'user' 'users' - ${
|
||||
config.clan.core.facts.services.moonlight.secret."moonlight.key".path or ""
|
||||
config.clan.core.vars.generators.moonlight.files."moonlight.key".path or ""
|
||||
}"
|
||||
];
|
||||
|
||||
@@ -45,7 +45,7 @@ in
|
||||
systemd.user.services.moonlight-join = {
|
||||
description = "Join sunshine hosts";
|
||||
script = ''${ms-accept}/bin/moonlight-sunshine-accept moonlight join --port ${builtins.toString defaultPort} --cert '${
|
||||
config.clan.core.facts.services.moonlight.public."moonlight.cert".value or ""
|
||||
config.clan.core.vars.generators.moonlight.files."moonlight.cert".value or ""
|
||||
}' --host fd2e:25da:6035:c98f:cd99:93e0:b9b8:9ca1'';
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
@@ -68,19 +68,20 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
clan.core.facts.services.moonlight = {
|
||||
secret."moonlight.key" = { };
|
||||
secret."moonlight.cert" = { };
|
||||
public."moonlight.cert" = { };
|
||||
generator.path = [
|
||||
clan.core.vars.generators.moonlight = {
|
||||
migrateFact = "moonlight";
|
||||
files."moonlight.key" = { };
|
||||
files."moonlight.cert" = { };
|
||||
files."moonlight.cert".secret = false;
|
||||
runtimeInputs = [
|
||||
pkgs.coreutils
|
||||
ms-accept
|
||||
];
|
||||
generator.script = ''
|
||||
script = ''
|
||||
moonlight-sunshine-accept moonlight init
|
||||
mv credentials/cakey.pem "$secrets"/moonlight.key
|
||||
cp credentials/cacert.pem "$secrets"/moonlight.cert
|
||||
mv credentials/cacert.pem "$facts"/moonlight.cert
|
||||
mv credentials/cakey.pem "$out"/moonlight.key
|
||||
cp credentials/cacert.pem "$out"/moonlight.cert
|
||||
mv credentials/cacert.pem "$out"/moonlight.cert
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user