Merge pull request #16108 from pwetzel/squeezelite

Squeezelite package and service init

authored by Joachim Fasting and committed by GitHub 6fd8e571 bbac378d

+98
+2
nixos/modules/misc/ids.nix
··· 268 268 nzbget = 245; 269 269 mosquitto = 246; 270 270 toxvpn = 247; 271 + squeezelite = 248; 271 272 272 273 # When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399! 273 274 ··· 506 507 nzbget = 245; 507 508 mosquitto = 246; 508 509 #toxvpn = 247; # unused 510 + #squeezelite = 248; #unused 509 511 510 512 # When adding a gid, make sure it doesn't match an existing 511 513 # uid. Users and groups with the same name should have equal
+1
nixos/modules/module-list.nix
··· 110 110 ./services/audio/liquidsoap.nix 111 111 ./services/audio/mpd.nix 112 112 ./services/audio/mopidy.nix 113 + ./services/audio/squeezelite.nix 113 114 ./services/backup/almir.nix 114 115 ./services/backup/bacula.nix 115 116 ./services/backup/crashplan.nix
+67
nixos/modules/services/audio/squeezelite.nix
··· 1 + { config, lib, pkgs, ... }: 2 + 3 + with lib; 4 + 5 + let 6 + 7 + uid = config.ids.uids.squeezelite; 8 + cfg = config.services.squeezelite; 9 + 10 + in { 11 + 12 + ###### interface 13 + 14 + options = { 15 + 16 + services.squeezelite= { 17 + 18 + enable = mkEnableOption "Squeezelite, a software Squeezebox emulator"; 19 + 20 + dataDir = mkOption { 21 + default = "/var/lib/squeezelite"; 22 + type = types.str; 23 + description = '' 24 + The directory where Squeezelite stores its name file. 25 + ''; 26 + }; 27 + 28 + extraArguments = mkOption { 29 + default = ""; 30 + type = types.str; 31 + description = '' 32 + Additional command line arguments to pass to Squeezelite. 33 + ''; 34 + }; 35 + 36 + }; 37 + 38 + }; 39 + 40 + 41 + ###### implementation 42 + 43 + config = mkIf cfg.enable { 44 + 45 + systemd.services.squeezelite= { 46 + wantedBy = [ "multi-user.target" ]; 47 + after = [ "network.target" "sound.target" ]; 48 + description = "Software Squeezebox emulator"; 49 + preStart = "mkdir -p ${cfg.dataDir} && chown -R squeezelite ${cfg.dataDir}"; 50 + serviceConfig = { 51 + ExecStart = "${pkgs.squeezelite}/bin/squeezelite -N ${cfg.dataDir}/player-name ${cfg.extraArguments}"; 52 + User = "squeezelite"; 53 + PermissionsStartOnly = true; 54 + }; 55 + }; 56 + 57 + users.extraUsers.squeezelite= { 58 + inherit uid; 59 + group = "nogroup"; 60 + extraGroups = [ "audio" ]; 61 + description = "Squeezelite user"; 62 + home = "${cfg.dataDir}"; 63 + }; 64 + 65 + }; 66 + 67 + }
+26
pkgs/applications/audio/squeezelite/default.nix
··· 1 + { stdenv, fetchFromGitHub, alsaLib, faad2, flac, libmad, libvorbis, mpg123 }: 2 + 3 + stdenv.mkDerivation { 4 + name = "squeezelite-git-2016-05-27"; 5 + 6 + src = fetchFromGitHub { 7 + owner = "ralph-irving"; 8 + repo = "squeezelite"; 9 + rev = "e37ed17fed9e11a7346cbe9f1e1deeccc051f42e"; 10 + sha256 = "15ihx2dbp4kr6k6r50g9q5npqad5zyv8nqf5cr37bhg964syvbdm"; 11 + }; 12 + 13 + buildInputs = [ alsaLib faad2 flac libmad libvorbis mpg123 ]; 14 + 15 + installPhase = '' 16 + mkdir -p $out/bin 17 + cp squeezelite $out/bin 18 + ''; 19 + 20 + meta = with stdenv.lib; { 21 + description = "Lightweight headless squeezebox client emulator"; 22 + homepage = https://github.com/ralph-irving/squeezelite; 23 + license = licenses.gpl3; 24 + platforms = platforms.linux; 25 + }; 26 + }
+2
pkgs/top-level/all-packages.nix
··· 14253 14253 apiKey = config.libspotify.apiKey or null; 14254 14254 }; 14255 14255 14256 + squeezelite = callPackage ../applications/audio/squeezelite { }; 14257 + 14256 14258 ltunify = callPackage ../tools/misc/ltunify { }; 14257 14259 14258 14260 src = callPackage ../applications/version-management/src/default.nix {