summaryrefslogtreecommitdiffstats
path: root/tv
diff options
context:
space:
mode:
Diffstat (limited to 'tv')
-rw-r--r--tv/1systems/bu/config.nix2
-rw-r--r--tv/1systems/nomic/config.nix2
-rw-r--r--tv/1systems/ru/config.nix34
-rw-r--r--tv/2configs/bash/default.nix4
-rw-r--r--tv/2configs/br.nix4
-rw-r--r--tv/2configs/default.nix21
-rw-r--r--tv/2configs/hw/AO753.nix4
-rw-r--r--tv/2configs/hw/winmax2.nix50
-rw-r--r--tv/2configs/nix.nix9
-rw-r--r--tv/2configs/urxvt.nix24
-rw-r--r--tv/2configs/vim.nix67
-rw-r--r--tv/3modules/default.nix20
-rw-r--r--tv/3modules/iptables.nix33
-rw-r--r--tv/3modules/lidControl.nix45
-rw-r--r--tv/3modules/systemd.nix47
-rw-r--r--tv/3modules/wwan.nix182
-rw-r--r--tv/5pkgs/haskell/xmonad-tv/src/Build.hs24
-rw-r--r--tv/5pkgs/haskell/xmonad-tv/src/THEnv/JSON.hs18
-rw-r--r--tv/5pkgs/haskell/xmonad-tv/src/main.hs83
-rw-r--r--tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal3
-rw-r--r--tv/5pkgs/override/alacritty.nix14
-rw-r--r--tv/5pkgs/override/flameshot/default.nix15
-rw-r--r--tv/5pkgs/override/flameshot/flameshot_imgur_0.10.2.patch35
-rw-r--r--tv/5pkgs/override/iosevka-tv-1.nix20
-rw-r--r--tv/5pkgs/override/iosevka-tv-2.nix20
-rw-r--r--tv/5pkgs/override/uqmi.nix10
-rw-r--r--tv/5pkgs/simple/alacritty-tv.nix100
-rw-r--r--tv/5pkgs/simple/ff.nix3
-rw-r--r--tv/5pkgs/simple/font-size-alacritty.nix (renamed from tv/5pkgs/simple/alacritty-font-size.nix)2
-rwxr-xr-xtv/5pkgs/simple/fzmenu/bin/otpmenu2
-rwxr-xr-xtv/5pkgs/simple/fzmenu/bin/passmenu2
-rw-r--r--tv/5pkgs/simple/fzmenu/default.nix14
-rw-r--r--tv/5pkgs/simple/iosevka-tv-1.nix18
-rw-r--r--tv/5pkgs/simple/iosevka-tv-2.nix20
-rw-r--r--tv/5pkgs/simple/libinput-tv.nix11
-rw-r--r--tv/5pkgs/simple/q/default.nix135
-rw-r--r--tv/5pkgs/vim/fzf.nix6
-rw-r--r--tv/5pkgs/vim/hack.nix3
-rw-r--r--tv/5pkgs/vim/tv.nix11
39 files changed, 857 insertions, 260 deletions
diff --git a/tv/1systems/bu/config.nix b/tv/1systems/bu/config.nix
index 22e5f1484..c7f7da24d 100644
--- a/tv/1systems/bu/config.nix
+++ b/tv/1systems/bu/config.nix
@@ -11,8 +11,6 @@ with import ./lib;
<stockholm/tv/2configs/xsessions>
];
- environment.homeBinInPath = true;
-
krebs.build.host = config.krebs.hosts.bu;
networking.hostId = lib.mkDefault "00000000";
diff --git a/tv/1systems/nomic/config.nix b/tv/1systems/nomic/config.nix
index fb67814db..5bc25fd36 100644
--- a/tv/1systems/nomic/config.nix
+++ b/tv/1systems/nomic/config.nix
@@ -41,8 +41,6 @@ with import ./lib;
fsType = "btrfs";
};
- environment.homeBinInPath = true;
-
environment.systemPackages = with pkgs; [
(writeDashBin "play" ''
set -euf
diff --git a/tv/1systems/ru/config.nix b/tv/1systems/ru/config.nix
new file mode 100644
index 000000000..e66cddead
--- /dev/null
+++ b/tv/1systems/ru/config.nix
@@ -0,0 +1,34 @@
+with import ./lib;
+{ config, ... }: {
+ imports = [
+ ../..
+ ../../2configs/hw/winmax2.nix
+ ../../2configs/retiolum.nix
+ ../../2configs/wiregrill.nix
+ ];
+
+ boot.initrd.luks.devices.main.device = "/dev/nvme0n1p2";
+ boot.loader.efi.canTouchEfiVariables = true;
+ boot.loader.systemd-boot.enable = true;
+
+ fileSystems."/" = {
+ device = "main/root";
+ fsType = "zfs";
+ };
+ fileSystems."/boot" = {
+ device = "/dev/nvme0n1p1";
+ fsType = "vfat";
+ };
+ fileSystems."/home" = {
+ device = "main/home";
+ fsType = "zfs";
+ };
+ fileSystems."/bku" = {
+ device = "main/bku";
+ fsType = "zfs";
+ };
+
+ krebs.build.host = config.krebs.hosts.ru;
+
+ system.stateVersion = "22.11";
+}
diff --git a/tv/2configs/bash/default.nix b/tv/2configs/bash/default.nix
index e38566b78..57801d964 100644
--- a/tv/2configs/bash/default.nix
+++ b/tv/2configs/bash/default.nix
@@ -39,6 +39,10 @@ with import ./lib;
esac
${pkgs.bash-fzf-history.bind}
+
+ if test -n "''${BASH_EXTRA_INIT-}"; then
+ . "$BASH_EXTRA_INIT"
+ fi
'';
promptInit = /* sh */ ''
case $UID in
diff --git a/tv/2configs/br.nix b/tv/2configs/br.nix
index 4a8db2e38..47d657c46 100644
--- a/tv/2configs/br.nix
+++ b/tv/2configs/br.nix
@@ -1,8 +1,8 @@
with import ./lib;
-{ config, pkgs, ... }: {
+{ config, modulesPath, pkgs, ... }: {
imports = [
- <nixpkgs/nixos/modules/services/hardware/sane_extra_backends/brscan4.nix>
+ (modulesPath + "/services/hardware/sane_extra_backends/brscan4.nix")
];
krebs.nixpkgs.allowUnfreePredicate = pkg: any (eq (packageName pkg)) [
diff --git a/tv/2configs/default.nix b/tv/2configs/default.nix
index 9babb92c2..d1384845a 100644
--- a/tv/2configs/default.nix
+++ b/tv/2configs/default.nix
@@ -16,6 +16,7 @@ with import ./lib;
./nets/hkw.nix
./networkd.nix
./nginx
+ ./nix.nix
./pki
./ssh.nix
./sshd.nix
@@ -45,20 +46,11 @@ with import ./lib;
}
{
- nix.extraOptions = ''
- auto-optimise-store = true
- '';
-
- # TODO check if both are required:
- nix.settings.extra-sandbox-paths = [
- "/etc/protocols"
- pkgs.iana-etc.outPath
- ];
- }
- {
nixpkgs.config.allowUnfree = false;
}
{
+ environment.homeBinInPath = true;
+
environment.profileRelativeEnvVars.PATH = mkForce [ "/bin" ];
environment.systemPackages = with pkgs; [
@@ -137,4 +129,11 @@ with import ./lib;
];
}
];
+
+ nixpkgs.overlays =
+ mkAfter (optional config.hardware.video.hidpi.enable (self: super: {
+ alacritty-tv = super.alacritty-tv.override {
+ variant = "hidpi";
+ };
+ }));
}
diff --git a/tv/2configs/hw/AO753.nix b/tv/2configs/hw/AO753.nix
index b998fcf7c..f2268a9b2 100644
--- a/tv/2configs/hw/AO753.nix
+++ b/tv/2configs/hw/AO753.nix
@@ -4,8 +4,8 @@ with import ./lib;
../smartd.nix
{
- nix.buildCores = 2;
- nix.maxJobs = 2;
+ nix.settings.cores = 2;
+ nix.settings.max-jobs = 2;
}
(if lib.versionAtLeast (lib.versions.majorMinor lib.version) "21.11" then {
nix.daemonCPUSchedPolicy = "batch";
diff --git a/tv/2configs/hw/winmax2.nix b/tv/2configs/hw/winmax2.nix
new file mode 100644
index 000000000..49af7611c
--- /dev/null
+++ b/tv/2configs/hw/winmax2.nix
@@ -0,0 +1,50 @@
+{ pkgs, ... }: {
+
+ imports = [
+ ../smartd.nix
+ ];
+
+ boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usbhid" ];
+ boot.initrd.kernelModules = [ "amdgpu" ];
+ boot.kernelModules = [
+ "amd-pstate"
+ "kvm-amd"
+ ];
+ boot.kernelPackages = pkgs.linuxPackages_latest;
+ boot.kernelParams = [
+ "amd_pstate=passive"
+ ];
+
+ hardware.bluetooth.enable = true;
+
+ hardware.cpu.amd.updateMicrocode = true;
+ hardware.enableRedistributableFirmware = true;
+
+ hardware.opengl.enable = true;
+ hardware.opengl.extraPackages = [
+ pkgs.amdvlk
+ pkgs.rocm-opencl-icd
+ pkgs.rocm-opencl-runtime
+ ];
+
+ hardware.video.hidpi.enable = true;
+
+ networking.wireless.enable = true;
+ networking.wireless.interfaces = [
+ "wlp1s0"
+ ];
+ networking.interfaces.wlp1s0.useDHCP = true;
+
+ nixpkgs.hostPlatform = "x86_64-linux";
+
+ services.illum.enable = true;
+
+ services.logind.extraConfig = /* ini */ ''
+ HandlePowerKey=ignore
+ '';
+
+ tv.lidControl.enable = true;
+
+ tv.hw.screens.primary.width = 2560;
+ tv.hw.screens.primary.height = 1600;
+}
diff --git a/tv/2configs/nix.nix b/tv/2configs/nix.nix
new file mode 100644
index 000000000..fa96d459f
--- /dev/null
+++ b/tv/2configs/nix.nix
@@ -0,0 +1,9 @@
+{ pkgs, ... }: {
+ nix.settings.auto-optimise-store = true;
+
+ # TODO check if both are required:
+ nix.settings.extra-sandbox-paths = [
+ "/etc/protocols"
+ pkgs.iana-etc.outPath
+ ];
+}
diff --git a/tv/2configs/urxvt.nix b/tv/2configs/urxvt.nix
deleted file mode 100644
index 89bb421aa..000000000
--- a/tv/2configs/urxvt.nix
+++ /dev/null
@@ -1,24 +0,0 @@
-{ pkgs, ... }:
-
-with builtins;
-
-let
- users = [ "tv" ];
- urxvt = pkgs.rxvt_unicode;
- mkService = user: {
- description = "urxvt terminal daemon";
- wantedBy = [ "multi-user.target" ];
- restartIfChanged = false;
- serviceConfig = {
- Restart = "always";
- User = user;
- ExecStart = "${urxvt}/bin/urxvtd";
- };
- };
-
-in
-
-{
- environment.systemPackages = [ urxvt ];
- systemd.services = listToAttrs (map (u: { name = "${u}-urxvtd"; value = mkService u; }) users);
-}
diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix
index b8819ee36..8aee31082 100644
--- a/tv/2configs/vim.nix
+++ b/tv/2configs/vim.nix
@@ -11,18 +11,31 @@ with import ./lib;
environment.variables.VIMINIT = ":so /etc/vimrc";
};
- extra-runtimepath = pkgs.tv.vim.makeRuntimePath [
- pkgs.tv.vimPlugins.elixir
+ base-plugins = [
pkgs.tv.vimPlugins.file-line
- pkgs.tv.vimPlugins.fzf
pkgs.tv.vimPlugins.hack
+ pkgs.vimPlugins.undotree
+ (pkgs.tv.vim.makePlugin (pkgs.write "vim-tv-base" {
+ "/ftplugin/haskell.vim".text = ''
+ if exists("g:vim_tv_ftplugin_haskell_loaded")
+ finish
+ endif
+ let g:vim_tv_ftplugin_haskell_loaded = 1
+
+ setlocal iskeyword+='
+ '';
+ }))
+ ];
+
+ extra-plugins = [
+ pkgs.tv.vimPlugins.elixir
+ pkgs.tv.vimPlugins.fzf
pkgs.tv.vimPlugins.jq
pkgs.tv.vimPlugins.nix
pkgs.tv.vimPlugins.showsyntax
pkgs.tv.vimPlugins.tv
pkgs.tv.vimPlugins.vim
pkgs.vimPlugins.fzfWrapper
- pkgs.vimPlugins.undotree
pkgs.vimPlugins.vim-nftables
];
@@ -58,7 +71,9 @@ with import ./lib;
];
};
- vimrc = pkgs.writeText "vimrc" ''
+ vimrc = pkgs.writeText "vimrc" /* vim */ ''
+ vim9script
+
set nocompatible
set autoindent
@@ -71,7 +86,7 @@ with import ./lib;
set mouse=a
set noruler
set pastetoggle=<INS>
- set runtimepath=${extra-runtimepath},$VIMRUNTIME
+ set runtimepath=${pkgs.tv.vim.makeRuntimePath base-plugins},$VIMRUNTIME
set shortmess+=I
set showcmd
set showmatch
@@ -88,13 +103,15 @@ with import ./lib;
set wildmenu
set wildmode=longest,full
+ set runtimepath^=${pkgs.tv.vim.makeRuntimePath extra-plugins}
+ syntax on
+
set et ts=2 sts=2 sw=2
filetype plugin indent on
set t_Co=256
colorscheme hack
- syntax on
au Syntax * syn match Garbage containedin=ALL /\s\+$/
\ | syn match TabStop containedin=ALL /\t\+/
@@ -115,30 +132,52 @@ with import ./lib;
nnoremap <f1> :tabp<cr>
nnoremap <f2> :tabn<cr>
- inoremap <f1> <esc>:tabp<cr>
- inoremap <f2> <esc>:tabn<cr>
+ imap <f1> <esc><f1>
+ imap <f2> <esc><f2>
+
+ nnoremap <S-f1> :tabm -1<cr>
+ nnoremap <S-f2> :tabm +1<cr>
+ imap <S-f1> <esc><S-f1>
+ imap <S-f2> <esc><S-f2>
noremap <f3> :ShowSyntax<cr>
- " <C-{Up,Down,Right,Left>
+ # <C-{Up,Down,Right,Left}>
noremap <esc>Oa <nop> | noremap! <esc>Oa <nop>
noremap <esc>Ob <nop> | noremap! <esc>Ob <nop>
noremap <esc>Oc <nop> | noremap! <esc>Oc <nop>
noremap <esc>Od <nop> | noremap! <esc>Od <nop>
- " <[C]S-{Up,Down,Right,Left>
+ # <[C]S-{Up,Down,Right,Left}>
noremap <esc>[a <nop> | noremap! <esc>[a <nop>
noremap <esc>[b <nop> | noremap! <esc>[b <nop>
noremap <esc>[c <nop> | noremap! <esc>[c <nop>
noremap <esc>[d <nop> | noremap! <esc>[d <nop>
vnoremap u <nop>
- " fzf
+ # fzf
nnoremap <esc>q :Buffers<cr>
nnoremap <esc>f :Files<cr>
nnoremap <esc>w :Rg<cr>
- " edit alternate buffer
- " For some reason neither putting <ctrl>6 nor <ctrl>^ works here...
+ # edit alternate buffer
+ # For some reason neither putting <ctrl>6 nor <ctrl>^ works here...
nnoremap <esc>a 
+
+ if $TOUCHSCREEN == "1"
+ nnoremap <ScrollWheelUp> <C-y>
+ nnoremap <ScrollWheelDown> <C-e>
+ nnoremap <C-ScrollWheelUp> 3<C-y>
+ nnoremap <C-ScrollWheelDown> 3<C-e>
+ nnoremap <S-ScrollWheelUp> 3<C-y>
+ nnoremap <S-ScrollWheelDown> 3<C-e>
+ nnoremap <C-S-ScrollWheelUp> <PageUp>
+ nnoremap <C-S-ScrollWheelDown> <PageDown>
+ endif
+
+ # remember last position
+ autocmd BufReadPost *
+ \ if line("'\"") > 0 && line("'\"") <= line("$") |
+ \ exe "normal! g`\"" |
+ \ endif
'';
}
diff --git a/tv/3modules/default.nix b/tv/3modules/default.nix
index b6b4faa51..1a0971ec6 100644
--- a/tv/3modules/default.nix
+++ b/tv/3modules/default.nix
@@ -1,16 +1,8 @@
+with import ./lib;
{
- imports = [
- ./charybdis
- ./dnsmasq.nix
- ./ejabberd
- ./focus.nix
- ./hosts.nix
- ./hw.nix
- ./im.nix
- ./iptables.nix
- ./org.freedesktop.machine1.host-shell.nix
- ./slock.nix
- ./x0vncserver.nix
- ./Xresources.nix
- ];
+ imports =
+ map
+ (name: ./. + "/${name}")
+ (attrNames
+ (filterAttrs isNixDirEntry (readDir ./.)));
}
diff --git a/tv/3modules/iptables.nix b/tv/3modules/iptables.nix
index c4bf4644d..5b36c5acb 100644
--- a/tv/3modules/iptables.nix
+++ b/tv/3modules/iptables.nix
@@ -34,6 +34,10 @@ with import ./lib;
type = with types; listOf str;
default = [];
};
+ filter.Wiregrill = mkOption {
+ type = with types; listOf str;
+ default = [];
+ };
};
};
};
@@ -66,6 +70,16 @@ with import ./lib;
default = [];
};
+ input-wiregrill-accept-tcp = mkOption {
+ type = with types; listOf (either int str);
+ default = [];
+ };
+
+ input-wiregrill-accept-udp = mkOption {
+ type = with types; listOf (either int str);
+ default = [];
+ };
+
extra = mkOption {
default = {};
type = extraTypes.rules;
@@ -141,6 +155,7 @@ with import ./lib;
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
:Retiolum - [0:0]
+ :Wiregrill - [0:0]
${concatMapStringsSep "\n" (rule: "-A INPUT ${rule}") ([]
++ [
"-m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT"
@@ -150,6 +165,7 @@ with import ./lib;
++ map accept-tcp (unique (map toString cfg.input-internet-accept-tcp))
++ map accept-udp (unique (map toString cfg.input-internet-accept-udp))
++ ["-i retiolum -j Retiolum"]
+ ++ ["-i wiregrill -j Wiregrill"]
)}
${formatTable cfg.extra.filter}
${formatTable cfg."extra${toString iptables-version}".filter}
@@ -170,6 +186,23 @@ with import ./lib;
];
}."ip${toString iptables-version}tables"
)}
+ ${concatMapStringsSep "\n" (rule: "-A Wiregrill ${rule}") ([]
+ ++ optional (cfg.accept-echo-request == "wiregrill") accept-echo-request
+ ++ map accept-tcp (unique (map toString cfg.input-wiregrill-accept-tcp))
+ ++ map accept-udp (unique (map toString cfg.input-wiregrill-accept-udp))
+ ++ {
+ ip4tables = [
+ "-p tcp -j REJECT --reject-with tcp-reset"
+ "-p udp -j REJECT --reject-with icmp-port-unreachable"
+ "-j REJECT --reject-with icmp-proto-unreachable"
+ ];
+ ip6tables = [
+ "-p tcp -j REJECT --reject-with tcp-reset"
+ "-p udp -j REJECT --reject-with icmp6-port-unreachable"
+ "-j REJECT"
+ ];
+ }."ip${toString iptables-version}tables"
+ )}
COMMIT
'';
}
diff --git a/tv/3modules/lidControl.nix b/tv/3modules/lidControl.nix
new file mode 100644
index 000000000..6a48da18d
--- /dev/null
+++ b/tv/3modules/lidControl.nix
@@ -0,0 +1,45 @@
+with import ./lib;
+{ config, pkgs, ... }: {
+ options = {
+ tv.lidControl.enable = mkEnableOption "tv.lidControl";
+ };
+ config = let
+ cfg = config.tv.lidControl;
+ in mkIf cfg.enable {
+ services.acpid.enable = true;
+ services.acpid.lidEventCommands = /* sh */ ''
+ set -- $1
+
+ # usage: vt_is_xserver NUMBER
+ vt_is_xserver() {
+ ${pkgs.iproute}/bin/ss -lp src unix:/tmp/.X11-unix/X* |
+ ${pkgs.gnused}/bin/sed -n 's|.*/tmp/.X11-unix/X\([0-9]\+\)\>.*|\1|p' |
+ ${pkgs.gnugrep}/bin/grep -Fqx "$1"
+ }
+
+ console=$(${pkgs.kbd}/bin/fgconsole)
+
+ if vt_is_xserver "$console"; then
+ # usage: run_on_display COMMAND [ARG...]
+ run_on_display() {
+ owner=$(${pkgs.coreutils}/bin/stat -c %u /tmp/.X11-unix/X$console)
+ ${pkgs.systemd}/bin/systemd-run -GPq \
+ -E DISPLAY=:$console \
+ --uid=$owner \
+ "$@"
+ }
+ case $3 in
+ open)
+ run_on_display ${pkgs.xorg.xset}/bin/xset dpms force on
+ ;;
+ close)
+ run_on_display ${pkgs.xorg.xset}/bin/xset dpms force off
+ ;;
+ esac
+ fi
+ '';
+ services.logind.lidSwitch = "ignore";
+ services.logind.lidSwitchDocked = "ignore";
+ services.logind.lidSwitchExternalPower = "ignore";
+ };
+}
diff --git a/tv/3modules/systemd.nix b/tv/3modules/systemd.nix
new file mode 100644
index 000000000..db8a51994
--- /dev/null
+++ b/tv/3modules/systemd.nix
@@ -0,0 +1,47 @@
+with import ./lib;
+{ config, ... }: let
+ normalUsers = filterAttrs (_: getAttr "isNormalUser") config.users.users;
+in {
+ options = {
+ tv.systemd.services = mkOption {
+ type = types.attrsOf (types.submodule (self: {
+ options = {
+ operators = mkOption {
+ type = with types; listOf (enum (attrNames normalUsers));
+ default = [];
+ };
+ };
+ }));
+ default = {};
+ };
+ };
+ config = {
+ security.polkit.extraConfig = let
+ access =
+ mapAttrs'
+ (name: cfg:
+ nameValuePair "${name}.service"
+ (genAttrs cfg.operators (const true))
+ )
+ config.tv.systemd.services;
+ in optionalString (access != {}) /* js */ ''
+ polkit.addRule(function () {
+ const access = ${lib.toJSON access};
+ return function (action, subject) {
+ if (action.id === "org.freedesktop.systemd1.manage-units") {
+ const unit = action.lookup("unit");
+ if (
+ (access[unit]||{})[subject.user] ||
+ (
+ unit.includes("@") &&
+ (access[unit.replace(/@[^.]+/, "@")]||{})[subject.user]
+ )
+ ) {
+ return polkit.Result.YES;
+ }
+ }
+ }
+ }());
+ '';
+ };
+}
diff --git a/tv/3modules/wwan.nix b/tv/3modules/wwan.nix
new file mode 100644
index 000000000..382f5a535
--- /dev/null
+++ b/tv/3modules/wwan.nix
@@ -0,0 +1,182 @@
+with import ./lib;
+{ config, pkgs, ... }: {
+ options = {
+ tv.wwan.enable = mkEnableOption "tv.wwan";
+ tv.wwan.apn = mkOption {
+ type = with types; filename;
+ };
+ tv.wwan.device = mkOption {
+ type = with types; pathname;
+ default = "/dev/cdc-wdm0";
+ };
+ tv.wwan.interface = mkOption {
+ type = with types; nullOr filename;
+ default = null;
+ };
+ tv.wwan.operators = mkOption {
+ type = with types; listOf username;
+ default = [];
+ };
+ tv.wwan.secrets = mkOption {
+ type = with types; pathname;
+ default = toString <secrets/wwan.json>;
+ # format: {"pin1":number}
+ };
+ };
+ config = let
+ cfg = config.tv.wwan;
+ in mkIf cfg.enable {
+ nixpkgs.overlays = singleton (self: super: {
+ uqmi-wrapper = pkgs.symlinkJoin {
+ name = "uqmi-wrapper";
+ paths = [
+ (pkgs.writeDashBin "uqmi" ''
+ exec ${pkgs.uqmi}/bin/uqmi --device=${cfg.device} "$@"
+ '')
+ (pkgs.writeTextDir "share/bash-completion/completions/uqmi" /* sh */''
+ _uqmi_complete() {
+ case ''${#COMP_WORDS[@]} in
+ 2)
+ COMPREPLY=($(compgen -W "$(
+ ${pkgs.uqmi}/bin/uqmi --help 2>&1 |
+ ${pkgs.coreutils}/bin/tr , \\n |
+ ${pkgs.gnused}/bin/sed -nr 's/^ *(-[a-z-]+).*/\1/p'
+ )" -- "''${COMP_WORDS[1]}"))
+ ;;
+ esac
+ }
+ complete -F _uqmi_complete uqmi
+ '')
+ pkgs.uqmi
+ ];
+ };
+ });
+ systemd.services.wwan = {
+ environment = {
+ SECRETS = "%d/secrets";
+ };
+ path = [
+ pkgs.busybox
+ pkgs.coreutils
+ pkgs.iproute2
+ pkgs.jq
+ pkgs.uqmi-wrapper
+ (pkgs.writeDashBin "get-interface" (
+ if cfg.interface != null then /* sh */ ''
+ echo ${cfg.interface}
+ '' else /* sh */ ''
+ exec ${pkgs.libqmi}/bin/qmicli -d ${cfg.device} -p --get-wwan-iface
+ ''
+ ))
+ ];
+ serviceConfig = {
+ LoadCredential = [
+ "secrets:${cfg.secrets}"
+ ];
+ Type = "oneshot";
+ RemainAfterExit = true;
+ SyslogIdentifier = "wwan";
+ ExecStart = pkgs.writeDash "tv.wwan.start.sh" ''
+ set -efu
+
+ interface=$(get-interface)
+
+ pin1_status=$(
+ uqmi --uim-get-sim-state |
+ jq -r '"\(.pin1_status)/\(.pin1_verify_tries)"'
+ )
+ case $pin1_status in
+ verified/*)
+ :
+ ;;
+ not_verified/3)
+ pin1=$(jq .pin1 "$SECRETS")
+ echo "verifying PIN1" >&2
+ if ! uqmi --uim-verify-pin1 "$pin1"; then
+ echo "error: failed to verify PIN1" >&2
+ exit 1
+ fi
+ ;;
+ not_verified/*)
+ echo "error: not trying to verify PIN1: not enough tries left" >&2
+ echo \
+ "please check your configuration in ${cfg.secrets}" \
+ " and verify if manually using:" \
+ " ${pkgs.uqmi}/bin/uqmi -d $device --uim-veriy-pin1 XXXX" \
+ >&2
+ exit 1
+ esac
+
+ raw_ip_path=/sys/class/net/$interface/qmi/raw_ip
+ raw_ip=$(cat "$raw_ip_path")
+ if [ "$raw_ip" != Y ]; then
+ echo "enabling raw-ip" >&2
+ if ! echo Y > "$raw_ip_path"; then
+ echo "error: failed to enable raw-ip" >&2
+ exit 1
+ fi
+ fi
+
+ operating_mode=$(uqmi --get-device-operating-mode | tr -d \")
+ case $operating_mode in
+ online)
+ :
+ ;;
+ persistent_low_power|low_power)
+ echo "settings device operating mode to online" >&2
+ uqmi --set-device-operating-mode online
+ operating_mode=$(uqmi --get-device-operating-mode | tr -d \")
+ if test "$operating_mode" != online; then
+ echo "error: failed to set device operating mode to online" >&2
+ exit 1
+ fi
+ ;;
+ *)
+ echo "error: don't know how to change device operating mode to online: $operating_mode" >&2
+ exit 1
+ esac
+
+ ip link set dev "$interface" up
+
+ data_status=$(uqmi --get-data-status | tr -d \")
+ case $data_status in
+ connected)
+ :
+ ;;
+ disconnected)
+ echo "starting network (APN=${cfg.apn})" >&2
+ sleep 1
+ uqmi \
+ --start-network \
+ --autoconnect \
+ --apn ${cfg.apn} \
+ --ip-family ipv4
+ sleep 1
+ ;;
+ *)
+ echo "error: unsupported data status: $data_status" >&2
+ exit 1
+ esac
+
+ udhcpc -q -f -n -i "$interface"
+ '';
+ Restart = "on-failure";
+ ExecStop = pkgs.writeDash "tv.wwan.stop.sh" ''
+ set -efu
+
+ interface=$(get-interface)
+
+ ip addr flush "$interface"
+ ip link set dev "$interface" down
+ uqmi --stop-network 0xFFFFFFFF --autoconnect
+ uqmi --sync
+ uqmi --set-device-operating-mode persistent_low_power
+ '';
+ };
+ };
+ users.users.root.packages = [
+ pkgs.uqmi-wrapper
+ ];
+ tv.systemd.services.wwan.operators = cfg.operators;
+ };
+}
diff --git a/tv/5pkgs/haskell/xmonad-tv/src/Build.hs b/tv/5pkgs/haskell/xmonad-tv/src/Build.hs
deleted file mode 100644
index 553a129b1..000000000
--- a/tv/5pkgs/haskell/xmonad-tv/src/Build.hs
+++ /dev/null
@@ -1,24 +0,0 @@
-{-# LANGUAGE TemplateHaskell #-}
-{-# LANGUAGE TypeApplications #-}
-
-module Build where
-
-import XMonad (Dimension)
-import THEnv.JSON (getCompileEnvJSONExp)
-
-
-myFont :: String
-myFont =
- "-schumacher-*-*-*-*-*-*-*-*-*-*-*-iso10646-*"
-
-myScreenWidth :: Dimension
-myScreenWidth =
- $(getCompileEnvJSONExp (id @Dimension) "XMONAD_BUILD_SCREEN_WIDTH")
-
-myTermFontWidth :: Dimension
-myTermFontWidth =
- $(getCompileEnvJSONExp (id @Dimension) "XMONAD_BUILD_TERM_FONT_WIDTH")
-
-myTermPadding :: Dimension
-myTermPadding =
- 2
diff --git a/tv/5pkgs/haskell/xmonad-tv/src/THEnv/JSON.hs b/tv/5pkgs/haskell/xmonad-tv/src/THEnv/JSON.hs
deleted file mode 100644
index 2a3a0e523..000000000
--- a/tv/5pkgs/haskell/xmonad-tv/src/THEnv/JSON.hs
+++ /dev/null
@@ -1,18 +0,0 @@
-{-# LANGUAGE ScopedTypeVariables #-}
-
-module THEnv.JSON where
-
-import Data.Aeson (eitherDecode,FromJSON)
-import Data.ByteString.Lazy.Char8 (pack)
-import Language.Haskell.TH.Syntax (Exp,Lift(lift),Q)
-import THEnv (getCompileEnv)
-import Control.Monad
-
-getCompileEnvJSON :: (FromJSON a) => String -> Q a
-getCompileEnvJSON name =
- either error (id :: a -> a) . eitherDecode . pack <$> getCompileEnv name
-
-getCompileEnvJSONExp ::
- forall proxy a. (FromJSON a, Lift a) => proxy a -> String -> Q Exp
-getCompileEnvJSONExp _ =
- (lift :: a -> Q Exp) <=< getCompileEnvJSON
diff --git a/tv/5pkgs/haskell/xmonad-tv/src/main.hs b/tv/5pkgs/haskell/xmonad-tv/src/main.hs
index c921d428b..eb61bd5cf 100644
--- a/tv/5pkgs/haskell/xmonad-tv/src/main.hs
+++ b/tv/5pkgs/haskell/xmonad-tv/src/main.hs
@@ -1,12 +1,18 @@
{-# LANGUAGE LambdaCase #-}
+{-# LANGUAGE PatternSynonyms #-}
module Main (main) where
import System.Exit (exitFailure)
+import XMonad.Hooks.EwmhDesktops (ewmh)
+import XMonad.Hooks.RefocusLast (refocusLastLayoutHook, toggleFocus)
import Control.Exception
import Control.Monad.Extra (whenJustM)
+import qualified Data.Aeson
+import qualified Data.ByteString.Char8
import qualified Data.List
+import qualified Data.Maybe
import Graphics.X11.ExtraTypes.XF86
import Text.Read (readEither)
import XMonad
@@ -20,11 +26,18 @@ import XMonad.Actions.CycleWS (toggleWS)
import XMonad.Layout.NoBorders ( smartBorders )
import XMonad.Layout.ResizableTile (ResizableTall(ResizableTall))
import XMonad.Layout.ResizableTile (MirrorResize(MirrorExpand,MirrorShrink))
+import XMonad.Layout.StateFull (pattern StateFull)
import qualified XMonad.Prompt
import qualified XMonad.StackSet as W
import Data.Map (Map)
import qualified Data.Map as Map
-import XMonad.Hooks.UrgencyHook (SpawnUrgencyHook(..), withUrgencyHook)
+import XMonad.Hooks.UrgencyHook
+ ( BorderUrgencyHook(BorderUrgencyHook,urgencyBorderColor)
+ , RemindWhen(Dont)
+ , SuppressWhen(Never)
+ , UrgencyConfig(UrgencyConfig,remindWhen,suppressWhen)
+ , withUrgencyHookC
+ )
import XMonad.Hooks.ManageHelpers (doCenterFloat,doRectFloat)
import Data.Ratio
import XMonad.Hooks.Place (placeHook, smart)
@@ -32,8 +45,6 @@ import XMonad.Actions.PerWorkspaceKeys (chooseAction)
import Shutdown (shutdown, newShutdownEventHandler)
-import Build (myFont, myScreenWidth, myTermFontWidth, myTermPadding)
-
main :: IO ()
main = getArgs >>= \case
@@ -45,21 +56,39 @@ main = getArgs >>= \case
(=??) :: Query a -> (a -> Bool) -> Query Bool
(=??) x p = fmap p x
+readEnv :: Data.Aeson.FromJSON b => String -> IO b
+readEnv name =
+ Data.Maybe.fromJust
+ . Data.Aeson.decodeStrict'
+ . Data.ByteString.Char8.pack
+ <$> getEnv name
mainNoArgs :: IO ()
mainNoArgs = do
+ myScreenWidth <- readEnv "XMONAD_SCREEN_WIDTH" :: IO Dimension
+ myTermFont <- getEnv "XMONAD_TERM_FONT"
+ myTermFontWidth <- readEnv "XMONAD_TERM_FONT_WIDTH" :: IO Dimension
+ myTermPadding <- readEnv "XMONAD_TERM_PADDING" :: IO Dimension
workspaces0 <- getWorkspaces0
handleShutdownEvent <- newShutdownEventHandler
let
config =
- id
- $ withUrgencyHook (SpawnUrgencyHook "echo emit Urgency ")
+ ewmh
+ $ withUrgencyHookC
+ BorderUrgencyHook
+ { urgencyBorderColor = "#ff0000"
+ }
+ UrgencyConfig
+ { remindWhen = Dont
+ , suppressWhen = Never
+ }
$ def
- { terminal = {-pkg:rxvt_unicode-}"urxvtc"
+ { terminal = {-pkg:alacritty-tv-}"alacritty"
, modMask = mod4Mask
- , keys = myKeys
+ , keys = myKeys myTermFont
, workspaces = workspaces0
, layoutHook =
+ refocusLastLayoutHook $
smartBorders $
ResizableTall
1
@@ -67,7 +96,7 @@ mainNoArgs = do
(fromIntegral (80 * myTermFontWidth + 2 * (myTermPadding + borderWidth def)) / fromIntegral myScreenWidth)
[]
|||
- Full
+ StateFull
, manageHook =
composeAll
[ appName =? "fzmenu-urxvt" --> doCenterFloat
@@ -113,20 +142,20 @@ forkFile path args env =
spawnRootTerm :: X ()
spawnRootTerm =
forkFile
- {-pkg:rxvt_unicode-}"urxvtc"
- ["-name", "root-urxvt", "-e", "/run/wrappers/bin/su", "-"]
+ {-pkg:alacritty-tv-}"alacritty"
+ ["--profile=root", "-e", "/run/wrappers/bin/su", "-"]
Nothing
-myKeys :: XConfig Layout -> Map (KeyMask, KeySym) (X ())
-myKeys conf = Map.fromList $
+myKeys :: String -> XConfig Layout -> Map (KeyMask, KeySym) (X ())
+myKeys font conf = Map.fromList $
[ ((_4 , xK_Escape ), forkFile {-pkg-}"slock" [] Nothing)
, ((_4S , xK_c ), kill)
, ((_4 , xK_o ), forkFile {-pkg:fzmenu-}"otpmenu" [] Nothing)
, ((_4 , xK_p ), forkFile {-pkg:fzmenu-}"passmenu" [] Nothing)
- , ((_4 , xK_x ), forkFile {-pkg:rxvt_unicode-}"urxvtc" [] Nothing)
+ , ((_4 , xK_x ), forkFile {-pkg:alacritty-tv-}"alacritty" ["--singleton"] Nothing)
, ((_4C , xK_x ), spawnRootTerm)
, ((_C , xK_Menu ), toggleWS)
@@ -134,6 +163,8 @@ myKeys conf = Map.fromList $
, ((_4 , xK_space ), withFocused $ \w -> ifM (isFloatingX w) xdeny $ sendMessage NextLayout)
, ((_4M , xK_space ), withFocused $ \w -> ifM (isFloatingX w) xdeny $ resetLayout)
+ , ((_4 , xK_l ), toggleFocus)
+
, ((_4 , xK_m ), windows W.focusMaster)
, ((_4 , xK_j ), windows W.focusDown)
, ((_4 , xK_k ), windows W.focusUp)
@@ -162,6 +193,7 @@ myKeys conf = Map.fromList $
, ((0, xF86XK_AudioLowerVolume), audioLowerVolume)
, ((0, xF86XK_AudioRaiseVolume), audioRaiseVolume)
, ((0, xF86XK_AudioMute), audioMute)
+ , ((0, xF86XK_AudioMicMute), audioMicMute)
, ((_4, xF86XK_AudioMute), pavucontrol [])
, ((_4, xK_Prior), forkFile {-pkg-}"xcalib" ["-invert", "-alter"] Nothing)
@@ -188,21 +220,20 @@ myKeys conf = Map.fromList $
audioLowerVolume = amixer ["-q", "sset", "Master", "5%-"]
audioRaiseVolume = amixer ["-q", "sset", "Master", "5%+"]
audioMute = amixer ["-q", "sset", "Master", "toggle"]
+ audioMicMute = amixer ["-q", "sset", "Capture", "toggle"]
resetLayout = setLayout $ XMonad.layoutHook conf
promptXPConfig =
- def { XMonad.Prompt.font = myFont }
-
+ def { XMonad.Prompt.font = font }
-xdeny :: X ()
-xdeny =
- forkFile
- {-pkg-}"xterm"
- [ "-fn", myFont
- , "-geometry", "300x100"
- , "-name", "AlertFloat"
- , "-bg", "#E4002B"
- , "-e", "sleep", "0.05"
- ]
- Nothing
+ xdeny =
+ forkFile
+ {-pkg-}"xterm"
+ [ "-fn", font
+ , "-geometry", "300x100"
+ , "-name", "AlertFloat"
+ , "-bg", "#E4002B"
+ , "-e", "sleep", "0.05"
+ ]
+ Nothing
diff --git a/tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal b/tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal
index a3ddcb039..62faf2f00 100644
--- a/tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal
+++ b/tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal
@@ -23,7 +23,6 @@ executable xmonad
xmonad,
xmonad-contrib
other-modules:
- Shutdown,
- THEnv.JSON
+ Shutdown
default-language: Haskell2010
ghc-options: -O2 -Wall -threaded
diff --git a/tv/5pkgs/override/alacritty.nix b/tv/5pkgs/override/alacritty.nix
new file mode 100644
index 000000000..17baa048f
--- /dev/null
+++ b/tv/5pkgs/override/alacritty.nix
@@ -0,0 +1,14 @@
+self: super:
+
+super.alacritty.overrideAttrs (old:
+ assert self.lib.versions.majorMinor old.version == "0.11";
+ {
+ version = "${old.version}-tv";
+ src = self.fetchFromGitHub {
+ owner = "4z3";
+ repo = "alacritty";
+ rev = "touchscreen-support-0.11";
+ hash = "sha256-oA4earrJ7lPVSBm9vRccWatAQ49hfDKsa7M72B5uQpY=";
+ };
+ }
+)
diff --git a/tv/5pkgs/override/flameshot/default.nix b/tv/5pkgs/override/flameshot/default.nix
new file mode 100644
index 000000000..10154cc44
--- /dev/null
+++ b/tv/5pkgs/override/flameshot/default.nix
@@ -0,0 +1,15 @@
+self: super:
+
+super.flameshot.overrideAttrs (old: rec {
+ name = "flameshot-${version}";
+ version = "0.10.2";
+ src = self.fetchFromGitHub {
+ owner = "flameshot-org";
+ repo = "flameshot";
+ rev = "v${version}";
+ sha256 = "sha256-rZUiaS32C77tFJmEkw/9MGbVTVscb6LOCyWaWO5FyR4=";
+ };
+ patches = old.patches or [] ++ [
+ ./flameshot_imgur_0.10.2.patch
+ ];
+})
diff --git a/tv/5pkgs/override/flameshot/flameshot_imgur_0.10.2.patch b/tv/5pkgs/override/flameshot/flameshot_imgur_0.10.2.patch
new file mode 100644
index 000000000..c4c0bf38a
--- /dev/null
+++ b/tv/5pkgs/override/flameshot/flameshot_imgur_0.10.2.patch
@@ -0,0 +1,35 @@
+--- a/src/tools/imgur/imguruploader.cpp
++++ b/src/tools/imgur/imguruploader.cpp
+@@ -31,6 +31,7 @@
+ #include <QTimer>
+ #include <QUrlQuery>
+ #include <QVBoxLayout>
++#include <stdlib.h>
+
+ ImgurUploader::ImgurUploader(const QPixmap& capture, QWidget* parent)
+ : QWidget(parent)
+@@ -79,8 +80,11 @@ void ImgurUploader::handleReply(QNetworkReply* reply)
+ m_imageURL.setUrl(data[QStringLiteral("link")].toString());
+
+ auto deleteToken = data[QStringLiteral("deletehash")].toString();
++ char *deleteImageURLPattern = secure_getenv("IMGUR_DELETE_URL");
++ if (deleteImageURLPattern == NULL)
++ deleteImageURLPattern = "https://imgur.com/delete/%1";
+ m_deleteImageURL.setUrl(
+- QStringLiteral("https://imgur.com/delete/%1").arg(deleteToken));
++ QString::fromUtf8(deleteImageURLPattern).arg(deleteToken));
+
+ // save history
+ QString imageName = m_imageURL.toString();
+@@ -133,7 +137,10 @@ void ImgurUploader::upload()
+ QString description = FileNameHandler().parsedPattern();
+ urlQuery.addQueryItem(QStringLiteral("description"), description);
+
+- QUrl url(QStringLiteral("https://api.imgur.com/3/image"));
++ char *createImageURLPattern = secure_getenv("IMGUR_CREATE_URL");
++ if (createImageURLPattern == NULL)
++ createImageURLPattern = "https://api.imgur.com/3/image";
++ QUrl url(QString::fromUtf8(createImageURLPattern));
+ url.setQuery(urlQuery);
+ QNetworkRequest request(url);
+ request.setHeader(QNetworkRequest::ContentTypeHeader,
diff --git a/tv/5pkgs/override/iosevka-tv-1.nix b/tv/5pkgs/override/iosevka-tv-1.nix
new file mode 100644
index 000000000..880160b3e
--- /dev/null
+++ b/tv/5pkgs/override/iosevka-tv-1.nix
@@ -0,0 +1,20 @@
+self: super:
+
+let
+ srcpkg = super.iosevka-tv-1;
+ binpkg = self.fetchzip {
+ inherit (srcpkg) pname version;
+ stripRoot = false;
+ hash = "sha256-QIuTS70vUQSvDDXjY4uI6SCcu1XT4HjvzpthvrNX4h0=";
+ urls = [
+ "https://c.krebsco.de/${srcpkg.name}.tar.gz"
+ "https://ni.krebsco.de/~tv/mirrors/iosevka/${srcpkg.name}.tar.gz"
+ ];
+ };
+in
+
+if srcpkg.version == binpkg.version then
+ binpkg
+
+else
+ srcpkg
diff --git a/tv/5pkgs/override/iosevka-tv-2.nix b/tv/5pkgs/override/iosevka-tv-2.nix
new file mode 100644
index 000000000..2eecf3cff
--- /dev/null
+++ b/tv/5pkgs/override/iosevka-tv-2.nix
@@ -0,0 +1,20 @@
+self: super:
+
+let
+ srcpkg = super.iosevka-tv-2;
+ binpkg = self.fetchzip {
+ inherit (srcpkg) pname version;
+ stripRoot = false;
+ hash = "sha256-PuIrW1ftYD5PW4du6gq1XpUM3v0potwmj+vAxJImF/A=";
+ urls = [
+ "https://c.krebsco.de/${srcpkg.name}.tar.gz"
+ "https://ni.krebsco.de/~tv/mirrors/iosevka/${srcpkg.name}.tar.gz"
+ ];
+ };
+in
+
+if srcpkg.version == binpkg.version then
+ binpkg
+
+else
+ srcpkg
diff --git a/tv/5pkgs/override/uqmi.nix b/tv/5pkgs/override/uqmi.nix
new file mode 100644
index 000000000..1eaecbd67
--- /dev/null
+++ b/tv/5pkgs/override/uqmi.nix
@@ -0,0 +1,10 @@
+self: super:
+
+super.uqmi.overrideAttrs (old: {
+ version = "unstable-2022-05-04";
+ src = self.fetchgit {
+ url = "https://git.openwrt.org/project/uqmi.git";
+ rev = "56cb2d4056fef132ccf78dfb6f3074ae5d109992";
+ hash = "sha256-PwnR24PbNKfLrsBlU5JTOHDzs/9Wgcuwfnu3dJuuZcM=";
+ };
+})
diff --git a/tv/5pkgs/simple/alacritty-tv.nix b/tv/5pkgs/simple/alacritty-tv.nix
index d80c46cbb..ddf2ca8df 100644
--- a/tv/5pkgs/simple/alacritty-tv.nix
+++ b/tv/5pkgs/simple/alacritty-tv.nix
@@ -1,4 +1,6 @@
-{ pkgs }:
+{ pkgs
+, variant ? "x220"
+}:
let
lib = import ./lib;
@@ -6,7 +8,7 @@ let
program = "${pkgs.font-size-alacritty}/bin/font-size-alacritty";
args = [arg];
};
- config = {
+ configs.default = lib.recursiveUpdate variants.${variant} {
bell.animation = "EaseOut";
bell.duration = 50;
bell.color = "#ff00ff";
@@ -30,10 +32,6 @@ let
colors.bright.cyan = "#72fbfb";
colors.bright.white = "#fbfbfb";
draw_bold_text_with_bright_colors = true;
- font.normal.family = "Clean";
- font.bold.family = "Clean";
- font.bold.style = "Regular";
- font.size = 10;
hints.enabled = [
{
regex = "(ipfs:|ipns:|magnet:|mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)[^\\u0000-\\u001F\\u007F-\\u009F<>\"\\s{-}\\^⟨⟩`]+";
@@ -42,15 +40,73 @@ let
action = "Select";
}
];
+ scrolling.multiplier = 8;
+ };
+ configs.root = lib.recursiveUpdate configs.default {
+ colors.primary.background = "#230000";
+ colors.primary.foreground = "#e0c0c0";
+ colors.normal.black = "#800000";
+ };
+ configs.fzmenu = lib.recursiveUpdate configs.default {
+ colors.primary.background = "#2A172A";
+ window.dimensions.columns = 70;
+ window.dimensions.lines = 9;
+ };
+ variants.hidpi = {
+ font.normal.family = "iosevka tv 2 Light";
+ font.italic.family = "iosevka tv 2 Light";
+ font.bold.family = "iosevka tv 2 Medium";
+ font.bold_italic.family = "iosevka tv 2 Medium";
+ font.size = 5;
+ key_bindings = [
+ { key = "Up"; mods = "Control"; action = "IncreaseFontSize"; }
+ { key = "Down"; mods = "Control"; action = "DecreaseFontSize"; }
+ { key = "Down"; mods = "Shift|Control"; action = "ResetFontSize"; }
+ ];
+ };
+ variants.x220 = {
+ font.normal.family = "Clean";
+ font.bold.family = "Clean";
+ font.bold.style = "Regular";
+ font.size = 10;
key_bindings = [
{ key = "Up"; mods = "Shift|Control"; command = font-size "=14"; }
{ key = "Up"; mods = "Control"; command = font-size "+1"; }
{ key = "Down"; mods = "Control"; command = font-size "-1"; }
{ key = "Down"; mods = "Shift|Control"; command = font-size "=0"; }
];
- scrolling.multiplier = 8;
};
- config-file = pkgs.writeJSON "alacritty-tv.json" config;
+ writeProfile = name: config: let
+ config-file =
+ assert lib.types.filename.check name;
+ pkgs.writeJSON "alacritty-tv-${name}.json" config;
+ in pkgs.writeText "alacritty-tv-${name}.profile" /* sh */ ''
+ # Use home so Alacritty can find the configuration without arguments.
+ # HOME will be reset once in Alacritty.
+ HOME=$XDG_RUNTIME_DIR/Alacritty-${name}
+ export HOME
+
+ # Tell Alacritty via XDG_RUNTIME_DIR where to create sockets.
+ # XDG_RUNTIME_DIR needs to be reset manually.
+ export ALACRITTY_XDG_RUNTIME_DIR="$XDG_RUNTIME_DIR"
+ export BASH_EXTRA_INIT=${pkgs.writeDash "alacritty-tv.cleanup.sh" ''
+ XDG_RUNTIME_DIR=$ALACRITTY_XDG_RUNTIME_DIR
+ unset ALACRITTY_XDG_RUNTIME_DIR
+ unset BASH_EXTRA_INIT
+ ''}
+ export XDG_RUNTIME_DIR="$HOME"
+
+ # Install stored configuration if it has changed.
+ # This allows for both declarative updates and runtime modifications.
+ # rust-xdg requires XDG_RUNTIME_DIR to be secure:
+ # https://docs.rs/xdg/2.4.1/src/xdg/lib.rs.html#311
+ ${pkgs.coreutils}/bin/mkdir -m 0700 -p "$HOME"
+ ref=$(! test -e "$HOME"/ref || ${pkgs.coreutils}/bin/cat "$HOME"/ref)
+ if test "$ref" != ${config-file}; then
+ echo ${config-file} > "$HOME"/ref
+ ${pkgs.coreutils}/bin/install -m 644 ${config-file} "$HOME"/.alacritty.yml
+ fi
+ '';
in
pkgs.symlinkJoin {
@@ -58,31 +114,35 @@ pkgs.symlinkJoin {
paths = [
(pkgs.writeDashBin "alacritty" ''
# usage:
- # alacritty [--singleton] [ARGS...]
+ # alacritty [--profile=PROFILE] [--singleton] [ARGS...]
+ # where
+ # PROFILE one of ${lib.toJSON (lib.attrNames configs)}
set -efu
- # Use home so Alacritty can find the configuration without arguments.
- # HOME will be reset once in Alacritty.
- HOME=$TMPDIR/Alacritty
- export HOME
+ case ''${1-} in
+ ${lib.concatMapStringsSep "\n" (name: /* sh */ ''
+ --${lib.shell.escape name}|--profile=${lib.shell.escape name})
+ shift
+ profile=${writeProfile name configs.${name}}
+ ;;
+ '') (lib.attrNames configs)}
+ *)
+ profile=${writeProfile "default" configs.default}
+ ;;
+ esac
- # Install stored configuration if it has changed.
- # This allows for both declarative updates and runtime modifications.
- ${pkgs.coreutils}/bin/mkdir -p "$HOME"
- if test "$(${pkgs.coreutils}/bin/cat "$HOME"/ref)" != ${config-file}; then
- echo ${config-file} > "$HOME"/ref
- ${pkgs.coreutils}/bin/cp ${config-file} "$HOME"/.alacritty.yml
- fi
case ''${1-} in
--singleton)
shift
if ! ${pkgs.alacritty}/bin/alacritty msg create-window "$@"; then
+ . "$profile"
${pkgs.alacritty}/bin/alacritty "$@" &
fi
;;
*)
+ . "$profile"
exec ${pkgs.alacritty}/bin/alacritty "$@"
;;
esac
diff --git a/tv/5pkgs/simple/ff.nix b/tv/5pkgs/simple/ff.nix
index 4ce9c3c75..b6022c6ca 100644
--- a/tv/5pkgs/simple/ff.nix
+++ b/tv/5pkgs/simple/ff.nix
@@ -1,5 +1,8 @@
{ pkgs }:
pkgs.writeDashBin "ff" ''
+ case $TOUCHSCREEN in 1)
+ export MOZ_USE_XINPUT2=1
+ esac
exec ${pkgs.firefox}/bin/firefox "$@"
''
diff --git a/tv/5pkgs/simple/alacritty-font-size.nix b/tv/5pkgs/simple/font-size-alacritty.nix
index 84bc3f616..d37f0f055 100644
--- a/tv/5pkgs/simple/alacritty-font-size.nix
+++ b/tv/5pkgs/simple/font-size-alacritty.nix
@@ -6,7 +6,7 @@ pkgs.writeDashBin "font-size-alacritty" ''
set -efu
- min_size=8
+ min_size=5
op=''${1%%[0-9]*}
op=''${op:-=}
diff --git a/tv/5pkgs/simple/fzmenu/bin/otpmenu b/tv/5pkgs/simple/fzmenu/bin/otpmenu
index ad8a0fda9..12bd60a9d 100755
--- a/tv/5pkgs/simple/fzmenu/bin/otpmenu
+++ b/tv/5pkgs/simple/fzmenu/bin/otpmenu
@@ -6,7 +6,7 @@ set -efu
case ${FZMENU_PHASE-0} in
0)
export FZMENU_PHASE=1
- exec setsid -f urxvt -name fzmenu-urxvt -e dash "$0"
+ exec setsid -f terminal dash "$0"
;;
1)
if result=$(
diff --git a/tv/5pkgs/simple/fzmenu/bin/passmenu b/tv/5pkgs/simple/fzmenu/bin/passmenu
index 00b36c3af..da8e739ee 100755
--- a/tv/5pkgs/simple/fzmenu/bin/passmenu
+++ b/tv/5pkgs/simple/fzmenu/bin/passmenu
@@ -6,7 +6,7 @@ set -efu
case ${FZMENU_PHASE-0} in
0)
export FZMENU_PHASE=1
- exec setsid -f urxvt -name fzmenu-urxvt -e dash "$0"
+ exec setsid -f terminal dash "$0"
;;
1)
if result=$(
diff --git a/tv/5pkgs/simple/fzmenu/default.nix b/tv/5pkgs/simple/fzmenu/default.nix
index 634d8338b..7e19505c1 100644
--- a/tv/5pkgs/simple/fzmenu/default.nix
+++ b/tv/5pkgs/simple/fzmenu/default.nix
@@ -1,5 +1,15 @@
{ lib, pkgs, stdenv }:
+let
+ terminal = pkgs.writeDashBin "terminal" ''
+ # usage: terminal COMMAND [ARGS...]
+ exec ${pkgs.alacritty-tv}/bin/alacritty \
+ --profile=fzmenu \
+ --class AlacrittyFzmenuFloat \
+ -e "$@"
+ '';
+in
+
pkgs.runCommand "fzmenu" {
} /* sh */ ''
mkdir $out
@@ -16,9 +26,9 @@ pkgs.runCommand "fzmenu" {
(pkgs.pass.withExtensions (ext: [
ext.pass-otp
]))
- pkgs.rxvt_unicode
pkgs.utillinux
pkgs.xdotool
+ terminal
]}
substituteInPlace $out/bin/passmenu \
@@ -31,8 +41,8 @@ pkgs.runCommand "fzmenu" {
(pkgs.pass.withExtensions (ext: [
ext.pass-otp
]))
- pkgs.rxvt_unicode
pkgs.utillinux
pkgs.xdotool
+ terminal
]}
''
diff --git a/tv/5pkgs/simple/iosevka-tv-1.nix b/tv/5pkgs/simple/iosevka-tv-1.nix
new file mode 100644
index 000000000..0f8b4d4b2
--- /dev/null
+++ b/tv/5pkgs/simple/iosevka-tv-1.nix
@@ -0,0 +1,18 @@
+{ pkgs }:
+
+pkgs.iosevka.override {
+ # https://typeof.net/Iosevka/customizer
+ privateBuildPlan = {
+ family = "iosevka tv 1";
+ spacing = "term";
+ serifs = "sans";
+ export-glyph-names = true;
+ no-ligation = true;
+ no-cv-ss = false;
+
+ widths.normal.shape = 600;
+ widths.normal.menu = 5;
+ widths.normal.css = "normal";
+ };
+ set = "tv-1";
+}
diff --git a/tv/5pkgs/simple/iosevka-tv-2.nix b/tv/5pkgs/simple/iosevka-tv-2.nix
new file mode 100644
index 000000000..888ba6a0c
--- /dev/null
+++ b/tv/5pkgs/simple/iosevka-tv-2.nix
@@ -0,0 +1,20 @@
+{ pkgs }:
+
+pkgs.iosevka.override {
+ # https://typeof.net/Iosevka/customizer
+ privateBuildPlan = {
+ family = "iosevka tv 2";
+ spacing = "term";
+ serifs = "sans";
+ export-glyph-names = true;
+ no-ligation = true;
+ no-cv-ss = false;
+
+ variants.inherits = "ss10";
+
+ widths.normal.shape = 600;
+ widths.normal.menu = 5;
+ widths.normal.css = "normal";
+ };
+ set = "tv-2";
+}
diff --git a/tv/5pkgs/simple/libinput-tv.nix b/tv/5pkgs/simple/libinput-tv.nix
new file mode 100644
index 000000000..6f08689bb
--- /dev/null
+++ b/tv/5pkgs/simple/libinput-tv.nix
@@ -0,0 +1,11 @@
+{ pkgs }:
+
+pkgs.libinput.overrideAttrs (old: {
+ patches = old.patches or [] ++ [
+ (pkgs.fetchurl {
+ name = "libinput-winmax2.patch";
+ url = "https://github.com/4z3/libinput/commit/2d0ff41.patch";
+ sha256 = "0ipsxzjf98g9w2m163gp49zl14wbxs84s0psdnvk7wfiivgcnm1f";
+ })
+ ];
+})
diff --git a/tv/5pkgs/simple/q/default.nix b/tv/5pkgs/simple/q/default.nix
index 2ae71db52..809e37e59 100644
--- a/tv/5pkgs/simple/q/default.nix
+++ b/tv/5pkgs/simple/q/default.nix
@@ -10,71 +10,44 @@ let
hspace = 2;
# Return number of columns required to print n calenders side by side.
- need_width = n:
- assert n >= 1;
- n * calwidth + (n - 1) * hspace;
+ need_width = n: assert n >= 1; n * calwidth + (n - 1) * hspace;
- pad = /* sh */ ''{
- ${pkgs.gnused}/bin/sed '
- # rtrim
- s/ *$//
-
- # delete last empty line
- ''${/^$/d}
- ' \
- | ${pkgs.gawk}/bin/awk '{printf "%-${toString calwidth}s\n", $0}' \
- | ${pkgs.gnused}/bin/sed '
- # colorize header
- 1,2s/.*/&/
-
- # colorize week number
- s/^[ 1-9][0-9]/&/
- '
- }'';
in /* sh */ ''
cols=$(${pkgs.ncurses}/bin/tput cols)
- ${pkgs.coreutils}/bin/paste \
- <(if test $cols -ge ${toString (need_width 3)}; then
- ${pkgs.utillinux}/bin/cal -mw \
- $(${pkgs.coreutils}/bin/date +'%m %Y' -d 'last month') \
- | ${pad}
- fi) \
- <(if test $cols -ge ${toString (need_width 1)}; then
- ${pkgs.utillinux}/bin/cal -mw \
- | ${pkgs.gnused}/bin/sed '
- # colorize day of month
- s/\(^\| \)'"$(${pkgs.coreutils}/bin/date +%e)"'\>/&/
- ' \
- | ${pad}
- fi) \
- <(if test $cols -ge ${toString (need_width 2)}; then
- ${pkgs.utillinux}/bin/cal -mw \
- $(${pkgs.coreutils}/bin/date +'%m %Y' -d 'next month') \
- | ${pad}
- fi) \
- | ${pkgs.gnused}/bin/sed '
- s/^\t//
- s/\t$//
- s/\t/${lpad hspace " " ""}/g
- '
+ if test $cols -ge ${toString (need_width 3)}; then
+ ${pkgs.utillinux}/bin/cal --color=always -mw3
+ elif test $cols -ge ${toString (need_width 2)}; then
+ ${pkgs.utillinux}/bin/cal --color=always -mw -n 2
+ elif test $cols -ge ${toString (need_width 1)}; then
+ ${pkgs.utillinux}/bin/cal --color=always -mw1
+ else
+ :
+ fi |
+ ${pkgs.gnused}/bin/sed -r '
+ # dim week numbers
+ s/((^ *| )[ 1-5][0-9]( *)?)(([ 1-3][0-9])*)/\1\4/g
+ # dim month and day names
+ s/^ *[A-Z].*/&/
+ # highlight current date
+ s/\[7m//
+ s/\[27m//
+ '
'';
- q-isodate = /* sh */ ''
+ q-isodate = TZ: color: /* sh */ ''
+ TZ=${shell.escape TZ} \
${pkgs.coreutils}/bin/date \
- '+%Y-%m-%dT%H:%M:%S%:z'
+ '+%Y-%m-%dT[;'${shell.escape color}'m%H:%M:%S%:z'
'';
+ q-deudate = q-isodate "Europe/Berlin" "38;5;085";
+
# Singapore's red is #ED2E38
- q-sgtdate = /* sh */ ''
- TZ=Asia/Singapore \
- ${pkgs.coreutils}/bin/date \
- '+%Y-%m-%dT%H:%M:%S%:z'
- '';
+ q-sgtdate = q-isodate "Asia/Singapore" "38;2;237;46;56";
- q-utcdate = /* sh */ ''
- ${pkgs.coreutils}/bin/date -u \
- '+%Y-%m-%dT%H:%M:%S%:z'
- '';
+ q-thadate = q-isodate "Asia/Bangkok" "38;5;226";
+
+ q-utcdate = q-isodate "UTC" "38;5;065";
q-gitdir = /* sh */ ''
if test -d .git; then
@@ -106,31 +79,34 @@ let
echo "VT: $(${pkgs.systemd}/bin/systemd-detect-virt)"
'';
- q-wireless = /* sh */ ''
+ q-net = /* sh */ ''
for dev in $(
- ${pkgs.iw}/bin/iw dev \
- | ${pkgs.gnused}/bin/sed -n 's/^\s*Interface\s\+\([0-9a-z]\+\)$/\1/p'
+ ${pkgs.iproute}/bin/ip a |
+ ${pkgs.gnused}/bin/sed -rn 's/^[0-9]+: ([^:]+):.*/\1/p' |
+ ${pkgs.gnugrep}/bin/grep -Ev '^(lo|retiolum|wiregrill)$'
+ # TODO wiregrill ping ni.w, retiolum ping ni.r
); do
- inet=$(${pkgs.iproute}/bin/ip addr show $dev \
- | ${pkgs.gnused}/bin/sed -n '
- s/.*inet \([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/p
- ') \
- || unset inet
- ssid=$(${pkgs.iw}/bin/iw dev $dev link \
- | ${pkgs.gnused}/bin/sed -n '
- s/.*\tSSID: \(.*\)/\1/p
- ') \
- || unset ssid
- echo "$dev''${inet+ $inet}''${ssid+ $ssid}"
+ {
+ inet=$(${pkgs.iproute}/bin/ip addr show $dev \
+ | ${pkgs.gnused}/bin/sed -n '
+ s/.*inet \([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/p
+ ')
+ ssid=$(${pkgs.iw}/bin/iw dev $dev link \
+ | ${pkgs.gnused}/bin/sed -n '
+ s/.*\tSSID: \(.*\)/\1/p
+ ')
+ latency=$(
+ /run/wrappers/bin/ping -W .25 -c 1 -I "$dev" ni.i 2>&1 |
+ ${pkgs.gnused}/bin/sed -rn '
+ s/.*time=([0-9.]+).*/online ni=\1/p
+ s/.*Network is unreachable.*/offline/p
+ s/.*100% packet loss.*/offline/p
+ '
+ )
+ echo "$dev''${inet:+ $inet}''${ssid:+ $ssid} $latency"
+ } &
done
- '';
-
- q-online = /* sh */ ''
- if ${pkgs.curl}/bin/curl -s google.com >/dev/null; then
- echo 'online'
- else
- echo offline
- fi
+ wait
'';
q-thermal_zone = /* sh */ ''
@@ -173,14 +149,13 @@ pkgs.writeBashBin "q" ''
export PATH=/var/empty
${q-cal}
${q-utcdate}
- ${q-isodate}
+ ${q-deudate}
${q-sgtdate}
(${q-gitdir}) &
(${q-intel_backlight}) &
${pkgs.q-power_supply}/bin/q-power_supply &
(${q-virtualization}) &
- (${q-wireless}) &
- (${q-online}) &
+ (${q-net}) &
(${q-thermal_zone}) &
wait
if test "$PWD" != "$HOME" && test -e "$HOME/TODO"; then
diff --git a/tv/5pkgs/vim/fzf.nix b/tv/5pkgs/vim/fzf.nix
index 14b6900b5..e24bee5d4 100644
--- a/tv/5pkgs/vim/fzf.nix
+++ b/tv/5pkgs/vim/fzf.nix
@@ -2,10 +2,10 @@
# cannot use pkgs.vimPlugins.fzf-vim as it's missing :Rg
pkgs.vimUtils.buildVimPlugin {
- name = "fzf-2018-11-14";
+ name = "fzf-2023-01-16";
src = pkgs.fetchgit {
url = https://github.com/junegunn/fzf.vim;
- rev = "ad1833ecbc9153b6e34a4292dc089a58c4bcb8dc";
- sha256 = "1z2q71q6l9hq9fqfqpj1svhyk4yk1bzw1ljhksx4bnpz8gkfbx2m";
+ rev = "bdf48c282ad2174c25c059b3cdb7956427b07a99";
+ hash = "sha256-eCCk+Q596Ljjdtjd0cYGqR77K3Me5gf+ts5icP22S3Y=";
};
}
diff --git a/tv/5pkgs/vim/hack.nix b/tv/5pkgs/vim/hack.nix
index 922d85ba2..d378f355b 100644
--- a/tv/5pkgs/vim/hack.nix
+++ b/tv/5pkgs/vim/hack.nix
@@ -42,5 +42,8 @@ in {
hi diffRemoved ctermfg=009
hi Search cterm=NONE ctermbg=216
+
+ hi TabLine cterm=underline guifg=#424242 guibg=#232323
+ hi TabLineFill cterm=underline guifg=#424242 guibg=#232323
'';
}))
diff --git a/tv/5pkgs/vim/tv.nix b/tv/5pkgs/vim/tv.nix
index dee6b2df8..10816ce96 100644
--- a/tv/5pkgs/vim/tv.nix
+++ b/tv/5pkgs/vim/tv.nix
@@ -2,17 +2,6 @@
pkgs.tv.vim.makePlugin (pkgs.write "vim-tv" {
#
- # Haskell
- #
- "/ftplugin/haskell.vim".text = ''
- if exists("g:vim_tv_ftplugin_haskell_loaded")
- finish
- endif
- let g:vim_tv_ftplugin_haskell_loaded = 1
-
- setlocal iskeyword+='
- '';
- #
# TODO
#
"/ftdetect/todo.vim".text = ''