From 679e58e96ed5ffe00a678dd26285f19bb3ea5721 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 7 Jun 2015 15:24:41 +0200 Subject: Cleanup --- autofs.nix | 120 -------------------------------------------------- bragi.nix | 6 +-- customized/autofs.nix | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++ customized/jack2.nix | 47 ++++++++++++++++++++ customized/mpd.nix | 119 +++++++++++++++++++++++++++++++++++++++++++++++++ jack2.nix | 47 -------------------- mpd.nix | 119 ------------------------------------------------- 7 files changed, 289 insertions(+), 289 deletions(-) delete mode 100644 autofs.nix create mode 100644 customized/autofs.nix create mode 100644 customized/jack2.nix create mode 100644 customized/mpd.nix delete mode 100644 jack2.nix delete mode 100644 mpd.nix diff --git a/autofs.nix b/autofs.nix deleted file mode 100644 index f4a1059d..00000000 --- a/autofs.nix +++ /dev/null @@ -1,120 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let - - cfg = config.services.autofs; - - autoMaster = pkgs.writeText "auto.master" cfg.autoMaster; - -in - -{ - - ###### interface - - options = { - - services.autofs = { - - enable = mkOption { - default = false; - description = " - Mount filesystems on demand. Unmount them automatically. - You may also be interested in afuese. - "; - }; - - autoMaster = mkOption { - example = literalExample '' - autoMaster = let - mapConf = pkgs.writeText "auto" ''' - kernel -ro,soft,intr ftp.kernel.org:/pub/linux - boot -fstype=ext2 :/dev/hda1 - windoze -fstype=smbfs ://windoze/c - removable -fstype=ext2 :/dev/hdd - cd -fstype=iso9660,ro :/dev/hdc - floppy -fstype=auto :/dev/fd0 - server -rw,hard,intr / -ro myserver.me.org:/ \ - /usr myserver.me.org:/usr \ - /home myserver.me.org:/home - '''; - in ''' - /auto file:''${mapConf} - ''' - ''; - description = " - file contents of /etc/auto.master. See man auto.master - See man 5 auto.master and man 5 autofs. - "; - }; - - timeout = mkOption { - default = 600; - description = "Set the global minimum timeout, in seconds, until directories are unmounted"; - }; - - debug = mkOption { - default = false; - description = " - pass -d and -7 to automount and write log to /var/log/autofs - "; - }; - - }; - - }; - - - ###### implementation - - config = mkIf cfg.enable { - - environment.etc = singleton - { target = "auto.master"; - source = pkgs.writeText "auto.master" cfg.autoMaster; - }; - - boot.kernelModules = [ "autofs4" ]; - - jobs.autofs = - { description = "Filesystem automounter"; - - startOn = "started network-interfaces"; - stopOn = "stopping network-interfaces"; - - path = [ pkgs.nfs-utils pkgs.sshfsFuse ]; - - preStop = - '' - set -e; while :; do pkill -TERM automount; sleep 1; done - ''; - - # automount doesn't clean up when receiving SIGKILL. - # umount -l should unmount the directories recursively when they are no longer used - # It does, but traces are left in /etc/mtab. So unmount recursively.. - postStop = - '' - PATH=${pkgs.gnused}/bin:${pkgs.coreutils}/bin - exec &> /tmp/logss - # double quote for sed: - escapeSpaces(){ sed 's/ /\\\\040/g'; } - unescapeSpaces(){ sed 's/\\040/ /g'; } - sed -n 's@^\s*\(\([^\\ ]\|\\ \)*\)\s.*@\1@p' ${autoMaster} | sed 's/[\\]//' | while read mountPoint; do - sed -n "s@[^ ]\+\s\+\($(echo "$mountPoint"| escapeSpaces)[^ ]*\).*@\1@p" /proc/mounts | sort -r | unescapeSpaces| while read smountP; do - ${pkgs.utillinux}/bin/umount -l "$smountP" || true - done - done - ''; - - script = - '' - ${if cfg.debug then "exec &> /var/log/autofs" else ""} - exec ${pkgs.autofs5}/sbin/automount ${if cfg.debug then "-d" else ""} -f -t ${builtins.toString cfg.timeout} "${autoMaster}" ${if cfg.debug then "-l7" else ""} - ''; - }; - - }; - -} diff --git a/bragi.nix b/bragi.nix index 8d52bf45..ef32b78f 100644 --- a/bragi.nix +++ b/bragi.nix @@ -4,7 +4,7 @@ imports = [ ./bragi-hw.nix - ./autofs.nix + ./customized/autofs.nix ]; boot.loader.grub.enable = true; @@ -29,8 +29,8 @@ nixpkgs.config.packageOverrides = pkgs: { - jack2 = pkgs.callPackage ./jack2.nix {}; - mpd = pkgs.callPackage ./mpd.nix { + jack2 = pkgs.callPackage ./customized/jack2.nix {}; + mpd = pkgs.callPackage ./customized/mpd.nix { gmeSupport = false; game-music-emu = null; }; 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 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.autofs; + + autoMaster = pkgs.writeText "auto.master" cfg.autoMaster; + +in + +{ + + ###### interface + + options = { + + services.autofs = { + + enable = mkOption { + default = false; + description = " + Mount filesystems on demand. Unmount them automatically. + You may also be interested in afuese. + "; + }; + + autoMaster = mkOption { + example = literalExample '' + autoMaster = let + mapConf = pkgs.writeText "auto" ''' + kernel -ro,soft,intr ftp.kernel.org:/pub/linux + boot -fstype=ext2 :/dev/hda1 + windoze -fstype=smbfs ://windoze/c + removable -fstype=ext2 :/dev/hdd + cd -fstype=iso9660,ro :/dev/hdc + floppy -fstype=auto :/dev/fd0 + server -rw,hard,intr / -ro myserver.me.org:/ \ + /usr myserver.me.org:/usr \ + /home myserver.me.org:/home + '''; + in ''' + /auto file:''${mapConf} + ''' + ''; + description = " + file contents of /etc/auto.master. See man auto.master + See man 5 auto.master and man 5 autofs. + "; + }; + + timeout = mkOption { + default = 600; + description = "Set the global minimum timeout, in seconds, until directories are unmounted"; + }; + + debug = mkOption { + default = false; + description = " + pass -d and -7 to automount and write log to /var/log/autofs + "; + }; + + }; + + }; + + + ###### implementation + + config = mkIf cfg.enable { + + environment.etc = singleton + { target = "auto.master"; + source = pkgs.writeText "auto.master" cfg.autoMaster; + }; + + boot.kernelModules = [ "autofs4" ]; + + jobs.autofs = + { description = "Filesystem automounter"; + + startOn = "started network-interfaces"; + stopOn = "stopping network-interfaces"; + + path = [ pkgs.nfs-utils pkgs.sshfsFuse ]; + + preStop = + '' + set -e; while :; do pkill -TERM automount; sleep 1; done + ''; + + # automount doesn't clean up when receiving SIGKILL. + # umount -l should unmount the directories recursively when they are no longer used + # It does, but traces are left in /etc/mtab. So unmount recursively.. + postStop = + '' + PATH=${pkgs.gnused}/bin:${pkgs.coreutils}/bin + exec &> /tmp/logss + # double quote for sed: + escapeSpaces(){ sed 's/ /\\\\040/g'; } + unescapeSpaces(){ sed 's/\\040/ /g'; } + sed -n 's@^\s*\(\([^\\ ]\|\\ \)*\)\s.*@\1@p' ${autoMaster} | sed 's/[\\]//' | while read mountPoint; do + sed -n "s@[^ ]\+\s\+\($(echo "$mountPoint"| escapeSpaces)[^ ]*\).*@\1@p" /proc/mounts | sort -r | unescapeSpaces| while read smountP; do + ${pkgs.utillinux}/bin/umount -l "$smountP" || true + done + done + ''; + + script = + '' + ${if cfg.debug then "exec &> /var/log/autofs" else ""} + exec ${pkgs.autofs5}/sbin/automount ${if cfg.debug then "-d" else ""} -f -t ${builtins.toString cfg.timeout} "${autoMaster}" ${if cfg.debug then "-l7" else ""} + ''; + }; + + }; + +} 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 @@ +{ stdenv, fetchurl, alsaLib, expat, libsamplerate +, libsndfile, makeWrapper, pkgconfig, python +, firewireSupport ? false, ffado ? null, bash }: + +assert firewireSupport -> ffado != null; + +stdenv.mkDerivation rec { + name = "jack2-${version}"; + version = "1.9.10"; + + src = fetchurl { + urls = [ + https://github.com/jackaudio/jack2/archive/v1.9.10.tar.gz + ]; + sha256 = "03b0iiyk3ng3vh5s8gaqwn565vik7910p56mlbk512bw3dhbdwc8"; + }; + + buildInputs = + [ alsaLib expat libsamplerate libsndfile makeWrapper + pkgconfig python + ] ++ (stdenv.lib.optional firewireSupport ffado); + + patchPhase = '' + substituteInPlace svnversion_regenerate.sh --replace /bin/bash ${bash}/bin/bash + ''; + + configurePhase = '' + python waf configure --prefix=$out --alsa ${if firewireSupport then "--firewire" else ""} + ''; + + buildPhase = "python waf build"; + + installPhase = '' + python waf install + wrapProgram $out/bin/jack_control --set PYTHONPATH $PYTHONPATH + for bin in $out/bin/*; do + wrapProgram $bin --set JACK_PROMISCOUS_SERVER 1 + done + ''; + + meta = with stdenv.lib; { + description = "JACK audio connection kit, version 2 with jackdbus"; + homepage = "http://jackaudio.org"; + license = licenses.gpl2Plus; + platforms = platforms.linux; + }; +} 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 @@ +{ stdenv, fetchurl, pkgconfig, glib, systemd, boost +, alsaSupport ? true, alsaLib +, flacSupport ? true, flac +, vorbisSupport ? true, libvorbis +, madSupport ? true, libmad +, id3tagSupport ? true, libid3tag +, mikmodSupport ? true, libmikmod +, shoutSupport ? true, libshout +, sqliteSupport ? true, sqlite +, curlSupport ? true, curl +, audiofileSupport ? true, audiofile +, bzip2Support ? true, bzip2 +, ffmpegSupport ? true, ffmpeg +, fluidsynthSupport ? true, fluidsynth +, zipSupport ? true, zziplib +, samplerateSupport ? true, libsamplerate +, mmsSupport ? true, libmms +, mpg123Support ? true, mpg123 +, aacSupport ? true, faad2 +, pulseaudioSupport ? true, pulseaudio +, jackSupport ? true, jack2 +, gmeSupport ? true, game-music-emu +, icuSupport ? true, icu +, clientSupport ? false, mpd_clientlib +, opusSupport ? true, libopus +}: + +let + opt = stdenv.lib.optional; + mkFlag = c: f: if c then "--enable-${f}" else "--disable-${f}"; + major = "0.19"; + minor = "9"; + +in stdenv.mkDerivation rec { + name = "mpd-${major}.${minor}"; + src = fetchurl { + url = "http://www.musicpd.org/download/mpd/${major}/${name}.tar.xz"; + sha256 = "0vzj365s4j0pw5w37lfhx3dmpkdp85driravsvx8rlrw0lii91a7"; + }; + + buildInputs = [ pkgconfig glib boost ] + ++ opt stdenv.isLinux systemd + ++ opt (stdenv.isLinux && alsaSupport) alsaLib + ++ opt flacSupport flac + ++ opt vorbisSupport libvorbis + # using libmad to decode mp3 files on darwin is causing a segfault -- there + # is probably a solution, but I'm disabling it for now + ++ opt (!stdenv.isDarwin && madSupport) libmad + ++ opt id3tagSupport libid3tag + ++ opt mikmodSupport libmikmod + ++ opt shoutSupport libshout + ++ opt sqliteSupport sqlite + ++ opt curlSupport curl + ++ opt bzip2Support bzip2 + ++ opt audiofileSupport audiofile + ++ opt ffmpegSupport ffmpeg + ++ opt fluidsynthSupport fluidsynth + ++ opt samplerateSupport libsamplerate + ++ opt mmsSupport libmms + ++ opt mpg123Support mpg123 + ++ opt aacSupport faad2 + ++ opt zipSupport zziplib + ++ opt pulseaudioSupport pulseaudio + ++ opt jackSupport jack2 + ++ opt gmeSupport game-music-emu + ++ opt icuSupport icu + ++ opt clientSupport mpd_clientlib + ++ opt opusSupport libopus; + + configureFlags = + [ (mkFlag (!stdenv.isDarwin && alsaSupport) "alsa") + (mkFlag flacSupport "flac") + (mkFlag vorbisSupport "vorbis") + (mkFlag vorbisSupport "vorbis-encoder") + (mkFlag (!stdenv.isDarwin && madSupport) "mad") + (mkFlag mikmodSupport "mikmod") + (mkFlag id3tagSupport "id3") + (mkFlag shoutSupport "shout") + (mkFlag sqliteSupport "sqlite") + (mkFlag curlSupport "curl") + (mkFlag audiofileSupport "audiofile") + (mkFlag bzip2Support "bzip2") + (mkFlag ffmpegSupport "ffmpeg") + (mkFlag fluidsynthSupport "fluidsynth") + (mkFlag zipSupport "zzip") + (mkFlag samplerateSupport "lsr") + (mkFlag mmsSupport "mms") + (mkFlag mpg123Support "mpg123") + (mkFlag aacSupport "aac") + (mkFlag pulseaudioSupport "pulse") + (mkFlag jackSupport "jack") + (mkFlag stdenv.isDarwin "osx") + (mkFlag icuSupport "icu") + (mkFlag gmeSupport "gme") + (mkFlag clientSupport "libmpdclient") + (mkFlag opusSupport "opus") + "--enable-debug" + ] + ++ opt stdenv.isLinux + "--with-systemdsystemunitdir=$(out)/etc/systemd/system"; + + NIX_LDFLAGS = '' + ${if shoutSupport then "-lshout" else ""} + ''; + + meta = with stdenv.lib; { + description = "A flexible, powerful daemon for playing music"; + homepage = http://mpd.wikia.com/wiki/Music_Player_Daemon_Wiki; + license = licenses.gpl2; + maintainers = with maintainers; [ astsmtl fuuzetsu emery ]; + platforms = platforms.unix; + + longDescription = '' + Music Player Daemon (MPD) is a flexible, powerful daemon for playing + music. Through plugins and libraries it can play a variety of sound + files while being controlled by its network protocol. + ''; + }; +} diff --git a/jack2.nix b/jack2.nix deleted file mode 100644 index f4f8fcaf..00000000 --- a/jack2.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ stdenv, fetchurl, alsaLib, expat, libsamplerate -, libsndfile, makeWrapper, pkgconfig, python -, firewireSupport ? false, ffado ? null, bash }: - -assert firewireSupport -> ffado != null; - -stdenv.mkDerivation rec { - name = "jack2-${version}"; - version = "1.9.10"; - - src = fetchurl { - urls = [ - https://github.com/jackaudio/jack2/archive/v1.9.10.tar.gz - ]; - sha256 = "03b0iiyk3ng3vh5s8gaqwn565vik7910p56mlbk512bw3dhbdwc8"; - }; - - buildInputs = - [ alsaLib expat libsamplerate libsndfile makeWrapper - pkgconfig python - ] ++ (stdenv.lib.optional firewireSupport ffado); - - patchPhase = '' - substituteInPlace svnversion_regenerate.sh --replace /bin/bash ${bash}/bin/bash - ''; - - configurePhase = '' - python waf configure --prefix=$out --alsa ${if firewireSupport then "--firewire" else ""} - ''; - - buildPhase = "python waf build"; - - installPhase = '' - python waf install - wrapProgram $out/bin/jack_control --set PYTHONPATH $PYTHONPATH - for bin in $out/bin/*; do - wrapProgram $bin --set JACK_PROMISCOUS_SERVER 1 - done - ''; - - meta = with stdenv.lib; { - description = "JACK audio connection kit, version 2 with jackdbus"; - homepage = "http://jackaudio.org"; - license = licenses.gpl2Plus; - platforms = platforms.linux; - }; -} diff --git a/mpd.nix b/mpd.nix deleted file mode 100644 index 36b78388..00000000 --- a/mpd.nix +++ /dev/null @@ -1,119 +0,0 @@ -{ stdenv, fetchurl, pkgconfig, glib, systemd, boost -, alsaSupport ? true, alsaLib -, flacSupport ? true, flac -, vorbisSupport ? true, libvorbis -, madSupport ? true, libmad -, id3tagSupport ? true, libid3tag -, mikmodSupport ? true, libmikmod -, shoutSupport ? true, libshout -, sqliteSupport ? true, sqlite -, curlSupport ? true, curl -, audiofileSupport ? true, audiofile -, bzip2Support ? true, bzip2 -, ffmpegSupport ? true, ffmpeg -, fluidsynthSupport ? true, fluidsynth -, zipSupport ? true, zziplib -, samplerateSupport ? true, libsamplerate -, mmsSupport ? true, libmms -, mpg123Support ? true, mpg123 -, aacSupport ? true, faad2 -, pulseaudioSupport ? true, pulseaudio -, jackSupport ? true, jack2 -, gmeSupport ? true, game-music-emu -, icuSupport ? true, icu -, clientSupport ? false, mpd_clientlib -, opusSupport ? true, libopus -}: - -let - opt = stdenv.lib.optional; - mkFlag = c: f: if c then "--enable-${f}" else "--disable-${f}"; - major = "0.19"; - minor = "9"; - -in stdenv.mkDerivation rec { - name = "mpd-${major}.${minor}"; - src = fetchurl { - url = "http://www.musicpd.org/download/mpd/${major}/${name}.tar.xz"; - sha256 = "0vzj365s4j0pw5w37lfhx3dmpkdp85driravsvx8rlrw0lii91a7"; - }; - - buildInputs = [ pkgconfig glib boost ] - ++ opt stdenv.isLinux systemd - ++ opt (stdenv.isLinux && alsaSupport) alsaLib - ++ opt flacSupport flac - ++ opt vorbisSupport libvorbis - # using libmad to decode mp3 files on darwin is causing a segfault -- there - # is probably a solution, but I'm disabling it for now - ++ opt (!stdenv.isDarwin && madSupport) libmad - ++ opt id3tagSupport libid3tag - ++ opt mikmodSupport libmikmod - ++ opt shoutSupport libshout - ++ opt sqliteSupport sqlite - ++ opt curlSupport curl - ++ opt bzip2Support bzip2 - ++ opt audiofileSupport audiofile - ++ opt ffmpegSupport ffmpeg - ++ opt fluidsynthSupport fluidsynth - ++ opt samplerateSupport libsamplerate - ++ opt mmsSupport libmms - ++ opt mpg123Support mpg123 - ++ opt aacSupport faad2 - ++ opt zipSupport zziplib - ++ opt pulseaudioSupport pulseaudio - ++ opt jackSupport jack2 - ++ opt gmeSupport game-music-emu - ++ opt icuSupport icu - ++ opt clientSupport mpd_clientlib - ++ opt opusSupport libopus; - - configureFlags = - [ (mkFlag (!stdenv.isDarwin && alsaSupport) "alsa") - (mkFlag flacSupport "flac") - (mkFlag vorbisSupport "vorbis") - (mkFlag vorbisSupport "vorbis-encoder") - (mkFlag (!stdenv.isDarwin && madSupport) "mad") - (mkFlag mikmodSupport "mikmod") - (mkFlag id3tagSupport "id3") - (mkFlag shoutSupport "shout") - (mkFlag sqliteSupport "sqlite") - (mkFlag curlSupport "curl") - (mkFlag audiofileSupport "audiofile") - (mkFlag bzip2Support "bzip2") - (mkFlag ffmpegSupport "ffmpeg") - (mkFlag fluidsynthSupport "fluidsynth") - (mkFlag zipSupport "zzip") - (mkFlag samplerateSupport "lsr") - (mkFlag mmsSupport "mms") - (mkFlag mpg123Support "mpg123") - (mkFlag aacSupport "aac") - (mkFlag pulseaudioSupport "pulse") - (mkFlag jackSupport "jack") - (mkFlag stdenv.isDarwin "osx") - (mkFlag icuSupport "icu") - (mkFlag gmeSupport "gme") - (mkFlag clientSupport "libmpdclient") - (mkFlag opusSupport "opus") - "--enable-debug" - ] - ++ opt stdenv.isLinux - "--with-systemdsystemunitdir=$(out)/etc/systemd/system"; - - NIX_LDFLAGS = '' - ${if shoutSupport then "-lshout" else ""} - ''; - - meta = with stdenv.lib; { - description = "A flexible, powerful daemon for playing music"; - homepage = http://mpd.wikia.com/wiki/Music_Player_Daemon_Wiki; - license = licenses.gpl2; - maintainers = with maintainers; [ astsmtl fuuzetsu emery ]; - platforms = platforms.unix; - - longDescription = '' - Music Player Daemon (MPD) is a flexible, powerful daemon for playing - music. Through plugins and libraries it can play a variety of sound - files while being controlled by its network protocol. - ''; - }; -} -- cgit v1.2.3