diff --git a/nixos/modules/misc/ids.nix b/nixos/modules/misc/ids.nix index 5f134b51939c..e78673514e3b 100644 --- a/nixos/modules/misc/ids.nix +++ b/nixos/modules/misc/ids.nix @@ -272,7 +272,7 @@ nzbget = 245; mosquitto = 246; toxvpn = 247; - squeezelite = 248; + # squeezelite = 248; # DynamicUser = true turnserver = 249; smokeping = 250; gocd-agent = 251; diff --git a/nixos/modules/services/audio/squeezelite.nix b/nixos/modules/services/audio/squeezelite.nix index 57ae38559939..ab2de179cfc3 100644 --- a/nixos/modules/services/audio/squeezelite.nix +++ b/nixos/modules/services/audio/squeezelite.nix @@ -3,9 +3,7 @@ with lib; let - - uid = config.ids.uids.squeezelite; - cfg = config.services.squeezelite; + dataDir = "/var/lib/squeezelite"; in { @@ -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; @@ -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}"; - }; - }; } diff --git a/pkgs/applications/audio/squeezelite/default.nix b/pkgs/applications/audio/squeezelite/default.nix index 20f6271c7adf..3184f89ced95 100644 --- a/pkgs/applications/audio/squeezelite/default.nix +++ b/pkgs/applications/audio/squeezelite/default.nix @@ -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; {