From 6b3c9e83f7f2b1a066c6bdd6ba39bb42f12d07f0 Mon Sep 17 00:00:00 2001 From: Andrea Ciceri Date: Wed, 2 Nov 2022 22:51:05 +0100 Subject: [PATCH] Many things --- doom.d/config.el | 30 ++++++++++++++--------- doom.d/init.el | 4 +-- flake.lock | 11 +++++---- flake.nix | 9 +++++-- hmModules/element/default.nix | 15 ++++++++++++ hmModules/franz/default.nix | 18 ++++++++++++++ hmModules/qutebrowser/default.nix | 1 + hmModules/sway/default.nix | 7 ++++++ hmModules/sway/style.css | 8 ++++-- hmModules/sway/waybar.nix | 15 +++++++++++- hmModules/zathura/default.nix | 3 +++ hosts/oneplus5t/default.nix | 15 ++++++++++++ hosts/thinkpad/default.nix | 3 ++- hosts/thinkpad/hardware-configuration.nix | 4 ++- modules/binfmt/default.nix | 4 +-- modules/nix/default.nix | 2 ++ utils/default.nix | 18 +++++++++++++- 17 files changed, 139 insertions(+), 28 deletions(-) create mode 100644 hmModules/franz/default.nix create mode 100644 hmModules/zathura/default.nix create mode 100644 hosts/oneplus5t/default.nix diff --git a/doom.d/config.el b/doom.d/config.el index f717a03..e02a5e0 100644 --- a/doom.d/config.el +++ b/doom.d/config.el @@ -96,16 +96,24 @@ (define-key vterm-mode-map (kbd (format "M-%d" workspace-number)) nil))) (after! polymode (progn - (define-hostmode poly-nix-hostmode :mode 'nix-mode) + (define-hostmode poly-nix-hostmode :mode 'nix-mode) - (define-innermode poly-sh-innermode - :mode 'sh-mode - :head-matcher "^.*=.*''.*$" - :tail-matcher "^.*''.*;.*$" - :head-mode 'host - :tail-mode 'host) + (define-innermode poly-sh-innermode + :mode 'sh-mode + :head-matcher "^.*[+=].*''" + :tail-matcher "''.*[+;].*$" + :head-mode 'host + :tail-mode 'host) - (define-polymode poly-nix-mode - :hostmode 'poly-nix-hostmode - :innermodes '(poly-sh-innermode)) -)) + (define-polymode poly-nix-mode + :hostmode 'poly-nix-hostmode + :innermodes '(poly-sh-innermode)) + )) + +(after! org + (setq-default prettify-symbols-alist + '(("[ ]" "☐") + ("[X]" "☑") + ("[-]" "❍") + ("#+begin_src" "λ") + ("#+end_src" "λ")))) diff --git a/doom.d/init.el b/doom.d/init.el index d7ce763..5f74e76 100644 --- a/doom.d/init.el +++ b/doom.d/init.el @@ -105,7 +105,7 @@ ;;taskrunner ; taskrunner for all your projects terraform ; infrastructure as code ;;tmux ; an API for interacting with tmux - tree-sitter ; syntax and parsing, sitting in a tree... + ;; tree-sitter ; syntax and parsing, sitting in a tree... ;;upload ; map local to remote projects via ssh/ftp :os @@ -152,7 +152,7 @@ ;;lua ; one-based indices? one-based indices markdown ; writing docs for people to ignore ;;nim ; python + lisp at the speed of c - (nix +tree-sitter) ; I hereby declare "nix geht mehr!" + (nix) ; I hereby declare "nix geht mehr!" ;;ocaml ; an objective camel (org +roam2) ; organize your plain life in plain text ;;php ; perl's insecure younger brother diff --git a/flake.lock b/flake.lock index 7454aab..52fcb53 100644 --- a/flake.lock +++ b/flake.lock @@ -727,15 +727,16 @@ "nixpkgsUnstable": "nixpkgsUnstable_2" }, "locked": { - "lastModified": 1665032132, - "narHash": "sha256-3TtIR7JXGewZmvN4TknmVPzZkPptxJUxDvlfxks46tA=", - "owner": "danielfullmer", + "lastModified": 1665920835, + "narHash": "sha256-FBe55Yz8q8lcgq5H/yClqeen7bTZtNGom6UAdAP+Pvg=", + "owner": "atemu", "repo": "robotnix", - "rev": "2bcd6a106fd73e5f6454a4e3afc2d29cb78a2793", + "rev": "dd7e83fb19c7ef7eb87d21ceb07fb44d84ddbd57", "type": "github" }, "original": { - "owner": "danielfullmer", + "owner": "atemu", + "ref": "update/lineageos", "repo": "robotnix", "type": "github" } diff --git a/flake.nix b/flake.nix index fea47a0..c0921aa 100644 --- a/flake.nix +++ b/flake.nix @@ -13,13 +13,14 @@ agenix.url = github:ryantm/agenix; doomEmacs.url = github:nix-community/nix-doom-emacs; comma.url = github:nix-community/comma; - robotnix.url = github:danielfullmer/robotnix; + robotnix.url = github:atemu/robotnix/update/lineageos; }; outputs = {self, ...} @ inputs: let utils = import ./utils inputs; inherit (utils) + androidGenerateKeysScripts androidImages checkFormatting formatApp @@ -34,7 +35,11 @@ packages = androidImages; - apps = lib.recursiveUpdate (mkVmApps self.nixosConfigurations) formatApp; + apps = lib.foldr lib.recursiveUpdate {} [ + (mkVmApps self.nixosConfigurations) + formatApp + androidGenerateKeysScripts + ]; checks = checkFormatting ./.; diff --git a/hmModules/element/default.nix b/hmModules/element/default.nix index 35b8890..512a533 100644 --- a/hmModules/element/default.nix +++ b/hmModules/element/default.nix @@ -1,3 +1,18 @@ {pkgs, ...}: { home.packages = [pkgs.element-desktop]; + + systemd.user.services.element-desktop = { + Install.WantedBy = ["graphical-session.target"]; + + Unit = { + Description = "Element"; + PartOf = ["graphical-session.target"]; + }; + + Service = { + ExecStart = "${pkgs.element-desktop}/bin/element-desktop"; + Restart = "on-failure"; + RestartSec = 3; + }; + }; } diff --git a/hmModules/franz/default.nix b/hmModules/franz/default.nix new file mode 100644 index 0000000..4b95d6a --- /dev/null +++ b/hmModules/franz/default.nix @@ -0,0 +1,18 @@ +{pkgs, ...}: { + home.packages = [pkgs.franz]; + + systemd.user.services.franz = { + Install.WantedBy = ["graphical-session.target"]; + + Unit = { + Description = "Franz"; + PartOf = ["graphical-session.target"]; + }; + + Service = { + ExecStart = "${pkgs.franz}/bin/franz"; + Restart = "on-failure"; + RestartSec = 3; + }; + }; +} diff --git a/hmModules/qutebrowser/default.nix b/hmModules/qutebrowser/default.nix index c0f273c..aadf46b 100644 --- a/hmModules/qutebrowser/default.nix +++ b/hmModules/qutebrowser/default.nix @@ -34,6 +34,7 @@ "-c" ]; content.pdfjs = true; + scrolling.smooth = true; fonts = { default_size = "11pt"; tabs = { diff --git a/hmModules/sway/default.nix b/hmModules/sway/default.nix index bbb8599..5fd6b00 100644 --- a/hmModules/sway/default.nix +++ b/hmModules/sway/default.nix @@ -59,6 +59,13 @@ command = "${pkgs.waybar}/bin/waybar"; } ]; + assigns = { + "1" = [{title = ".*Mozilla Firefox$";} {title = ".*qutebrowser$";}]; + "2" = [{title = ".*Emacs$";}]; + "3" = [{title = "Slack.*";}]; + "8" = [{title = "^Franz$";}]; + "9" = [{title = "^Element.*";}]; + }; floating.criteria = [ {title = "MetaMask Notification.*";} {title = "Volume Control";} # pavucontrol diff --git a/hmModules/sway/style.css b/hmModules/sway/style.css index 9223797..9c219e5 100644 --- a/hmModules/sway/style.css +++ b/hmModules/sway/style.css @@ -1,7 +1,7 @@ * { border: none; font-family: "Fira Code, Symbols Nerd Font"; - font-weight: bold; + font-weight: normal; font-size: 9pt; min-height: 0; } @@ -14,7 +14,7 @@ window#waybar { transition-duration: .5s; } -window .modules-right * { +window .modules-right :not(image) { /* :not(image) excluded tray icon */ margin: 0 1rem; } @@ -28,6 +28,10 @@ window#waybar.hidden { color: #ffffff; } +#workspaces button label { + font-size: 25px; +} + /* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ #workspaces button:hover { background: rgba(0, 0, 0, 0.2); diff --git a/hmModules/sway/waybar.nix b/hmModules/sway/waybar.nix index f30fc9b..f03cf77 100644 --- a/hmModules/sway/waybar.nix +++ b/hmModules/sway/waybar.nix @@ -27,13 +27,26 @@ "sway/workspaces" = { all-outputs = true; disable-scroll-wraparound = true; + active-only = true; + format = "{icon}"; + on-click = "activate"; + format-icons = { + "1" = ""; + "2" = ""; + "3" = ""; + "8" = "甆"; + "9" = "ﬧ"; + urgent = ""; + default = ""; + }; + sort-by-number = true; }; "sway/mode" = {tooltip = false;}; "sway/window" = {max_length = 50;}; tray = { - spacing = "1px"; + spacing = 10; }; battery = { format = "{capacity}% {icon}"; diff --git a/hmModules/zathura/default.nix b/hmModules/zathura/default.nix new file mode 100644 index 0000000..4de14ad --- /dev/null +++ b/hmModules/zathura/default.nix @@ -0,0 +1,3 @@ +{ + programs.zathura.enable = true; +} diff --git a/hosts/oneplus5t/default.nix b/hosts/oneplus5t/default.nix new file mode 100644 index 0000000..990d6c9 --- /dev/null +++ b/hosts/oneplus5t/default.nix @@ -0,0 +1,15 @@ +{ + config, + lib, + pkgs, + ... +}: { + signing.enable = true; + + # apps.prebuilt = { + # whatsapp.apk = (pkgs.fetchurl { + # url = "https://d.apkpure.com/b/APK/com.whatsapp?versionCode=222403004"; + # sha256 = "0000000000000000000000000000000000000000000000000000000000000000"; + # }); + # }; +} diff --git a/hosts/thinkpad/default.nix b/hosts/thinkpad/default.nix index c5e8b88..0f336af 100644 --- a/hosts/thinkpad/default.nix +++ b/hosts/thinkpad/default.nix @@ -52,7 +52,9 @@ "sway" "udiskie" "vscode" + "franz" "xdg" + "zathura" ]; packages = with pkgs; [ comma @@ -75,7 +77,6 @@ boot.kernelModules = ["kvm-intel"]; boot.extraModulePackages = []; - boot.binfmt.emulatedSystems = ["aarch64-linux"]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's # still possible to use this option, but it's recommended to use it in conjunction diff --git a/hosts/thinkpad/hardware-configuration.nix b/hosts/thinkpad/hardware-configuration.nix index a9b8bd1..7d48cf3 100644 --- a/hosts/thinkpad/hardware-configuration.nix +++ b/hosts/thinkpad/hardware-configuration.nix @@ -58,7 +58,9 @@ options = ["bind"]; }; - swapDevices = []; + swapDevices = [ + {device = "/dev/disk/by-label/swap";} + ]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/modules/binfmt/default.nix b/modules/binfmt/default.nix index d799a59..8bf9fa8 100644 --- a/modules/binfmt/default.nix +++ b/modules/binfmt/default.nix @@ -4,8 +4,8 @@ pkgs, ... }: { - boot.binfmt.emulatedSystems = ["aarch64-linux"]; + boot.binfmt.emulatedSystems = ["aarch64-linux" "i686-linux"]; nix.extraOptions = '' - extra-platforms = aarch64-linux arm-linux + extra-platforms = aarch64-linux arm-linux i686-linux ''; } diff --git a/modules/nix/default.nix b/modules/nix/default.nix index e0408f1..156cfea 100644 --- a/modules/nix/default.nix +++ b/modules/nix/default.nix @@ -17,12 +17,14 @@ "mlabs.cachix.org-1:gStKdEqNKcrlSQw5iMW6wFCj3+b+1ASpBVY2SYuNV2M=" "aciceri-fleet.cachix.org-1:e1AodrwmzRWy0eQi3lUY71M41fp9Sq+UpuKKv705xsI=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + "robotnix.cachix.org-1:+y88eX6KTvkJyernp1knbpttlaLTboVp4vq/b24BIv0=" ]; substituters = [ "https://cache.iog.io" "https://mlabs.cachix.org" "https://aciceri-fleet.cachix.org" "https://nix-community.cachix.org" + "https://robotnix.cachix.org" ]; }; diff --git a/utils/default.nix b/utils/default.nix index c758825..03a0dab 100644 --- a/utils/default.nix +++ b/utils/default.nix @@ -77,9 +77,13 @@ name, device, flavor, + androidVersion, }: lib.robotnixSystem { inherit device flavor; + imports = [ + (../hosts + "/${name}") + ]; }; androidConfigurations = { @@ -87,10 +91,21 @@ name = "oneplus5t"; device = "dumpling"; flavor = "lineageos"; + androidVersion = 12; }; }; - androidImages = lib.perSystem (system: builtins.mapAttrs (name: conf: conf.img) androidConfigurations); + androidImages = lib.perSystem (system: builtins.mapAttrs (confName: conf: conf.img) androidConfigurations); + + androidGenerateKeysScripts = lib.perSystem (system: + lib.mapAttrs' (confName: conf: { + name = "${confName}-generateKeys"; + value = { + type = "app"; + program = "${conf.generateKeysScript}"; + }; + }) + androidConfigurations); mkVmApp = system: configuration: let shellScript = pkgsFor.${system}.writeShellScript "run-vm" '' @@ -154,6 +169,7 @@ }); in { inherit + androidGenerateKeysScripts androidImages checkFormatting formatApp