about summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2022-08-28 21:14:14 +0300
committerAzat Bahawi <azat@bahawi.net>2022-08-28 21:14:14 +0300
commit2e2a7bb1f640def9d627af8cc194faf7d911d8bf (patch)
tree4252d60535ffed05bb5f304f6fb0b05226809d8a /modules
parent2022-08-25 (diff)
2022-08-28
Diffstat (limited to '')
-rw-r--r--modules/nixfiles/common/nix/default.nix5
-rw-r--r--modules/nixfiles/emacs/default.nix12
-rw-r--r--modules/nixfiles/emacs/doom/config.el35
-rw-r--r--modules/nixfiles/emacs/doom/custom.el0
-rw-r--r--modules/nixfiles/emacs/doom/init.el30
-rw-r--r--modules/nixfiles/emacs/doom/packages.el10
-rw-r--r--modules/nixfiles/endlessh-go.nix51
-rw-r--r--modules/nixfiles/profiles/headless.nix2
-rw-r--r--modules/nixfiles/x11.nix31
9 files changed, 85 insertions, 91 deletions
diff --git a/modules/nixfiles/common/nix/default.nix b/modules/nixfiles/common/nix/default.nix
index 4e995d3..3d320ae 100644
--- a/modules/nixfiles/common/nix/default.nix
+++ b/modules/nixfiles/common/nix/default.nix
@@ -87,11 +87,6 @@ with lib; {
           alejandra = super.alejandra.overrideAttrs (_: _: {
             patches = [./patches/alejandra-no-ads.patch];
           });
-
-          # FIXME https://github.com/NixOS/nixpkgs/pull/187519
-          dendrite = super.dendrite.overrideAttrs (_: _: {
-            doCheck = false;
-          });
         }
         // (with super; let
           np = nodePackages;
diff --git a/modules/nixfiles/emacs/default.nix b/modules/nixfiles/emacs/default.nix
index 86db0f7..41b2085 100644
--- a/modules/nixfiles/emacs/default.nix
+++ b/modules/nixfiles/emacs/default.nix
@@ -48,9 +48,9 @@ in {
             cmigemo # :lang japanese
             dockerfile-language-server # :tools (docker +lsp)
             editorconfig # :tools editorconfig
-            fd # core
+            fd # doom!
             gnuplot # :lang (org +gnuplot)
-            gnutls # core
+            gnutls # doom!
             gomodifytags # :lang go
             gopls # :lang (go +lsp)
             gore # :lang go
@@ -72,19 +72,25 @@ in {
             nodePackages.prettier # :editor format
             nodePackages.stylelint # :lang web
             pandoc # :lang org markdown latex
+            pinentry-emacs # doom!
             pre-commit # :tools magit
             python3Packages.black # :lang python :editor format
             python3Packages.isort # :lang python
             python3Packages.pyflakes # :lang python
-            ripgrep # core
+            ripgrep # doom!
             rust-analyzer # :lang rust
             shellcheck # :lang sh
             shfmt # :lang sh :editor format
             sqlite # :lang (org +roam2) :tools lookup
             texlive.combined.scheme-full # :lang org tex
             wordnet # :tools (lookup +dictionary +offline)
+            xclip # :app everywhere
+            xdotool # :app everywhere
+            xorg.xprop # :app everywhere
+            xorg.xwininfo # :app everywhere
             yaml-language-server # :lang (yaml +lsp)
             zls # :lang (zig +lsp)
+            zstd # :emacs undo
           ];
         in ''
           ;; This will integrate packages, which are required by various modules
diff --git a/modules/nixfiles/emacs/doom/config.el b/modules/nixfiles/emacs/doom/config.el
index ac9cdb3..bd429c0 100644
--- a/modules/nixfiles/emacs/doom/config.el
+++ b/modules/nixfiles/emacs/doom/config.el
@@ -1,15 +1,29 @@
 ;;; config.el -*- lexical-binding: t; -*-
 
-(setq doom-theme 'doom-tomorrow-night)
-
 (setq frame-title-format '("Emacs")
       icon-title-format frame-title-format)
 
+(setq doom-theme 'doom-tomorrow-night)
+
 (setq org-directory "~/doc/org/"
       org-roam-directory "~/doc/roam/"
-      org-roam-db-location (concat org-roam-directory ".db"))
-(setq deft-directory org-directory
-      deft-default-extension "org")
+      org-roam-db-location (concat org-roam-directory ".db")
+      org-todo-keywords '((sequence
+                           "PROJ(p)" ; A master task.
+                           "TODO(t)" ; A task that needs to be done with statues:
+                           "STRT(s@)" ; - In progress.
+                           "HOLD(l@/!)" ; - Paused because of me.
+                           "WAIT(w@/!)" ; - Paused because of not me.
+                           "|"
+                           "DONE(d@/!)" ; Complete state.
+                           "KILL(k@/!)")) ; Incomplete state.
+      org-todo-keyword-faces '(("PROJ" . +org-todo-project)
+                               ("TODO" . +org-todo-active)
+                               ("STRT" . +org-todo-active)
+                               ("HOLD" . +org-todo-onhold)
+                               ("WAIT" . +org-todo-onhold)
+                               ("DONE" . +org-todo-cancel)
+                               ("KILL" . +org-todo-cancel)))
 
 (use-package! websocket
   :after org-roam)
@@ -22,8 +36,13 @@
         org-roam-ui-update-on-save t
         org-roam-ui-open-on-start t))
 
+(setq deft-directory org-directory
+      deft-default-extension "org")
+
 (setq lsp-haskell-formatting-provider "brittany")
 
+(setq editorconfig-exclude-modes '(elisp-mode))
+
 (setq-default flycheck-disabled-checkers '(emacs-lisp-checkdoc))
 
 (after! lsp-mode
@@ -36,8 +55,7 @@
 
 (setq-hook! 'yaml-mode-hook +format-with-lsp nil)
 
-(setq +format-on-save-enabled-modes
-      '(not yaml-mode nix-mode))
+(setq +format-on-save-enabled-modes '(not yaml-mode nix-mode))
 
 (add-hook 'org-mode-hook
           (lambda (&rest _)
@@ -60,6 +78,8 @@
 
 (setq display-line-numbers-type t)
 
+(setq highlight-indent-guides-method 'fill)
+
 (setq browse-url-generic-program (executable-find "firefox")
       browse-url-browser-function 'browse-url-generic)
 
@@ -78,7 +98,6 @@
                                      "a.gondor@yahoo.com"
                                      "a.gondor@yahoo.com"))
 
-
 (set-email-account! "yahoo"
                     '(
                       (mu4e-sent-folder   . "/yahoo/Sent")
diff --git a/modules/nixfiles/emacs/doom/custom.el b/modules/nixfiles/emacs/doom/custom.el
deleted file mode 100644
index e69de29..0000000
--- a/modules/nixfiles/emacs/doom/custom.el
+++ /dev/null
diff --git a/modules/nixfiles/emacs/doom/init.el b/modules/nixfiles/emacs/doom/init.el
index 4f2fd4e..9ad69c6 100644
--- a/modules/nixfiles/emacs/doom/init.el
+++ b/modules/nixfiles/emacs/doom/init.el
@@ -13,14 +13,14 @@
        ;; doom-dashboard
        ;; doom-quit
        hl-todo
-       indent-guides
+       ;; indent-guides
        ;; ligatures
        ;; modeline
-       nav-flash
+       ;; nav-flash
        ophints
        (popup +defaults)
        ;; tabs
-       (treemacs +lsp)
+       ;; (treemacs +lsp)
        ;; unicode
        (vc-gutter +diff-hl +pretty)
        window-select
@@ -55,7 +55,7 @@
        (spell +aspell
               +everywhere
               +flyspell)
-       grammar
+       ;; grammar
 
        :tools
        ansible
@@ -71,7 +71,6 @@
        (pass +auth)
        pdf
        terraform
-       ;; tmux
        tree-sitter
        upload
 
@@ -82,38 +81,35 @@
        (cc +lsp +tree-sitter)
        common-lisp
        ;; (csharp +lsp +tree-sitter)
-       ;; data
+       data
        dhall
        emacs-lisp
        (go +lsp +tree-sitter)
-       ;; (graphql +lsp)
+       ;; graphql
        (haskell +lsp)
        (java +lsp +tree-sitter)
        (javascript +lsp +tree-sitter)
-       json
+       (json +tree-sitter)
        (latex +lsp +tree-sitter)
        (lua +lsp +tree-sitter)
        markdown
        (nix +lsp +tree-sitter)
-       (org +brain
-            +gnuplot
-            +hugo
+       (org +hugo
             +journal
             +noter
             +pandoc
             +pomodoro
             +present
-            +pretty
             +roam2)
        plantuml
        (python +lsp +tree-sitter)
-       (racket +lsp +tree-sitter)
-       rst
+       ;; (racket +lsp +tree-sitter)
+       ;; rst
        (rust +lsp +tree-sitter)
-       (scheme +racket)
+       ;; (scheme +racket)
        (sh +lsp +tree-sitter)
        (web +lsp +tree-sitter)
-       (yaml +lsp +tree-sitter)
+       (yaml +tree-sitter)
        (zig +lsp +tree-sitter)
 
        :email
@@ -122,7 +118,7 @@
        :app
        calendar
        ;; emms
-       ;; everywhere
+       everywhere
        irc
        (rss +org)
 
diff --git a/modules/nixfiles/emacs/doom/packages.el b/modules/nixfiles/emacs/doom/packages.el
index b29ee5f..80651f2 100644
--- a/modules/nixfiles/emacs/doom/packages.el
+++ b/modules/nixfiles/emacs/doom/packages.el
@@ -1,4 +1,6 @@
-;;; packages.el -*- no-byte-compile: t; -*-
+;;; packages.el -*- lexical-binding: t; -*-
+
+(disable-packages! writegood-mode)
 
 (package! hledger-mode)
 
@@ -10,10 +12,8 @@
 (package! org-roam
   :recipe (:host github
            :repo "org-roam/org-roam"
-           :branch "main"
-           :files (:defaults "extensions/*")))
+           :branch "main"))
 (package! org-roam-ui
   :recipe (:host github
            :repo "org-roam/org-roam-ui"
-           :branch "main"
-           :files ("*.el" "out")))
+           :branch "main"))
diff --git a/modules/nixfiles/endlessh-go.nix b/modules/nixfiles/endlessh-go.nix
index cb9a639..b89ffc4 100644
--- a/modules/nixfiles/endlessh-go.nix
+++ b/modules/nixfiles/endlessh-go.nix
@@ -3,56 +3,31 @@
   inputs,
   lib,
   pkgs,
+  this,
   ...
 }:
 with lib; let
   cfg = config.nixfiles.modules.endlessh-go;
 in {
-  # imports = ["${inputs.nixpkgs-local}/nixos/modules/services/security/endlessh-go.nix"];
+  # Remove this later.
+  imports = ["${inputs.nixpkgs-endlessh-go}/nixos/modules/services/security/endlessh-go.nix"];
 
-  options.nixfiles.modules.endlessh-go = {
-    enable = mkEnableOption "endlessh-go";
-
-    prometheusPort = mkOption {
-      description = "Prometheus port.";
-      type = with types; port;
-      default = 9119;
-    };
-  };
+  options.nixfiles.modules.endlessh-go.enable = mkEnableOption "endlessh-go";
 
   config = let
     port = 22;
   in
     mkIf cfg.enable {
-      assertions = [
-        {
-          assertion = !(any (x: x == port) config.services.openssh.ports);
-          message = "Port ${toString port} is already occupied by OpenSSH";
-        }
-      ];
-
-      systemd.services.endlessh-go = {
-        description = "Endlessh SSH Tarpit";
-        requires = ["network-online.target"];
-        serviceConfig = {
-          Restart = "always";
-          ExecStart = concatStringsSep " " [
-            "${pkgs.endlessh-go}/bin/endlessh-go"
-            "-conn_type=tcp4"
-            "-host=0.0.0.0"
-            "-port=${toString port}"
-            "-enable_prometheus"
-            "-prometheus_port=${toString cfg.prometheusPort}"
-            "-geoip_supplier=ip-api"
-            "-logtostderr"
-            "-v=1"
-          ];
-          KillSignal = "SIGTERM";
-          AmbientCapabilities = "CAP_NET_BIND_SERVICE";
-          DynamicUser = true;
-          StateDirectory = "endlessh-go";
+      services.endlessh-go = {
+        enable = true;
+        listenAddress = "0.0.0.0";
+        inherit port;
+        prometheus = {
+          enable = true;
+          listenAddress = this.wireguard.ipv4.address;
+          port = 9229;
         };
-        wantedBy = ["multi-user.target"];
+        extraOptions = ["-conn_type=tcp4" "-geoip_supplier=ip-api" "-v=1"];
       };
 
       networking.firewall.allowedTCPPorts = [port];
diff --git a/modules/nixfiles/profiles/headless.nix b/modules/nixfiles/profiles/headless.nix
index 107c9fc..b3c5c86 100644
--- a/modules/nixfiles/profiles/headless.nix
+++ b/modules/nixfiles/profiles/headless.nix
@@ -59,7 +59,9 @@ in {
       defaultLocale = mkForce "C";
       supportedLocales = mkForce ["en_US.UTF-8/UTF-8" "en_GB.UTF-8/UTF-8"];
     };
+
     services.udisks2.enable = false;
+
     xdg.sounds.enable = false;
 
     environment.systemPackages = with pkgs; [alacritty.terminfo];
diff --git a/modules/nixfiles/x11.nix b/modules/nixfiles/x11.nix
index ac1b799..502a24b 100644
--- a/modules/nixfiles/x11.nix
+++ b/modules/nixfiles/x11.nix
@@ -14,21 +14,22 @@ in {
 
     hm = {
       home = {
-        packages = with pkgs;
-          [xclip xdotool]
-          ++ (with xorg; [
-            xdpyinfo
-            xdriinfo
-            xev
-            xfontsel
-            xkill
-            xlsatoms
-            xlsclients
-            xlsfonts
-            xprop
-            xrandr
-            xwininfo
-          ]);
+        # TODO Get these out of the global state.
+        # packages = with pkgs;
+        #   [xclip xdotool]
+        #   ++ (with xorg; [
+        #     xdpyinfo
+        #     xdriinfo
+        #     xev
+        #     xfontsel
+        #     xkill
+        #     xlsatoms
+        #     xlsclients
+        #     xlsfonts
+        #     xprop
+        #     xrandr
+        #     xwininfo
+        #   ]);
 
         sessionVariables = with config.dirs; {
           XCOMPOSEFILE = "${cache}/XComposeFile";

Consider giving Nix/NixOS a try! <3