From b3dfe0f05fb34d5d10823f44d71136729f66aa21 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 2 Aug 2017 01:08:12 +0200 Subject: ma sane-extra: init --- 3modules/default.nix | 1 + 3modules/sane-extra.nix | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 3modules/sane-extra.nix diff --git a/3modules/default.nix b/3modules/default.nix index 2981e0fa3..00df56bee 100644 --- a/3modules/default.nix +++ b/3modules/default.nix @@ -9,6 +9,7 @@ _: ./opentracker.nix ./ps3netsrv.nix ./logging-config.nix + ./sane-extra.nix ./server-config.nix ./snapraid.nix ./torrent.nix diff --git a/3modules/sane-extra.nix b/3modules/sane-extra.nix new file mode 100644 index 000000000..2e0ce8f2f --- /dev/null +++ b/3modules/sane-extra.nix @@ -0,0 +1,45 @@ +{ config, lib, pkgs, ... }: +# https://github.com/michalrus/dotfiles/blob/d943be3089aa436e07cea5f22d829402936a9229/.nixos-config.symlink/modules/sane-extra-config.nix +# via https://github.com/NixOS/nixpkgs/issues/17411 +# via https://unix.stackexchange.com/questions/321954/install-epson-v39-on-nixos +with lib; + +let + + cfg = config.hardware.sane; + + pkg = if cfg.snapshot + then pkgs.sane-backends-git + else pkgs.sane-backends; + + backends = [ pkg ] ++ cfg.extraBackends; + + saneConfig = pkgs.mkSaneConfig { paths = backends; }; + + saneExtraConfig = pkgs.runCommand "sane-extra-config" {} '' + cp -Lr '${pkgs.mkSaneConfig { paths = [ pkgs.sane-backends ]; }}'/etc/sane.d $out + chmod +w $out + ${concatMapStrings (c: '' + f="$out/${c.name}.conf" + [ ! -e "$f" ] || chmod +w "$f" + cat ${builtins.toFile "" (c.value + "\n")} >>"$f" + chmod -w "$f" + '') (mapAttrsToList nameValuePair cfg.extraConfig)} + chmod -w $out + ''; + +in + +{ + options = { + hardware.sane.extraConfig = mkOption { + type = types.attrsOf types.lines; + default = {}; + example = { "some-backend" = "# some lines to add to its .conf"; }; + }; + }; + + config = mkIf (cfg.enable && cfg.extraConfig != {}) { + hardware.sane.configDir = saneExtraConfig.outPath; + }; +} -- cgit v1.2.3 From 149a86402bcaf9c15a7419867a16387077011a3e Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 2 Aug 2017 11:49:27 +0200 Subject: ma printer: add support for magicolor --- 2configs/printer.nix | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/2configs/printer.nix b/2configs/printer.nix index 509ed512d..0865a0841 100644 --- a/2configs/printer.nix +++ b/2configs/printer.nix @@ -1,15 +1,30 @@ -{ pkgs, ... }: +{ config, pkgs, ... }: -{ +let + mainUser = config.krebs.build.user.name; +in { services.printing = { enable = true; drivers = [ pkgs.samsungUnifiedLinuxDriver - pkgs.cups-dymo + pkgs.cups-dymo # dymo labelwriter + pkgs.foo2zjs # magicolor 1690mf ]; }; # scanners are printers just in reverse anyway - hardware.sane.enable = true; - hardware.sane.extraBackends = [ pkgs.samsungUnifiedLinuxDriver ]; + services.saned.enable = true; + users.users."${mainUser}".extraGroups = [ "scanner" ]; + + hardware.sane = { + enable = true; + extraBackends = [ pkgs.samsungUnifiedLinuxDriver ]; + + # $ scanimage -p --format=jpg --mode=Gray --source="Automatic Document Feeder" -v --batch="lol%d.jpg" --resolution=150 + + # requires 'sane-extra', scan via: + extraConfig."magicolor" = '' + net 10.42.20.30 0x2098 + ''; # 10.42.20.30: uhrenkind.shack magicolor 1690mf + }; } -- cgit v1.2.3 From 537bb1aee6d6fee1b05d9494b2afb13e9aa20dd9 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 2 Aug 2017 22:17:41 +0200 Subject: ma x: enable stk1160 --- 1systems/x/config.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/1systems/x/config.nix b/1systems/x/config.nix index 969e78bee..368655575 100644 --- a/1systems/x/config.nix +++ b/1systems/x/config.nix @@ -54,7 +54,7 @@ with import ; - # + # # Filesystem @@ -62,6 +62,9 @@ with import ; # Security + { + programs.adb.enable = true; + } ]; -- cgit v1.2.3 From e2559bc5fd49cb8e30efc603b637027a5100d810 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 2 Aug 2017 22:38:26 +0200 Subject: ma stk1160: revert to hacky override --- 2configs/hw/stk1160.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/2configs/hw/stk1160.nix b/2configs/hw/stk1160.nix index e73741e26..b3a9e1a5a 100644 --- a/2configs/hw/stk1160.nix +++ b/2configs/hw/stk1160.nix @@ -1,8 +1,9 @@ { pkgs, ... }: { # TODO: un-pin linuxPackages somehow + boot.kernelPackages = builtins.trace "Warning: overriding kernel Packages with 4.9" pkgs.linuxPackages; nixpkgs.config.packageOverrides = pkgs: { - linux_latest = pkgs.linux_latest.override { + linux_4_9 = pkgs.linux_4_9.override { extraConfig = '' MEDIA_ANALOG_TV_SUPPORT y VIDEO_STK1160_COMMON m -- cgit v1.2.3 [cgit] Unable to lock slot /tmp/cgit/3e100000.lock: No such file or directory (2)