Commit 9a6da9539074
Changed files (4)
machine
modules
machine/wakasu.nix
@@ -3,6 +3,10 @@
with import ../assets/machines.nix; {
imports = [ ../hardware/lenovo-p50.nix ];
time.timeZone = "Europe/Paris";
+ hardware.sane.enable = true;
+ hardware.sane.extraConfig = {
+ "canon" = "bjnp://192.168.12.70";
+ };
profiles = {
containerd.enable = true;
dev.enable = true;
modules/hardware/sane-extra-config.nix
@@ -0,0 +1,43 @@
+{ config, lib, pkgs, ... }:
+
+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;
+ };
+}
modules/profiles/users.nix
@@ -27,7 +27,7 @@ in
isNormalUser = true;
uid = 1000;
createHome = true;
- extraGroups = [ "wheel" "input" ] ++ optionals config.profiles.desktop.enable ["audio" "video" "scanner" "networkmanager"]
+ extraGroups = [ "wheel" "input" ] ++ optionals config.profiles.desktop.enable ["audio" "video" "lp" "scanner" "networkmanager"]
++ optionals config.profiles.docker.enable [ "docker" ]
++ optionals config.profiles.buildkit.enable [ "buildkit" ]
++ optionals config.profiles.virtualization.enable [ "libvirtd" "vboxusers" ];
modules/module-list.nix
@@ -2,6 +2,7 @@
{
imports = [
+ ./hardware/sane-extra-config.nix
./profiles/avahi.nix
./profiles/base.nix
./profiles/buildkit.nix