From 9c9b1c5748840e398e8c326ec1caa8d68d554978 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 23 Jun 2020 09:59:09 +0200 Subject: l mors.r: update physical hardware --- lass/1systems/mors/physical.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lass') diff --git a/lass/1systems/mors/physical.nix b/lass/1systems/mors/physical.nix index 6828d70de..2f3a68442 100644 --- a/lass/1systems/mors/physical.nix +++ b/lass/1systems/mors/physical.nix @@ -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' ''; } -- cgit v1.2.3 From a56bbf6dc296d1ead192d6d22617c4fca39991e7 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 23 Jun 2020 10:19:28 +0200 Subject: l skynet.r: ignore lidswitch --- lass/1systems/skynet/config.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lass') diff --git a/lass/1systems/skynet/config.nix b/lass/1systems/skynet/config.nix index 70787e514..1bc440a98 100644 --- a/lass/1systems/skynet/config.nix +++ b/lass/1systems/skynet/config.nix @@ -36,7 +36,6 @@ with import ; networking.wireless.enable = false; networking.networkmanager.enable = true; - services.logind.extraConfig = '' - HandleLidSwitch=ignore - ''; + services.logind.lidSwitch = "ignore"; + services.logind.lidSwitchDocked = "ignore"; } -- cgit v1.2.3 From 60c94ad26957aeeb5b61394c5bca29c5ecbeab7e Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 24 Jun 2020 12:00:27 +0200 Subject: l nfs-dl: add more mount options --- lass/2configs/nfs-dl.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lass') diff --git a/lass/2configs/nfs-dl.nix b/lass/2configs/nfs-dl.nix index ba53321b9..91b026455 100644 --- a/lass/2configs/nfs-dl.nix +++ b/lass/2configs/nfs-dl.nix @@ -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" ]; }; } -- cgit v1.2.3 From 0caacbdf420e1da5da01353958f5bd082f77b884 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 4 Jul 2020 06:15:53 +0200 Subject: l: add klem service --- lass/2configs/baseX.nix | 32 +++++++++++++++++++++ lass/3modules/klem.nix | 75 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 lass/3modules/klem.nix (limited to 'lass') diff --git a/lass/2configs/baseX.nix b/lass/2configs/baseX.nix index 1185be9d4..3376f5ea2 100644 --- a/lass/2configs/baseX.nix +++ b/lass/2configs/baseX.nix @@ -147,4 +147,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 - + ''; + }; + }; } diff --git a/lass/3modules/klem.nix b/lass/3modules/klem.nix new file mode 100644 index 000000000..a297adcd1 --- /dev/null +++ b/lass/3modules/klem.nix @@ -0,0 +1,75 @@ +{ config, pkgs, ... }: with import ; 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; + }) + ]; + }; +} -- cgit v1.2.3 From 11b0cc0451b961cccb67a0ff9372e2b9985610bf Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 4 Jul 2020 06:51:08 +0200 Subject: l: use klem in xmonad --- lass/2configs/baseX.nix | 4 ++++ lass/5pkgs/custom/xmonad-lass/default.nix | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'lass') diff --git a/lass/2configs/baseX.nix b/lass/2configs/baseX.nix index 3376f5ea2..baf93ffe5 100644 --- a/lass/2configs/baseX.nix +++ b/lass/2configs/baseX.nix @@ -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; [ diff --git a/lass/5pkgs/custom/xmonad-lass/default.nix b/lass/5pkgs/custom/xmonad-lass/default.nix index e1c45598f..e6d4b0664 100644 --- a/lass/5pkgs/custom/xmonad-lass/default.nix +++ b/lass/5pkgs/custom/xmonad-lass/default.nix @@ -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") - , ("", 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)) -- cgit v1.2.3 From dbee272de6f3dae261ac6e15992b91cd3c1d02ed Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 4 Jul 2020 10:20:26 +0200 Subject: l: import klem module --- lass/3modules/default.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'lass') diff --git a/lass/3modules/default.nix b/lass/3modules/default.nix index f6179c394..335658ed8 100644 --- a/lass/3modules/default.nix +++ b/lass/3modules/default.nix @@ -6,6 +6,7 @@ _: ./folderPerms.nix ./hass.nix ./hosts.nix + ./klem.nix ./mysql-backup.nix ./news.nix ./nichtparasoup.nix -- cgit v1.2.3 From b5b90b598430cfa876639d76dbbdc8d826ccb5c0 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 4 Aug 2020 20:28:04 +0200 Subject: types.secret-file: add service option --- lass/2configs/binary-cache/server.nix | 8 ++++++-- lass/2configs/websites/sqlBackup.nix | 8 ++++++-- lass/3modules/ejabberd/default.nix | 11 +++++++++-- 3 files changed, 21 insertions(+), 6 deletions(-) (limited to 'lass') diff --git a/lass/2configs/binary-cache/server.nix b/lass/2configs/binary-cache/server.nix index d3775b5df..fbaf16a3c 100644 --- a/lass/2configs/binary-cache/server.nix +++ b/lass/2configs/binary-cache/server.nix @@ -9,8 +9,12 @@ }; systemd.services.nix-serve = { - requires = ["secret.service"]; - after = ["secret.service"]; + after = [ + config.krebs.secret.files.nix-serve-key.service + ]; + requires = [ + config.krebs.secret.files.nix-serve-key.service + ]; }; krebs.secret.files.nix-serve-key = { path = "/run/secret/nix-serve.key"; diff --git a/lass/2configs/websites/sqlBackup.nix b/lass/2configs/websites/sqlBackup.nix index 10a6e4643..72d7c7b9a 100644 --- a/lass/2configs/websites/sqlBackup.nix +++ b/lass/2configs/websites/sqlBackup.nix @@ -14,8 +14,12 @@ }; systemd.services.mysql = { - requires = [ "secret.service" ]; - after = [ "secret.service" ]; + after = [ + config.krebs.secret.files.mysql_rootPassword.service + ]; + requires = [ + config.krebs.secret.files.mysql_rootPassword.service + ]; }; lass.mysqlBackup = { diff --git a/lass/3modules/ejabberd/default.nix b/lass/3modules/ejabberd/default.nix index 4838a9093..9642c64c9 100644 --- a/lass/3modules/ejabberd/default.nix +++ b/lass/3modules/ejabberd/default.nix @@ -74,8 +74,15 @@ in { systemd.services.ejabberd = { wantedBy = [ "multi-user.target" ]; - requires = [ "secret.service" ]; - after = [ "network.target" "secret.service" ]; + after = [ + config.krebs.secret.files.ejabberd-certfile.service + config.krebs.secret.files.ejabberd-s2s_certfile.service + "network.target" + ]; + requires = [ + config.krebs.secret.files.ejabberd-certfile.service + config.krebs.secret.files.ejabberd-s2s_certfile.service + ]; serviceConfig = { ExecStartPre = "${gen-dhparam} ${cfg.dhfile.path}"; ExecStart = "${cfg.pkgs.ejabberdctl}/bin/ejabberdctl foreground"; -- cgit v1.2.3 From ec91d1b83cfad151033433159a04eb7b5381bc73 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 4 Aug 2020 22:22:43 +0200 Subject: krebs.secret: restart units on secret change --- lass/2configs/binary-cache/server.nix | 2 +- lass/2configs/websites/sqlBackup.nix | 2 +- lass/3modules/ejabberd/default.nix | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'lass') diff --git a/lass/2configs/binary-cache/server.nix b/lass/2configs/binary-cache/server.nix index fbaf16a3c..9b91035a8 100644 --- a/lass/2configs/binary-cache/server.nix +++ b/lass/2configs/binary-cache/server.nix @@ -12,7 +12,7 @@ after = [ config.krebs.secret.files.nix-serve-key.service ]; - requires = [ + partOf = [ config.krebs.secret.files.nix-serve-key.service ]; }; diff --git a/lass/2configs/websites/sqlBackup.nix b/lass/2configs/websites/sqlBackup.nix index 72d7c7b9a..c9783bece 100644 --- a/lass/2configs/websites/sqlBackup.nix +++ b/lass/2configs/websites/sqlBackup.nix @@ -17,7 +17,7 @@ after = [ config.krebs.secret.files.mysql_rootPassword.service ]; - requires = [ + partOf = [ config.krebs.secret.files.mysql_rootPassword.service ]; }; diff --git a/lass/3modules/ejabberd/default.nix b/lass/3modules/ejabberd/default.nix index 9642c64c9..20a38d572 100644 --- a/lass/3modules/ejabberd/default.nix +++ b/lass/3modules/ejabberd/default.nix @@ -17,6 +17,7 @@ in { certfile = mkOption { type = types.secret-file; default = { + name = "ejabberd-certfile"; path = "${cfg.user.home}/ejabberd.pem"; owner = cfg.user; source-path = "/var/lib/acme/lassul.us/full.pem"; @@ -25,6 +26,7 @@ in { dhfile = mkOption { type = types.secret-file; default = { + name = "ejabberd-dhfile"; path = "${cfg.user.home}/dhparams.pem"; owner = cfg.user; source-path = "/dev/null"; @@ -79,7 +81,7 @@ in { config.krebs.secret.files.ejabberd-s2s_certfile.service "network.target" ]; - requires = [ + partOf = [ config.krebs.secret.files.ejabberd-certfile.service config.krebs.secret.files.ejabberd-s2s_certfile.service ]; -- cgit v1.2.3