It builds, submodules

This commit is contained in:
2025-02-06 15:11:05 +02:00
parent 91250841a9
commit 3d102d08cb
42 changed files with 140 additions and 3281 deletions
+3
View File
@@ -0,0 +1,3 @@
[submodule "azos-core"]
path = azos-core
url = git@github.com:anerisgreat/azos-core.git
+8 -2
View File
@@ -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
Submodule
+1
Submodule azos-core added at 63005bf295
Generated
+80 -11
View File
@@ -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",
+25 -15
View File
@@ -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};}));
};
}
+4 -3
View File
@@ -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;
+1 -1
View File
@@ -1,3 +1,3 @@
{
imports = [ ./suites ];
imports = [];
}
@@ -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
];
}
@@ -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);
};
};
}
@@ -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;
};
}
@@ -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;
};
}
@@ -1,6 +0,0 @@
grab
pinentry-program /usr/bin/pinentry
default-cache-ttl 86400
max-cache-ttl 86400
enable-ssh-support
@@ -1,4 +0,0 @@
#https://xeiaso.net/talks/asg-2023-nixos/ example
{ lib, config, pkgs, ... }:{
home.file."name.txt".text = ''${config.azos.name}'';
}
@@ -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 = [
];
}
-13
View File
@@ -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
];
}
@@ -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
];
}
@@ -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];
};
}
@@ -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 ];
};
}
@@ -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 ];
};
}
@@ -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 = [
];
}
@@ -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 ];
};
}
@@ -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'';
};
}
@@ -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
];
};
}
@@ -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];
};
}
@@ -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];
};
}
-49
View File
@@ -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
'';
});
}
+15 -5
View File
@@ -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";
+1 -1
View File
@@ -12,7 +12,7 @@
nixpkgs = {
overlays = [
outputs.overlays.additions
# outputs.overlays.additions
outputs.overlays.modifications
outputs.overlays.unstable-packages
];
+1 -1
View File
@@ -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.
-32
View File
@@ -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
];
}
-23
View File
@@ -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
];
}
-19
View File
@@ -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
];
}
-19
View File
@@ -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
];
}
-20
View File
@@ -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
];
}
-10
View File
@@ -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.
''
-26
View File
@@ -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;
})
+1 -39
View File
@@ -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; };
}
{}
File diff suppressed because it is too large Load Diff
-165
View File
@@ -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
-246
View File
@@ -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
-357
View File
@@ -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-<f2>" to "slock", a simple X display locker.
([s-f2] . (lambda ()
(interactive)
(start-process "" nil "/usr/bin/slock")))
([s-<tab>] . 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 "<print>") '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 "<XF86AudioRaiseVolume>")
(lambda ()
(interactive) (start-process
"pactl" nil "pactl" "set-sink-volume" "0" "+5%")))
(exwm-input-set-key
(kbd "<XF86AudioLowerVolume>")
(lambda ()
(interactive) (start-process
"pactl" nil "pactl" "set-sink-volume" "0" "-5%")))
(exwm-input-set-key
(kbd "<XF86AudioMute>")
(lambda ()
(interactive) (start-process
"pactl" nil "pactl" "set-sink-mute" "0" "toggle")))
(exwm-input-set-key
(kbd "<XF86AudioPlay>")
'desktop-environment-toggle-music)
(exwm-input-set-key
(kbd "<XF86AudioNext>")
'desktop-environment-music-next)
(exwm-input-set-key
(kbd "<XF86AudioPrev>")
'desktop-environment-music-previous)
(exwm-input-set-key
(kbd "<XF86AudioStop>")
'desktop-environment-music-stop)
(exwm-input-set-key
(kbd "<XF86AudioPause>")
'desktop-environment-toggle-music)
(exwm-input-set-key
(kbd "<XF86MonBrightnessUp>")
(lambda ()
(interactive) (start-process
"light" nil "light" "-A" "5")))
(exwm-input-set-key
(kbd "<XF86MonBrightnessDown>")
(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
-300
View File
@@ -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 <ID>
pass insert gmail.com/<username>
#+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