Skip to content

Commit

Permalink
Merge pull request #38033 from peterhoeg/f/slite
Browse files Browse the repository at this point in the history
squeezelite: 2016-05-27 -> 2018-08-14
  • Loading branch information
ryantm committed Feb 23, 2019
2 parents 695fb80 + 440556a commit 7776de0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 31 deletions.
2 changes: 1 addition & 1 deletion nixos/modules/misc/ids.nix
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@
nzbget = 245;
mosquitto = 246;
toxvpn = 247;
squeezelite = 248;
# squeezelite = 248; # DynamicUser = true
turnserver = 249;
smokeping = 250;
gocd-agent = 251;
Expand Down
28 changes: 5 additions & 23 deletions nixos/modules/services/audio/squeezelite.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
with lib;

let

uid = config.ids.uids.squeezelite;
cfg = config.services.squeezelite;
dataDir = "/var/lib/squeezelite";

in {

Expand All @@ -17,14 +15,6 @@ in {

enable = mkEnableOption "Squeezelite, a software Squeezebox emulator";

dataDir = mkOption {
default = "/var/lib/squeezelite";
type = types.str;
description = ''
The directory where Squeezelite stores its name file.
'';
};

extraArguments = mkOption {
default = "";
type = types.str;
Expand All @@ -46,22 +36,14 @@ in {
wantedBy = [ "multi-user.target" ];
after = [ "network.target" "sound.target" ];
description = "Software Squeezebox emulator";
preStart = "mkdir -p ${cfg.dataDir} && chown -R squeezelite ${cfg.dataDir}";
serviceConfig = {
ExecStart = "${pkgs.squeezelite}/bin/squeezelite -N ${cfg.dataDir}/player-name ${cfg.extraArguments}";
User = "squeezelite";
PermissionsStartOnly = true;
DynamicUser = true;
ExecStart = "${pkgs.squeezelite}/bin/squeezelite -N ${dataDir}/player-name ${cfg.extraArguments}";
StateDirectory = builtins.baseNameOf dataDir;
SupplementaryGroups = "audio";
};
};

users.users.squeezelite= {
inherit uid;
group = "nogroup";
extraGroups = [ "audio" ];
description = "Squeezelite user";
home = "${cfg.dataDir}";
};

};

}
20 changes: 13 additions & 7 deletions pkgs/applications/audio/squeezelite/default.nix
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
{ stdenv, fetchFromGitHub, alsaLib, faad2, flac, libmad, libvorbis, mpg123 }:

stdenv.mkDerivation {
name = "squeezelite-git-2016-05-27";
name = "squeezelite-git-2018-08-14";

src = fetchFromGitHub {
owner = "ralph-irving";
repo = "squeezelite";
rev = "e37ed17fed9e11a7346cbe9f1e1deeccc051f42e";
sha256 = "15ihx2dbp4kr6k6r50g9q5npqad5zyv8nqf5cr37bhg964syvbdm";
owner = "ralph-irving";
repo = "squeezelite";
rev = "ecb6e3696a42113994640e5345d0b5ca2e77d28b";
sha256 = "0di3d5qy8fhawijq6bxy524fgffvzl08dprrws0fs2j1a70fs0fh";
};

buildInputs = [ alsaLib faad2 flac libmad libvorbis mpg123 ];

enableParallelBuilding = true;

installPhase = ''
mkdir -p $out/bin
cp squeezelite $out/bin
runHook preInstall
install -Dm755 -t $out/bin squeezelite
install -Dm644 -t $out/share/doc/squeezelite *.txt *.md
runHook postInstall
'';

meta = with stdenv.lib; {
Expand Down

0 comments on commit 7776de0

Please sign in to comment.