Merge remote-tracking branches 'gum/master' and 'prism/master'

This commit is contained in:
tv 2020-07-14 19:31:19 +02:00
commit 7534036668
11 changed files with 143 additions and 19 deletions

View File

@ -14,7 +14,7 @@ let
confirmation=no
'';
in {
pattern = "^${name}-([a-z]+)(?::\\s*(.*))?";
pattern = "^${name}-([a-z]+)(?::?\\s*(.*))?";
activate = "match";
command = 1;
arguments = [2];
@ -76,7 +76,7 @@ let
};
}
{
pattern = ''^(\S+)\s+([+-][1-9][0-9]*)\s+(\S+)$'';
pattern = ''^([\w-]*):?\s+([+-][1-9][0-9]*)\s+(\S+)$'';
activate = "match";
arguments = [1 2 3];
command = {

View File

@ -13,6 +13,11 @@ in {
amy = {
owner = config.krebs.users.Mic92;
nets = rec {
internet = {
ip4.addr = "129.215.165.57";
ip6.addr = "2001:630:3c1:164:b62e:99ff:fe3e:d369";
aliases = [ "amy.i" ];
};
retiolum = {
addrs = [
config.krebs.hosts.amy.nets.retiolum.ip4.addr
@ -41,6 +46,11 @@ in {
clara = {
owner = config.krebs.users.Mic92;
nets = rec {
internet = {
ip4.addr = "129.215.165.58";
ip6.addr = "2001:630:3c1:164:b62e:99ff:fe3d:70f2";
aliases = [ "clara.i" ];
};
retiolum = {
addrs = [
config.krebs.hosts.clara.nets.retiolum.ip4.addr
@ -92,6 +102,7 @@ in {
nets = rec {
internet = {
ip4.addr = "129.215.165.54";
ip6.addr = "2001:630:3c1:164:30a2:6e7b:c58b:cafd";
aliases = [ "donna.i" ];
};
retiolum = {
@ -272,6 +283,7 @@ in {
nets = rec {
internet = {
ip4.addr = "129.215.165.53";
ip6.addr = "2001:630:3c1:164:6d4:c4ff:fe04:4aba";
aliases = [ "martha.i" ];
};
retiolum = {
@ -355,6 +367,7 @@ in {
nets = rec {
internet = {
ip4.addr = "129.215.165.52";
ip6.addr = "2001:630:3c1:164:6d4:c4ff:fe04:4e4b";
aliases = [ "rose.i" ];
};
retiolum = {

View File

@ -1,7 +1,7 @@
{
"url": "https://github.com/NixOS/nixpkgs-channels",
"rev": "0f5ce2fac0c726036ca69a5524c59a49e2973dd4",
"date": "2020-05-19T01:31:20+02:00",
"sha256": "0nkk492aa7pr0d30vv1aw192wc16wpa1j02925pldc09s9m9i0r3",
"rev": "22a81aa5fc15b2d41b12f7160a71cd4a9f3c3fa1",
"date": "2020-06-22T17:52:02+02:00",
"sha256": "14gx5fsqibdn2cxp7gymfrz2vcnwiwwjnxqlnysczz8dqihnrpa7",
"fetchSubmodules": false
}

View File

@ -1,7 +1,7 @@
{
"url": "https://github.com/NixOS/nixpkgs-channels",
"rev": "e2bb73ce5f786b83e984b80199112f86b8a6cc9d",
"date": "2020-06-07T23:11:12+02:00",
"sha256": "0mpcdwhippvgsj3kj8vw35dgz94dnzgxgsfqqzcfpmvnzjc23vk7",
"rev": "6460602eec5ced5b9720f4d9fdb0dd717b89b4fd",
"date": "2020-06-24T19:32:57+02:00",
"sha256": "0fk22vc780xf8jza4hcin7f88z1g9gsly5mjhfbygcxfxv334q2i",
"fetchSubmodules": false
}

View File

@ -23,7 +23,7 @@
services.udev.extraRules = ''
SUBSYSTEM=="net", DEVPATH=="/devices/pci*/*1c.1/*/net/*", NAME="wl0"
SUBSYSTEM=="net", ATTR{address}=="f0:de:f1:c4:7a:f1", NAME="et0"
SUBSYSTEM=="net", ATTR{address}=="3c:97:0e:4f:42:35", NAME="et0"
'';
#TODO activationScripts seem broken, fix them!
@ -37,12 +37,10 @@
echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.2/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1d.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.3/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1b.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1a.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:19.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.1/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.4/power/control'
'';
}

View File

@ -36,7 +36,6 @@ with import <stockholm/lib>;
networking.wireless.enable = false;
networking.networkmanager.enable = true;
services.logind.extraConfig = ''
HandleLidSwitch=ignore
'';
services.logind.lidSwitch = "ignore";
services.logind.lidSwitchDocked = "ignore";
}

View File

@ -91,6 +91,10 @@ in {
xorg.xhost
xsel
zathura
(pkgs.writeDashBin "screenshot" ''
${pkgs.flameshot-once}/bin/flameshot-once
${pkgs.klem}/bin/klem
'')
];
fonts.fonts = with pkgs; [
@ -147,4 +151,36 @@ in {
krebs.xresources.enable = true;
lass.screenlock.enable = true;
lass.klem = {
kpaste.script = pkgs.writeDash "kpaste-wrapper" ''
${pkgs.kpaste}/bin/kpaste \
| ${pkgs.coreutils}/bin/tail -1 \
| ${pkgs.coreutils}/bin/tr -d '\r\n'
'';
go = {
target = "STRING";
script = "${pkgs.goify}/bin/goify";
};
"go.lassul.us" = {
target = "STRING";
script = pkgs.writeDash "go.lassul.us" ''
export GO_HOST='go.lassul.us'
${pkgs.goify}/bin/goify
'';
};
qrcode = {
target = "image";
script = pkgs.writeDash "zbar" ''
${pkgs.zbar}/bin/zbarimg -q -
'';
};
ocr = {
target = "image";
script = pkgs.writeDash "gocr" ''
${pkgs.netpbm}/bin/pngtopnm - \
| ${pkgs.gocr}/bin/gocr -
'';
};
};
}

View File

@ -3,17 +3,19 @@
device = "prism.w:/export/download";
fsType = "nfs";
options = [
"timeo=14"
#"timeo=14"
"noauto"
"noatime"
"nodiratime"
"noac"
"nocto"
#"noac"
#"nocto"
"x-systemd.automount"
"x-systemd.device-timeout=1"
"x-systemd.idle-timeout=1min"
"x-systemd.requires=retiolum.service"
"x-systemd.requires=wpa_supplicant.service"
"user"
"_netdev"
];
};
}

View File

@ -6,6 +6,7 @@ _:
./folderPerms.nix
./hass.nix
./hosts.nix
./klem.nix
./mysql-backup.nix
./news.nix
./nichtparasoup.nix

75
lass/3modules/klem.nix Normal file
View File

@ -0,0 +1,75 @@
{ config, pkgs, ... }: with import <stockholm/lib>; let
cfg = config.lass.klem;
in {
options.lass.klem = mkOption {
default = {};
type = types.attrsOf (types.submodule ({ config, ...}: {
options = {
target = mkOption {
default = ".*";
description = ''
regex of valid targets
can be shown with xclip -selection clipboard -t TARGETS
the first hit is taken as target argument
'';
type = types.str;
};
script = mkOption {
description = ''
file to run if entry is selected
'';
type = types.path;
};
label = mkOption {
default = config._module.args.name;
description = ''
label to show in dmenu for this script
'';
type = types.str;
};
};
}));
};
config = let
klem = pkgs.writers.writeDashBin "klem" ''
set -x
labels=""
# match filetype against patterns
${concatMapStringsSep "\n" (script: ''
${pkgs.xclip}/bin/xclip -selection clipboard -target TARGETS -out \
| grep -q '${script.target}'
if [ $? -eq 0 ]; then
labels="$labels:${script.label}"
fi
'') (attrValues cfg)}
#remove empty line, feed into dmenu
script=$(echo "$labels" \
| ${pkgs.gnused}/bin/sed 's/^://;s/:/\n/g' \
| ${pkgs.dmenu}/bin/dmenu)
#run the chosen script
case $script in
${concatMapStringsSep "\n" (script: indent ''
${script.label})
target=$(${pkgs.xclip}/bin/xclip -selection clipboard -target TARGETS -out \
| ${pkgs.gnugrep}/bin/grep '${script.target}' \
| ${pkgs.gnugrep}/bin/grep -v TARGETS \
| ${pkgs.coreutils}/bin/head -1)
${pkgs.xclip}/bin/xclip -selection clipboard -target "$target" -out \
| ${script.script} \
| ${pkgs.xclip}/bin/xclip -selection clipboard -in
;;
'') (attrValues cfg)}
esac
'';
in mkIf (cfg != {}) {
environment.systemPackages = [ klem ];
nixpkgs.overlays = [
(self: super: {
klem = klem;
})
];
};
}

View File

@ -126,7 +126,7 @@ myKeyMap =
, ("M4-x", floatNext True >> spawn myTerm)
, ("M4-c", floatNext True >> spawn "${pkgs.termite}/bin/termite")
, ("M4-f", floatNext True)
, ("M4-b", sendMessage ToggleStruts)
, ("M4-b", spawn "/run/current-system/sw/bin/klem")
, ("M4-v", gets windowset >>= allWorkspaceNames >>= pager pagerConfig (windows . W.greedyView) )
, ("M4-S-v", gets windowset >>= allWorkspaceNames >>= pager pagerConfig (windows . W.shift) )
@ -161,7 +161,7 @@ myKeyMap =
, ("M4-u", spawn "${pkgs.xcalib}/bin/xcalib -invert -alter")
, ("M4-s", spawn "${pkgs.knav}/bin/knav")
, ("<Print>", spawn "${pkgs.flameshot-once}/bin/flameshot-once")
, ("M4-i", spawn "/run/current-system/sw/bin/screenshot")
--, ("M4-w", screenWorkspace 0 >>= (windows . W.greedyView))
--, ("M4-e", screenWorkspace 1 >>= (windows . W.greedyView))