3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #21444 from league/fix/gphoto2-udev

gphoto2: nixos programs module to configure udev
This commit is contained in:
Jörg Thalheim 2017-01-01 11:16:28 +01:00 committed by GitHub
commit 84a50084c3
4 changed files with 38 additions and 1 deletions

View file

@ -242,6 +242,7 @@
lassulus = "Lassulus <lassulus@gmail.com>";
layus = "Guillaume Maudoux <layus.on@gmail.com>";
ldesgoui = "Lucas Desgouilles <ldesgoui@gmail.com>";
league = "Christopher League <league@contrapunctus.net>";
lebastr = "Alexander Lebedev <lebastr@gmail.com>";
leenaars = "Michiel Leenaars <ml.software@leenaa.rs>";
leonardoce = "Leonardo Cecchi <leonardo.cecchi@gmail.com>";

View file

@ -71,6 +71,7 @@
./programs/environment.nix
./programs/fish.nix
./programs/freetds.nix
./programs/gphoto2.nix
./programs/info.nix
./programs/java.nix
./programs/kbdlight.nix

View file

@ -0,0 +1,31 @@
{ config, lib, pkgs, ... }:
with lib;
{
meta.maintainers = [ maintainers.league ];
###### interface
options = {
programs.gphoto2 = {
enable = mkOption {
default = false;
example = true;
type = types.bool;
description = ''
Whether to configure system to use gphoto2.
To grant digital camera access to a user, the user must
be part of the camera group:
<code>users.extraUsers.alice.extraGroups = ["camera"];</code>
'';
};
};
};
###### implementation
config = mkIf config.programs.gphoto2.enable {
services.udev.packages = [ pkgs.libgphoto2 ];
environment.systemPackages = [ pkgs.gphoto2 ];
users.extraGroups.camera = {};
};
}

View file

@ -25,6 +25,11 @@ stdenv.mkDerivation rec {
hardeningDisable = [ "format" ];
postInstall = ''
mkdir -p $out/lib/udev/rules.d
$out/lib/libgphoto2/print-camera-list udev-rules version 175 group camera >$out/lib/udev/rules.d/40-gphoto2.rules
'';
meta = {
homepage = http://www.gphoto.org/proj/libgphoto2/;
description = "A library for accessing digital cameras";
@ -41,4 +46,3 @@ stdenv.mkDerivation rec {
maintainers = with stdenv.lib.maintainers; [ jcumming ];
};
}