diff options
| author | Gregor Kleen <gkleen@yggdrasil.li> | 2015-06-07 15:24:41 +0200 |
|---|---|---|
| committer | Gregor Kleen <gkleen@yggdrasil.li> | 2015-06-07 15:24:41 +0200 |
| commit | 679e58e96ed5ffe00a678dd26285f19bb3ea5721 (patch) | |
| tree | 25992b65f271f193c37f4b0528a04ae77d14e8de /customized | |
| parent | 409484adb9ca96480b26f63c7c9c3752380fc959 (diff) | |
| download | nixos-679e58e96ed5ffe00a678dd26285f19bb3ea5721.tar nixos-679e58e96ed5ffe00a678dd26285f19bb3ea5721.tar.gz nixos-679e58e96ed5ffe00a678dd26285f19bb3ea5721.tar.bz2 nixos-679e58e96ed5ffe00a678dd26285f19bb3ea5721.tar.xz nixos-679e58e96ed5ffe00a678dd26285f19bb3ea5721.zip | |
Cleanup
Diffstat (limited to 'customized')
| -rw-r--r-- | customized/autofs.nix | 120 | ||||
| -rw-r--r-- | customized/jack2.nix | 47 | ||||
| -rw-r--r-- | customized/mpd.nix | 119 |
3 files changed, 286 insertions, 0 deletions
diff --git a/customized/autofs.nix b/customized/autofs.nix new file mode 100644 index 00000000..f4a1059d --- /dev/null +++ b/customized/autofs.nix | |||
| @@ -0,0 +1,120 @@ | |||
| 1 | { config, lib, pkgs, ... }: | ||
| 2 | |||
| 3 | with lib; | ||
| 4 | |||
| 5 | let | ||
| 6 | |||
| 7 | cfg = config.services.autofs; | ||
| 8 | |||
| 9 | autoMaster = pkgs.writeText "auto.master" cfg.autoMaster; | ||
| 10 | |||
| 11 | in | ||
| 12 | |||
| 13 | { | ||
| 14 | |||
| 15 | ###### interface | ||
| 16 | |||
| 17 | options = { | ||
| 18 | |||
| 19 | services.autofs = { | ||
| 20 | |||
| 21 | enable = mkOption { | ||
| 22 | default = false; | ||
| 23 | description = " | ||
| 24 | Mount filesystems on demand. Unmount them automatically. | ||
| 25 | You may also be interested in afuese. | ||
| 26 | "; | ||
| 27 | }; | ||
| 28 | |||
| 29 | autoMaster = mkOption { | ||
| 30 | example = literalExample '' | ||
| 31 | autoMaster = let | ||
| 32 | mapConf = pkgs.writeText "auto" ''' | ||
| 33 | kernel -ro,soft,intr ftp.kernel.org:/pub/linux | ||
| 34 | boot -fstype=ext2 :/dev/hda1 | ||
| 35 | windoze -fstype=smbfs ://windoze/c | ||
| 36 | removable -fstype=ext2 :/dev/hdd | ||
| 37 | cd -fstype=iso9660,ro :/dev/hdc | ||
| 38 | floppy -fstype=auto :/dev/fd0 | ||
| 39 | server -rw,hard,intr / -ro myserver.me.org:/ \ | ||
| 40 | /usr myserver.me.org:/usr \ | ||
| 41 | /home myserver.me.org:/home | ||
| 42 | '''; | ||
| 43 | in ''' | ||
| 44 | /auto file:''${mapConf} | ||
| 45 | ''' | ||
| 46 | ''; | ||
| 47 | description = " | ||
| 48 | file contents of /etc/auto.master. See man auto.master | ||
| 49 | See man 5 auto.master and man 5 autofs. | ||
| 50 | "; | ||
| 51 | }; | ||
| 52 | |||
| 53 | timeout = mkOption { | ||
| 54 | default = 600; | ||
| 55 | description = "Set the global minimum timeout, in seconds, until directories are unmounted"; | ||
| 56 | }; | ||
| 57 | |||
| 58 | debug = mkOption { | ||
| 59 | default = false; | ||
| 60 | description = " | ||
| 61 | pass -d and -7 to automount and write log to /var/log/autofs | ||
| 62 | "; | ||
| 63 | }; | ||
| 64 | |||
| 65 | }; | ||
| 66 | |||
| 67 | }; | ||
| 68 | |||
| 69 | |||
| 70 | ###### implementation | ||
| 71 | |||
| 72 | config = mkIf cfg.enable { | ||
| 73 | |||
| 74 | environment.etc = singleton | ||
| 75 | { target = "auto.master"; | ||
| 76 | source = pkgs.writeText "auto.master" cfg.autoMaster; | ||
| 77 | }; | ||
| 78 | |||
| 79 | boot.kernelModules = [ "autofs4" ]; | ||
| 80 | |||
| 81 | jobs.autofs = | ||
| 82 | { description = "Filesystem automounter"; | ||
| 83 | |||
| 84 | startOn = "started network-interfaces"; | ||
| 85 | stopOn = "stopping network-interfaces"; | ||
| 86 | |||
| 87 | path = [ pkgs.nfs-utils pkgs.sshfsFuse ]; | ||
| 88 | |||
| 89 | preStop = | ||
| 90 | '' | ||
| 91 | set -e; while :; do pkill -TERM automount; sleep 1; done | ||
| 92 | ''; | ||
| 93 | |||
| 94 | # automount doesn't clean up when receiving SIGKILL. | ||
| 95 | # umount -l should unmount the directories recursively when they are no longer used | ||
| 96 | # It does, but traces are left in /etc/mtab. So unmount recursively.. | ||
| 97 | postStop = | ||
| 98 | '' | ||
| 99 | PATH=${pkgs.gnused}/bin:${pkgs.coreutils}/bin | ||
| 100 | exec &> /tmp/logss | ||
| 101 | # double quote for sed: | ||
| 102 | escapeSpaces(){ sed 's/ /\\\\040/g'; } | ||
| 103 | unescapeSpaces(){ sed 's/\\040/ /g'; } | ||
| 104 | sed -n 's@^\s*\(\([^\\ ]\|\\ \)*\)\s.*@\1@p' ${autoMaster} | sed 's/[\\]//' | while read mountPoint; do | ||
| 105 | sed -n "s@[^ ]\+\s\+\($(echo "$mountPoint"| escapeSpaces)[^ ]*\).*@\1@p" /proc/mounts | sort -r | unescapeSpaces| while read smountP; do | ||
| 106 | ${pkgs.utillinux}/bin/umount -l "$smountP" || true | ||
| 107 | done | ||
| 108 | done | ||
| 109 | ''; | ||
| 110 | |||
| 111 | script = | ||
| 112 | '' | ||
| 113 | ${if cfg.debug then "exec &> /var/log/autofs" else ""} | ||
| 114 | exec ${pkgs.autofs5}/sbin/automount ${if cfg.debug then "-d" else ""} -f -t ${builtins.toString cfg.timeout} "${autoMaster}" ${if cfg.debug then "-l7" else ""} | ||
| 115 | ''; | ||
| 116 | }; | ||
| 117 | |||
| 118 | }; | ||
| 119 | |||
| 120 | } | ||
diff --git a/customized/jack2.nix b/customized/jack2.nix new file mode 100644 index 00000000..f4f8fcaf --- /dev/null +++ b/customized/jack2.nix | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | { stdenv, fetchurl, alsaLib, expat, libsamplerate | ||
| 2 | , libsndfile, makeWrapper, pkgconfig, python | ||
| 3 | , firewireSupport ? false, ffado ? null, bash }: | ||
| 4 | |||
| 5 | assert firewireSupport -> ffado != null; | ||
| 6 | |||
| 7 | stdenv.mkDerivation rec { | ||
| 8 | name = "jack2-${version}"; | ||
| 9 | version = "1.9.10"; | ||
| 10 | |||
| 11 | src = fetchurl { | ||
| 12 | urls = [ | ||
| 13 | https://github.com/jackaudio/jack2/archive/v1.9.10.tar.gz | ||
| 14 | ]; | ||
| 15 | sha256 = "03b0iiyk3ng3vh5s8gaqwn565vik7910p56mlbk512bw3dhbdwc8"; | ||
| 16 | }; | ||
| 17 | |||
| 18 | buildInputs = | ||
| 19 | [ alsaLib expat libsamplerate libsndfile makeWrapper | ||
| 20 | pkgconfig python | ||
| 21 | ] ++ (stdenv.lib.optional firewireSupport ffado); | ||
| 22 | |||
| 23 | patchPhase = '' | ||
| 24 | substituteInPlace svnversion_regenerate.sh --replace /bin/bash ${bash}/bin/bash | ||
| 25 | ''; | ||
| 26 | |||
| 27 | configurePhase = '' | ||
| 28 | python waf configure --prefix=$out --alsa ${if firewireSupport then "--firewire" else ""} | ||
| 29 | ''; | ||
| 30 | |||
| 31 | buildPhase = "python waf build"; | ||
| 32 | |||
| 33 | installPhase = '' | ||
| 34 | python waf install | ||
| 35 | wrapProgram $out/bin/jack_control --set PYTHONPATH $PYTHONPATH | ||
| 36 | for bin in $out/bin/*; do | ||
| 37 | wrapProgram $bin --set JACK_PROMISCOUS_SERVER 1 | ||
| 38 | done | ||
| 39 | ''; | ||
| 40 | |||
| 41 | meta = with stdenv.lib; { | ||
| 42 | description = "JACK audio connection kit, version 2 with jackdbus"; | ||
| 43 | homepage = "http://jackaudio.org"; | ||
| 44 | license = licenses.gpl2Plus; | ||
| 45 | platforms = platforms.linux; | ||
| 46 | }; | ||
| 47 | } | ||
diff --git a/customized/mpd.nix b/customized/mpd.nix new file mode 100644 index 00000000..36b78388 --- /dev/null +++ b/customized/mpd.nix | |||
| @@ -0,0 +1,119 @@ | |||
| 1 | { stdenv, fetchurl, pkgconfig, glib, systemd, boost | ||
| 2 | , alsaSupport ? true, alsaLib | ||
| 3 | , flacSupport ? true, flac | ||
| 4 | , vorbisSupport ? true, libvorbis | ||
| 5 | , madSupport ? true, libmad | ||
| 6 | , id3tagSupport ? true, libid3tag | ||
| 7 | , mikmodSupport ? true, libmikmod | ||
| 8 | , shoutSupport ? true, libshout | ||
| 9 | , sqliteSupport ? true, sqlite | ||
| 10 | , curlSupport ? true, curl | ||
| 11 | , audiofileSupport ? true, audiofile | ||
| 12 | , bzip2Support ? true, bzip2 | ||
| 13 | , ffmpegSupport ? true, ffmpeg | ||
| 14 | , fluidsynthSupport ? true, fluidsynth | ||
| 15 | , zipSupport ? true, zziplib | ||
| 16 | , samplerateSupport ? true, libsamplerate | ||
| 17 | , mmsSupport ? true, libmms | ||
| 18 | , mpg123Support ? true, mpg123 | ||
| 19 | , aacSupport ? true, faad2 | ||
| 20 | , pulseaudioSupport ? true, pulseaudio | ||
| 21 | , jackSupport ? true, jack2 | ||
| 22 | , gmeSupport ? true, game-music-emu | ||
| 23 | , icuSupport ? true, icu | ||
| 24 | , clientSupport ? false, mpd_clientlib | ||
| 25 | , opusSupport ? true, libopus | ||
| 26 | }: | ||
| 27 | |||
| 28 | let | ||
| 29 | opt = stdenv.lib.optional; | ||
| 30 | mkFlag = c: f: if c then "--enable-${f}" else "--disable-${f}"; | ||
| 31 | major = "0.19"; | ||
| 32 | minor = "9"; | ||
| 33 | |||
| 34 | in stdenv.mkDerivation rec { | ||
| 35 | name = "mpd-${major}.${minor}"; | ||
| 36 | src = fetchurl { | ||
| 37 | url = "http://www.musicpd.org/download/mpd/${major}/${name}.tar.xz"; | ||
| 38 | sha256 = "0vzj365s4j0pw5w37lfhx3dmpkdp85driravsvx8rlrw0lii91a7"; | ||
| 39 | }; | ||
| 40 | |||
| 41 | buildInputs = [ pkgconfig glib boost ] | ||
| 42 | ++ opt stdenv.isLinux systemd | ||
| 43 | ++ opt (stdenv.isLinux && alsaSupport) alsaLib | ||
| 44 | ++ opt flacSupport flac | ||
| 45 | ++ opt vorbisSupport libvorbis | ||
| 46 | # using libmad to decode mp3 files on darwin is causing a segfault -- there | ||
| 47 | # is probably a solution, but I'm disabling it for now | ||
| 48 | ++ opt (!stdenv.isDarwin && madSupport) libmad | ||
| 49 | ++ opt id3tagSupport libid3tag | ||
| 50 | ++ opt mikmodSupport libmikmod | ||
| 51 | ++ opt shoutSupport libshout | ||
| 52 | ++ opt sqliteSupport sqlite | ||
| 53 | ++ opt curlSupport curl | ||
| 54 | ++ opt bzip2Support bzip2 | ||
| 55 | ++ opt audiofileSupport audiofile | ||
| 56 | ++ opt ffmpegSupport ffmpeg | ||
| 57 | ++ opt fluidsynthSupport fluidsynth | ||
| 58 | ++ opt samplerateSupport libsamplerate | ||
| 59 | ++ opt mmsSupport libmms | ||
| 60 | ++ opt mpg123Support mpg123 | ||
| 61 | ++ opt aacSupport faad2 | ||
| 62 | ++ opt zipSupport zziplib | ||
| 63 | ++ opt pulseaudioSupport pulseaudio | ||
| 64 | ++ opt jackSupport jack2 | ||
| 65 | ++ opt gmeSupport game-music-emu | ||
| 66 | ++ opt icuSupport icu | ||
| 67 | ++ opt clientSupport mpd_clientlib | ||
| 68 | ++ opt opusSupport libopus; | ||
| 69 | |||
| 70 | configureFlags = | ||
| 71 | [ (mkFlag (!stdenv.isDarwin && alsaSupport) "alsa") | ||
| 72 | (mkFlag flacSupport "flac") | ||
| 73 | (mkFlag vorbisSupport "vorbis") | ||
| 74 | (mkFlag vorbisSupport "vorbis-encoder") | ||
| 75 | (mkFlag (!stdenv.isDarwin && madSupport) "mad") | ||
| 76 | (mkFlag mikmodSupport "mikmod") | ||
| 77 | (mkFlag id3tagSupport "id3") | ||
| 78 | (mkFlag shoutSupport "shout") | ||
| 79 | (mkFlag sqliteSupport "sqlite") | ||
| 80 | (mkFlag curlSupport "curl") | ||
| 81 | (mkFlag audiofileSupport "audiofile") | ||
| 82 | (mkFlag bzip2Support "bzip2") | ||
| 83 | (mkFlag ffmpegSupport "ffmpeg") | ||
| 84 | (mkFlag fluidsynthSupport "fluidsynth") | ||
| 85 | (mkFlag zipSupport "zzip") | ||
| 86 | (mkFlag samplerateSupport "lsr") | ||
| 87 | (mkFlag mmsSupport "mms") | ||
| 88 | (mkFlag mpg123Support "mpg123") | ||
| 89 | (mkFlag aacSupport "aac") | ||
| 90 | (mkFlag pulseaudioSupport "pulse") | ||
| 91 | (mkFlag jackSupport "jack") | ||
| 92 | (mkFlag stdenv.isDarwin "osx") | ||
| 93 | (mkFlag icuSupport "icu") | ||
| 94 | (mkFlag gmeSupport "gme") | ||
| 95 | (mkFlag clientSupport "libmpdclient") | ||
| 96 | (mkFlag opusSupport "opus") | ||
| 97 | "--enable-debug" | ||
| 98 | ] | ||
| 99 | ++ opt stdenv.isLinux | ||
| 100 | "--with-systemdsystemunitdir=$(out)/etc/systemd/system"; | ||
| 101 | |||
| 102 | NIX_LDFLAGS = '' | ||
| 103 | ${if shoutSupport then "-lshout" else ""} | ||
| 104 | ''; | ||
| 105 | |||
| 106 | meta = with stdenv.lib; { | ||
| 107 | description = "A flexible, powerful daemon for playing music"; | ||
| 108 | homepage = http://mpd.wikia.com/wiki/Music_Player_Daemon_Wiki; | ||
| 109 | license = licenses.gpl2; | ||
| 110 | maintainers = with maintainers; [ astsmtl fuuzetsu emery ]; | ||
| 111 | platforms = platforms.unix; | ||
| 112 | |||
| 113 | longDescription = '' | ||
| 114 | Music Player Daemon (MPD) is a flexible, powerful daemon for playing | ||
| 115 | music. Through plugins and libraries it can play a variety of sound | ||
| 116 | files while being controlled by its network protocol. | ||
| 117 | ''; | ||
| 118 | }; | ||
| 119 | } | ||
