uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
112
nixos/modules/services/hardware/sane_extra_backends/brscan4.nix
Normal file
112
nixos/modules/services/hardware/sane_extra_backends/brscan4.nix
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.hardware.sane.brscan4;
|
||||
|
||||
netDeviceList = attrValues cfg.netDevices;
|
||||
|
||||
etcFiles = pkgs.callPackage ./brscan4_etc_files.nix { netDevices = netDeviceList; };
|
||||
|
||||
netDeviceOpts = { name, ... }: {
|
||||
|
||||
options = {
|
||||
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
The friendly name you give to the network device. If undefined,
|
||||
the name of attribute will be used.
|
||||
'';
|
||||
|
||||
example = "office1";
|
||||
};
|
||||
|
||||
model = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
The model of the network device.
|
||||
'';
|
||||
|
||||
example = "MFC-7860DW";
|
||||
};
|
||||
|
||||
ip = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
The ip address of the device. If undefined, you will have to
|
||||
provide a nodename.
|
||||
'';
|
||||
|
||||
example = "192.168.1.2";
|
||||
};
|
||||
|
||||
nodename = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
The node name of the device. If undefined, you will have to
|
||||
provide an ip.
|
||||
'';
|
||||
|
||||
example = "BRW0080927AFBCE";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
config =
|
||||
{ name = mkDefault name;
|
||||
};
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
options = {
|
||||
|
||||
hardware.sane.brscan4.enable =
|
||||
mkEnableOption "Brother's brscan4 scan backend" // {
|
||||
description = ''
|
||||
When enabled, will automatically register the "brscan4" sane
|
||||
backend and bring configuration files to their expected location.
|
||||
'';
|
||||
};
|
||||
|
||||
hardware.sane.brscan4.netDevices = mkOption {
|
||||
default = {};
|
||||
example =
|
||||
{ office1 = { model = "MFC-7860DW"; ip = "192.168.1.2"; };
|
||||
office2 = { model = "MFC-7860DW"; nodename = "BRW0080927AFBCE"; };
|
||||
};
|
||||
type = with types; attrsOf (submodule netDeviceOpts);
|
||||
description = ''
|
||||
The list of network devices that will be registered against the brscan4
|
||||
sane backend.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf (config.hardware.sane.enable && cfg.enable) {
|
||||
|
||||
hardware.sane.extraBackends = [
|
||||
pkgs.brscan4
|
||||
];
|
||||
|
||||
environment.etc."opt/brother/scanner/brscan4" =
|
||||
{ source = "${etcFiles}/etc/opt/brother/scanner/brscan4"; };
|
||||
|
||||
assertions = [
|
||||
{ assertion = all (x: !(null != x.ip && null != x.nodename)) netDeviceList;
|
||||
message = ''
|
||||
When describing a network device as part of the attribute list
|
||||
`hardware.sane.brscan4.netDevices`, only one of its `ip` or `nodename`
|
||||
attribute should be specified, not both!
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
{ stdenv, lib, brscan4, netDevices ? [] }:
|
||||
|
||||
/*
|
||||
|
||||
Testing
|
||||
-------
|
||||
|
||||
No net devices:
|
||||
|
||||
~~~
|
||||
nix-shell -E 'with import <nixpkgs> { }; brscan4-etc-files'
|
||||
~~~
|
||||
|
||||
Two net devices:
|
||||
|
||||
~~~
|
||||
nix-shell -E 'with import <nixpkgs> { }; brscan4-etc-files.override{netDevices=[{name="a"; model="MFC-7860DW"; nodename="BRW0080927AFBCE";} {name="b"; model="MFC-7860DW"; ip="192.168.1.2";}];}'
|
||||
~~~
|
||||
|
||||
*/
|
||||
|
||||
let
|
||||
|
||||
addNetDev = nd: ''
|
||||
brsaneconfig4 -a \
|
||||
name="${nd.name}" \
|
||||
model="${nd.model}" \
|
||||
${if (lib.hasAttr "nodename" nd && nd.nodename != null) then
|
||||
''nodename="${nd.nodename}"'' else
|
||||
''ip="${nd.ip}"''}'';
|
||||
addAllNetDev = xs: lib.concatStringsSep "\n" (map addNetDev xs);
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
|
||||
name = "brscan4-etc-files-0.4.3-3";
|
||||
src = "${brscan4}/opt/brother/scanner/brscan4";
|
||||
|
||||
nativeBuildInputs = [ brscan4 ];
|
||||
|
||||
dontConfigure = true;
|
||||
|
||||
buildPhase = ''
|
||||
TARGET_DIR="$out/etc/opt/brother/scanner/brscan4"
|
||||
mkdir -p "$TARGET_DIR"
|
||||
cp -rp "./models4" "$TARGET_DIR"
|
||||
cp -rp "./Brsane4.ini" "$TARGET_DIR"
|
||||
cp -rp "./brsanenetdevice4.cfg" "$TARGET_DIR"
|
||||
|
||||
export BRSANENETDEVICE4_CFG_FILENAME="$TARGET_DIR/brsanenetdevice4.cfg"
|
||||
|
||||
printf '${addAllNetDev netDevices}\n'
|
||||
|
||||
${addAllNetDev netDevices}
|
||||
'';
|
||||
|
||||
dontInstall = true;
|
||||
dontStrip = true;
|
||||
dontPatchELF = true;
|
||||
|
||||
meta = with lib; {
|
||||
description = "Brother brscan4 sane backend driver etc files";
|
||||
homepage = "http://www.brother.com";
|
||||
platforms = platforms.linux;
|
||||
license = licenses.unfree;
|
||||
maintainers = with maintainers; [ jraygauthier ];
|
||||
};
|
||||
}
|
||||
110
nixos/modules/services/hardware/sane_extra_backends/brscan5.nix
Normal file
110
nixos/modules/services/hardware/sane_extra_backends/brscan5.nix
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.hardware.sane.brscan5;
|
||||
|
||||
netDeviceList = attrValues cfg.netDevices;
|
||||
|
||||
etcFiles = pkgs.callPackage ./brscan5_etc_files.nix { netDevices = netDeviceList; };
|
||||
|
||||
netDeviceOpts = { name, ... }: {
|
||||
|
||||
options = {
|
||||
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
The friendly name you give to the network device. If undefined,
|
||||
the name of attribute will be used.
|
||||
'';
|
||||
|
||||
example = "office1";
|
||||
};
|
||||
|
||||
model = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
The model of the network device.
|
||||
'';
|
||||
|
||||
example = "ADS-1200";
|
||||
};
|
||||
|
||||
ip = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
The ip address of the device. If undefined, you will have to
|
||||
provide a nodename.
|
||||
'';
|
||||
|
||||
example = "192.168.1.2";
|
||||
};
|
||||
|
||||
nodename = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
The node name of the device. If undefined, you will have to
|
||||
provide an ip.
|
||||
'';
|
||||
|
||||
example = "BRW0080927AFBCE";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
config =
|
||||
{ name = mkDefault name;
|
||||
};
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
options = {
|
||||
|
||||
hardware.sane.brscan5.enable =
|
||||
mkEnableOption "the Brother brscan5 sane backend";
|
||||
|
||||
hardware.sane.brscan5.netDevices = mkOption {
|
||||
default = {};
|
||||
example =
|
||||
{ office1 = { model = "MFC-7860DW"; ip = "192.168.1.2"; };
|
||||
office2 = { model = "MFC-7860DW"; nodename = "BRW0080927AFBCE"; };
|
||||
};
|
||||
type = with types; attrsOf (submodule netDeviceOpts);
|
||||
description = ''
|
||||
The list of network devices that will be registered against the brscan5
|
||||
sane backend.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf (config.hardware.sane.enable && cfg.enable) {
|
||||
|
||||
hardware.sane.extraBackends = [
|
||||
pkgs.brscan5
|
||||
];
|
||||
|
||||
environment.etc."opt/brother/scanner/brscan5" =
|
||||
{ source = "${etcFiles}/etc/opt/brother/scanner/brscan5"; };
|
||||
environment.etc."opt/brother/scanner/models" =
|
||||
{ source = "${etcFiles}/etc/opt/brother/scanner/brscan5/models"; };
|
||||
environment.etc."sane.d/dll.d/brother5.conf".source = "${pkgs.brscan5}/etc/sane.d/dll.d/brother.conf";
|
||||
|
||||
assertions = [
|
||||
{ assertion = all (x: !(null != x.ip && null != x.nodename)) netDeviceList;
|
||||
message = ''
|
||||
When describing a network device as part of the attribute list
|
||||
`hardware.sane.brscan5.netDevices`, only one of its `ip` or `nodename`
|
||||
attribute should be specified, not both!
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
{ stdenv, lib, brscan5, netDevices ? [] }:
|
||||
|
||||
/*
|
||||
|
||||
Testing
|
||||
-------
|
||||
From nixpkgs repo
|
||||
|
||||
No net devices:
|
||||
|
||||
~~~
|
||||
nix-build -E 'let pkgs = import ./. {};
|
||||
brscan5-etc-files = pkgs.callPackage (import ./nixos/modules/services/hardware/sane_extra_backends/brscan5_etc_files.nix) {};
|
||||
in brscan5-etc-files'
|
||||
~~~
|
||||
|
||||
Two net devices:
|
||||
|
||||
~~~
|
||||
nix-build -E 'let pkgs = import ./. {};
|
||||
brscan5-etc-files = pkgs.callPackage (import ./nixos/modules/services/hardware/sane_extra_backends/brscan5_etc_files.nix) {};
|
||||
in brscan5-etc-files.override {
|
||||
netDevices = [
|
||||
{name="a"; model="ADS-1200"; nodename="BRW0080927AFBCE";}
|
||||
{name="b"; model="ADS-1200"; ip="192.168.1.2";}
|
||||
];
|
||||
}'
|
||||
~~~
|
||||
|
||||
*/
|
||||
|
||||
let
|
||||
|
||||
addNetDev = nd: ''
|
||||
brsaneconfig5 -a \
|
||||
name="${nd.name}" \
|
||||
model="${nd.model}" \
|
||||
${if (lib.hasAttr "nodename" nd && nd.nodename != null) then
|
||||
''nodename="${nd.nodename}"'' else
|
||||
''ip="${nd.ip}"''}'';
|
||||
addAllNetDev = xs: lib.concatStringsSep "\n" (map addNetDev xs);
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
|
||||
name = "brscan5-etc-files";
|
||||
version = "1.2.6-0";
|
||||
src = "${brscan5}/opt/brother/scanner/brscan5";
|
||||
|
||||
nativeBuildInputs = [ brscan5 ];
|
||||
|
||||
dontConfigure = true;
|
||||
|
||||
buildPhase = ''
|
||||
TARGET_DIR="$out/etc/opt/brother/scanner/brscan5"
|
||||
mkdir -p "$TARGET_DIR"
|
||||
cp -rp "./models" "$TARGET_DIR"
|
||||
cp -rp "./brscan5.ini" "$TARGET_DIR"
|
||||
cp -rp "./brsanenetdevice.cfg" "$TARGET_DIR"
|
||||
|
||||
export NIX_REDIRECTS="/etc/opt/brother/scanner/brscan5/=$TARGET_DIR/"
|
||||
|
||||
printf '${addAllNetDev netDevices}\n'
|
||||
|
||||
${addAllNetDev netDevices}
|
||||
'';
|
||||
|
||||
dontInstall = true;
|
||||
|
||||
meta = with lib; {
|
||||
description = "Brother brscan5 sane backend driver etc files";
|
||||
homepage = "https://www.brother.com";
|
||||
platforms = platforms.linux;
|
||||
license = licenses.unfree;
|
||||
maintainers = with maintainers; [ mattchrist ];
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
options = {
|
||||
|
||||
hardware.sane.dsseries.enable =
|
||||
mkEnableOption "Brother DSSeries scan backend" // {
|
||||
description = ''
|
||||
When enabled, will automatically register the "dsseries" SANE backend.
|
||||
|
||||
This supports the Brother DSmobile scanner series, including the
|
||||
DS-620, DS-720D, DS-820W, and DS-920DW scanners.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf (config.hardware.sane.enable && config.hardware.sane.dsseries.enable) {
|
||||
|
||||
hardware.sane.extraBackends = [ pkgs.dsseries ];
|
||||
services.udev.packages = [ pkgs.dsseries ];
|
||||
boot.kernelModules = [ "sg" ];
|
||||
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue