diff --git a/common/nixos-wayland.nix b/common/nixos-wayland.nix index 2178a56..568564b 100644 --- a/common/nixos-wayland.nix +++ b/common/nixos-wayland.nix @@ -2,14 +2,9 @@ # special thanks to: https://github.com/lostMia/nixos-config # TODOs # - monitor scaling -# - fix copying # - flameshot -# - rofi config -# - rofi show ssh as well -# - fix audio next,prev -# - backgroudn and transperency +# - background and transperency # - hibernation -# - swapfile not found in stage1 # - win + D command # - kernel output for luks pwd on all displays @@ -66,6 +61,7 @@ ]; sound.enable = true; + home-manager.users.me.services.swayosd.enable = true; services.blueman.enable = true; hardware.bluetooth.enable = true; @@ -80,6 +76,32 @@ }; environment.systemPackages = with pkgs; [ + # flameshot where clipboard works with wayland + (flameshot.overrideAttrs (prev: { + nativeBuildInputs = prev.nativeBuildInputs or [] ++ [ libsForQt5.kguiaddons ]; + cmakeFlags = prev.nativeBuildInputs or [] ++ [ "-DUSE_WAYLAND_CLIPBOARD=true" "-DUSE_WAYLAND_GRIM=ON" ]; + patches = prev.patches or [] ++ [ ../overlays/patches/flameshot-wayland.patch ]; + })) + + waybar + /* + (waybar.overrideAttrs (prev: { + //patches = prev.patches or [] ++ [ + //(pkgs.fetchpatch { + //url = "https://github.com/alebastr/Waybar/commit/reload-signal-fix.patch"; + //hash = "sha256-c4+A7biF1FOLemjcr+TobWMLUnha8zbHIkLaW24iUcQ="; + //}) + //]; + patches = []; + src = pkgs.fetchFromGitHub { + owner = "alebastr"; + repo = "Waybar"; + rev = "d8a7f429e756f4dc378ed1cb9824d47ea46edab5"; + hash = "sha256-EB7tA2mHv67Hq1yMMDJ7YuQdAinrcpI0GkLxsTguWac="; + }; + })) + */ + xdg-desktop-portal wlr-randr rofi-wayland @@ -87,7 +109,7 @@ swayfx wl-clipboard zoxide - waybar + power-profiles-daemon brightnessctl autotiling @@ -103,7 +125,6 @@ sway-audio-idle-inhibit dunst libnotify - nur.repos.kira-bruneau.swaylock-fprintd swayidle corrupter swayosd @@ -157,7 +178,7 @@ dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK ### Variables - set $mod Mod1 + set $mod Mod4 set $left h set $down j set $up k @@ -174,9 +195,9 @@ ### Input configuration input type:keyboard { xkb_layout de,de - repeat_delay 160,160 - repeat_rate 80,80 - xkb_options altwin:swap_lalt_lwin + repeat_delay 130,130 + repeat_rate 90,90 + # xkb_options altwin:swap_lalt_lwin } # altwin:swap_lalt_lwin swaps the left alt and windows keys, so the win key is on the right and the alt is on the left. @@ -206,35 +227,51 @@ ## Autostart exec autotiling # Automatically tiles in whatever direction is the longest - exec "/usr/bin/env bash ${./..}/scripts/idlescript" # Manages suspending and locking - exec "/usr/bin/env bash ${./..}/scripts/batteryscript.sh" # Sends battery notifications when necessary + + #exec "/usr/bin/env bash ${./..}/scripts/idlescript" # Manages suspending and locking + exec ${pkgs.bash}/bin/bash ${./..}/scripts/batteryscript.sh # Sends battery notifications when necessary exec nm-applet # Networkmanager applet exec blueman-applet # Bluetoothmanager applet exec blueman-tray # Bluetoothmanager tray icon exec shikane # Manages displays and known display setups exec sway-audio-idle-inhibit # Prevents sleep when audio is playing - exec swayosd-server # OSD server for audio and screen brightness popups exec waybar # Status bar for sway + exec swayosd-server - assign [class="vesktop"] workspace 1 - assign [class="Signal"] workspace 1 - assign [app_id="firefox"] workspace 2 - assign [app_id="thunderbird"] workspace 10 + exec swayidle lock ${pkgs.writeScriptBin "my-lock" '' + swaylock + systemctl suspend-then-hibernate + ''}/bin/my-lock + + #assign [class="vesktop"] workspace 1 + #assign [class="Signal"] workspace 1 + #assign [app_id="firefox"] workspace 2 + #assign [app_id="thunderbird"] workspace 10 ### Key bindings - bindsym Mod4+Shift+Return exec $term + #bindsym Mod4+Shift+Return exec $term + + bindsym --locked $mod+d exec wlr-randr --output eDP-1 --on + bindsym --locked $mod+Shift+d exec wlr-randr --output eDP-1 --off bindsym $mod+Shift+Return exec $term bindsym $mod+delete exec $term bindsym $mod+Shift+c kill bindsym $mod+q reload - bindsym $mod+x exec ${./..}/scripts/lockscript + bindsym $mod+x exec swaylock + bindsym $mod+Shift+x exec bash -c "swaylock; systemctl suspend-then-hibernate" + + + #exec swayidle -w \ + #timeout 300 'swaylock -f -c 000000 -i $lock_bg' \ + #timeout 600 'swaymsg "output * dpms off"' \ + #resume 'swaymsg "output * dpms on"' \ + #before-sleep 'swaylock -f -c 000000 -i $lock_bg' + bindsym $mod+Shift+s exec "${./..}/scripts/screenshot.sh" - #bindsym $mod+p exec $menu -show combi -combi-modes "run" -modi combi -monitor "eDP-1" # rofi - bindsym $mod+p exec $menu -show combi -combi-modes "run" -modi combi - bindsym $mod+Shift+p exec $menu -show ssh -monitor "eDP-1" + bindsym $mod+p exec $menu -show combi -combi-modes "ssh,run" bindsym $mod+Shift+q exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit' @@ -243,18 +280,22 @@ #bindsym $mod+Escape exec 'swaymsg input type:keyboard xkb_switch_layout next' # bindsym $mod+odiaeresis exec woomer - + #bindsym $mod+a exec woomer #bindsym $mod+p exec ${./..}/scripts/toggle_freeze_process.sh # Function Keys - bindsym $mod+Shift+m exec sleep 0.1 && swaymsg output eDP-1 dpms toggle + #bindsym $mod+Shift+m exec sleep 0.1 && swaymsg output eDP-1 dpms toggle - bindsym $mod+Shift+y exec swayosd-client --brightness -2 - bindsym $mod+y exec swayosd-client --brightness +2 + bindsym $mod+Shift+y exec swayosd-client --brightness -8 + bindsym $mod+y exec swayosd-client --brightness +8 #bindsym $mod+m exec swayosd-client --output-volume mute-toggle --max-volume 200 + bindsym $mod+n exec playerctl next + bindsym $mod+Shift+n exec playerctl previous + bindsym $mod+c exec playerctl play-pause + bindsym $mod+Shift+v exec swayosd-client --output-volume -2 --max-volume 200 bindsym $mod+v exec swayosd-client --output-volume +2 --max-volume 200 @@ -335,9 +376,9 @@ # Layout stuff: gaps inner 2 - gaps outer 2 + gaps outer 0 - gaps top 5 + gaps top 0 #smart_borders on #smart_gaps on @@ -353,9 +394,10 @@ bindsym $mod+Comma layout tabbed bindsym $mod+Period layout toggle split - bindsym $mod+Return fullscreen + bindsym $mod+space fullscreen bindsym $mod+Shift+space floating toggle - bindsym $mod+space focus mode_toggle + #bindsym $mod+r focus mode_toggle + bindsym $mod+r exec sh -c "echo Run > ~/.mize/mize_dev_module/pipe" # Scratchpad: # Sway has a "scratchpad", which is a bag of holding for windows. @@ -376,15 +418,15 @@ # down will grow the containers height set $move_amount 175px - bindsym $mod+Mod4+$right resize grow width $move_amount - bindsym $mod+Mod4+$up resize shrink height $move_amount - bindsym $mod+Mod4+$down resize grow height $move_amount - bindsym $mod+Mod4+$left resize shrink width $move_amount + bindsym $mod+Mod1+$right resize grow width $move_amount + bindsym $mod+Mod1+$up resize shrink height $move_amount + bindsym $mod+Mod1+$down resize grow height $move_amount + bindsym $mod+Mod1+$left resize shrink width $move_amount - bindsym $mod+Mod4+Left resize grow width $move_amount - bindsym $mod+Mod4+Down resize shrink height $move_amount - bindsym $mod+Mod4+Up resize grow height $move_amount - bindsym $mod+Mod4+Right resize shrink width $move_amount + bindsym $mod+Mod1+Left resize grow width $move_amount + bindsym $mod+Mod1+Down resize shrink height $move_amount + bindsym $mod+Mod1+Up resize grow height $move_amount + bindsym $mod+Mod1+Right resize shrink width $move_amount # Return to default mode # bindsym Return mode "default" @@ -1044,42 +1086,58 @@ ''; }; - home-manager.users.me.home.file.".config/swaylock/config".text = '' - daemonize - show-failed-attempts - show-keyboard-layout - ignore-empty-password - fingerprint - image=$HOME/Pictures/Screenshots/screen.png - indicator-radius=200 - indicator-thickness=10 - inside-color=#00000000 - line-color=#00000000 - ring-color=#00000000 - text-color=#00000000 - layout-bg-color=#00000000 - layout-text-color=#00000000 - - inside-clear-color=#00000000 - line-clear-color=#00000000 - ring-clear-color=#ffff99 - text-clear-color=#00000000 - - inside-ver-color=#00000000 - line-ver-color=#00000000 - ring-ver-color=#70ffff - text-ver-color=#00000000 - - inside-wrong-color=#00000000 - line-wrong-color=#00000000 - ring-wrong-color=#ff5555 - text-wrong-color=#00000000 - - bs-hl-color=#ff5555 - key-hl-color=#99ff99 - - text-caps-lock-color=#ffffff - ''; + security.pam.services.swaylock = { + text = '' + auth include login + ''; + }; + home-manager.users.me.programs.swaylock = { + package = pkgs.writeScriptBin "swaylock" '' + path=/tmp/lock_screen_picture.png + grim "$path" && + corrupter -add 0 -bheight 20 -stdabber 10 -boffset 50 "$path" "$path" && + #swaymsg "output * dpms on" + ${nur.repos.kira-bruneau.swaylock-fprintd}/bin/swaylock + ''; + enable = true; + settings = { + daemonize = true; + show-failed-attempts = true; + show-keyboard-layout = true; + ignore-empty-password = true; + fingerprint = true; + image = "/tmp/lock_screen_picture.png"; + indicator-radius = 200; + indicator-thickness = 10; + inside-color = "#00000000"; + line-color = "#00000000"; + ring-color = "#00000000"; + text-color = "#00000000"; + + layout-bg-color = "#00000000"; + layout-text-color = "#00000000"; + + inside-clear-color = "#555755"; + line-clear-color = "#00000000"; + ring-clear-color = "#ffff99"; + text-clear-color = "#00000000"; + + inside-ver-color = "#00000000"; + line-ver-color = "#00000000"; + ring-ver-color = "#70ffff"; + text-ver-color = "#00000000"; + + inside-wrong-color = "#00000000"; + line-wrong-color = "#00000000"; + ring-wrong-color = "#ff5555"; + text-wrong-color = "#00000000"; + + bs-hl-color = "#ff5555"; + key-hl-color = "#99ff99"; + + text-caps-lock-color = "#ffffff"; + }; + }; } diff --git a/flake.lock b/flake.lock index 7cb3b3f..a5780d8 100644 --- a/flake.lock +++ b/flake.lock @@ -3667,6 +3667,7 @@ "robotnix": "robotnix", "systems": "systems_5", "victorinix": "victorinix", + "waveforms": "waveforms", "zephyr-nix": "zephyr-nix", "zmk-nix": "zmk-nix" } @@ -4157,6 +4158,26 @@ "type": "github" } }, + "waveforms": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1740296893, + "narHash": "sha256-8FQRWdQXqRI7EfDjx9EkQMpnEEQXmK/m/PSRWcRIagc=", + "owner": "liff", + "repo": "waveforms-flake", + "rev": "d210e3a743349a659a1cfdc202cba32bae6f2dbc", + "type": "github" + }, + "original": { + "owner": "liff", + "repo": "waveforms-flake", + "type": "github" + } + }, "ws-butler": { "flake": false, "locked": { diff --git a/flake.nix b/flake.nix index 4e57a78..0013fcd 100644 --- a/flake.nix +++ b/flake.nix @@ -82,6 +82,11 @@ url = "github:lilyinstarlight/zmk-nix"; inputs.nixpkgs.follows = "nixpkgs"; }; + + waveforms = { + url = "github:liff/waveforms-flake"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = { self, nixpkgs, nixpkgs-unstable, nixos-generators, flake-utils, systems, ... }@inputs: diff --git a/hosts/fusu.nix b/hosts/fusu.nix index d60a5d4..a7462aa 100644 --- a/hosts/fusu.nix +++ b/hosts/fusu.nix @@ -1,5 +1,5 @@ -{ inputs, pkgs, ... }: +{ inputs, pkgs, secretsDir, ... }: { imports = [ ../common/all.nix @@ -30,6 +30,8 @@ #]; + + boot.supportedFilesystems = [ "zfs" ]; boot.zfs.package = pkgs.zfs_unstable; boot.zfs.forceImportRoot = false; @@ -89,6 +91,21 @@ 8080 # for mitm proxy 5901 # vnc + 5357 # wsdd + 8080 # for mitm proxy + + 49388 + 49389 + 49390 + 49391 + 49392 + 49393 + ]; + + networking.firewall.allowedUDPPorts = [ + 3702 # wsdd + 67 # allow DHCP traffic + 53 # allow dns ]; networking.networkmanager.enable = false; # Easiest to use and most distros use this by default. @@ -101,6 +118,11 @@ environment.systemPackages = with pkgs; [ ntfs3g virtiofsd + bcache-tools + su + fuse3 + terraform + usbutils ]; nix.settings = { @@ -131,4 +153,203 @@ nameservers = [ "1.1.1.1" "8.8.8.8" ]; }; + + ############################ update ip service + + systemd.services.update-ip = + let + update-ip = pkgs.writeShellApplication { + name = "update-ip"; + + runtimeInputs = with pkgs; [ curl w3m ]; + + text = '' + ip=$(curl my.ip.fi) + curl "http://dynv6.com/api/update?hostname=${builtins.readFile "${secretsDir}/dns-name-two"}&ipv4=$ip&token=${builtins.readFile "${secretsDir}/dns-name-two-token"}" + curl "https://dynamicdns.park-your-domain.com/update?host=home&domain=${builtins.readFile "${secretsDir}/dns-name"}&password=${builtins.readFile "${secretsDir}/dns-name-token"}&ip=$ip" + + # https://www.namecheap.com/support/knowledgebase/article.aspx/29/11/how-to-dynamically-update-the-hosts-ip-with-an-https-request/ + ''; + }; + #curl "https://dynamicdns.park-your-domain.com/update?host=mc&domain=c2vi.dev&password=${builtins.readFile "${secretsDir}/dns-name-token"}&ip=$ip" + in + { + enable = true; + description = "dyndns ip updates"; + unitConfig = { + Type = "simple"; + }; + serviceConfig = { + Restart = "always"; + RestartSec = "500s"; + ExecStart = "${update-ip}/bin/update-ip"; + }; + wantedBy = [ "multi-user.target" ]; + }; + + + + + + + + ###################################### get oci ampere vm #################################### + + systemd.services.oci-ampere = + let + oci-ampere = pkgs.writeShellApplication { + name = "oci-ampere"; + + runtimeInputs = with pkgs; [ terraform ]; + + text = '' + if [[ -f /home/me/here/oci-ampere-vm/not_gotten ]] + then + echo not gotten.................................... + pwd + cd /home/me/here/oci-ampere-vm + terraform apply -auto-approve && rm /home/me/here/oci-ampere-vm/not_gotten + else + echo gotten!!!!!!!!!!!!!!!!!!!!! + fi + ''; + }; + in + { + enable = false; + description = "get a oci ampere vm"; + unitConfig = { + Type = "simple"; + }; + serviceConfig = { + Restart = "always"; + RestartSec = "500s"; + ExecStart = "${oci-ampere}/bin/oci-ampere"; + }; + wantedBy = [ "multi-user.target" ]; + }; + + + ################################ samba ###################################### + services.samba-wsdd.enable = true; # make shares visible for windows 10 clients + + # needed see: [[samba problems]] in my obsidian vault + users.users.files.group = "files"; + users.groups.files = {}; + + services.samba = { + enable = true; + securityType = "user"; + extraConfig = '' + server role = standalone server + map to guest = bad user + usershare allow guests = yes + hosts allow = 192.168.0.0/16 + hosts deny = 0.0.0.0 + workgroup = WORKGROUP + security = user + ''; + shares = { + files = { + "valid users" = "files"; + "comment" = "all my files"; + "path" = "/home/files/storage/files"; + "browsable" = "no"; + "read only" = "no"; + "guest ok" = "no"; + "force user" = "files"; + "force group" = "files"; + "force create mode" = "0777"; + # Papierkorb + "vfs object" = "recycle"; + "recycle:repository" = "/home/files/storage/files/trash-files"; + "recycle:keeptree" = "Yes"; + "recycle:versions" = "Yes"; + "recycle:touch" = "Yes"; + "recycle:touch_mtime" = "Yes"; + "recycle:maxsize" = "80000"; + }; + lan = { + "comment" = "gastordner"; + "path" = "/home/files/storage/lan"; + "read only" = "no"; + "guest ok" = "yes"; + "force user" = "files"; + "force group" = "files"; + "force create mode" = "0777"; + # Papierkorb + "vfs object" = "recycle"; + "recycle:repository" = "/home/files/storage/files/trash-lan"; + "recycle:keeptree" = "No"; + "recycle:versions" = "Yes"; + "recycle:touch" = "Yes"; + "recycle:touch_mtime" = "Yes"; + "recycle:maxsize" = "8000"; + }; + mama = { + "comment" = "Meine Dateien auf Mamas Laptop"; + "path" = "/home/files/storage/files/stuff/Mamas-Laptop"; + "browsable" = "no"; + "read only" = "no"; + "guest ok" = "no"; + "valid users" = "mamafiles"; + "force user" = "files"; + "force group" = "files"; + "force create mode" = "0777"; + }; + }; + }; + + ############################## backup to onedrive ################################## + # needs that + programs.fuse.userAllowOther = true; # otherwise the root user has no acces to the mount + + systemd.services.rclone-mount-backup = { + enable = false; + description = "Mount rclone backup folder"; + unitConfig = { + Type = "simple"; + }; + serviceConfig = { + ExecStart = "${pkgs.bash}/bin/bash -c 'export PATH=/run/wrappers/bin:$PATH; id; ${pkgs.rclone}/bin/rclone mount --allow-non-empty --allow-other --vfs-cache-max-size 2G --vfs-cache-mode full backup: /home/files/backup'"; + User = "files"; + Group = "files"; + }; + wantedBy = [ "multi-user.target" ]; + }; + + services.borgbackup.jobs.files = { + #user = "files"; + extraCreateArgs = "--verbose --list --filter=AMECbchfs --stats --checkpoint-interval 600"; + extraArgs = "--progress"; + paths = "/home/files/storage"; + doInit = false; + repo = "/home/files/backup/dateien-backup-borg-repo"; + compression = "lzma,9"; + startAt = "weekly"; + user = "files"; + group = "files"; + postCreate = '' + echo create done!!!!! + ''; + extraPruneArgs = "--stats --list --save-space"; + patterns = [ + "- /home/files/storage/files/no-backup" + ]; + + encryption.mode = "repokey-blake2"; + encryption.passCommand = "cat /home/files/secrets/borg-passphrase"; + + environment.BORG_KEY_FILE = "/home/files/secrets/borg-key"; + + prune.keep = { + #within = "1w"; # Keep all archives from the last day + daily = 7; + weekly = 7; + monthly = -1; # Keep at least one archive for each month + }; + + }; + + } diff --git a/hosts/lush.nix b/hosts/lush.nix index f7b7f21..f6bd5d7 100644 --- a/hosts/lush.nix +++ b/hosts/lush.nix @@ -145,6 +145,7 @@ uuid = "e0103dac-7da0-4e32-a01b-487b8c4c813c"; type = "wifi"; interface-name = "wlan0"; + autoconnect = true; }; wifi = { @@ -164,6 +165,31 @@ }; }; + hh40 = { + connection = { + id = "hh40"; + uuid = "73a61cef-8f7b-4f42-ab3f-0066e0295bbc"; + type = "wifi"; + interface-name = "wlan0"; + autoconnect = true; + }; + + wifi = { + hidden = "false"; + mode = "infrastructure"; + ssid = builtins.readFile "${secretsDir}/home-wifi-ssid"; + }; + + wifi-security = { + key-mgmt = "wpa-psk"; + psk = builtins.readFile "${secretsDir}/home-wifi-password"; + }; + + ipv4 = { + method = "auto"; + }; + }; + share = { connection = { id = "share"; diff --git a/hosts/main.nix b/hosts/main.nix index d5fc5b8..0a4e929 100644 --- a/hosts/main.nix +++ b/hosts/main.nix @@ -38,6 +38,9 @@ virtualisation.vmVariant.services.timesyncd.enable = lib.mkForce false; + virtualisation.waydroid.enable = true; + + services.nscd.enable = lib.mkForce false; virtualisation.docker.enable = true; @@ -55,6 +58,10 @@ programs.nix-ld.enable = true; programs.steam.enable = true; + + + + # disable touch clicks because i always tap while typing #services.xserver.libinput.touchpad.tappingButtonMap = null; services.xserver.libinput.touchpad.tapping = false; @@ -76,10 +83,20 @@ # see: https://github.com/NixOS/nixpkgs/issues/300081 #"${inputs.nixpkgs-unstable}/nixos/modules/virtualisation/incus.nix" #../scripts/yt-block/module.nix + + # add waveforms flake module + #inputs.waveforms.nixosModule ]; + services.udev.packages = [ inputs.waveforms.packages.${system}.adept2-runtime ]; + environment.systemPackages = with pkgs; [ + inputs.waveforms.packages.${system}.waveforms + + # add pyclip for waydroid + python310Packages.pyclip + grim # screenshot functionality slurp # screenshot functionality wl-clipboard # wl-copy and wl-paste for copy/paste from stdin / stdout @@ -91,6 +108,14 @@ ]; }) + # waveforms + + # my keyboar flash script, that opens as an alacritty window + (pkgs.writeShellScriptBin "keyboard-flash" "alacritty --command ${pkgs.writeShellScriptBin "keyboard-flash-internal" "${./..}/scripts/keyboard-flash; bash"}/bin/keyboard-flash-internal") + + # my keyboar flash script, that opens as an alacritty window + (pkgs.writeShellScriptBin "keyboard-flash-left" "alacritty --command ${pkgs.writeShellScriptBin "keyboard-flash-internal" "${./..}/scripts/keyboard-flash left; bash"}/bin/keyboard-flash-internal") + slint-lsp cifs-utils nfs-utils @@ -104,7 +129,9 @@ # shedule nix builds with low priority, so the laptop is still usable while building something nix.daemonCPUSchedPolicy = "idle"; nix.daemonIONiceLevel = 7; - systemd.services.nix-daemon.serviceConfig.Nice = 9; + + + systemd.services.nix-daemon.serviceConfig.Nice = 9; # enable ntp #services.ntp.enable = true; @@ -513,14 +540,22 @@ virtualisation.incus.enable = true; systemd.services.incus.path = [ pkgs.swtpm ]; #virtualisation.incus.package = inputs.nixpkgs-unstable.legacyPackages.x86_64-linux.incus; - users.users.me.extraGroups = [ "incus-admin" ]; + + # add myself to plugdev group for waveforms + # and incus-admin to use incus without sudo + users.users.me.extraGroups = [ "incus-admin" "plugdev" ]; virtualisation.podman.enable = true; virtualisation.kvmgt.enable = true; boot.extraModprobeConfig = "options i915 enable_guc=2"; - boot.kernelParams = [ "intel_iommu=on" "pcie_aspm=force" ]; + boot.resumeDevice = "/dev/disk/by-uuid/20002ed7-1431-4992-90f6-730bdc6eef2c"; + boot.kernelParams = [ + "resume_offset=45743809" + "intel_iommu=on" + "pcie_aspm=force" + ]; virtualisation.kvmgt.vgpus = { "i915-GVTg_V5_8" = { @@ -544,17 +579,18 @@ ############################## swap and hibernate ################################### swapDevices = [ { device = "/swapfile"; } ]; - boot.resumeDevice = "/swapfile"; + + # boot.resumeDevice = "/swapfile"; services.logind = { extraConfig = '' HandlePowerKey=suspend-then-hibernate ''; - lidSwitch = "suspend-then-hibernate"; - lidSwitchExternalPower = "suspend-then-hibernate"; + lidSwitch = "lock"; + lidSwitchExternalPower = "lock"; lidSwitchDocked = "ignore"; }; systemd.sleep.extraConfig = '' - HibernateDelaySec=27h + HibernateDelaySec=4h HibernateMode=shutdown ''; } diff --git a/misc/my-hosts-r b/misc/my-hosts-r index 304a0ed..d21822a 100644 --- a/misc/my-hosts-r +++ b/misc/my-hosts-r @@ -1,3 +1,4 @@ home.c2vi.dev rpi +home.c2vi.dev fusu home.c2vi.dev rpis home.c2vi.dev files diff --git a/mods/nurPkgs/exit0.nix b/mods/nurPkgs/exit0.nix index fe1ce7f..16faed6 100644 --- a/mods/nurPkgs/exit0.nix +++ b/mods/nurPkgs/exit0.nix @@ -1,20 +1,23 @@ { stdenv , fetchFromGitHub , meson +, lib +, ninja }: stdenv.mkDerivation rec { - name = "exitß"; + name = "exit0"; src = fetchFromGitHub { owner = "richardweinberger"; repo = "exit0"; rev = "f6cdeeb858ad9717b698a21e6fec3bb94b2aa2dd"; - sha256 = ""; + sha256 = "sha256-NCNPO4XCdCwPLSQuW4AT6vskqvu1ks/yHGUzzI+l3hE="; }; nativeBuildInputs = [ meson + ninja ]; buildInputs = [ diff --git a/mybin/htldoc b/mybin/htldoc index 84e84c7..794028b 100755 --- a/mybin/htldoc +++ b/mybin/htldoc @@ -1,7 +1,8 @@ #!/bin/sh if [ -f "htldoc.nix" ]; then - htldocUrl=$(nix eval --expr 'let config = (import ./htldoc.nix {}); in if builtins.hasAttr "htldocVersion" config then config.htldocVersion else "github:c2vi/htldoc/master"' --impure) + htldocUrl=$(nix eval --expr 'let config = (import ./htldoc.nix {}); in if builtins.hasAttr "htldocVersion" config then config.htldocVersion else "github:c2vi/htldoc/master"' --impure --raw) + echo htldocUrl: $htldocUrl nix run $htldocUrl -- $@ else nix run github:c2vi/htldoc/master -- $@ diff --git a/mybin/ru b/mybin/ru index bcefacd..e489d4a 100755 --- a/mybin/ru +++ b/mybin/ru @@ -104,6 +104,7 @@ cat /sys/class/power_supply/BAT1/status elif [ "$1" == "hibernate" ] then +swaylock sudo systemctl hibernate diff --git a/mybin/win b/mybin/win index 9ae3fa6..a832623 100755 --- a/mybin/win +++ b/mybin/win @@ -1,3 +1,3 @@ #!/bin/bash -~/work/config/scripts/win -o main-win 192.168.122.98 sebastian $@ +~/work/config/scripts/win -o win 192.168.122.141 me $@ diff --git a/programs/neovim.nix b/programs/neovim.nix index e090760..75be837 100644 --- a/programs/neovim.nix +++ b/programs/neovim.nix @@ -395,6 +395,20 @@ " ###### rust ###### " + " specially for mize... + cnoreabbrev md call Set_Mize_RunBuild() + + function! Set_Mize_RunBuild() + cnoreabbrev c call Mize_RunBuild() + endfunction + + function! Mize_RunBuild() + :w + silent ! echo Run > ~/.mize/mize_dev_module/pipe + endfunction + + + function! Setup_rust() vnoremap s :call Rust_toggle_comment() diff --git a/programs/rofi/default.nix b/programs/rofi/default.nix index deb764b..3b205c0 100644 --- a/programs/rofi/default.nix +++ b/programs/rofi/default.nix @@ -1,5 +1,6 @@ { ... }: { + /* programs.rofi = { enable = true; theme = "Arc-Dark"; @@ -11,4 +12,175 @@ color-window = "#1c2023, #919ba0, #1c2023"; }; }; + */ + + + # credit https://github.com/lostMia/nixos-config/blob/f1654caf8572f25f9de9216cfe402995187f3c27/programs/rofi.nix + home.file.".config/rofi/config.rasi".text = '' + * { + selected-normal-foreground: #282a36; + foreground: #f8f8f2; + item-normal: #1e1e1e; + item-alternative: #222222; + normal-foreground: @foreground; + alternate-normal-background: rgba ( 45, 48, 59, 1 % ); + red: rgba ( 220, 50, 47, 100 % ); + selected-urgent-foreground: rgba ( 249, 249, 249, 100 % ); + blue: rgba ( 38, 139, 210, 100 % ); + urgent-foreground: rgba ( 204, 102, 102, 100 % ); + alternate-urgent-background: rgba ( 75, 81, 96, 90 % ); + active-foreground: rgba ( 101, 172, 255, 100 % ); + lightbg: rgba ( 238, 232, 213, 100 % ); + selected-active-foreground: @foreground; + alternate-active-background: rgba ( 45, 48, 59, 88 % ); + background: #1b1b1b; + alternate-normal-foreground: @foreground; + normal-background: rgba ( 45, 48, 59, 1 % ); + lightfg: rgba ( 88, 104, 117, 100 % ); + selected-normal-background: #f8f8f2; + border-color: #ff3060; + spacing: 10; + separatorcolor: rgba ( 45, 48, 59, 1 % ); + urgent-background: rgba ( 45, 48, 59, 15 % ); + selected-urgent-background: rgba ( 165, 66, 66, 100 % ); + alternate-urgent-foreground: @urgent-foreground; + background-color: rgba ( 0, 0, 0, 0 % ); + alternate-active-foreground: @active-foreground; + active-background: rgba ( 29, 31, 33, 17 % ); + selected-active-background: rgba ( 26, 28, 35, 100 % ); + } + + configuration { + font: "HackNerdFont Regular 14"; + show-icons: true; + icon-theme: "Tela circle purple dark"; + drun-display-format: "{name}"; + scroll-method: 0; + disable-history: false; + sidebar-mode: false; + } + + window { + background-color: @background; + border: 2; + border-color: @border-color; + padding: 15; + width: 500px; + } + listview { + lines: 12; + columns: 1; + } + mainbox { + border: 0; + padding: 0; + } + message { + border: 2px 0px 0px ; + border-color: @separatorcolor; + padding: 1px ; + } + textbox { + text-color: @foreground; + } + listview { + fixed-height: 0; + border: 8px 0px 0px ; + border-color: @separatorcolor; + spacing: 8px ; + scrollbar: false; + padding: 2px 0px 0px ; + } + element { + border: 1px; + border-radius: 12px; + border-color: #333333; + padding: 4px ; + } + element-text { + background-color: inherit; + text-color: inherit; + } + element.normal.normal { + background-color: @item-normal; + text-color: @normal-foreground; + } + element.normal.urgent { + background-color: @urgent-background; + text-color: @urgent-foreground; + } + element.normal.active { + background-color: @active-background; + text-color: @active-foreground; + } + element.selected.normal { + background-color: @selected-normal-background; + text-color: @selected-normal-foreground; + } + element.selected.urgent { + background-color: @selected-urgent-background; + text-color: @selected-urgent-foreground; + } + element.selected.active { + background-color: @selected-active-background; + text-color: @selected-active-foreground; + } + element.alternate.normal { + background-color: @item-alternative; + text-color: @alternate-normal-foreground; + } + element.alternate.urgent { + background-color: @alternate-urgent-background; + text-color: @alternate-urgent-foreground; + } + element.alternate.active { + background-color: @alternate-active-background; + text-color: @alternate-active-foreground; + } + scrollbar { + width: 4px ; + border: 0; + handle-color: @normal-foreground; + handle-width: 8px ; + padding: 0; + } + mode-switcher { + border: 2px 0px 0px ; + border-color: @separatorcolor; + } + button { + spacing: 0; + text-color: @normal-foreground; + } + button.selected { + background-color: @selected-normal-background; + text-color: @selected-normal-foreground; + } + inputbar { + spacing: 0; + text-color: @normal-foreground; + padding: 1px ; + } + case-indicator { + spacing: 0; + text-color: @normal-foreground; + } + entry { + spacing: 0; + text-color: @normal-foreground; + } + prompt { + spacing: 0; + text-color: @normal-foreground; + } + inputbar { + children: [ prompt,textbox-prompt-colon,entry,case-indicator ]; + } + textbox-prompt-colon { + expand: false; + str: " "; + margin: 0px 0.3em 0em 0em ; + text-color: @normal-foreground; + } + ''; } diff --git a/random-pkgs.nix b/random-pkgs.nix index 739c6c5..92c1844 100644 --- a/random-pkgs.nix +++ b/random-pkgs.nix @@ -140,8 +140,12 @@ in rec { # the charybdis has a left and right, so the default parts works shield = "charybdis_right"; - #zephyrDepsHash = "sha256-n7xX/d8RLqDyPOX4AEo5hl/3tQtY6mZ6s8emYYtOYOg="; - zephyrDepsHash = "sha256-/ECQR3x0hzVGB7icGuWeyyNC9HuWmCgS5xA8r30gCAw="; + postPatch = '' + mkdir -p ./zmk/app/boards/ + cp -r ./boards/* ./zmk/app/boards/ + ''; + + zephyrDepsHash = "sha256-4enAzZRvlV0ni1+rv7PUsRI6Rhb+zweuFBLeb/sflBc="; }; @@ -155,8 +159,13 @@ in rec { # the charybdis has a left and right, so the default parts works shield = "charybdis_left"; + postPatch = '' + mkdir -p ./zmk/app/boards/ + cp -r ./boards/* ./zmk/app/boards/ + ''; + #zephyrDepsHash = "sha256-n7xX/d8RLqDyPOX4AEo5hl/3tQtY6mZ6s8emYYtOYOg="; - zephyrDepsHash = "sha256-/ECQR3x0hzVGB7icGuWeyyNC9HuWmCgS5xA8r30gCAw="; + zephyrDepsHash = "sha256-4enAzZRvlV0ni1+rv7PUsRI6Rhb+zweuFBLeb/sflBc="; }; @@ -172,7 +181,7 @@ in rec { shield = "charybdis_%PART%"; #zephyrDepsHash = "sha256-n7xX/d8RLqDyPOX4AEo5hl/3tQtY6mZ6s8emYYtOYOg="; - zephyrDepsHash = "sha256-/ECQR3x0hzVGB7icGuWeyyNC9HuWmCgS5xA8r30gCAw="; + zephyrDepsHash = "sha256-r4SIPCLqBT/y2bblHUUZtNRwrhXFWY8wWtkplbG3coo="; }; diff --git a/scripts/batteryscript.sh b/scripts/batteryscript.sh index bbb9954..a7a9519 100755 --- a/scripts/batteryscript.sh +++ b/scripts/batteryscript.sh @@ -2,14 +2,14 @@ # Settings battery_percent_MODULUS=5 # How many percent difference are required for another update -INTERVAL=5 # The interval at which to check the battery percentage +INTERVAL=20 # The interval at which to check the battery percentage ALERT_SCRIPT="sudo /home/mia/Scripts/keyboard_alert.sh" # Battery Levels BAT_RECOMMENDED_UPPER_LIMIT=80 -BAT_RECOMMENDED_LOWER_LIMIT=40 -BAT_SLIGHTLY_LOW=30 -BAT_LOW=20 +BAT_RECOMMENDED_LOWER_LIMIT=30 +BAT_SLIGHTLY_LOW=25 +BAT_LOW=17 BAT_VERY_LOW=10 BAT_HIB=5 @@ -23,13 +23,13 @@ get_percentage() countdown() { - for i in $(seq 1 10); + for i in $(seq 1 15); do if [[ $(cat /sys/bus/acpi/drivers/battery/*/power_supply/BAT?/status) = "Charging" ]]; then return fi - sleep 1 + sleep 4 notify-send $((10-$i)) -u critical done systemctl hibernate diff --git a/scripts/keyboard-flash b/scripts/keyboard-flash index fcc9a8a..248cd36 100755 --- a/scripts/keyboard-flash +++ b/scripts/keyboard-flash @@ -1,11 +1,13 @@ #!/usr/bin/env bash +set -e + CONFIG_REPO_LOCATION=~/work/config CHARYBDIS_DISK_LOCATION=/dev/disk/by-uuid/0042-0042 # use the fusefatfs packaged in my nurPkgs -alias fusefatfs="$(nix build ${CONFIG_REPO_LOCATION}#mynurPkgs.fusefatfs --no-keep-outputs --print-out-paths)/bin/fusefatfs" +export fusefatfs="$(nix build ${CONFIG_REPO_LOCATION}#mynurPkgs.fusefatfs --no-keep-outputs --print-out-paths)/bin/fusefatfs" # if we have a keyboard config like thing in the clipboard.... use that @@ -15,18 +17,34 @@ if [[ "$(wl-paste | head -n 4)" == '#include #include ' ]] then echo pasting keyboard config from clipboard - wl-paste > $CONFIG_REPO_LOCATION/zmk-config/config/charybdis.keymap + wl-paste | grep -v "bindings/zmk/pointing" > $CONFIG_REPO_LOCATION/zmk-config/config/charybdis.keymap fi -mkdir -p $TMP/keyboard-flash-mnt -exit +sudo mkdir -p /tmp/keyboard-flash-mnt -sudo fusefatfs $CHARYBDIS_DISK_LOCATION $TMP/keyboard-flash-mnt +# error checking if device exists +if [[ ! -L $CHARYBDIS_DISK_LOCATION ]] +then + echo err: keyboard not in bootloader mode + exit 1 +fi +echo before build -firmware_out_path=$(nix build .#random.keyboardRight -L --no-keep-outputs --print-out-paths) +if [[ $1 == "left" ]] +then + firmware_out_path=$(nix build ${CONFIG_REPO_LOCATION}#random.keyboardLeft -L --no-keep-outputs --print-out-paths) +else + firmware_out_path=$(nix build ${CONFIG_REPO_LOCATION}#random.keyboardRight -L --no-keep-outputs --print-out-paths) +fi echo firmware at: $firmware_out_path -sudo cp $firmware_out_path #NEXT: what to copy where +# flashing by writing to device directly +#sudo dd if=$firmware_out_path/zmk.uf2 of=$CHARYBDIS_DISK_LOCATION -sudo umount $TMP/keyboard-flash-mnt +# flashing by mounting +sudo $fusefatfs -o rw+ $CHARYBDIS_DISK_LOCATION /tmp/keyboard-flash-mnt + +sudo cp $firmware_out_path/zmk.uf2 /tmp/keyboard-flash-mnt/CURRENT.UF2 || true + +sudo umount /tmp/keyboard-flash-mnt diff --git a/scripts/lockscript b/scripts/lockscript deleted file mode 100755 index 5a320b2..0000000 --- a/scripts/lockscript +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -path="/home/mia/Pictures/Screenshots/screen.png" -grim "$path" && -corrupter -add 0 -bheight 20 -stdabber 10 -boffset 50 "$path" "$path" && - -swaylock -c /home/mia/.config/swaylock/config && -swaymsg "output * dpms on" diff --git a/scripts/win b/scripts/win index 77d33aa..dd17d8a 100755 --- a/scripts/win +++ b/scripts/win @@ -9,7 +9,7 @@ default_vm_uuid=win #default_vm_uuid=6a412143-871f-4838-bacd-5dcfa5fa95c3 username=me -password=$(cat ~/work/here/secrets/win-vm-pwd) +password=$(cat ~/secrets/win-vm-pwd) if [ "$1" == "-o" ];then cmd=$5 @@ -119,6 +119,9 @@ elif [ "$cmd" == "f" ];then #xfreerdp ${RDP_FLAGS} /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} /scale:${RDP_SCALE} /dynamic-resolution +clipboard +auto-reconnect +home-drive /wm-class:"Microsoft Windows" -grab-keyboard # elif [ "$cmd" == "fl" ];then + echo username: $username + echo ip: $default_vm_ip + RDP_SCALE=100 MULTI_FLAG="span" RDP_USER=$username diff --git a/users/me/gui-home.nix b/users/me/gui-home.nix index c166cdb..199f133 100755 --- a/users/me/gui-home.nix +++ b/users/me/gui-home.nix @@ -71,7 +71,6 @@ blueman pavucontrol spotify - flameshot networkmanagerapplet haskellPackages.xmobar dolphin