From 3d102d08cbcaf1c8ad0ea15d7273dc498572fa42 Mon Sep 17 00:00:00 2001 From: Aner Zakobar Date: Thu, 6 Feb 2025 15:11:05 +0200 Subject: [PATCH] It builds, submodules --- .gitmodules | 3 + README.org | 10 +- azos-core | 1 + flake.lock | 91 +- flake.nix | 40 +- home-manager/home.nix | 7 +- modules/home-manager/default.nix | 2 +- modules/home-manager/suites/base/default.nix | 24 - .../suites/base/emacs/default.nix | 48 - .../home-manager/suites/base/git/default.nix | 13 - .../suites/base/gpg-agent/default.nix | 14 - .../suites/base/gpg-agent/gpg-agent.conf | 6 - modules/home-manager/suites/base/name.nix | 4 - .../suites/base/python/default.nix | 29 - modules/home-manager/suites/default.nix | 13 - modules/home-manager/suites/dev/default.nix | 9 - .../home-manager/suites/dev/emacs/default.nix | 17 - .../home-manager/suites/editor/default.nix | 17 - .../suites/editor/emacs/default.nix | 21 - modules/home-manager/suites/editor/tex.nix | 40 - modules/home-manager/suites/exwm/default.nix | 21 - .../suites/exwm/emacs/default.nix | 19 - .../home-manager/suites/station/default.nix | 273 ---- .../suites/station/emacs/default.nix | 18 - .../suites/station/mail/default.nix | 24 - modules/home-manager/suites/utils.nix | 49 - nixos/configuration-vm.nix | 20 +- nixos/configuration.nix | 2 +- overlays/default.nix | 2 +- pkgs/azos-emacs-base.nix | 32 - pkgs/azos-emacs-dev.nix | 23 - pkgs/azos-emacs-editor.nix | 19 - pkgs/azos-emacs-exwm.nix | 19 - pkgs/azos-emacs-station.nix | 20 - pkgs/azos-fetchmail.nix | 10 - pkgs/azos-tex.nix | 26 - pkgs/default.nix | 40 +- pkgs/elisp/azos-emacs-base.org | 1327 ----------------- pkgs/elisp/azos-emacs-dev.org | 165 -- pkgs/elisp/azos-emacs-editor.org | 246 --- pkgs/elisp/azos-emacs-exwm.org | 357 ----- pkgs/elisp/azos-emacs-station.org | 300 ---- 42 files changed, 140 insertions(+), 3281 deletions(-) create mode 100644 .gitmodules create mode 160000 azos-core delete mode 100644 modules/home-manager/suites/base/default.nix delete mode 100644 modules/home-manager/suites/base/emacs/default.nix delete mode 100644 modules/home-manager/suites/base/git/default.nix delete mode 100644 modules/home-manager/suites/base/gpg-agent/default.nix delete mode 100644 modules/home-manager/suites/base/gpg-agent/gpg-agent.conf delete mode 100644 modules/home-manager/suites/base/name.nix delete mode 100644 modules/home-manager/suites/base/python/default.nix delete mode 100644 modules/home-manager/suites/default.nix delete mode 100644 modules/home-manager/suites/dev/default.nix delete mode 100644 modules/home-manager/suites/dev/emacs/default.nix delete mode 100644 modules/home-manager/suites/editor/default.nix delete mode 100644 modules/home-manager/suites/editor/emacs/default.nix delete mode 100644 modules/home-manager/suites/editor/tex.nix delete mode 100644 modules/home-manager/suites/exwm/default.nix delete mode 100644 modules/home-manager/suites/exwm/emacs/default.nix delete mode 100644 modules/home-manager/suites/station/default.nix delete mode 100644 modules/home-manager/suites/station/emacs/default.nix delete mode 100644 modules/home-manager/suites/station/mail/default.nix delete mode 100644 modules/home-manager/suites/utils.nix delete mode 100644 pkgs/azos-emacs-base.nix delete mode 100644 pkgs/azos-emacs-dev.nix delete mode 100644 pkgs/azos-emacs-editor.nix delete mode 100644 pkgs/azos-emacs-exwm.nix delete mode 100644 pkgs/azos-emacs-station.nix delete mode 100644 pkgs/azos-fetchmail.nix delete mode 100644 pkgs/azos-tex.nix delete mode 100644 pkgs/elisp/azos-emacs-base.org delete mode 100644 pkgs/elisp/azos-emacs-dev.org delete mode 100644 pkgs/elisp/azos-emacs-editor.org delete mode 100644 pkgs/elisp/azos-emacs-exwm.org delete mode 100644 pkgs/elisp/azos-emacs-station.org diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..b820fc4 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "azos-core"] + path = azos-core + url = git@github.com:anerisgreat/azos-core.git diff --git a/README.org b/README.org index 0b34f03..1b0cacd 100644 --- a/README.org +++ b/README.org @@ -62,6 +62,10 @@ inputs.nixpkgs.lib And stuff +If life is giving you trouble with submodules +#+begin_src bash +nix flake lock --update-input azos-core +#+end_src ** Shell @@ -71,8 +75,10 @@ nix develop .#shells.x86_64-linux.debugTexShell * Tasks +** Seperate repos + +Two flakes, make the first one flake, have it just import the other one as an input from a subdir. + ** Station ORG *** Move mail config *** Add mail service -*** Verify package list -** EXWM Everything diff --git a/azos-core b/azos-core new file mode 160000 index 0000000..63005bf --- /dev/null +++ b/azos-core @@ -0,0 +1 @@ +Subproject commit 63005bf29562177ca11e2b7a821a8133c5cff6f1 diff --git a/flake.lock b/flake.lock index dc9409a..0c27c9d 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,42 @@ { "nodes": { + "azos-core": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1738844253, + "narHash": "sha256-9+P5G/177kZ6QN+psxb2IJcwvqxZ6FjuqZ7wjSlsD0w=", + "ref": "refs/heads/master", + "rev": "63005bf29562177ca11e2b7a821a8133c5cff6f1", + "revCount": 13, + "type": "git", + "url": "file:./azos-core" + }, + "original": { + "type": "git", + "url": "file:./azos-core" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -7,11 +44,11 @@ ] }, "locked": { - "lastModified": 1720042825, - "narHash": "sha256-A0vrUB6x82/jvf17qPCpxaM+ulJnD8YZwH9Ci0BsAzE=", + "lastModified": 1726989464, + "narHash": "sha256-Vl+WVTJwutXkimwGprnEtXc/s/s8sMuXzqXaspIGlwM=", "owner": "nix-community", "repo": "home-manager", - "rev": "e1391fb22e18a36f57e6999c7a9f966dc80ac073", + "rev": "2f23fa308a7c067e52dfcc30a0758f47043ec176", "type": "github" }, "original": { @@ -23,27 +60,27 @@ }, "nixpkgs": { "locked": { - "lastModified": 1725407940, - "narHash": "sha256-tiN5Rlg/jiY0tyky+soJZoRzLKbPyIdlQ77xVgREDNM=", + "lastModified": 1738702386, + "narHash": "sha256-nJj8f78AYAxl/zqLiFGXn5Im1qjFKU8yBPKoWEeZN5M=", "owner": "nixos", "repo": "nixpkgs", - "rev": "6f6c45b5134a8ee2e465164811e451dcb5ad86e3", + "rev": "030ba1976b7c0e1a67d9716b17308ccdab5b381e", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-24.05", + "ref": "nixos-24.11", "repo": "nixpkgs", "type": "github" } }, "nixpkgs-unstable": { "locked": { - "lastModified": 1686501370, - "narHash": "sha256-G0WuM9fqTPRc2URKP9Lgi5nhZMqsfHGrdEbrLvAPJcg=", + "lastModified": 1738680400, + "narHash": "sha256-ooLh+XW8jfa+91F1nhf9OF7qhuA/y1ChLx6lXDNeY5U=", "owner": "nixos", "repo": "nixpkgs", - "rev": "75a5ebf473cd60148ba9aec0d219f72e5cf52519", + "rev": "799ba5bffed04ced7067a91798353d360788b30d", "type": "github" }, "original": { @@ -53,12 +90,44 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1735563628, + "narHash": "sha256-OnSAY7XDSx7CtDoqNh8jwVwh4xNL/2HaJxGjryLWzX8=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "b134951a4c9f3c995fd7be05f3243f8ecd65d798", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { + "azos-core": "azos-core", "home-manager": "home-manager", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "nixpkgs-unstable": "nixpkgs-unstable" } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index c5aa179..808b710 100644 --- a/flake.nix +++ b/flake.nix @@ -19,6 +19,11 @@ # Shameless plug: looking for a way to nixify your themes and make # everything match nicely? Try nix-colors! # nix-colors.url = "github:misterio77/nix-colors"; + + azos-core = { + url = "git+file:./azos-core"; + flake = true; + }; }; outputs = { @@ -42,7 +47,10 @@ # Your custom packages # Accessible through 'nix build', 'nix shell', etc - packages = forAllSystems (system: ((import ./pkgs) {pkgs= nixpkgs.legacyPackages.${system};})); + #OLD CODE + # packages = forAllSystems (system: ((import ./pkgs) {pkgs= nixpkgs.legacyPackages.${system};})); + #NEW CODE + # azos-packages = forAllSystems (system: (inputs.azos-core.azos-packages.${system})); # Formatter for your nix files, available through 'nix fmt' # Other options beside 'alejandra' include 'nixpkgs-fmt' formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra); @@ -51,10 +59,12 @@ overlays = import ./overlays {inherit inputs;}; # Reusable nixos modules you might want to export # These are usually stuff you would upstream into nixpkgs - nixosModules = import ./modules/nixos; + nixosModules = inputs.azos-core.nixosModules.nixosModules; # Reusable home-manager modules you might want to export # These are usually stuff you would upstream into home-manager - homeManagerModules = import ./modules/home-manager; + homeManagerModules = inputs.azos-core.nixosModules.homeManagerModules; + #OLD CODE + # homeManagerModules = import ./modules/home-manager; # NixOS configuration entrypoint # Available through 'nixos-rebuild --flake .#your-hostname' @@ -79,18 +89,18 @@ # Standalone home-manager configuration entrypoint # Available through 'home-manager --flake .#your-username@your-hostname' - homeConfigurations = { - # FIXME replace with your username@hostname - "aner@lauretta" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance - extraSpecialArgs = {inherit inputs outputs;}; - modules = [ - # > Our main home-manager configuration file < - ./home-manager/home.nix - ]; - }; - }; + # homeConfigurations = { + # # FIXME replace with your username@hostname + # "aner@lauretta" = home-manager.lib.homeManagerConfiguration { + # pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance + # extraSpecialArgs = {inherit inputs outputs;}; + # modules = [ + # # > Our main home-manager configuration file < + # ./home-manager/home.nix + # ]; + # }; + # }; - shells = forAllSystems (system: ((import ./shells) { pkgs= nixpkgs.legacyPackages.${system} // outputs.packages.${system};})); + shells = forAllSystems (system: ((import ./shells) { pkgs= nixpkgs.legacyPackages.${system} // outputs.packages.${system} // outputs.azos-packages.${system};})); }; } diff --git a/home-manager/home.nix b/home-manager/home.nix index 8121d07..5b5a9e2 100644 --- a/home-manager/home.nix +++ b/home-manager/home.nix @@ -15,9 +15,10 @@ nixpkgs = { overlays = [ - outputs.overlays.additions - outputs.overlays.modifications - outputs.overlays.unstable-packages + inputs.azos-core.overlays.addpkgs + # outputs.overlays.additions + # outputs.overlays.modifications + # outputs.overlays.unstable-packages ]; config = { allowUnfree = true; diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index de312e7..70dec76 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -1,3 +1,3 @@ { - imports = [ ./suites ]; + imports = []; } diff --git a/modules/home-manager/suites/base/default.nix b/modules/home-manager/suites/base/default.nix deleted file mode 100644 index 6e572de..0000000 --- a/modules/home-manager/suites/base/default.nix +++ /dev/null @@ -1,24 +0,0 @@ -#https://xeiaso.net/talks/asg-2023-nixos/ example -{ lib, config, pkgs, options, azos-utils, ... }: -{ - options.azos.suites.base.enable = (azos-utils.mkSuiteEnableOption {}); - - imports = [ - ./emacs - ./python - ./gpg-agent - ./git - ./name.nix - ]; - - options.azos.name = lib.mkOption{ - default = "YOUR NAME HERE"; - type = lib.types.str; - description = "Your full name."; - }; - - config.home.packages = [ - pkgs.liberation_ttf - pkgs.font-awesome - ]; -} diff --git a/modules/home-manager/suites/base/emacs/default.nix b/modules/home-manager/suites/base/emacs/default.nix deleted file mode 100644 index 806c1ed..0000000 --- a/modules/home-manager/suites/base/emacs/default.nix +++ /dev/null @@ -1,48 +0,0 @@ -{ lib, config, pkgs, azos-utils, outputs, ... }: -let - isEnabled = - config.azos.emacs.enable && config.azos.suites.base.enable; - emacspkgs = config.azos.emacs.emacspkg.pkgs; - localPkgName = "azos-emacs-base"; -in -{ - options.azos.emacs.enable = (azos-utils.mkFeatureEnableOption { - description = "Enables EMACS installation.";}); - - options.azos.emacs.emacspkg = lib.mkOption{ - type = lib.types.package; - default = pkgs.emacs; - description = "The base package to use for Emacs."; - }; - - options.azos.emacs.pkgs = lib.mkOption{ - default = []; - description = "List of packages for Emacs."; - }; - - options.azos.emacs.enabledSuites = lib.mkOption{ - default = []; - description = "List of enabled suite names for Emacs. Used to enable the " + - "custom packages in init.el."; - }; - - #Set config - config = lib.mkIf isEnabled { - #Base emacs suite definition - azos.emacs.pkgs = [pkgs.azos.emacs.base]; - - azos.emacs.enabledSuites = [localPkgName]; - - #Global instantiation of Emacs - programs.emacs = { - enable = true; - package = - ((pkgs.emacsPackagesFor config.azos.emacs.emacspkg).emacsWithPackages ( - config.azos.emacs.pkgs - )); - extraConfig = lib.strings.concatStringsSep "\n" - (builtins.map (s : "(require '" + s + ")\n") - config.azos.emacs.enabledSuites); - }; - }; -} diff --git a/modules/home-manager/suites/base/git/default.nix b/modules/home-manager/suites/base/git/default.nix deleted file mode 100644 index da2b9b6..0000000 --- a/modules/home-manager/suites/base/git/default.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ lib, config, pkgs, azos-utils, ... }: -let - isEnabled = - config.azos.git.enable && - config.azos.suites.base.enable; -in -{ - options.azos.git.enable = (azos-utils.mkFeatureEnableOption {}); - - config = lib.mkIf isEnabled { - programs.git.enable = true; - }; -} diff --git a/modules/home-manager/suites/base/gpg-agent/default.nix b/modules/home-manager/suites/base/gpg-agent/default.nix deleted file mode 100644 index c67784c..0000000 --- a/modules/home-manager/suites/base/gpg-agent/default.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ lib, config, pkgs, azos-utils, ... }: -let - isEnabled = - config.azos.gpgagent.enable && - config.azos.suites.base.enable; -in -{ - options.azos.gpgagent.enable = (azos-utils.mkFeatureEnableOption {}); - - config = lib.mkIf isEnabled { - home.packages = [ pkgs.gnupg ]; - home.file.".gnupg/gpg-agent.conf".source = ./gpg-agent.conf; - }; -} diff --git a/modules/home-manager/suites/base/gpg-agent/gpg-agent.conf b/modules/home-manager/suites/base/gpg-agent/gpg-agent.conf deleted file mode 100644 index 4223529..0000000 --- a/modules/home-manager/suites/base/gpg-agent/gpg-agent.conf +++ /dev/null @@ -1,6 +0,0 @@ -grab -pinentry-program /usr/bin/pinentry -default-cache-ttl 86400 -max-cache-ttl 86400 -enable-ssh-support - diff --git a/modules/home-manager/suites/base/name.nix b/modules/home-manager/suites/base/name.nix deleted file mode 100644 index b25a809..0000000 --- a/modules/home-manager/suites/base/name.nix +++ /dev/null @@ -1,4 +0,0 @@ -#https://xeiaso.net/talks/asg-2023-nixos/ example -{ lib, config, pkgs, ... }:{ - home.file."name.txt".text = ''${config.azos.name}''; -} diff --git a/modules/home-manager/suites/base/python/default.nix b/modules/home-manager/suites/base/python/default.nix deleted file mode 100644 index b890f86..0000000 --- a/modules/home-manager/suites/base/python/default.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ lib, config, pkgs, azos-utils, ... }: -let - isEnabled = - config.azos.python.enable && config.azos.suites.base.enable; - pythonpkgs = config.azos.python.pythonpkg.pkgs; -in -{ - options.azos.python.enable = (azos-utils.mkFeatureEnableOption {}); - - options.azos.python.pythonpkg = lib.mkOption{ - type = lib.types.package; - default = pkgs.python3; - }; - - options.azos.python.pkgs = lib.mkOption{ - default = []; - description = "List of packages for python."; - }; - - config = lib.mkIf isEnabled { - - home.packages = with pkgs; - [(config.azos.python.pythonpkg.withPackages (python-pkgs: config.azos.python.pkgs)) - ]; - }; - - imports = [ - ]; -} diff --git a/modules/home-manager/suites/default.nix b/modules/home-manager/suites/default.nix deleted file mode 100644 index 3e4f7ee..0000000 --- a/modules/home-manager/suites/default.nix +++ /dev/null @@ -1,13 +0,0 @@ -#https://xeiaso.net/talks/asg-2023-nixos/ example -{ lib, config, pkgs, options, azos-utils, ... }: -{ - _module.args.azos-utils = import ./utils.nix { lib = lib; }; - - imports = [ - ./base - ./station - ./dev - ./editor - ./exwm - ]; -} diff --git a/modules/home-manager/suites/dev/default.nix b/modules/home-manager/suites/dev/default.nix deleted file mode 100644 index b7ae4ce..0000000 --- a/modules/home-manager/suites/dev/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -#https://xeiaso.net/talks/asg-2023-nixos/ example -{ lib, config, pkgs, options, azos-utils, ... }: -{ - options.azos.suites.dev.enable = (azos-utils.mkSuiteEnableOption {}); - - imports = [ - ./emacs - ]; -} diff --git a/modules/home-manager/suites/dev/emacs/default.nix b/modules/home-manager/suites/dev/emacs/default.nix deleted file mode 100644 index ad2e043..0000000 --- a/modules/home-manager/suites/dev/emacs/default.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ lib, config, pkgs, azos-utils, ... }: -let - isEnabled = - config.azos.emacs.enable && config.azos.suites.dev.enable; - emacspkgs = config.azos.emacs.emacspkg.pkgs; - localPkgName = "azos-emacs-dev"; -in -{ - #Set config - config = lib.mkIf isEnabled { - - #Base emacs suite definition - azos.emacs.pkgs = [pkgs.azos.emacs.dev]; - - azos.emacs.enabledSuites = [localPkgName]; - }; -} diff --git a/modules/home-manager/suites/editor/default.nix b/modules/home-manager/suites/editor/default.nix deleted file mode 100644 index 790f5c5..0000000 --- a/modules/home-manager/suites/editor/default.nix +++ /dev/null @@ -1,17 +0,0 @@ -#https://xeiaso.net/talks/asg-2023-nixos/ example -{ lib, config, pkgs, options, azos-utils, ... }: -let - isEnabled = - config.azos.suites.editor.enable; -in -{ - options.azos.suites.editor.enable = (azos-utils.mkSuiteEnableOption {}); - - imports = [ - ./emacs - ]; - - config = lib.mkIf isEnabled { - home.packages = [ pkgs.azos.tex ]; - }; -} diff --git a/modules/home-manager/suites/editor/emacs/default.nix b/modules/home-manager/suites/editor/emacs/default.nix deleted file mode 100644 index c8a6928..0000000 --- a/modules/home-manager/suites/editor/emacs/default.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ lib, config, pkgs, azos-utils, ... }: -let - isEnabled = - config.azos.emacs.enable && config.azos.suites.dev.enable; - emacspkgs = config.azos.emacs.emacspkg.pkgs; - pythonpkgs = config.azos.python.pythonpkg.pkgs; - localPkgName = "azos-emacs-editor"; -in -{ - #Set config - config = lib.mkIf isEnabled { - - #Base emacs suite definition - azos.emacs.pkgs = [pkgs.azos.emacs.base]; - - azos.emacs.enabledSuites = [localPkgName]; - - azos.python.pkgs = with pythonpkgs; [ graphviz pygments ]; - }; - -} diff --git a/modules/home-manager/suites/editor/tex.nix b/modules/home-manager/suites/editor/tex.nix deleted file mode 100644 index 2b74141..0000000 --- a/modules/home-manager/suites/editor/tex.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ lib, config, pkgs, azos-utils, ... }: -let - isEnabled = - config.azos.tex.enable && config.azos.suites.editor.enable; -in -{ - options.azos.tex.enable = (azos-utils.mkFeatureEnableOption {}); - - options.azos.tex.pkgs = lib.mkOption{ - default = []; - description = "List of packages for tex."; - }; - - config = lib.mkIf isEnabled { - azos.tex.pkgs = with pkgs.texlive; [ - combined.scheme-basic - dvisvgm - dvipng - wrapfig - amsmath - ulem - hyperref - capt-of - - polyglossia - xcolor - amsmath - amsfonts - braket - hebrew-fonts - ]; - - home.packages = with pkgs; [(texlive.combine azos.tex.pkgs)]; - }; - - imports = [ - ]; - - -} diff --git a/modules/home-manager/suites/exwm/default.nix b/modules/home-manager/suites/exwm/default.nix deleted file mode 100644 index 8c9d10c..0000000 --- a/modules/home-manager/suites/exwm/default.nix +++ /dev/null @@ -1,21 +0,0 @@ -#https://xeiaso.net/talks/asg-2023-nixos/ example -#https://gist.github.com/rycee/1ad8654856ce8519f2270b18d27b76d5 -{ lib, config, pkgs, options, azos-utils, ... }: -let - isEnabled = - config.azos.suites.exwm.enable; -in -{ - options.azos.suites.exwm.enable = (azos-utils.mkSuiteEnableOption {}); - - imports = [ - ./emacs - ]; - - config = lib.mkIf isEnabled { - home.packages = [ pkgs.xlayoutdisplay ]; - }; - - - -} diff --git a/modules/home-manager/suites/exwm/emacs/default.nix b/modules/home-manager/suites/exwm/emacs/default.nix deleted file mode 100644 index b2e343d..0000000 --- a/modules/home-manager/suites/exwm/emacs/default.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ lib, config, pkgs, azos-utils, ... }: -let - isEnabled = - config.azos.emacs.enable && config.azos.suites.exwm.enable; - emacspkgs = config.azos.emacs.emacspkg.pkgs; - localPkgName = "azos-emacs-exwm"; -in -{ - #Set config - config = lib.mkIf isEnabled { - - azos.emacs.enabledSuites = [localPkgName]; - - #Base emacs suite definition - azos.emacs.pkgs = [pkgs.azos.emacs.exwm]; - - home.file.".xinitrc".text = ''exec emacs''; - }; -} diff --git a/modules/home-manager/suites/station/default.nix b/modules/home-manager/suites/station/default.nix deleted file mode 100644 index 62abb83..0000000 --- a/modules/home-manager/suites/station/default.nix +++ /dev/null @@ -1,273 +0,0 @@ -{ lib, config, pkgs, options, azos-utils, ... }: -let - isEnabled = config.azos.suites.base.enable; -in -{ - options.azos.suites.station.enable = azos-utils.mkSuiteEnableOption {}; - - imports = [ - ./emacs - ]; - - config = lib.mkIf isEnabled { - #Input! - home.keyboard = { - options = [ - "grp:alt_shift_toggle" - ]; - layout = "us,il"; - }; - - #Flameshot - services.flameshot = { - enable = true; - settings = { - General = { - disabledTrayIcon = true; - showStartupLaunchMessage = false; - }; - }; - }; - - #DUNST - services.dunst = { - enable = true; - settings = { - global = { - monitor = 0; - follow = "keyboard"; - geometry = "300x5-30+20"; - - progress_bar = true; - progress_bar_height = 10; - progress_bar_frame_width = 1; - progress_bar_min_width = 150; - progress_bar_max_width = 300; - - indicate_hidden = "yes"; - shrink = "no"; - transparency = 0; - - notification_height = 0; - separator_height = 1; - padding = 3; - horizontal_padding = 4; - text_icon_padding = 0; - - frame_width = 1; - - separator_color = "frame"; - - background = "#cdcbb4"; - - sort = "yes"; - idle_threshold = 120; - - ### Text ### - - font = "Iosevka Term 10"; - line_height = 0; - - markup = "full"; - - format = "%s\n%b"; - - # Alignment of message text. - alignment = "left"; - - # Vertical alignment of message text and icon. - # Possible values are "top", "center" and "bottom". - vertical_alignment = "center"; - - # Show age of message if message is older than show_age_threshold - # seconds. - show_age_threshold = 60; - - # Split notifications into multiple lines if they don't fit into - # geometry. - word_wrap = "yes"; - - # Ignore newlines '\n' in notifications. - ignore_newline = "no"; - - # Stack together notifications with the same content - stack_duplicates = true; - - # Hide the count of stacked notifications with the same content - hide_duplicate_count = false; - - # Display indicators for URLs (U) and actions (A). - show_indicators = "yes"; - - ### Icons ### - - # Align icons left/right/off - icon_position = "left"; - - # Scale small icons up to this size, set to 0 to disable. Helpful - # for e.g. small files or high-dpi screens. In case of conflict, - # max_icon_size takes precedence over this. - min_icon_size = 0; - - # Scale larger icons down to this size, set to 0 to disable - max_icon_size = 32; - - ### History ### - # Should a notification popped up from history be sticky or timeout - # as if it would normally do. - sticky_history = "yes"; - - # Maximum amount of notifications kept in history - history_length = 20; - - ### Misc/Advanced ### - - # Browser for opening urls in context menu. - # browser = /usr/bin/firefox -new-tab - - # Always run rule-defined scripts, even if the notification is suppressed - always_run_script = "true"; - - # Define the title of the windows spawned by dunst - title = "Dunst"; - - # Define the class of the windows spawned by dunst - class = "Dunst"; - - # Print a notification on startup. - # This is mainly for error detection, since dbus (re-)starts dunst - # automatically after a crash. - startup_notification = false; - - # Manage dunst's desire for talking - # Can be one of the following values: - # crit: Critical features. Dunst aborts - # warn: Only non-fatal warnings - # mesg: Important Messages - # info: all unimportant stuff - # debug: all less than unimportant stuff - verbosity = "mesg"; - - # Define the corner radius of the notification window - # in pixel size. If the radius is 0, you have no rounded - # corners. - # The radius will be automatically lowered if it exceeds half of the - # notification height to avoid clipping text and/or icons. - corner_radius = 0; - - # Ignore the dbus closeNotification message. - # Useful to enforce the timeout set by dunst configuration. Without this - # parameter, an application may close the notification sent before the - # user defined timeout. - ignore_dbusclose = false; - - ### Wayland ### - # These settings are Wayland-specific. They have no effect when using X11 - - # Uncomment this if you want to let notications appear under fullscreen - # applications (default: overlay) - # layer = top - - # Set this to true to use X11 output on Wayland. - force_xwayland = false; - - ### Legacy - - # Use the Xinerama extension instead of RandR for multi-monitor support. - # This setting is provided for compatibility with older nVidia drivers that - # do not support RandR and using it on systems that support RandR is highly - # discouraged. - # - # By enabling this setting dunst will not be able to detect when a monitor - # is connected or disconnected which might break follow mode if the screen - # layout changes. - force_xinerama = false; - - ### mouse - - # Defines list of actions for each mouse event - # Possible values are: - # * none: Don't do anything. - # * do_action: If the notification has exactly one action, or one is marked as default, - # invoke it. If there are multiple and no default, open the context menu. - # * close_current: Close current notification. - # * close_all: Close all notifications. - # These values can be strung together for each mouse event, and - # will be executed in sequence. - mouse_left_click = "close_current"; - mouse_middle_click = "do_action, close_current"; - mouse_right_click = "close_all"; - }; - - # Experimental features that may or may not work correctly. Do not expect them - # to have a consistent behaviour across releases. - experimental = { - # Calculate the dpi to use on a per-monitor basis. - # If this setting is enabled the Xft.dpi value will be ignored and instead - # dunst will attempt to calculate an appropriate dpi value for each monitor - # using the resolution and physical size. This might be useful in setups - # where there are multiple screens with very different dpi values. - per_monitor_dpi = false; - }; - - # The internal keyboard shortcut support in dunst is now considered deprecated - # and should be replaced by dunstctl calls. You can use the configuration of your - # WM or DE to bind these to shortcuts of your choice. - # Check the dunstctl manual page for more info. - shortcuts = { - # Shortcuts are specified as [modifier+][modifier+]...key - # Available modifiers are "ctrl", "mod1" (the alt-key), "mod2", - # "mod3" and "mod4" (windows-key). - # Xev might be helpful to find names for keys. - - # Close notification. Equivalent dunstctl command: - # dunstctl close - # close = ctrl+space - - # Close all notifications. Equivalent dunstctl command: - # dunstctl close-all - # close_all = ctrl+shift+space - - # Redisplay last message(s). Equivalent dunstctl command: - # dunstctl history-pop - # history = ctrl+grave - - # Context menu. Equivalent dunstctl command: - # dunstctl context - # context = ctrl+shift+period - - }; - - urgency_low = { - foreground = "#2f4f4f"; - frame_color = "#cdcdb4"; - timeout = 10; - # Icon for notifications with low urgency, uncomment to enable - #icon = /path/to/icon - }; - - urgency_normal = { - foreground = "#00cd00"; - frame_color = "#9aff9a"; - timeout = 10; - #icon = /path/to/icon - }; - - urgency_critical = { - foreground = "#cd0000"; - frame_color = "#cd0000"; - timeout = 0; - #icon = /path/to/icon - }; - }; - }; - - home.packages = with pkgs; [ - qutebrowser - mpv - upower - pass - lmms - ]; - }; -} diff --git a/modules/home-manager/suites/station/emacs/default.nix b/modules/home-manager/suites/station/emacs/default.nix deleted file mode 100644 index 46dfadd..0000000 --- a/modules/home-manager/suites/station/emacs/default.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ lib, config, pkgs, azos-utils, ... }: -let - isEnabled = - config.azos.emacs.enable && config.azos.suites.station.enable; - emacspkgs = config.azos.emacs.emacspkg.pkgs; - - localPkgName = "azos-emacs-station"; -in -{ - #Set config - config = lib.mkIf isEnabled { - - azos.emacs.enabledSuites = [localPkgName]; - - azos.emacs.pkgs = [pkgs.azos.emacs.station]; - }; - -} diff --git a/modules/home-manager/suites/station/mail/default.nix b/modules/home-manager/suites/station/mail/default.nix deleted file mode 100644 index 3d1f391..0000000 --- a/modules/home-manager/suites/station/mail/default.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ lib, config, pkgs, options, azos-utils, ... }: -let - isEnabled = config.azos.suites.station.enable && config.azos.mail.enable; -in -{ - options.azos.mail.enable = (azos-utils.mkFeatureEnableOption { - description = "Enables Mail installation.";}); - - options.azos.mail.accounts = lib.mkOption{ - default = []; - type = lib.types.list; - description = "List of accounts."; - }; - - - imports = [ - ]; - - config = lib.mkIf isEnabled { - home.packages = with pkgs; [pkgs pkgs]; - # home.packages = [#TODO THIS]; - }; - -} diff --git a/modules/home-manager/suites/utils.nix b/modules/home-manager/suites/utils.nix deleted file mode 100644 index 7734786..0000000 --- a/modules/home-manager/suites/utils.nix +++ /dev/null @@ -1,49 +0,0 @@ -{ lib, ... }: -{ - mkFeatureEnableOption = { ... } @ attrs : - lib.mkOption (lib.mergeAttrs attrs { - default = true; - example = true; - type = lib.types.bool; - }); - - mkSuiteEnableOption = { ... } @ attrs : - lib.mkOption (lib.mergeAttrs attrs { - default = false; - example = true; - type = lib.types.bool; - }); - - trivialFromOrg = { ... } @ attrs : ( - lib.mergeAttrs attrs { - preBuild = '' - for file in ./*.org - do - emacs --batch --eval "(require 'org)" --eval "(org-babel-tangle-file \"$file\" (concat (file-name-sans-extension \"$file\") \".el\") \"emacs-lisp\")" - done - ''; - unpackCmd = '' - case "$curSrc" in - *.el) - # keep original source filename without the hash - local filename=$(basename "$curSrc") - filename="''${filename:33}" - cp $curSrc $filename - chmod +w $filename - sourceRoot="." - ;; - *.org) - # keep original source filename without the hash - local filename=$(basename "$curSrc") - filename="''${filename:33}" - cp $curSrc $filename - chmod +w $filename - sourceRoot="." - ;; - *) - _defaultUnpack "$curSrc" - ;; - esac - ''; - }); -} diff --git a/nixos/configuration-vm.nix b/nixos/configuration-vm.nix index 1b0c00a..53b9dd2 100644 --- a/nixos/configuration-vm.nix +++ b/nixos/configuration-vm.nix @@ -34,9 +34,10 @@ imports = [ nixpkgs = { overlays = [ - outputs.overlays.additions - outputs.overlays.modifications - outputs.overlays.unstable-packages + inputs.azos-core.overlays.addpkgs + # outputs.overlays.additions + # outputs.overlays.modifications + # outputs.overlays.unstable-packages ]; # Configure your nixpkgs instance config = { @@ -103,8 +104,17 @@ imports = [ #Graphical environment services.xserver.enable = true; - services.xserver.displayManager.startx.enable = true; - # services.xserver.desktopManager.xfce.enable = true; + # services.greetd = { + # enable = true; + # settings = { + # default_session = { + # command = "startx"; + # user = "aner"; + # }; + # }; + # }; + # services.xserver.displayManager.startx.enable = true; + services.xserver.desktopManager.xfce.enable = true; # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion system.stateVersion = "24.05"; diff --git a/nixos/configuration.nix b/nixos/configuration.nix index ac1bf1a..5d84f81 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -12,7 +12,7 @@ nixpkgs = { overlays = [ - outputs.overlays.additions + # outputs.overlays.additions outputs.overlays.modifications outputs.overlays.unstable-packages ]; diff --git a/overlays/default.nix b/overlays/default.nix index a13ea3c..c9704a5 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,7 +1,7 @@ # This file defines overlays {inputs, ...}: { # This one brings our custom packages from the 'pkgs' directory - additions = final: _prev: import ../pkgs {pkgs = final;}; + # additions = final: _prev: import ./pkgs {pkgs = final;}; # This one contains whatever you want to overlay # You can change versions, add patches, set compilation flags, anything really. diff --git a/pkgs/azos-emacs-base.nix b/pkgs/azos-emacs-base.nix deleted file mode 100644 index e426901..0000000 --- a/pkgs/azos-emacs-base.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ - orgTrivialBuild, - epkgs, - pkgs -}: -orgTrivialBuild { - pname = "azos-emacs-base"; - version = "0.1.6"; - src = ./elisp/azos-emacs-base.org; - packageRequires = with epkgs; [ - evil - evil-collection - magit - undo-tree - ivy - ivy-hydra - ivy-avy - counsel - counsel-tramp - counsel-projectile - swiper - projectile - which-key - yasnippet - evil-nerd-commenter - company - olivetti #FLYCHECK PANDOC - dired-subtree - dashboard - vterm - ]; -} diff --git a/pkgs/azos-emacs-dev.nix b/pkgs/azos-emacs-dev.nix deleted file mode 100644 index 3325854..0000000 --- a/pkgs/azos-emacs-dev.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ - orgTrivialBuild, - epkgs, - pkgs -}: -orgTrivialBuild { - pname = "azos-emacs-dev"; - version = "0.1.6"; - src = ./elisp/azos-emacs-dev.org; - packageRequires = with epkgs; [ - flycheck - cmake-mode - yaml - yaml-mode - nix-mode - python - rust-mode - ein - ob-async - pkgs.azos.emacs.base - pkgs.azos.emacs.editor - ]; -} diff --git a/pkgs/azos-emacs-editor.nix b/pkgs/azos-emacs-editor.nix deleted file mode 100644 index 097cc92..0000000 --- a/pkgs/azos-emacs-editor.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ - orgTrivialBuild, - epkgs, - pkgs -}: -orgTrivialBuild { - pname = "azos-emacs-editor"; - version = "0.1.6"; - src = ./elisp/azos-emacs-editor.org; - packageRequires = with epkgs; [ - pkgs.azos.emacs.base - - graphviz-dot-mode - markdown-mode - markdown-toc - org-present - pdf-tools - ]; -} diff --git a/pkgs/azos-emacs-exwm.nix b/pkgs/azos-emacs-exwm.nix deleted file mode 100644 index 7428443..0000000 --- a/pkgs/azos-emacs-exwm.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ - orgTrivialBuild, - epkgs, - pkgs -}: -orgTrivialBuild { - pname = "azos-emacs-exwm"; - version = "0.1.6"; - src = ./elisp/azos-emacs-exwm.org; - packageRequires = with epkgs; [ - pkgs.azos.emacs.base - pkgs.azos.emacs.station - - exwm - desktop-environment - bluetooth - pulseaudio-control - ]; -} diff --git a/pkgs/azos-emacs-station.nix b/pkgs/azos-emacs-station.nix deleted file mode 100644 index b299c91..0000000 --- a/pkgs/azos-emacs-station.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ - orgTrivialBuild, - epkgs, - pkgs -}: -orgTrivialBuild { - pname = "azos-emacs-station"; - version = "0.1.6"; - src = ./elisp/azos-emacs-station.org; - packageRequires = with epkgs; [ - pkgs.azos.emacs.base - - notmuch #TODO CHECK, ALSO FOR THIS CONFIGURE ALL PACKAGES N STUFF - elfeed #PROBABLY ALSO BUILT IN - elfeed-tube - pass - scad-mode - kubernetes - ]; -} diff --git a/pkgs/azos-fetchmail.nix b/pkgs/azos-fetchmail.nix deleted file mode 100644 index bb5ae10..0000000 --- a/pkgs/azos-fetchmail.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ - pkgs, -}: -let - a = 2; -in -pkgs.writeShellScriptBin "my-script" '' - ATE="$(${pkgs.ddate}/bin/ddate +'the %e of %B%, %Y')" - ${pkgs.cowsay}/bin/cowsay Hello, world! Today is $DATE. -'' diff --git a/pkgs/azos-tex.nix b/pkgs/azos-tex.nix deleted file mode 100644 index 95cf1e9..0000000 --- a/pkgs/azos-tex.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ - pkgs -}: -(pkgs.texlive.combine { - inherit (pkgs.texlive) - scheme-small - collection-binextra - collection-fontsextra - - #Org PDF stuff - dvisvgm dvipng # for preview and export as html - wrapfig amsmath ulem hyperref capt-of - - #Hebrew - bidi babel-hebrew cjhebrew hebrew-fonts - - #Others - zref #Page numbering - transparent #Transparency - - #Exporting - latexmk - minted braket - fontawesome - pygmentex; - }) diff --git a/pkgs/default.nix b/pkgs/default.nix index 31e2661..0c0c426 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,40 +1,2 @@ { pkgs } @ args: -let - inherit args; - emacs-pkg = pkgs.emacs; - epkgs = emacs-pkg.pkgs; - trivialBuild = epkgs.trivialBuild; - orgTrivialBuild = attrs : (trivialBuild (pkgs.lib.mergeAttrs attrs { - preBuild = '' - for file in ./*.org - do - emacs --batch --eval "(require 'org)" --eval "(org-babel-tangle-file \"$file\" (concat (file-name-sans-extension \"$file\") \".el\") \"emacs-lisp\")" - done - ''; - unpackCmd = '' - case "$curSrc" in - *.el | *.org) - # keep original source filename without the hash - local filename=$(basename "$curSrc") - filename="''${filename:33}" - cp $curSrc $filename - chmod +w $filename - sourceRoot="." - ;; - *) - _defaultUnpack "$curSrc" - ;; - esac - ''; - })); - localEmacsPkg = (src: pkgs.callPackage src { orgTrivialBuild = orgTrivialBuild; epkgs = epkgs; pkgs = pkgs; }); -in -{ - azos.emacs.base = localEmacsPkg ./azos-emacs-base.nix; - azos.emacs.editor = localEmacsPkg ./azos-emacs-editor.nix; - azos.emacs.dev = localEmacsPkg ./azos-emacs-dev.nix; - azos.emacs.station = localEmacsPkg ./azos-emacs-station.nix; - azos.emacs.exwm = localEmacsPkg ./azos-emacs-exwm.nix; - azos.tex = pkgs.callPackage ./azos-tex.nix { pkgs = pkgs; }; - # azos.fetchmail = pkgs.callPackage ./azos-fetchmail.nix { pkgs = pkgs; }; -} +{} diff --git a/pkgs/elisp/azos-emacs-base.org b/pkgs/elisp/azos-emacs-base.org deleted file mode 100644 index 49a12e8..0000000 --- a/pkgs/elisp/azos-emacs-base.org +++ /dev/null @@ -1,1327 +0,0 @@ -#+title: Aner's Emacs Base Configuration -#+property: header-args :results silent - -* Base setup -** Bootstrapping - -#+begin_src emacs-lisp -(setq - vc-follow-symlinks t ;Follow symlinks - - ;Backups from https://www.emacswiki.org/emacs/BackupDirectory - backup-directory-alist `(("." . temporary-file-directory)) - auto-save-file-name-transforms '((".*" temporary-file-directory t)) - backup-by-copying t ;Always copy never link - delete-old-versions t ;Auto delete old backups - kept-new-versions 6 ;Number of versions to keep - kept-old-versions 2 - version-control t ;Backups for files - - ;Garbage collection - gc-cons-threshold 100000000 - - ;Set external cusotm file - custom-file (expand-file-name "custom.el" user-emacs-directory) -) - -#+end_src - -Load custom file - -#+begin_src emacs-lisp -(if (file-exists-p custom-file) (load custom-file)) -#+end_src - -** Utility functions - -*** CL - -CL is a base library that has a bunch of useful stuff, primarily for lists. -We are using the built-in version, no need to pull from anywhere. -This just makes sure the code is loaded early on for later use. - -#+begin_src emacs-lisp -(require 'cl-lib) -#+end_src - -*** Copy file name - -Defining a function to copy filename. - -#+begin_src emacs-lisp -(defun azos/copy-file-name () (interactive) - (let ((fpath buffer-file-name)) - (if fpath (kill-new fpath) (message "No current file!")))) -#+end_src - -*** Font candidate - -#+begin_src emacs-lisp -(defun azos/font-candidate (&rest fonts) - "Return existing font which first match." - (cl-find-if (lambda (f) (find-font (font-spec :name f))) fonts)) -#+end_src - -*** Regex match function - -#+begin_src emacs-lisp -(defun azos/re-seq (regexp string) - "Get a list of all regexp matches in a string" - (save-match-data - (let ((pos 0) - matches) - (while (string-match regexp string pos) - (push (match-string 0 string) matches) - (setq pos (match-end 0))) - matches))) -#+end_src - -** Keymap setup - -In this section global keybindings are defined using a global minor mode. - -First, utility functions that will be bound are defined. - -The first, =azos/set-window-width= is a helper function that resizes a window. Used because I wanted a function -that resizes a window to 85 cols easily. - -The second, =azos/open-conf-file=, opens the configuration file. - -#+begin_src emacs-lisp -(defun azos/set-window-width (n) - (adjust-window-trailing-edge (selected-window) ( - n (window-width)) t)) - -(defun azos/open-conf-file () - (interactive) - (find-file (concat user-emacs-directory "config.org"))) -#+end_src - -Now let's define keybindings. To start, we'd like =M-o= to be available to us, so let's unbind it. - -#+begin_src emacs-lisp -;Unbind face menu map -(define-key global-map (kbd "M-o") nil) -#+end_src - -This creates an "open keymap", a bunch of keybindings we'll use to open basic applications and files. -This will be mapped to =M-o=, and things will be opened form this sub-menu. -We'll start it with a binding to open the conf file with =M-o o= (MOO!) - -Setting of keybindings based on [[https://stackoverflow.com/questions/49853494/the-best-way-to-set-a-key-to-do-nothing][this]] - -#+begin_src emacs-lisp -;We'll define a basic keymap and already load window-manip funcs -(defvar azos/global-minor-mode/open-keymap - (let ((map (make-sparse-keymap))) - (define-key map (kbd "o") 'azos/open-conf-file) - map) - "global keymap for opening stuff on azos") -#+end_src - -At this stage a minor-mode-map is defined with keybindings, and an accompanying minor-mode is added. - -#+begin_src emacs-lisp -(defvar azos/global-minor-mode/keymap - (let ((map (make-sparse-keymap))) - - ;Window movement and manipulation - (define-key map (kbd "M-h") 'windmove-left) - (define-key map (kbd "M-l") 'windmove-right) - (define-key map (kbd "M-k") 'windmove-up) - (define-key map (kbd "M-j") 'windmove-down) - - (define-key map (kbd "M-") 'windmove-left) - (define-key map (kbd "M-") 'windmove-right) - (define-key map (kbd "M-") 'windmove-up) - (define-key map (kbd "M-") 'windmove-down) - (define-key map (kbd "M-d M-d") 'delete-window) - (define-key map (kbd "M-d D") 'kill-buffer-and-window) - (define-key map (kbd "M-\\") 'split-window-horizontally) - (define-key map (kbd "M-\-") 'split-window-vertically) - (define-key map (kbd "M-d R") (lambda () (interactive) - (set-window-width 85))) - (define-key map (kbd "M-o") azos/global-minor-mode/open-keymap) - map) - "azos/global-minor-mode keymap.") - -(define-minor-mode azos/global-minor-mode - "A minor mode for azos global keymaps." - :init-value t - :lighter "azos" - :keymap azos/global-minor-mode/keymap) - -(azos/global-minor-mode 1) -#+end_src - -This keymap will be referenced many times during this document at relevant points. - -Keymaps are included with relevant sections. - -** EVIL mode - -This section binds keys for changing window size. Done here because can only do after evil loads. - -#+begin_src emacs-lisp -(setq evil-want-keybinding nil) - -(use-package evil - :init - (setq evil-want-C-i-jump nil) - :config - (require 'evil ) - (evil-mode 1) - - :bind - (:map azos/global-minor-mode/keymap - ("M-w h" . evil-window-decreace-width) - ("M-w l" . evil-window-increase-width) - ("M-w k" . evil-window-decrease-height) - ("M-w j" . evil-window-increase-height)) -) -#+end_src - -Loading evil collection. Functions from this package will be referenced many times later in the configuration. - -#+begin_src emacs-lisp -(use-package evil-collection - :config - (setq evil-collection-setup-minibuffer t) -) -#+end_src - -#+begin_src emacs-lisp -(defvar azos/evil-color-normal "LightGoldenrod1") -(defvar azos/evil-color-emacs "LightBlue1") -(defvar azos/evil-color-insert "PaleGreen1") -(defvar azos/evil-color-replace "LightPink") -(defvar azos/evil-color-motion "LightCyan") -(defvar azos/evil-color-visual "LightGray") -(defvar azos/evil-color-operate "sandy brown") -#+end_src - -** IVY - -Enabling IVY. Taken from [[https://github.com/abo-abo/swiper][their website]]. - -Using ivy, hydra, counsel. - -#+begin_src emacs-lisp -(use-package ivy - :custom - (ivy-use-virtual-buffers t) - (enable-recursive-minibuffers t) - (ivy-count-format "(%d/%d) ") - :config - (ivy-mode 1) -) - -(use-package ivy-hydra - :after ivy) -(use-package ivy-avy - :after ivy) -(use-package counsel - :after ivy - - :bind - (:map azos/global-minor-mode/keymap - ("M-i" . counsel-imenu) - ("M-b" . counsel-switch-buffer) - ("C-x C-f" . counsel-find-file)) - (:map azos/global-minor-mode/open-keymap - ("l" . counsel-linux-app)) -) -#+end_src - -Using swiper. Replacing evil search with swiper search. - -#+begin_src emacs-lisp -(use-package swiper - :after ivy evil - :config - (setq evil-search-module 'swiper-isearch) - - :bind - (:map azos/global-minor-mode/keymap - ("C-s" . swiper-isearch)) -) -#+end_src - -Setting up keymaps - -#+begin_src emacs-lisp -(evil-collection-ivy-setup) -#+end_src - -** Assorted utility functions -* UI -** General -*** Clean UI - -Disabling the toolbar, the splash-screen, the menu-bar and the scroll-bar - -#+begin_src emacs-lisp -(menu-bar-mode -1) ; no menu bar -(when (display-graphic-p) - (tool-bar-mode -1) ; no tool bar with icons - (scroll-bar-mode -1) ; no scroll bars - (set-fringe-mode 0)) -#+end_src - -*** Background color - -#+begin_src emacs-lisp -(add-to-list 'default-frame-alist '(background-color . "LightYellow")) -#+end_src - -*** Fringe color - -While we don't actually want fringes (almost at all), some frames use them. - -#+begin_src emacs-lisp -;; (set-face-attribute 'fringe nil :background "LemonChiffon1") -#+end_src - -*** Window dividers - -#+begin_src emacs-lisp -(setq window-divider-default-bottom-width 1 - window-divider-default-places 'bottom-only) - -(window-divider-mode 1) -#+end_src - -*** Tab bar -*** Base - -Prettification of tab bar. We only use tab-bar if the version is greater than 27.1. -We also use this section to bind keys. - -#+begin_src emacs-lisp -;; If version greater than 27.1 - -(defun azos/new-tab-and-rename () - "Created for back compatibility with emacs 27" - (interactive) - (progn - (tab-bar-new-tab) - (call-interactively 'tab-bar-rename-tab))) - -(if (version<= "27.1" emacs-version) (progn - (tab-bar-mode 1) - - (set-face-attribute 'tab-bar nil - :box t - :background "LightYellow3" - :foreground "DarkSlateGrey" - :font "LiberationMono" - :height 90) - - (set-face-attribute 'tab-bar-tab nil - :box '(:color "DarkSlateGrey" :line-width -2) - :background "LightYellow3" - :weight 'bold) - - (set-face-attribute 'tab-bar-tab-inactive nil - :background "LightYellow3" - :inherit 'tab-bar) - - (define-key azos/global-minor-mode/keymap - (kbd "M-") 'tab-next) - (define-key azos/global-minor-mode/keymap - (kbd "M-'") 'tab-previous) - (define-key azos/global-minor-mode/keymap - (kbd "M-t r") 'tab-bar-rename-tab) - (define-key azos/global-minor-mode/keymap - (kbd "M-t n") 'tab-next) - (define-key azos/global-minor-mode/keymap - (kbd "M-t p") 'tab-previous) - (define-key azos/global-minor-mode/keymap - (kbd "M-t x") 'tab-bar-close-tab) - (define-key azos/global-minor-mode/keymap - (kbd "M-t c") 'azos/new-tab-and-rename) - (setq tab-bar-close-button-show nil - tab-bar-new-button-show nil - tab-bar-separator (propertize " ● " 'face - (list :foreground "LightYellow1" - :box '(:color "DarkSlateGrey"))) - ) - (add-hook 'emacs-startup-hook (lambda () (tab-bar-rename-tab "home" 1))) -)) -#+end_src - -*** Right Group Display - -#+begin_src emacs-lisp -(defvar azos/tab-bar/right-update-group '() - "Functions needed to run to update tab bar") - -(defvar azos/tab-bar/right-group '() - "A list of items to be displayed on the right of the tab-bar") - -(defun azos/tab-bar/right-group-func () - "Function that returns a string to be displayed on right of tab-bar" - (concat - tab-bar-separator - (mapconcat 'eval - (remove "" - (mapcar 'funcall azos/tab-bar/right-group)) - tab-bar-separator) - tab-bar-separator)) - -(defun azos/tab-bar/update-func () "Function to update the tab bar" - (progn - (mapc 'funcall azos/tab-bar/right-update-group) - (force-mode-line-update))) - -(if (version<= "28.1" emacs-version) (progn - (setq tab-bar-format - '( - tab-bar-format-history - tab-bar-format-tabs - tab-bar-separator - tab-bar-format-add-tab - tab-bar-format-align-right - azos/tab-bar/right-group-func) - tab-bar-auto-width nil) - (define-key azos/global-minor-mode/keymap - (kbd "M-n") 'tab-switch) - ;; (if (member system-type '(gnu gnu/linux)) - ;; (azos/run-timer 'tab-timer 'azos/tab-bar/update-func 5)) - ;; No auto-update, maybe some other way -)) -#+end_src - -Let's define a clock for the tab bar - -#+begin_src emacs-lisp -(defun azos/tab-bar/get-clock-string () "Get tab bar time string" - (propertize (format-time-string "%a, %b %d %H:%M") - 'face '(:background "LightYellow3" :foreground "DarkSlateGrey"))) - -(defun azos/tab-bar/enable-clock-display () - "Enables clock display in tab bar" - (cl-pushnew 'azos/tab-bar/get-clock-string - azos/tab-bar/right-group)) -#+end_src - -By default let's enable the clock display - -#+begin_src emacs-lisp -(azos/tab-bar/enable-clock-display) -#+end_src - -*** Tab bar addons -**** Battery status in tab bar - -#+begin_src emacs-lisp -(defun azos/bat/get-stats () "Gets battery statistics. First value returned -is battery percentage, second one is t if charging" - (let* ((commandout (string-clean-whitespace (shell-command-to-string - "upower -i /org/freedesktop/UPower/devices/DisplayDevice")))) - (list - (string-to-number (progn - (string-match "\\(?:percentage\\:\s+\\)\\([0-9]+\\)" commandout) - (match-string 1 commandout))) - (progn - (string-match "\\(?:state\\:\s+\\)\\([^\s]+\\)" commandout) - (match-string 1 commandout))) - )) - -(defvar azos/bat/status-string nil "Holds battery string") - -(defun azos/bat/set-status-string () "Sets battery-string" - (let* ((bat-stats (azos/bat/get-stats)) - (bat-charge-state (nth 1 bat-stats)) - (bat-percentage-number - (if (string= bat-charge-state "fully-charged") 100 - (nth 0 bat-stats))) - (bat-color (if (<= bat-percentage-number 10) "red3" - (if (<= bat-percentage-number 20) "DarkOrange" - "DarkSlateGrey"))) - (bat-weight (if (<= bat-percentage-number 20) 'bold 'normal)) - (bat-charge-symbol (if (string= bat-charge-state "charging") "↑" - (if (string= bat-charge-state "fully-charged") "◼" "↓")))) - (setq azos/bat/status-string - (concat - "⚡" bat-charge-symbol " " - (propertize (format "%3d" bat-percentage-number) - 'face (list :foreground bat-color - :box (list :color "DarkSlateGrey"))))))) - -(defun azos/bat/get-status-string () "Get battery string" - (if azos/bat/status-string azos/bat/status-string "")) - -(defun azos/bat/enable-tab-display () - "Enables battery display in tab bar" - (progn - (cl-pushnew 'azos/bat/get-status-string azos/tab-bar/right-group) - (cl-pushnew 'azos/bat/set-status-string azos/tab-bar/right-update-group) - )) -#+end_src - -**** Network status in tab bar - -Code to check for internet connection: - -https://emacs.stackexchange.com/questions/7653/elisp-code-to-check-for-internet-connection - -#+begin_src emacs-lisp -(defvar azos/network/status-string nil "Holds network status string") - -(defun azos/network/get-status-string () "Gets the network status string" - (if azos/network/status-string azos/network/status-string "")) - -(defun azos/network/set-status-string-sentinel (process event) - "Sets the network string based on proc run" - (setq azos/network/status-string - (concat - "↹ " - (if (= 0 (process-exit-status process)) - (propertize "✓" 'face - (list :foreground "green3" - :background "LightYellow3" - :box (list :color "DarkSlateGrey"))) - (propertize "X" 'face - (list :foreground "red3" - :background "LightYellow3" - :box (list :color "DarkSlateGrey"))))))) - -(defun azos/network/start-test-proc () "Tests whether internet" - (interactive) - (set-process-sentinel - (start-process "wget" nil "wget" "--spider" "--timeout=1" - "www.google.com") 'azos/network/set-status-string-sentinel)) - -(defun azos/network/enable-tab-display () - "Enables network display in tab bar" - (progn - (cl-pushnew 'azos/network/get-status-string - azos/tab-bar/right-group) - (cl-pushnew 'azos/network/start-test-proc - azos/tab-bar/right-update-group) - )) -#+end_src - -*** Easy Prompt - -#+begin_src emacs-lisp -(defalias 'yes-or-no-p 'y-or-n-p) -#+end_src - -*** Minibuff - -#+begin_src emacs-lisp -(add-hook 'minibuffer-setup-hook - (lambda () - (make-local-variable 'face-remapping-alist) - (add-to-list 'face-remapping-alist - '(default (:background "WhiteSmoke"))))) -#+end_src - -*** Bell - -Disable bell, who needs the bell? - -#+begin_src emacs-lisp -(setq ring-bell-function (lambda () ())) -#+end_src - -*** Olivetti - -Useful to have even if I rarely use it. - -#+begin_src emacs-lisp -(use-package olivetti - :init - (setq olivetti-body-width 96)) -#+end_src - -*** Modeline - -Setting colors - -#+begin_src emacs-lisp -(set-face-attribute 'mode-line nil :box nil :background "AliceBlue") -(set-face-attribute 'mode-line-inactive nil :box nil :background "LightYellow3") -#+end_src - -We use [[https://emacs.stackexchange.com/questions/5529/how-to-right-align-some-items-in-the-modeline][this stackoverflow page]] to make left\right aligned stuff. - -We use [[https://www.reddit.com/r/emacs/comments/4mhphb/spacemacs_how_to_limit_the_length_of_displayed/][this article]] to try and limit the mode name length. - -#+begin_src emacs-lisp -(setq evil-normal-state-tag - (propertize " NORMAL " 'face - (list :background azos/evil-color-normal)) - evil-emacs-state-tag - (propertize " EMACS " 'face - (list :background azos/evil-color-emacs)) - evil-insert-state-tag - (propertize " INSERT " 'face - (list :background azos/evil-color-insert)) - evil-replace-state-tag - (propertize " REPLACE " 'face - (list :background azos/evil-color-replace)) - evil-motion-state-tag - (propertize " MOTION " 'face - (list :background azos/evil-color-motion)) - evil-visual-state-tag - (propertize " VISUAL " 'face - (list :background azos/evil-color-visual)) - evil-operator-state-tag - (propertize " OPERATE " 'face - (list :background azos/evil-color-operate))) - -(defun azos/modeline/modeline-render (left right) - "Return a string of `window-width' length containing LEFT, and RIGHT - aligned respectively." - (let* ((available-width (- (window-width) (length left) 2))) - (format (format " %%s %%%ds " available-width) left right))) - -(setq-default mode-line-buffer-identification - (list -80 (propertized-buffer-identification "%12b"))) - -(setq-default mode-line-format - '((:eval (azos/modeline/modeline-render - ;;Left - (concat - (propertize (format-mode-line "%b") 'face '((:foreground "maroon"))) - (format-mode-line " (%m) ")) - ;;Right - (concat - (format-mode-line "%5lL%4cC ") - evil-mode-line-tag))))) -#+end_src - -*** Notifications - -#+begin_src emacs-lisp -(require 'notifications) -#+end_src - -*** Which-Key - -#+begin_src emacs-lisp -(use-package which-key - :config - (which-key-mode)) -#+end_src - -** Text -*** YASnippet - -Loading yasnippet. Useful for snippeting. Mode-specific snippets defined in relevant sections. - -#+begin_src emacs-lisp -(use-package yasnippet - :config - (yas-global-mode 1) -) -#+end_src - -*** Text font - -This section configures the base fonts. We select fonts if available (have configurations for good defaults in -Linux and Windows). - -Also setting default fixed-pitch and variable-pitch fonts. - -Setting font size to 10. The value to place is font-size * 10 - -Font size 12 for variable pitch. - -The function =font-candidate= is from https://www.gnu.org/software/emacs/manual/html_mono/cl.html. - -#+begin_src emacs-lisp -(let ((variable-font (azos/font-candidate - "Liberation Serif" "Microsoft Sans Serif"))) - (if variable-font - (set-face-attribute 'variable-pitch nil :font variable-font))) - -(let ((fixed-font (azos/font-candidate - "Source Code Pro" "LiberationMono" "Consolas"))) - (if fixed-font (progn - (set-face-attribute 'default nil :font fixed-font) - (set-face-attribute 'fixed-pitch nil :font fixed-font)))) - -(set-face-attribute 'default nil :height 100) -(set-face-attribute 'variable-pitch nil - :height 130 - :weight 'normal - :width 'normal) - -(set-face-attribute 'fixed-pitch nil - :height 100 - :weight 'normal - :width 'normal) - -(defun azos/default-variable-pitch () - (face-remap-add-relative 'default '(:inherit 'variable-pitch))) -#+end_src - -*** Line numbering - -We want line numbering, but only in modes where it makes sense. - -To do this, a custom minor-mode, =azos/global-linum-mode=, is created. -This mode selectively activates linum-mode if the mode is not one of a selected exempt modes. -These exempt modes are defined in =display-line-numbers-exempt-modes=. - -Taken from [[https://www.emacswiki.org/emacs/LineNumbers][this wiki entry]]. - -#+begin_src emacs-lisp -(use-package display-line-numbers - :init - (defcustom azos/display-line-numbers-exempt-modes - '(vterm-mode - eshell-mode - shell-mode - term-mode - ansi-term-mode - magit-mode - magit-diff-mode - notmuch-hello - pdf-view-mode) - "Major modes on which to disable the linum mode, exempts them." - :group 'display-line-numbers - :type 'list - :version "green") - - (define-global-minor-mode azos/global-linum-mode - display-line-numbers-mode - (lambda () (if (and - (not (apply 'derived-mode-p - azos/display-line-numbers-exempt-modes)) - (not (minibufferp))) - (display-line-numbers-mode)))) - - (setq display-line-numbers-type 'visual - display-line-numbers-grow-only 1 - display-line-numbers-width-start 1) - - :config - (azos/global-linum-mode 1) - (set-face-attribute 'line-number nil - :family (face-attribute 'fixed-pitch :family)) -) -#+end_src - -*** Line highlight - -Highlighting line with cursor. - -Modification done to use EVIL colors on highlighted line. - -#+begin_src emacs-lisp -(global-hl-line-mode) -(set-face-attribute 'hl-line nil :background azos/evil-color-emacs) - -(defface hl-line-normal - (list (list t (list :inherit 'hl-line :background azos/evil-color-normal - :extend t))) - "Highlight face for evil normal mode." - :group 'hl-line) - -(defface hl-line-insert - (list (list t (list :inherit 'hl-line :background azos/evil-color-insert - :extend t))) - "Highlight face for evil insert mode." - :group 'hl-line) - -(defface hl-line-emacs - (list (list t (list :inherit 'hl-line :background azos/evil-color-emacs - :extend t))) - "Highlight face for evil insert mode." - :group 'hl-line) - -(defface hl-line-replace - (list (list t (list :inherit 'hl-line :background azos/evil-color-replace - :extend t))) - "Highlight face for evil insert mode." - :group 'hl-line) - -(defface hl-line-motion - (list (list t (list :inherit 'hl-line :background azos/evil-color-motion - :extend t))) - "Highlight face for evil insert mode." - :group 'hl-line) - -(defface hl-line-visual - (list (list t (list :inherit 'hl-line :background azos/evil-color-visual - :extend t))) - "Highlight face for evil insert mode." - :group 'hl-line) - -(defface hl-line-operate - (list (list t (list :inherit 'hl-line :background azos/evil-color-operate - :extend t))) - "Highlight face for evil insert mode." - :group 'hl-line) - -(defun azos/hl-line-evil/set-hl-state (state-face) - "Refresh hl-line to be state-face" - (progn - (global-hl-line-unhighlight) - (setq-local hl-line-face state-face) - (global-hl-line-highlight))) -#+end_src - -#+begin_src emacs-lisp -(add-hook 'evil-insert-state-entry-hook - (lambda () (azos/hl-line-evil/set-hl-state 'hl-line-insert))) -(add-hook 'evil-normal-state-entry-hook - (lambda () (azos/hl-line-evil/set-hl-state 'hl-line-normal))) -(add-hook 'evil-emacs-state-entry-hook - (lambda () (azos/hl-line-evil/set-hl-state 'hl-line-emacs))) -(add-hook 'evil-replace-state-entry-hook - (lambda () (azos/hl-line-evil/set-hl-state 'hl-line-replace))) -(add-hook 'evil-motion-state-entry-hook - (lambda () (azos/hl-line-evil/set-hl-state 'hl-line-motion))) -(add-hook 'evil-visual-state-entry-hook - (lambda () (azos/hl-line-evil/set-hl-state 'hl-line-visual))) -(add-hook 'evil-operate-state-entry-hook - (lambda () (azos/hl-line-evil/set-hl-state 'hl-line-operate))) -#+end_src - -*** Line wrap - -Don't want to have to scroll to see more chars. - -#+begin_src emacs-lisp -(global-visual-line-mode t) -#+end_src - -*** Parenthesis - -Highlight matching parenthesis - -#+begin_src emacs-lisp -(show-paren-mode 1) -#+end_src - -*** Tabs - -Using spaces instead of tabs, default offset is 4. - -#+begin_src emacs-lisp -(setq-default indent-tabs-mode nil - tab-width 4 - c-basic-offset 4 - tab-always-indent 'complete) -#+end_src - -*** BIDI and lang - -Setting up Hebrew as alternative input, using bidi mode so that every line is -aligned left\right accordingly. - -#+begin_src emacs-lisp -(setq-default default-input-method "hebrew" - bidi-display-reordering t - bidi-paragraph-direction 'nil) - -(defun azos/set-bidi-env () - (setq bidi-paragraph-direction 'nil) -) - -(define-key azos/global-minor-mode/keymap - (kbd "C-SPC") 'toggle-input-method) -#+end_src - -*** Whitespace mode - -We define a custom global-whitespace-mode in order to enable it only on -relevant modes. - -We check if the current mode doesn't derive from a set of blacklisted mode, the -main culprit being terminal modes where whitespace occur naturally and are a -pain to see all the time. - -#+begin_src emacs-lisp -(setq-default whitespace-style - '(face tabs trailing tab-mark - lines-tail indentation)) - -(defun azos/whitespace-mode-func () - (interactive) - (if (derived-mode-p 'text-mode 'prog-mode 'org-mode) - (whitespace-mode 1) (whitespace-mode -1))) - -(add-hook 'after-change-major-mode-hook 'azos/whitespace-mode-func) -#+end_src - -*** Commenter - -Quick keybindings to comment out regions. - -#+begin_src emacs-lisp -(use-package evil-nerd-commenter - :config - (define-key evil-normal-state-map (kbd "C-;") - 'evilnc-comment-or-uncomment-lines)) -#+end_src - -*** Company mode - -Auto completion framework. - -#+begin_src emacs-lisp -(use-package company - :ensure t - :defer t - :init (add-hook 'after-init-hook 'global-company-mode) - :config - ;; (use-package company-irony :ensure t :defer t) - (setq - company-minimum-prefix-length 2 - company-show-numbers t - company-tooltip-limit 20 - company-idle-delay 0.2 - ) - :bind ("C-;" . company-complete-common) - ;; :hook (irony-mode . company-mode) - ) -#+end_src - -*** Folding - -#+begin_src emacs-lisp -(add-hook 'prog-mode-hook 'hs-minor-mode) -#+end_src - -* Mode specific -** Undo tree - -Loading =undo-tree= for undo/redo functionality with evil. - -Redo taken from https://github.com/syl20bnr/spacemacs/issues/14036 - -#+begin_src emacs-lisp -(use-package undo-tree - :after evil - :config - (evil-set-undo-system 'undo-tree) - (setq undo-tree-history-directory-alist - (list (cons "." (concat user-emacs-directory "undo-tree")))) - (global-undo-tree-mode 1) -) -#+end_src - -** Projectile - -Startup up projectile. - -A config line here disables modeline display because I don't want my modeline to be cluttered. - -Mapping modeline commands to =M-p= prefix. Also adding a shortcut to add project. - -#+begin_src emacs-lisp -(use-package projectile - :config - (projectile-mode +1) - (setq projectile-mode-line-function (lambda () "")) - :bind - (:map projectile-command-map - ("a" . projectile-add-known-project) - ) - (:map azos/global-minor-mode/keymap - ("M-p" . projectile-command-map)) -) -#+end_src - -Ivy for projectile: -Parts taken from [[https://emacs.stackexchange.com/questions/40787/display-corresponding-key-binding-of-command-during-m-x-completion][this post]] and [[https://emacs.stackexchange.com/questions/38841/counsel-m-x-always-shows][this post]] from StackOverflow. - -Helps with many functions to use counsel's/ivy's autocomplete with projectile. - -#+begin_src emacs-lisp -(use-package counsel-projectile - :after counsel projectile - :config - (counsel-projectile-mode +1) - (setq projectile-completion-system 'ivy) - ;Making counsel start with empty regex - (when (commandp 'counsel-M-x) - (global-set-key [remap execute-extended-command] 'counsel-M-x)) - (setcdr (assoc 'counsel-M-x ivy-initial-inputs-alist) "") -) -#+end_src - -** Tramp - -Ensuring tramp is loaded, and loading counsel-tramp for easy tramping. - -#+begin_src emacs-lisp -(use-package tramp - :straight (:type built-in)) - -(use-package counsel-tramp) -#+end_src - -** Dired - -Need to autoload dired-x for dired-omit - -#+begin_src emacs-lisp -;; (autoload 'dired-omit-mode "dired-x") -(setq dired-omit-files "^\\...+$") -(add-hook 'dired-mode-hook 'dired-omit-mode) -(add-hook 'dired-mode-hook 'dired-hide-details-mode) -(evil-collection-dired-setup) -#+end_src - -#+begin_src emacs-lisp -(use-package dired-subtree - :config - (evil-collection-define-key 'normal 'dired-mode-map - (kbd "SPC") 'dired-subtree-toggle - (kbd "TAB") 'dired-subtree-cycle - ) - (setq dired-subtree-use-backgrounds nil) - ;Evil collection binds these keys, we need them for window movement - (evil-collection-define-key 'normal 'dired-mode-map - (kbd "M-j") nil - (kbd "M-k") nil) -) - -#+end_src - -** Magit - -#+begin_src emacs-lisp -(use-package magit - :config - (evil-collection-magit-setup) - :bind - (:map azos/global-minor-mode/open-keymap - ("g" . 'magit-status)) -) -#+end_src - -** Org -*** Base - -#+begin_src emacs-lisp -(require 'org-faces) -(defun azos/set-org-mode-fixed-pitch-faces () - (mapc (lambda (face) (set-face-attribute face nil - :font (face-attribute 'fixed-pitch :font) - :height (face-attribute 'fixed-pitch :height))) - `(line-number - org-block - org-special-keyword - org-drawer - org-todo - org-done - org-priority - org-checkbox - org-block-end-line - org-block-begin-line - org-table - org-verbatim))) - -(use-package org - :hook - (org-mode . variable-pitch-mode) - (org-mode . azos/set-bidi-env) - (org-mode . (lambda () - (setq-local whitespace-style '(face tabs trailing tab-mark - indentation)))) - :config - (azos/set-org-mode-fixed-pitch-faces) - (setq org-src-tab-acts-natively t - org-adapt-indentation nil - org-startup-folded t - org-hide-emphasis-markers t) - (set-face-attribute 'org-code nil - :family (face-attribute 'fixed-pitch :family)) - (set-face-attribute 'org-block nil - :family (face-attribute 'fixed-pitch :family)) - :bind - ("C-a" . nil) - ("C-a l" . org-toggle-latex-fragment) -) -#+end_src - -#+end_src -*** Code blocks - -The following displays the contents of code blocks in Org-mode files using -the major-mode of the code. It also changes the behavior of TAB to as if it -were used in the appropriate major mode. - -#+begin_src emacs-lisp -(setq org-src-fontify-natively t - org-src-tab-acts-natively t - org-src-preserve-indentation t) - -(set-face-attribute 'org-block nil - :background "LemonChiffon1") -(set-face-attribute 'org-block-begin-line nil - :background "LightYellow2") -(set-face-attribute 'org-block-end-line nil - :background "LightYellow2") -#+end_src - -*** Babel - -Define languages to use - -#+begin_src emacs-lisp -(require 'ob) -(require 'ob-tangle) - -;; TODO Not sure I like this here -(org-babel-do-load-languages - 'org-babel-load-languages - '((shell . t) - (emacs-lisp . t) - (python . t) - (org . t) - (lilypond . t) - (latex . t) - (js . t) - (java . t) - (dot . t) - (C . t))) - -;; TODO move these around -;; (add-to-list 'org-src-lang-modes (quote ("dot". graphviz-dot))) -;; (add-to-list 'org-src-lang-modes (quote ("plantuml" . fundamental))) -;; (add-to-list 'org-babel-tangle-lang-exts '("clojure" . "clj")) -#+end_src - -This section makes code-indentation correction work inside source blocks. -Taken from: https://github.com/emacs-evil/evil/issues/1288 - -#+begin_src emacs-lisp -(defun azos/org/evil-org-insert-state-in-edit-buffer (fun &rest args) - "Bind `evil-default-state' to `insert' before calling FUN with ARGS." - (let ((evil-default-state 'insert) - ;; Force insert state - evil-emacs-state-modes - evil-normal-state-modes - evil-motion-state-modes - evil-visual-state-modes - evil-operator-state-modes - evil-replace-state-modes) - (apply fun args) - (evil-refresh-cursor))) - -(advice-add 'org-babel-do-key-sequence-in-edit-buffer - :around #'azos/org/evil-org-insert-state-in-edit-buffer) -#+end_src - -*** Fonts - -Fonts - -#+begin_src emacs-lisp -;; (set-face-attribute 'org-document-title nil :height 200 :underline t) -#+end_src - -*** Inline images - -#+begin_src emacs-lisp -(setq org-startup-with-inline-images t) - -(defun azos/org/shk-fix-inline-images () - (when org-inline-image-overlays - (org-redisplay-inline-images))) - -(with-eval-after-load 'org - (add-hook 'org-babel-after-execute-hook 'azos/org/shk-fix-inline-images)) -#+end_src - -*** Snippets - -Want to create snippets for latex insertion. -There is one template for inline and one template for standalone latex snippets. -Each template is defind by two templates. One for other langauges and one for standard -input. This is done to toggle back to the original language once done with the -function toggle-input-method. - -#+begin_src emacs-lisp -(defun azos/org/toggle-input-method () - (if current-input-method (toggle-input-method)) -) -;Inline -(add-hook 'org-mode-hook (lambda () (progn - (yas-define-snippets 'org-mode (list (list - nil - "\$$1\$$0" - "ORG_LATEX_INLINE_SNIPPET_ENG" - '(not (eval current-input-method)) - nil - nil - nil - "C-l" - nil - nil - ))) - - (yas-define-snippets 'org-mode (list (list - nil - "\$$1\$$0" - "ORG_LATEX_INLINE_SNIPPET_OTHER_LANG" - '(eval current-input-method) - nil - '((unused (azos/org/toggle-input-method)) - (yas-after-exit-snippet-hook 'toggle-input-method)) - nil - "C-l" - nil - nil - ))) - - ;Not inline - (yas-define-snippets 'org-mode (list (list - nil - "\$\$$1\$\$$0" - "ORG_LATEX_OUTLINE_SNIPPET_ENG" - '(not (eval current-input-method)) - nil - nil - nil - "C-S-l" - nil - nil - ))) - (yas-define-snippets 'org-mode (list (list - nil - "\$\$$1\$\$$0" - "ORG_LATEX_OUTLINE_SNIPPET_OTHER_LANG" - '(eval current-input-method) - nil - '((unused (azos/org/toggle-input-method)) - (yas-after-exit-snippet-hook 'toggle-input-method)) - nil - "C-S-l" - nil - nil - ))) - ))) -#+end_src - -Snippet for src blocks - -#+begin_src emacs-lisp -(add-hook 'org-mode-hook (lambda () (progn - (yas-define-snippets 'org-mode (list (list - nil - "#+begin_src $1\n$0\n#+end_src" - "ORG_SRC_BLOCK" - nil - nil - nil - nil - "C-c i b" - nil - nil - ))) - - (yas-define-snippets 'org-mode (list (list - nil - (concat - "#+begin_export latex\n" - "\\begin{english}\n" - "#+end_export\n" - "#+begin_src $1\n" - "$0\n#+end_src\n" - "#+begin_export latex\n" - "\\end{english}\n" - "#+end_export") - "ORG_SRC_ENGLISH_BLOCK" - nil - nil - nil - nil - "C-c i B" - nil - nil - ))) -))) -#+end_src - -*** Imenu quirks - -#+begin_src emacs-lisp -(add-to-list 'org-show-context-detail '(isearch . tree)) -(add-to-list 'org-show-context-detail '(default . tree)) -#+end_src - -** Ibuffer - -#+begin_src emacs-lisp -(evil-collection-ibuffer-setup) -(define-key azos/global-minor-mode/keymap - (kbd "C-x C-b") 'ibuffer) -#+end_src - -** Dashboard - -#+begin_src emacs-lisp -(setq inhibit-startup-screen t) -(use-package dashboard - :config - (add-hook 'after-init-hook - (lambda () (dashboard-insert-startupify-lists))) - (add-hook 'emacs-startup-hook (lambda () - (switch-to-buffer dashboard-buffer-name) - (goto-char (point-min)) - (redisplay) - (run-hooks 'dashboard-after-initialize-hook))) - (add-to-list 'evil-emacs-state-modes 'dashboard-mode) - (setq dashboard-items '((recents . 5) - (bookmarks . 5) - (projects . 5)) - dashboard-center-content t - dashboard-banner-logo-title nil - dashboard-set-init-info nil - dashboard-set-footer nil - dashboard-startup-banner 'ascii - dashboard-banner-ascii "azos")) -#+end_src - -** VTerm - -#+begin_src emacs-lisp -;; (use-package xterm-color :ensure t) -;; (use-package eterm-256color :ensure t -;; :config -;; (add-hook 'term-mode-hook #'eterm-256color-mode) -;; (add-hook 'vterm-mode-hook #'eterm-256color-mode) -;; ) -#+end_src - -#+begin_src emacs-lisp -(use-package vterm - :if (member system-type '(gnu gnu/linux)) - :config - (add-hook 'vterm-mode-hook - (lambda () (setq-local global-hl-line-mode nil))) - - (evil-collection-define-key 'normal 'vterm-mode-map - (kbd "p") 'vterm-yank) - (setq vterm-timer-delay 0.01 - vterm-term-environment-variable "xterm-256color")) -#+end_src - -** Boomkark - -#+begin_src emacs-lisp -(use-package bookmark - :straight - (:type built-in) - :config - (evil-collection-bookmark-setup) -) -#+end_src - -* Provide - -#+begin_src emacs-lisp -(provide 'azos-emacs-base) -(add-hook 'after-init-hook (lambda () (require 'azos-emacs-base))) -#+end_src - diff --git a/pkgs/elisp/azos-emacs-dev.org b/pkgs/elisp/azos-emacs-dev.org deleted file mode 100644 index dded346..0000000 --- a/pkgs/elisp/azos-emacs-dev.org +++ /dev/null @@ -1,165 +0,0 @@ -#+title: Aner's Emacs Development Configuration -#+property: header-args :results silent - -* Base dev - -** Require - -#+begin_src emacs-lisp -(require 'azos-emacs-base) -#+end_src - -** Flycheck - -Flycheck is for syntax checking. Mode-specific configs in their relevant sections. - -#+begin_src emacs-lisp -(use-package flycheck - :config - (global-flycheck-mode 1) -) -#+end_src - -* Dev modes -** Irony-mode - -Must work on this. While it does work, can get slow and for weird projects can -show errors. - -Namespace indent disabling based on: -https://stackoverflow.com/questions/13825188/suppress-c-namespace-indentation-in-emacs - -#+begin_src emacs-lisp -;; == irony-mode == -(use-package irony - :ensure t - :defer t - :init - (add-hook 'c++-mode-hook 'irony-mode) - (add-hook 'c-mode-hook 'irony-mode) - (add-hook 'objc-mode-hook 'irony-mode) - :config - ;; replace the `completion-at-point' and `complete-symbol' bindings in - ;; irony-mode's buffers by irony-mode's function - (defun azos/irony-mode-hook () - (define-key irony-mode-map [remap completion-at-point] - 'irony-completion-at-point-async) - (define-key irony-mode-map [remap complete-symbol] - 'irony-completion-at-point-async)) - (add-hook 'irony-mode-hook 'azos/irony-mode-hook) - (add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options) - - (defconst azos/cc-style - '("gnu" - (c-offsets-alist . ((innamespace . [0]))) - (c-basic-offset . 4))) - - (c-add-style "azos/cc-style" azos/cc-style) - (add-hook 'irony-mode-hook (lambda () (c-set-style "azos/cc-style"))) - ) -#+end_src - -Integration with flycheck - -#+begin_src emacs-lisp -(use-package flycheck-irony - :after flycheck irony - :config - (add-hook 'flycheck-mode-hook #'flycheck-irony-setup) - (add-hook 'c++-mode-hook (lambda () (setq flycheck-checker 'irony))) -) -#+end_src - -** CMake - -#+begin_src emacs-lisp -(use-package cmake-mode) -#+end_src - -** YAML - -#+begin_src emacs-lisp -(use-package yaml-mode) -#+end_src - -** Nix - -#+begin_src emacs-lisp -(use-package nix-mode) -#+end_src - -** Python - -#+begin_src emacs-lisp -(setq - ;; python-shell-interpreter "python3" - python-shell-completion-native-enable nil) - -(defun azos/python/set-fringes () "Sets fringes for python" - (setq left-fringe-width 10 right-fringe-width 0)) - -(add-hook 'python-mode-hook 'azos/python/set-fringes) - -(use-package elpy - :ensure t - :defer t) - ;; :init - ;; (elpy-enable)) - -(define-key azos/global-minor-mode/open-keymap - (kbd "r p") 'run-python) -#+end_src - -*** org src block - -#+begin_src emacs-lisp -(setq org-babel-python-command "python3") -#+end_src - -** Rust - -#+begin_src emacs-lisp -(use-package rust-mode) -#+end_src - -** Jupyter (ein) - -#+begin_src emacs-lisp -(use-package ein - :config - (setq ein:output-area-inlined-images t) - (add-hook 'ein:notebook-mode-hook (lambda () (progn - ;; (elpy-mode -1) - (define-key ein:notebook-mode-map (kbd "C-c C-k") nil))))) -#+end_src - -** Python - -*** Python version for ORG - -#+begin_src emacs-lisp -(require 'ob) -(setq org-babel-python-command "python3") -#+end_src - -* ORG - -** Async blocks - -#+begin_src emacs-lisp -(use-package ob-async - :config - ;Setting command of async blocks to Python3 - (add-hook 'ob-async-pre-execute-src-block-hook - '(lambda () - (setq org-babel-python-command "python3") - )) -) -#+end_src - -* Provide - -#+begin_src emacs-lisp -(provide 'azos-emacs-dev) -(add-hook 'after-init-hook (lambda () (require 'azos-emacs-dev))) -#+end_src diff --git a/pkgs/elisp/azos-emacs-editor.org b/pkgs/elisp/azos-emacs-editor.org deleted file mode 100644 index bec0cc5..0000000 --- a/pkgs/elisp/azos-emacs-editor.org +++ /dev/null @@ -1,246 +0,0 @@ -#+title: Aner's Emacs Editor Configuration -#+property: header-args :results silent - -* Base dev - -** Require - -#+begin_src emacs-lisp -(require 'azos-emacs-base) -#+end_src - -* Editor modes - -** Pandoc - -Pandoc mode lets us export different formats to PDF. - -Added for use with markdown. - -Binding to startup is 'C-c /' - -#+begin_src emacs-lisp -(use-package pandoc-mode - :hook - (markdown-mode . pandoc-mode)) -#+end_src - -** Graphviz - -#+begin_src emacs-lisp -(use-package graphviz-dot-mode) -#+end_src - -** Markdown - -Based on [[https://www.reddit.com/r/emacs/comments/u5owr4/how_to_enable_variablepitchmode_for_markdownmode/][this]] post -detailing variable pitch. - -We default to github-flavored markdown and show it as variable pitch. - -#+begin_src emacs-lisp -(use-package markdown-mode - :mode (("\\.md$" . gfm-mode) - ("\\.mkd$" . gfm-mode)) - :hook (gfm-mode . variable-pitch-mode) - :diminish markdown-live-preview-mode - :config - (when (bound-and-true-p lsp-mode) - (variable-pitch-mode -1)) - (set-face-attribute 'markdown-pre-face nil - :background "LemonChiffon1" :extend t) - ) -#+end_src - -Let's add a TOC - -#+begin_src emacs-lisp -(use-package markdown-toc) -#+end_src - -* ORG - -** PDF exporting - -#+begin_src emacs-lisp -(setq org-latex-listings 'minted - org-export-babel-evaluate nil - org-latex-pdf-process - (list (concat "latexmk -xelatex -shell-escape -interaction=nonstopmode " - "-output-directory=%o %f ; latexmk -c %f"))) - -(require 'ox-latex) -(unless (boundp 'org-latex-classes) - (setq org-latex-classes nil)) -#+end_src - -This code removes unecessary files after each export - -#+begin_src emacs-lisp -(add-to-list 'org-latex-logfiles-extensions "tex") -#+end_src - -Creating classes - -#+begin_src emacs-lisp -(defvar anerenv/latex-class-common-header - "[DEFAULT-PACKAGES] -\\usepackage{polyglossia} -\\usepackage[cache=false]{minted} -\\usepackage{xcolor} -\\usepackage{amsfonts} -\\usepackage{transparent} -\\usepackage{amsmath} -\\definecolor{codebg}{rgb}{0.95,0.95,0.95} -\\setdefaultlanguage{english} -\\setlength{\\parindent}{0in} - -\\DeclareMathOperator*{\\argmax}{arg\\,max} -\\DeclareMathOperator*{\\argmin}{arg\\,min} -\\newfontfamily\\hebrewfont{LiberationSans}[Script=Hebrew] -\\newfontfamily\\hebrewfonttt{LiberationSans}[Script=Hebrew] -\\newfontfamily\\hebrewfontsf{LiberationSans}[Script=Hebrew] -\\setotherlanguage{hebrew} -" "Default common class header") - -(setq org-latex-classes - (list (list "article" -(concat "\\documentclass{article} -" anerenv/latex-class-common-header -"\\setminted{ - bgcolor=codebg, - breaklines=true, - mathescape, - fontsize=\\scriptsize, - linenos=false, -} -") - '("\\section{%s}" . "\\section*{%s}") - '("\\subsection{%s}" . "\\subsection*{%s}") - '("\\subsubsection{%s}" . "\\subsubsection*{%s}") - '("\\paragraph{%s}" . "\\paragraph*{%s}") - '("\\subparagraph{%s}" . "\\subparagraph*{%s}")) - (list "beamer" -(concat "\\documentclass{beamer} -" anerenv/latex-class-common-header -"\\setminted{ - bgcolor={}, - breaklines=true, - mathescape, - fontsize=\\scriptsize, - linenos=false, -} -") - '("\\section{%s}" . "\\section*{%s}") - '("\\subsection{%s}" . "\\subsection*{%s}") - '("\\subsubsection{%s}" . "\\subsubsection*{%s}") - '("\\paragraph{%s}" . "\\paragraph*{%s}") - '("\\subparagraph{%s}" . "\\subparagraph*{%s}"))) - ) -#+end_src - -This should render Hebrew text. - -#+begin_export latex -\begin{hebrew} -#+end_export -זה אמור לעבוד -#+begin_export latex -\end{hebrew} -#+end_export - -** DOCX exporting - -Taken from https://www.reddit.com/r/emacs/comments/zjv1gj/org_files_to_docx/ - -#+begin_src emacs-lisp -(defun anerenv/org/export-docx-with-pandoc () - "Use Pandoc to convert .org to .docx. -Comments: -- The `-N' flag numbers the headers lines. -- Use the `--from org' flag to have this function work on files - that are in Org syntax but do not have a .org extension" - (interactive) - (message "exporting .org to .docx") - (shell-command - (concat "pandoc -N --from org " (buffer-file-name) - " -o " - (file-name-sans-extension (buffer-file-name)) - (format-time-string "-%Y-%m-%d-%H%M%S") ".docx"))) -#+end_src - -** Latex previews - -We don't want to create ltximg directories all over the place. -Let's store all ltximg previews in tmp directory. - -Latex scaling from - -https://karthinks.com/software/scaling-latex-previews-in-emacs/ - -#+begin_src emacs-lisp -(setq org-format-latex-header - "\\documentclass{article} -\\usepackage[usenames]{color} -[PACKAGES] -[DEFAULT-PACKAGES] -\\pagestyle{empty} % do not remove -% The settings below are copied from fullpage.sty -\\setlength{\\textwidth}{\\paperwidth} -\\addtolength{\\textwidth}{-3cm} -\\setlength{\\oddsidemargin}{1.5cm} -\\addtolength{\\oddsidemargin}{-2.54cm} -\\setlength{\\evensidemargin}{\\oddsidemargin} -\\setlength{\\textheight}{\\paperheight} -\\addtolength{\\textheight}{-\\headheight} -\\addtolength{\\textheight}{-\\headsep} -\\addtolength{\\textheight}{-\\footskip} -\\addtolength{\\textheight}{-3cm} -\\setlength{\\topmargin}{1.5cm} -\\addtolength{\\topmargin}{-2.54cm} -\\DeclareMathOperator*{\\argmax}{arg\\,max} -\\DeclareMathOperator*{\\argmin}{arg\\,min}" - ) - -(setq org-preview-latex-image-directory (concat user-emacs-directory "ltximg/")) - -(setq org-latex-create-formula-image-program 'dvisvgm) - -(setq org-format-latex-options (plist-put org-format-latex-options :scale 1)) -#+end_src - -** Presentation - -#+begin_src emacs-lisp -(use-package org-present - :config - (add-hook 'org-present-mode-hook (lambda () - (evil-emacs-state) - (blink-cursor-mode 0) - (org-present-big) - (org-display-inline-images) - (org-present-read-only) - (setq-local global-hl-line-mode nil) - (org-present-hide-cursor) - (olivetti-mode 1) - (display-line-numbers-mode 0))) - - (add-hook 'org-present-mode-quit-hook (lambda () - (org-present-small) - (blink-cursor-mode 1) - (org-remove-inline-images) - (org-present-show-cursor) - (org-present-read-write) - (evil-normal-state) - (setq-local global-hl-line-mode 1) - (olivetti-mode 0) - (display-line-numbers-mode 1))) -) -#+end_src - -* Provide - -#+begin_src emacs-lisp -(provide 'azos-emacs-editor) -(add-hook 'after-init-hook (lambda () (require 'azos-emacs-editor))) -#+end_src diff --git a/pkgs/elisp/azos-emacs-exwm.org b/pkgs/elisp/azos-emacs-exwm.org deleted file mode 100644 index 1af9497..0000000 --- a/pkgs/elisp/azos-emacs-exwm.org +++ /dev/null @@ -1,357 +0,0 @@ -#+title: Aner's Emacs EXWM Configuration -#+property: header-args :results silent - -* Base setup -** Require - -#+begin_src emacs-lisp -(require 'azos-emacs-station) -(require 'azos-emacs-base) -#+end_src - -* EXWM - -We execute the following code only if started with EXWM argument - -** EXWM Setup - -#+begin_src emacs-lisp -(defvar azos/exwm/load-hook nil "Load EXWM hook") - -(defun azos/exwm/load-exwm (switch) "Loads EXWM" - (use-package exwm - :ensure t - :config - (require 'exwm) - (require 'exwm-randr) - ;Workspaces - (setq exwm-workspace-number 4 - exwm-layout-show-all-buffers t - exwm-workspace-show-all-buffers t) - ;System tray - (require 'exwm-systemtray) - (setq exwm-systemtray-background-color "LightYellow3") - (exwm-systemtray-enable) - - ;In EXWM mode, no evil - (add-to-list 'evil-emacs-state-modes 'exwm-mode) - (run-hooks 'azos/exwm/load-hook) - - ;Enable - (exwm-randr-enable) - (exwm-enable) - )) -#+end_src - -** Smart buffer naming - -#+begin_src emacs-lisp -(add-hook 'azos/exwm/load-hook (lambda () (progn - -(add-hook 'exwm-update-class-hook - (lambda () - (unless (or (string-prefix-p "sun-awt-X11-" exwm-instance-name) - (string= "gimp" exwm-instance-name)) - (string-prefix-p "qute" exwm-instance-name) - (exwm-workspace-rename-buffer exwm-class-name)))) - -(add-hook 'exwm-update-title-hook - (lambda () - (when (or (not exwm-instance-name) - (string-prefix-p "sun-awt-X11-" exwm-instance-name) - (string-prefix-p "qute" exwm-instance-name) - (string= "gimp" exwm-instance-name)) - (exwm-workspace-rename-buffer exwm-title)))) - -(add-hook 'exwm-update-class-hook - (lambda () - (when (or (not exwm-instance-name) - (string-prefix-p "mpv" exwm-class-name)) - (exwm-workspace-rename-buffer (concat "mpv | " exwm-title))))) - -))) -#+end_src - -** Basic keybindings - -Global keybindings can be defined with `exwm-input-global-keys'. -Here are a few examples: -#+begin_src emacs-lisp -(add-hook 'azos/exwm/load-hook (lambda () - (setq exwm-input-global-keys - `( - ;; Bind "s-" to "slock", a simple X display locker. - ([s-f2] . (lambda () - (interactive) - (start-process "" nil "/usr/bin/slock"))) - ([s-] . persp-switch) - ;; Bind "s-r" to exit char-mode and fullscreen mode. - ([?\s-r] . exwm-reset) - ;; Bind "s-w" to switch workspace interactively. - ([?\s-w] . exwm-workspace-switch) - ;; Bind "s-0" to "s-9" to switch to a workspace by its index. - ,@(mapcar (lambda (i) - `(,(kbd (format "s-%d" i)) . - (lambda () - (interactive) - (exwm-workspace-switch-create ,i)))) - (number-sequence 0 9)) - ;; Bind "s-&" to launch applications ('M-&' also works if the output - ;; buffer does not bother you). - ([?\s-&] . (lambda (command) - (interactive (list (read-shell-command "$ "))) - (start-process-shell-command command nil command))) - )))) - -(defun azos/exwm/take-screenshot () - (interactive) - (shell-command "flameshot gui") -) - -(defun azos/exwm/start-qutebrowser () - (interactive) - (start-process "qutebrowser" nil "qutebrowser")) - -(add-hook 'azos/exwm/load-hook (lambda () (progn - (define-key azos/global-minor-mode/open-keymap - (kbd "q") 'azos/exwm/start-qutebrowser) - (define-key azos/global-minor-mode/keymap - (kbd "") 'azos/exwm/take-screenshot)))) -#+end_src - -** Better modeline - -This currently does nothing and I am not sure why. - -#+begin_src emacs-lisp -(defvar azos/exwm/modeline-hash-table (make-hash-table) - "Table to store relative face change cookies in") - -(defface azos/exwm/modeline-remap-style - (list (list t (list :background azos/evil-color-insert))) - "Make the backgrounds pop to green") - -(defun azos/exwm/input-mode-modeline () "Changes modeline based on input mode" - (let ((currbuff (current-buffer))) - (if (eq exwm--input-mode 'char-mode) - ;;line - (let ((remap-cookie (gethash currbuff - azos/exwm/modeline-hash-table))) - (if remap-cookie - (progn - (face-remap-remove-relative remap-cookie) - (remhash currbuff - azos/exwm/modeline-hash-table)))) - ;;char - (puthash - currbuff - (face-remap-add-relative 'mode-line - 'azos/exwm/modeline-remap-style) - azos/exwm/modeline-hash-table) - ))) -(add-hook 'exwm-input-input-mode-change-hook 'azos/exwm/input-mode-modeline) -;; (set-face-attribute 'mode-line nil :box nil :background "AliceBlue") -;; (set-face-attribute 'mode-line-inactive nil :box nil :background "LightYellow3") -#+end_src - -** RANDR screen settings - -Enabling randr. Automatic mapping of randr screens to workspaces. - -#+begin_src emacs-lisp -(defun azos/exwm/get-monitor-list () - (mapcar (lambda (x) (match-string (string-match "^[A-Za-z]+-*[0-9]+" x) x)) - (azos/re-seq "^[A-Za-z]+-*[0-9]+ connected" - (shell-command-to-string "xrandr")))) - -(defun azos/exwm/add-indexes (list) - (azos/exwm/add-indexes-i list 1) -) - -(defun azos/exwm/add-indexes-i (list i) - (if list - (cons i (cons (car list) (azos/exwm/add-indexes-i (cdr list) (+ i 1)))) - nil)) - -(defun azos/exwm/update-randr-monitor-plist () - (interactive) - (progn - (start-process - "xlayoutdisplay" nil "xlayoutdisplay") - (setq exwm-randr-workspace-monitor-plist - (azos/exwm/add-indexes (azos/exwm/get-monitor-list))) - (exwm-randr-refresh))) - -(add-hook 'azos/exwm/load-hook (lambda () (progn - (add-hook 'exwm-randr-screen-change-hook - 'azos/exwm/update-randr-monitor-plist) - - (define-key azos/global-minor-mode/keymap - (kbd "s-x") 'azos/exwm/update-randr-monitor-plist)))) -#+end_src - -** Prefix keys - -Sending simulated keys to X windows -#+begin_src emacs-lisp -(add-hook 'azos/exwm/load-hook (lambda () (progn - (setq exwm-input-prefix-keys - '(?\C-x ?\C-u ?\C-h ?\M-x ?\M-& ?\M-: ?\s-d - ?\s-m ?\s-r ?\s-s ?\s-q ?\H-l ?\C-w))))) -#+end_src - -** Desktop environment - -#+begin_src emacs-lisp -(use-package desktop-environment :after exwm) -#+end_src - -** Bluetooth - -#+begin_src emacs-lisp -(use-package bluetooth :after exwm) -#+end_src - -** Pulse - -#+begin_src emacs-lisp -(use-package pulseaudio-control :after exwm) -#+end_src - -** Media keys - -https://gist.github.com/ajyoon/5323b999a01dce8db2d4456da1740fe3 - -#+begin_src emacs-lisp -(add-hook 'azos/exwm/load-hook (lambda () - (progn - (dolist (k '( - XF86AudioLowerVolume - XF86AudioRaiseVolume - XF86AudioPlay - XF86AudioStop - XF86AudioPrev - XF86AudioNext)) - (push k exwm-input-prefix-keys)) - - (exwm-input-set-key - (kbd "") - (lambda () - (interactive) (start-process - "pactl" nil "pactl" "set-sink-volume" "0" "+5%"))) - (exwm-input-set-key - (kbd "") - (lambda () - (interactive) (start-process - "pactl" nil "pactl" "set-sink-volume" "0" "-5%"))) - - (exwm-input-set-key - (kbd "") - (lambda () - (interactive) (start-process - "pactl" nil "pactl" "set-sink-mute" "0" "toggle"))) - - (exwm-input-set-key - (kbd "") - 'desktop-environment-toggle-music) - - (exwm-input-set-key - (kbd "") - 'desktop-environment-music-next) - - (exwm-input-set-key - (kbd "") - 'desktop-environment-music-previous) - - (exwm-input-set-key - (kbd "") - 'desktop-environment-music-stop) - - (exwm-input-set-key - (kbd "") - 'desktop-environment-toggle-music) - - (exwm-input-set-key - (kbd "") - (lambda () - (interactive) (start-process - "light" nil "light" "-A" "5"))) - - (exwm-input-set-key - (kbd "") - (lambda () - (interactive) (start-process - "light" nil "light" "-U" "5"))) - ))) -#+end_src - -In the event =xbacklight= doesn't work, the following command can be run: - -#+begin_example -xrandr --output eDP1 --brightness 0.5 -#+end_example - -** Dedicated processes - -We'd want to be able to quickly map processes (Spotify, etc.) to -keybindings, and have dedicated buffers for them (so they don't reopen). - -We first define variables to be used later, and a function that checks, for each -new process, should it be displayed in a new buffer/tab. - -#+begin_src emacs-lisp -(defvar azos/exwm/startproc-regex-buffname-list nil - "Match between buffer and tab.") -(defun azos/exwm/startproc-check-for-buff-entry () - "On new buffer, check if requested to display differently" - (let ((entry (cdr (car (seq-filter - (lambda (e) (string-match (car e) (buffer-name))) - azos/exwm/startproc-regex-buffname-list - ))))) - (if entry - (let ((rn (nth 0 entry)) (tn (nth 1 entry)) (buff (current-buffer))) - ;; Too much complication for renaming - ;; (if requested-name (rename-buffer requested-name)) - (progn - (if tn (tab-bar-switch-to-tab tn)) - (switch-to-buffer buff) - ))))) - -(add-hook 'exwm-manage-finish-hook 'azos/exwm/startproc-check-for-buff-entry) -#+end_src - -#+begin_src emacs-lisp -(defun azos/exwm/start-proc-dedicated - (name tab-name procregex proc &rest args) - (let ((buff (car (seq-filter (lambda (b -) - (string-match procregex (buffer-name b))) - (buffer-list))))) - (if buff - ;; Found buffer, display - (progn - (if tab-name (tab-bar-switch-to-tab tab-name)) - (switch-to-buffer buff) - ) - ;;No known buffer, add entry to alist - (let ((new-entry `(,procregex ,tab-name ,name))) (progn - (add-to-list 'azos/exwm/startproc-regex-buffname-list - new-entry) - (apply 'start-process name nil proc - args)))))) -#+end_src - -** EXWM Ending - -End the execute only if EXWM block. - -#+begin_src emacs-lisp -(add-to-list 'command-switch-alist '("--start-exwm" . azos/exwm/load-exwm)) -#+end_src - -* Provide - -#+begin_src emacs-lisp -(provide 'azos-emacs-exwm) -(add-hook 'after-init-hook (lambda () (require 'azos-emacs-exwm))) -#+end_src diff --git a/pkgs/elisp/azos-emacs-station.org b/pkgs/elisp/azos-emacs-station.org deleted file mode 100644 index 6e6f4ba..0000000 --- a/pkgs/elisp/azos-emacs-station.org +++ /dev/null @@ -1,300 +0,0 @@ -#+title: Aner's Emacs Station Configuration -#+property: header-args :results silent - -* Base setup -** Require - -#+begin_src emacs-lisp -(require 'azos-emacs-base) -#+end_src - -* Major modes - -** Mail - -*** General instructions - -Due to the fact that setting up email in general is complicated, I'll recap the process here. - -Before ANYTHING, setup pass. - -https://wiki.archlinux.org/title/Pass - -Initialize password - -Then for gmail, used - -#+begin_src bash :results none :exports code -pass init -pass insert gmail.com/ -#+end_src - -It prompted for password, I put it in. - -Then setup mbsync properly. The ansible files already take care of that. - -Then we setup ~/.mbsyncrc. This file is important and is not linked to repository for security reasons. - -https://wiki.archlinux.org/title/isync - -Wrote mbsyncrc - - -Created all directories - -Went into gmail settings to allow less secure things. - -https://notmuchmail.org/getting-started/ - -We then RUN notmuch, and notmuch setup for prompt. - -Adding emails can be done with notmuch new - -*** Config - -#+begin_src emacs-lisp -;; (defvar azos/mail/sync-list nil "List of functions with args to sync mail") - -;; (defun azos/mail/lieer-sync-func-str (maildir) -;; (concat "cd " maildir " && gmi sync -s")) - -;; (defun azos/mail/mbsync-func-str () -;; "mbsync -a") - -;; (defun azos/mail/pre-sync-func-str () -;; (concat (mapconcat 'eval (mapcar 'apply azos/mail/sync-list) " &\n") -;; "\nwait\n")) - -;; (defun azos/mail/sync-notify () (interactive) -;; (let ((command (concat (azos/mail/pre-sync-func-str) -;; "{ if [[ $(notmuch new | grep \"No new mail\") ]]; " -;; "then dunstify -u low \"Synced mail\" ; " -;; "else dunstify \"New mail!\" ; fi ; } || " -;; "dunstify -u critical \"Error syncing mail\""))) -;; (start-process-shell-command "mailsync" "*mailsync*" command))) - -;; (defun azos/mail/sync-n-notify () -;; (let ((command (concat (azos/mail/pre-sync-func-str) -;; "{ if [[ $(notmuch new | grep \"No new mail\") ]]; " -;; "then : ; " -;; "else dunstify \"New mail!\" ; fi ; } || " -;; "dunstify -u critical \"Error syncing mail\""))) -;; (start-process-shell-command "mailsync" "*mailsync*" command))) - -;; (defun azos/mail/set-sync-list (sync-list) -;; "Set list of mails and start timer" -;; (progn -;; (setq azos/mail/sync-list sync-list))) -;; ; (azos/run-timer 'mail-sync 'azos/mail/sync-n-notify (* 60 10)))) - -(use-package notmuch - :straight (:type built-in) - :init - (setq-default - notmuch-hello-sections - '(notmuch-hello-insert-saved-searches - notmuch-hello-insert-alltags) - notmuch-always-prompt-for-sender t - message-sendmail-envelope-from 'header) - :config - (evil-collection-notmuch-setup) - (add-hook 'notmuch-show-mode 'azos/default-variable-pitch) - (setq send-mail-function 'sendmail-send-it - notmuch-search-oldest-first nil - message-cite-style message-cite-style-gmail - message-citation-line-function - 'message-insert-formatted-citation-line) - (defun azos/notmuch-archive () "Archive a message" (interactive) - (progn - (evil-collection-notmuch-toggle-tag "arx" "search" 'ignore) - (evil-collection-notmuch-toggle-tag "inbox" "search" - 'notmuch-search-next-thread) - )) - (defun azos/notmuch-keep () "Mark important message for keeps" (interactive) - (progn - (evil-collection-notmuch-toggle-tag "keep" "search" - 'notmuch-search-next-thread))) - - (defun azos/notmuch-delete-gmail () "Delete a message, no inbox" - (interactive) - (progn - (evil-collection-notmuch-toggle-tag "deleted" "search" 'ignore) - (evil-collection-notmuch-toggle-tag "trash" "search" 'ignore) - (evil-collection-notmuch-toggle-tag "inbox" "search" - 'notmuch-search-next-thread))) - - (defun azos/notmuch-toggle-inbox () "Toggles inbox tag" (interactive) - (evil-collection-notmuch-toggle-tag "inbox" "search" 'ignore)) - - (dolist (state '(normal visual)) - (evil-collection-define-key state 'notmuch-search-mode-map - "d" 'azos/notmuch-delete-gmail - "I" 'azos/notmuch-toggle-inbox - "D" 'evil-collection-notmuch-search-toggle-delete - "A" 'azos/notmuch-archive - "K" 'azos/notmuch-keep)) - (evil-collection-define-key 'normal 'notmuch-show-mode-map - (kbd "M-j") nil - (kbd "K") nil - (kbd "M-k") nil) - - :bind - (:map azos/global-minor-mode/open-keymap - ("m" . notmuch)) -) -#+end_src - -Run this command to make sendmail use the right thing - -#+begin_src bash :results none :exports code -sudo ln -s /usr/bin/msmtp /usr/sbin/sendmail -#+end_src - -Then we go to - -https://wiki.archlinux.org/title/isync - -We will do this manually. - -*** Signatures - -Taken from - -https://emacs.stackexchange.com/questions/27759/do-not-automatically-sign-emails-directed-to-mailing-lists-and-such - -Thanks to Dan of Stackoverflow. - -#+begin_src emacs-lisp -(defvar azos/mail/blacklist-addresses nil - "List of email addresses (as strings) to blacklist for - `mml-secure-message-sign'.") - -(defun azos/mail/secure-sign-maybe () - "Use `mml-secure-message-sign' unless the addressee is in the -`azos/mail/blacklist-addresses'." - (let ((addresses (mapcar (lambda (address) - (when (string-match - "\\( ]+\\)\\(>?\\)" - address) - (match-string 2 address))) - ;; (split-string (message-field-value "To") - ;; "," t "[[:blank:]]+")))) - (split-string (concat (message-field-value "To") - ", " - (message-field-value "Cc")) - "," t "[[:blank:]]+")))) - ;; skip secure signing when an address is blacklisted - (unless (delq nil (mapcar (lambda (address) - (car (member address azos/mail/blacklist-addresses))) - addresses)) - (mml-secure-message-sign)))) -#+end_src - -** Elfeed - -MPV from https://www.reddit.com/r/emacs/comments/7usz5q/youtube_subscriptions_using_elfeed_mpv_no_browser/ - -https://medium.com/emacs/using-elfeed-to-view-videos-6dfc798e51e6 - -#+begin_src emacs-lisp -(use-package elfeed - :init - (defun azos/elfeed/v-mpv (url) - "Watch a video from URL in MPV" - (start-process "mpv" nil "mpv" url)) - - (defun azos/elfeed/view-mpv (&optional use-generic-p) - "Youtube-feed link" - (interactive "P") - (let ((entries (elfeed-search-selected))) - (cl-loop for entry in entries - do (elfeed-untag entry 'unread) - when (elfeed-entry-link entry) - do (azos/elfeed/v-mpv it)) - (mapc #'elfeed-search-update-entry entries))) - - (defun slurp (f) - (with-temp-buffer - (insert-file-contents f) - (buffer-substring-no-properties - (point-min) - (point-max)))) - - (setq-default elfeed-search-filter "@3-days-ago") - :config - (evil-collection-elfeed-setup) -) -#+end_src - -*** Elfeed tube - -https://github.com/karthink/elfeed-tube - -#+begin_src emacs-lisp -(use-package elfeed-tube - :ensure t ;; or :straight t - :after elfeed - :demand t - :config - ;; (setq elfeed-tube-auto-save-p nil) ; default value - ;; (setq elfeed-tube-auto-fetch-p t) ; default value - (elfeed-tube-setup) - - :bind (:map elfeed-show-mode-map - ("F" . elfeed-tube-fetch) - ([remap save-buffer] . elfeed-tube-save) - :map elfeed-search-mode-map - ("F" . elfeed-tube-fetch) - ([remap save-buffer] . elfeed-tube-save))) - -(use-package elfeed-tube-mpv - :ensure t ;; or :straight t - :after elfeed-tube - :bind (:map elfeed-show-mode-map - ("C-c C-f" . elfeed-tube-mpv-follow-mode) - ("C-c C-w" . elfeed-tube-mpv-where))) -#+end_src - -** Pass - -#+begin_src emacs-lisp -(use-package pass - :bind - (:map azos/global-minor-mode/open-keymap - ("p" . 'password-store-copy))) -#+end_src - -** Calendar - -#+begin_src emacs-lisp -(evil-collection-calendar-setup) -#+end_src - -** OpenSCAD - -#+begin_src emacs-lisp -(use-package scad-mode) - -; Disabling for now -;; (use-package scad-preview -;; :straight '( -;; scad-preview -;; :type git -;; :host github -;; :repo "zk-phi/scad-preview")) -#+end_src - -** Kubernetes - -#+begin_src emacs-lisp -(use-package kubernetes - :ensure t - :commands (kubernetes-overview)) -#+end_src - -* Provide - -#+begin_src emacs-lisp -(provide 'azos-emacs-station) -(add-hook 'after-init-hook (lambda () (require 'azos-emacs-station))) -#+end_src