From 4a73fa3126ba4ff474c135f36a71ae01675c6f9b Mon Sep 17 00:00:00 2001 From: Peter Hoeg Date: Thu, 29 Mar 2018 16:58:09 +0800 Subject: [PATCH 1/2] squeezelite: 2016-05-27 -> 2018-08-14 --- .../audio/squeezelite/default.nix | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) 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; { From 440556a77ce2885cc823c97064ba4b209d33b3ce Mon Sep 17 00:00:00 2001 From: Peter Hoeg Date: Thu, 29 Mar 2018 16:59:00 +0800 Subject: [PATCH 2/2] nixos squeezelite: run using DynamicUser --- nixos/modules/misc/ids.nix | 2 +- nixos/modules/services/audio/squeezelite.nix | 28 ++++---------------- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/nixos/modules/misc/ids.nix b/nixos/modules/misc/ids.nix index 0b4ed6d3b628..bc844737b5b0 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}"; - }; - }; }