summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2021-01-27 22:57:15 +0100
committermakefu <github@syntax-fehler.de>2021-01-27 22:57:15 +0100
commiteebd84fdfa262fa20a707458c85240bafbd760d9 (patch)
tree6bf9b971dfec7fc48f177f39c840bf8d2879f4ca
parentfc951fa8b4950a67c55e1ab27ffd3e4039851ef1 (diff)
parentc39fea09607ec693055e0981c1a4b81a6c48ae83 (diff)
Merge remote-tracking branch 'lass/master'
-rw-r--r--lib/default.nix1
-rw-r--r--lib/uri.nix77
-rw-r--r--tv/1systems/mu/config.nix6
-rw-r--r--tv/3modules/slock.nix5
-rw-r--r--tv/5pkgs/haskell/xmonad-tv/src/main.hs8
-rw-r--r--tv/5pkgs/simple/pinentry-urxvt/default.nix56
6 files changed, 149 insertions, 4 deletions
diff --git a/lib/default.nix b/lib/default.nix
index be9f60f..2efeec0 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -12,6 +12,7 @@ let
encodeName = replaceChars ["/"] ["\\x2f"];
};
types = nixpkgs-lib.types // import ./types.nix { inherit lib; };
+ uri = import ./uri.nix { inherit lib; };
xml = import ./xml.nix { inherit lib; };
eq = x: y: x == y;
diff --git a/lib/uri.nix b/lib/uri.nix
new file mode 100644
index 0000000..72ad390
--- /dev/null
+++ b/lib/uri.nix
@@ -0,0 +1,77 @@
+{ lib }:
+with lib;
+with builtins;
+rec {
+ # Regular expression to match URIs per RFC3986
+ # From: # http://jmrware.com/articles/2009/uri_regexp/URI_regex.html#uri-40
+ native-regex = ''
+ # RFC-3986 URI component: URI
+ [A-Za-z][A-Za-z0-9+\-.]* : # scheme ":"
+ (?: // # hier-part
+ (?: (?:[A-Za-z0-9\-._~!$&'()*+,;=:]|%[0-9A-Fa-f]{2})* @)?
+ (?:
+ \[
+ (?:
+ (?:
+ (?: (?:[0-9A-Fa-f]{1,4}:){6}
+ | :: (?:[0-9A-Fa-f]{1,4}:){5}
+ | (?: [0-9A-Fa-f]{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?:/ (?:[A-Za-z0-9\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})* )*
+ |
+ )
+ (?:\? (?:[A-Za-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9A-Fa-f]{2})* )? # [ "?" query ]
+ (?:\# (?:[A-Za-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9A-Fa-f]{2})* )? # [ "#" fragment ]
+ '';
+
+ posix-extended-regex =
+ let
+ removeComment = s:
+ elemAt (match "^((\\\\#|[^#])*)(#.*)?$" s) 0;
+
+ removeWhitespace =
+ replaceStrings [" "] [""];
+
+ moveDashToEndOfCharacterClass = s:
+ let
+ result = match "(.*)\\\\-([^]]+)(].*)" s;
+ s' = elemAt result 0 + elemAt result 1 + "-" + elemAt result 2;
+ in
+ if result != null then
+ moveDashToEndOfCharacterClass s'
+ else
+ s;
+ in
+ concatStrings
+ (foldl' (a: f: map f a) (splitString "\n" native-regex) [
+ removeComment
+ moveDashToEndOfCharacterClass
+ (replaceStrings ["(?:"] ["("])
+ removeWhitespace
+ ]);
+}
diff --git a/tv/1systems/mu/config.nix b/tv/1systems/mu/config.nix
index d516928..8fd6ee4 100644
--- a/tv/1systems/mu/config.nix
+++ b/tv/1systems/mu/config.nix
@@ -17,6 +17,7 @@ with import <stockholm/lib>;
boot.initrd.luks.devices.muca.device = "/dev/sda2";
boot.initrd.availableKernelModules = [ "ahci" ];
boot.kernelModules = [ "fbcon" "kvm-intel" ];
+ boot.kernelParams = [ "fsck.repair=yes" ];
boot.extraModulePackages = [ ];
fileSystems = {
@@ -109,9 +110,8 @@ with import <stockholm/lib>;
services.xserver.desktopManager.plasma5.enable = true;
- services.xserver.displayManager.lightdm.autoLogin.enable = true;
- services.xserver.displayManager.lightdm.autoLogin.user = "vv";
- services.xserver.displayManager.lightdm.enable = true;
+ services.xserver.displayManager.autoLogin.enable = true;
+ services.xserver.displayManager.autoLogin.user = "vv";
users.users.vv = {
inherit (config.krebs.users.vv) home uid;
diff --git a/tv/3modules/slock.nix b/tv/3modules/slock.nix
index 53f7f1f..926adc8 100644
--- a/tv/3modules/slock.nix
+++ b/tv/3modules/slock.nix
@@ -28,6 +28,9 @@ in {
});
'';
systemd.services."slock-${cfg.user.name}@" = {
+ conflicts = [
+ "picom@%i.target"
+ ];
environment = {
DISPLAY = ":%I";
LD_PRELOAD = pkgs.runCommandCC "slock-${cfg.user.name}.so" {
@@ -61,6 +64,8 @@ in {
restartIfChanged = false;
serviceConfig = {
ExecStart = "${pkgs.slock}/bin/slock";
+ ExecStopPost =
+ "+${pkgs.systemd}/bin/systemctl start xsession@%i.target";
OOMScoreAdjust = -1000;
Restart = "on-failure";
RestartSec = "100ms";
diff --git a/tv/5pkgs/haskell/xmonad-tv/src/main.hs b/tv/5pkgs/haskell/xmonad-tv/src/main.hs
index b8ddd27..50b03d8 100644
--- a/tv/5pkgs/haskell/xmonad-tv/src/main.hs
+++ b/tv/5pkgs/haskell/xmonad-tv/src/main.hs
@@ -8,6 +8,7 @@ import System.Exit (exitFailure)
import Control.Exception
import Control.Monad.Extra (whenJustM)
+import qualified Data.List
import Graphics.X11.ExtraTypes.XF86
import Text.Read (readEither)
import XMonad
@@ -59,6 +60,11 @@ main = getArgs >>= \case
args -> hPutStrLn stderr ("bad arguments: " <> show args) >> exitFailure
+queryPrefix :: Query String -> String -> Query Bool
+queryPrefix query prefix =
+ fmap (Data.List.isPrefixOf prefix) query
+
+
mainNoArgs :: IO ()
mainNoArgs = do
workspaces0 <- getWorkspaces0
@@ -82,7 +88,7 @@ mainNoArgs = do
, manageHook =
composeAll
[ appName =? "fzmenu-urxvt" --> doCenterFloat
- , appName =? "pinentry" --> doCenterFloat
+ , appName `queryPrefix` "pinentry" --> doCenterFloat
, title =? "Upload to Imgur" -->
doRectFloat (W.RationalRect 0 0 (1 % 8) (1 % 8))
, placeHook (smart (1,0))
diff --git a/tv/5pkgs/simple/pinentry-urxvt/default.nix b/tv/5pkgs/simple/pinentry-urxvt/default.nix
new file mode 100644
index 0000000..65b76c0
--- /dev/null
+++ b/tv/5pkgs/simple/pinentry-urxvt/default.nix
@@ -0,0 +1,56 @@
+{ pkgs, ... }@args:
+
+let
+ lib = import <stockholm/lib>;
+
+ # config cannot be declared in the input attribute set because that would
+ # cause callPackage to inject the wrong config. Instead, get it from ...
+ # via args.
+ config = args.config or {};
+
+ cfg = eval.config;
+
+ eval = lib.evalModules {
+ modules = lib.singleton {
+ _file = toString ./default.nix;
+ imports = lib.singleton config;
+ options = {
+ appName = lib.mkOption {
+ default = "pinentry-urxvt";
+ type = lib.types.str;
+ };
+ display = lib.mkOption {
+ default = ":0";
+ type = lib.types.str;
+ };
+ };
+ };
+ };
+
+
+in
+
+ pkgs.write "pinentry-urxvt" {
+ "/bin/pinentry".link = pkgs.writeDash "pinentry-urxvt-wrapper" ''
+ set -efu
+ exec 3<&0 4>&1 5>&2
+ export DISPLAY=${lib.shell.escape cfg.display}
+ exec ${pkgs.rxvt_unicode}/bin/urxvt \
+ -name ${lib.shell.escape cfg.appName} \
+ -e ${pkgs.writeDash "pinentry-urxvt-tty" ''
+ set -efu
+ exec 2>&5
+ TTY=$(${pkgs.coreutils}/bin/tty)
+ while read -r line <&3; do
+ case $line in
+ 'OPTION ttyname='*)
+ echo "OPTION ttyname=$TTY"
+ ;;
+ *)
+ echo "$line"
+ esac
+ done | ${pkgs.pinentry.tty}/bin/pinentry-tty "$@" >&4
+ ''} \
+ "$@"
+ '';
+ }