Re: [Nix-dev] [PATCH] pulseaudio: Add support for package configuration files.
On 11/18/2015 12:08 PM, Jookia wrote: > I wonder if there's any review tools that support a github > bridge that someone could set up. It doesn't look like it from first glance. I've seen the command-line tool, but I almost haven't used it yet. $ hub --help [...] GitHub Commands: pull-request Open a pull request on GitHub fork Make a fork of a remote repository on GitHub and add as remote create Create this repository on GitHub and add GitHub as origin browse Open a GitHub page in the default browser compareOpen a compare page on GitHub releaseList or create releases (beta) issue List or create issues (beta) ci-status Show the CI status of a commit Vladimir smime.p7s Description: S/MIME Cryptographic Signature ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
Re: [Nix-dev] [PATCH] pulseaudio: Add support for package configuration files.
On Thu, Nov 19, 2015 at 09:59:09AM +0100, Vladimír Čunát wrote: > On 11/18/2015 12:08 PM, Jookia wrote: > > I wonder if there's any review tools that support a github > > bridge that someone could set up. It doesn't look like it from first glance. > I've seen the command-line tool, but I almost haven't used it yet. > $ hub --help > [...] > Vladimir hub is pretty good, but I'm not sure if you can sign up or verify emails through it. I've used hub in the past to contribute to projects, but the problem is that there's a block for joining using only free software. Jookia. ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
Re: [Nix-dev] [PATCH] pulseaudio: Add support for package configuration files.
On Wed, Nov 18, 2015 at 10:02:33AM +0100, Luca Bruno wrote: > I hope somehow will review this. Personally I'd prefer if you made a > pull request on github. While github allows use of its services for registered users without nonfree javascript, unfortunately it doesn't allow you to register without it. In my tests I got as far as email validation. Nitpicky I know, but it'd really make me feel uncomfortable using a service that disallows people to join in without using only free software. I've heard that the mailing list is okay for patches, and given the speed of things I'm fine if it takes longer to get a patch reviewed or in. I don't have a good solution to fix this problem, or even if others acknowledge that it's a problem. I wonder if there's any review tools that support a github bridge that someone could set up. It doesn't look like it from first glance. Jookia. ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
Re: [Nix-dev] [PATCH] pulseaudio: Add support for package configuration files.
On 17/11/2015 21:39, Jookia wrote: > In a fashion like udev's support, this patch allows configurations from > packages > to be merged in to directories for PulseAudio to read from. Currently > supported > directories are the alsa-mixer mdoule's profile-sets and paths. > > This is accomplished by patching PulseAudio to read directories from > environment > variables globally defined by NixOS rather from the data path in the Nix > store. > Modules that support it (such as the alsa module) can still be configured at > runtime to use specific paths, this just changes the default paths. > > The environment variables are only used if they're defined, as such the > previous > behaviour can be reverted to if the variables are unset or NixOS isn't > running. > --- > nixos/modules/config/pulseaudio.nix | 43 + > pkgs/servers/pulseaudio/custom-dirs.patch | 52 > +++ > pkgs/servers/pulseaudio/default.nix | 2 +- > 3 files changed, 96 insertions(+), 1 deletion(-) > create mode 100644 pkgs/servers/pulseaudio/custom-dirs.patch > > diff --git a/nixos/modules/config/pulseaudio.nix > b/nixos/modules/config/pulseaudio.nix > index 2ebc612..bad4bf3 100644 > --- a/nixos/modules/config/pulseaudio.nix > +++ b/nixos/modules/config/pulseaudio.nix > @@ -52,6 +52,37 @@ let > } >''); > > + # Create a directory full of configuration files for PulseAudio to use for > + # various modules. Packages are scanned similiar how udev does it. > + moduleEnvVars = { > +PA_ALSA_PATHS_DIR = "${moduleConf}/alsa-paths"; > +PA_ALSA_PROFILE_SETS_DIR = "${moduleConf}/alsa-profiles"; > + }; > + moduleConf = stdenv.mkDerivation { > +name = "pulseaudio-moduleconf"; > + > +preferLocalBuild = true; > +allowSubstitutes = false; > + > +buildCommand = '' > + mkdir -p $out/{alsa-profiles,alsa-paths} > + shopt -s nullglob > + set +o pipefail > + > + function copy_dir() { > +for j in $1/$2/*; do > + echo "Copying $i to $out/$3/$(basename $j)" > + cat $j > $out/$3/$(basename $j) > +done > + } > + > + for i in ${toString cfg.packages}; do > +echo "Adding configuration for package $i" > +copy_dir $i/usr/share/pulseaudio/alsa-mixer profile-sets > alsa-profiles > +copy_dir $i/usr/share/pulseaudio/alsa-mixer paths alsa-paths > + done > +''; > + }; > in { > >options = { > @@ -96,6 +127,17 @@ in { > ''; >}; > > + packages = mkOption { > +type = types.listOf types.path; > +description = '' > + List of packages containing additional PulseAudio configuration. > + All files found in the following directories: > + > pkg/usr/share/lib/pulseaudio/alsa-mixer/profile-sets > + > pkg/usr/share/lib/pulseaudio/alsa-mixer/paths > + will be included. > +''; > + }; > + >package = mkOption { > type = types.package; > default = pulseaudioLight; > @@ -130,6 +172,7 @@ in { >}; > >hardware.pulseaudio.configFile = mkDefault > "${cfg.package}/etc/pulse/default.pa"; > + environment.sessionVariables = moduleEnvVars; > } > > (mkIf cfg.enable { > diff --git a/pkgs/servers/pulseaudio/custom-dirs.patch > b/pkgs/servers/pulseaudio/custom-dirs.patch > new file mode 100644 > index 000..00e2ee7 > --- /dev/null > +++ b/pkgs/servers/pulseaudio/custom-dirs.patch > @@ -0,0 +1,52 @@ > +diff -Naur pulseaudio-7.0/src/modules/alsa/alsa-mixer.c > pulseaudio-7.0.new/src/modules/alsa/alsa-mixer.c > +--- pulseaudio-7.0/src/modules/alsa/alsa-mixer.c 2015-09-15 > 14:46:06.0 +1000 > pulseaudio-7.0.new/src/modules/alsa/alsa-mixer.c 2015-11-18 > 12:58:33.490001078 +1100 > +@@ -2521,10 +2521,11 @@ > + } > + > + static const char *get_default_paths_dir(void) { > ++char *env = getenv("PA_ALSA_PATHS_DIR"); > + if (pa_run_from_build_tree()) > + return PA_SRCDIR "/modules/alsa/mixer/paths/"; > + else > +-return PA_ALSA_PATHS_DIR; > ++return (env ? env : PA_ALSA_PATHS_DIR); > + } > + > + pa_alsa_path* pa_alsa_path_new(const char *paths_dir, const char *fname, > pa_alsa_direction_t direction) { > +@@ -4347,6 +4348,7 @@ > + pa_alsa_profile *p; > + pa_alsa_mapping *m; > + pa_alsa_decibel_fix *db_fix; > ++char *env; > + char *fn; > + int r; > + void *state; > +@@ -4392,9 +4394,10 @@ > + if (!fname) > + fname = "default.conf"; > + > ++env = getenv("PA_ALSA_PROFILE_SETS_DIR"); > + fn = pa_maybe_prefix_path(fname, > + pa_run_from_build_tree() ? PA_SRCDIR > "/modules/alsa/mixer/profile-sets/" : > +- PA_ALSA_PROFILE_SETS_DIR); > ++ (env ? env : PA_ALSA_PROFILE_SETS_DIR)); > + > + r = pa_config_parse(fn, NULL, items, NULL, ps); > + pa_xfree(fn); > +diff
[Nix-dev] [PATCH] pulseaudio: Add support for package configuration files.
In a fashion like udev's support, this patch allows configurations from packages to be merged in to directories for PulseAudio to read from. Currently supported directories are the alsa-mixer mdoule's profile-sets and paths. This is accomplished by patching PulseAudio to read directories from environment variables globally defined by NixOS rather from the data path in the Nix store. Modules that support it (such as the alsa module) can still be configured at runtime to use specific paths, this just changes the default paths. The environment variables are only used if they're defined, as such the previous behaviour can be reverted to if the variables are unset or NixOS isn't running. --- nixos/modules/config/pulseaudio.nix | 43 + pkgs/servers/pulseaudio/custom-dirs.patch | 52 +++ pkgs/servers/pulseaudio/default.nix | 2 +- 3 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 pkgs/servers/pulseaudio/custom-dirs.patch diff --git a/nixos/modules/config/pulseaudio.nix b/nixos/modules/config/pulseaudio.nix index 2ebc612..bad4bf3 100644 --- a/nixos/modules/config/pulseaudio.nix +++ b/nixos/modules/config/pulseaudio.nix @@ -52,6 +52,37 @@ let } ''); + # Create a directory full of configuration files for PulseAudio to use for + # various modules. Packages are scanned similiar how udev does it. + moduleEnvVars = { +PA_ALSA_PATHS_DIR = "${moduleConf}/alsa-paths"; +PA_ALSA_PROFILE_SETS_DIR = "${moduleConf}/alsa-profiles"; + }; + moduleConf = stdenv.mkDerivation { +name = "pulseaudio-moduleconf"; + +preferLocalBuild = true; +allowSubstitutes = false; + +buildCommand = '' + mkdir -p $out/{alsa-profiles,alsa-paths} + shopt -s nullglob + set +o pipefail + + function copy_dir() { +for j in $1/$2/*; do + echo "Copying $i to $out/$3/$(basename $j)" + cat $j > $out/$3/$(basename $j) +done + } + + for i in ${toString cfg.packages}; do +echo "Adding configuration for package $i" +copy_dir $i/usr/share/pulseaudio/alsa-mixer profile-sets alsa-profiles +copy_dir $i/usr/share/pulseaudio/alsa-mixer paths alsa-paths + done +''; + }; in { options = { @@ -96,6 +127,17 @@ in { ''; }; + packages = mkOption { +type = types.listOf types.path; +description = '' + List of packages containing additional PulseAudio configuration. + All files found in the following directories: + pkg/usr/share/lib/pulseaudio/alsa-mixer/profile-sets + pkg/usr/share/lib/pulseaudio/alsa-mixer/paths + will be included. +''; + }; + package = mkOption { type = types.package; default = pulseaudioLight; @@ -130,6 +172,7 @@ in { }; hardware.pulseaudio.configFile = mkDefault "${cfg.package}/etc/pulse/default.pa"; + environment.sessionVariables = moduleEnvVars; } (mkIf cfg.enable { diff --git a/pkgs/servers/pulseaudio/custom-dirs.patch b/pkgs/servers/pulseaudio/custom-dirs.patch new file mode 100644 index 000..00e2ee7 --- /dev/null +++ b/pkgs/servers/pulseaudio/custom-dirs.patch @@ -0,0 +1,52 @@ +diff -Naur pulseaudio-7.0/src/modules/alsa/alsa-mixer.c pulseaudio-7.0.new/src/modules/alsa/alsa-mixer.c +--- pulseaudio-7.0/src/modules/alsa/alsa-mixer.c 2015-09-15 14:46:06.0 +1000 pulseaudio-7.0.new/src/modules/alsa/alsa-mixer.c 2015-11-18 12:58:33.490001078 +1100 +@@ -2521,10 +2521,11 @@ + } + + static const char *get_default_paths_dir(void) { ++char *env = getenv("PA_ALSA_PATHS_DIR"); + if (pa_run_from_build_tree()) + return PA_SRCDIR "/modules/alsa/mixer/paths/"; + else +-return PA_ALSA_PATHS_DIR; ++return (env ? env : PA_ALSA_PATHS_DIR); + } + + pa_alsa_path* pa_alsa_path_new(const char *paths_dir, const char *fname, pa_alsa_direction_t direction) { +@@ -4347,6 +4348,7 @@ + pa_alsa_profile *p; + pa_alsa_mapping *m; + pa_alsa_decibel_fix *db_fix; ++char *env; + char *fn; + int r; + void *state; +@@ -4392,9 +4394,10 @@ + if (!fname) + fname = "default.conf"; + ++env = getenv("PA_ALSA_PROFILE_SETS_DIR"); + fn = pa_maybe_prefix_path(fname, + pa_run_from_build_tree() ? PA_SRCDIR "/modules/alsa/mixer/profile-sets/" : +- PA_ALSA_PROFILE_SETS_DIR); ++ (env ? env : PA_ALSA_PROFILE_SETS_DIR)); + + r = pa_config_parse(fn, NULL, items, NULL, ps); + pa_xfree(fn); +diff -Naur pulseaudio-7.0/src/tests/alsa-mixer-path-test.c pulseaudio-7.0.new/src/tests/alsa-mixer-path-test.c +--- pulseaudio-7.0/src/tests/alsa-mixer-path-test.c2014-02-15 03:06:12.0 +1100 pulseaudio-7.0.new/src/tests/alsa-mixer-path-test.c2015-11-18 12:57:40.750001071 +1100 +@@ -15,10 +15,11 @@ + + /*