nixos/mpd: use pkgs.writeTextFile, with a checkPhase
This commit is contained in:
@@ -24,7 +24,9 @@ let
|
||||
lib.concatStringsSep "\n" placeholders
|
||||
);
|
||||
|
||||
mpdConf = pkgs.writeText "mpd.conf" ''
|
||||
mpdConf = pkgs.writeTextFile {
|
||||
name = "mpd.conf";
|
||||
text = ''
|
||||
# This file was automatically generated by NixOS. Edit mpd's configuration
|
||||
# via NixOS' configuration.nix, as this file will be rewritten upon mpd's
|
||||
# restart.
|
||||
@@ -48,6 +50,27 @@ let
|
||||
|
||||
${cfg.extraConfig}
|
||||
'';
|
||||
derivationArgs = {
|
||||
expectScript = ''
|
||||
spawn ${lib.getExe pkgs.buildPackages.mpd} --no-daemon "$env(out)"
|
||||
expect {
|
||||
"exception: Error in \"$env(out)\"" {
|
||||
puts "Config file invalid\n"
|
||||
exit 1
|
||||
}
|
||||
"exception:" {
|
||||
exit 0
|
||||
}
|
||||
}
|
||||
'';
|
||||
passAsFile = [
|
||||
"expectScript"
|
||||
];
|
||||
};
|
||||
checkPhase = ''
|
||||
${lib.getExe pkgs.buildPackages.expect} -f "$expectScriptPath"
|
||||
'';
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user