commit 5c87b9d8eb24a867411aa0f6c106e9bf8f9e2ce6 Author: Stefan Ellmauthaler Date: Sat Sep 25 20:13:32 2021 +0200 first stuff diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..6dd2e89 --- /dev/null +++ b/configuration.nix @@ -0,0 +1,195 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ./programs/emacs + ]; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.kernelPackages = pkgs.linuxPackages_latest; + + networking.hostName = "nucturne"; # Define your hostname. + #networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + networking.networkmanager.enable = true; + #networking.networkmanager.unmanaged = [ "enp0s20f0u4u1u3" ]; + + # Set your time zone. + time.timeZone = "Europe/Berlin"; + + # The global useDHCP flag is deprecated, therefore explicitly set to false here. + # Per-interface useDHCP will be mandatory in the future, so this generated config + # replicates the default behaviour. + networking.useDHCP = false; + # networking.interfaces.eno1.useDHCP = true; + # networking.interfaces.enp0s20f0u4u1u3.useDHCP = true; + # networking.interfaces.wlp0s20f3.useDHCP = true; + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_GB.UTF-8"; + # console = { + # font = "Lat2-Terminus16"; + # keyMap = "us"; + # }; + + # Enable the X11 windowing system. + services.xserver.enable = true; + + + # Enable i3 + services.xserver.displayManager.lightdm.enable = true; + services.xserver.windowManager.i3 = { + enable = true; + extraPackages = with pkgs; [ + rofi # launcher + polybar # bar + i3lock # lock screen + ]; + }; + + + # Configure keymap in X11 + services.xserver.layout = "us"; + services.xserver.xkbOptions = "eurosign:e"; + + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable sound. + sound.enable = true; + hardware.pulseaudio.enable = true; + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.mutableUsers = false; + users.users.ellmau = { + isNormalUser = true; + extraGroups = [ "wheel" "networkmanager" "audio"]; + description = "Stefan Ellmauthaler"; + shell = pkgs.zsh; + home = "/home/ellmau"; + hashedPassword = "$6$JZPnaZYG$KL2c3e1it3j2avioovE1WveN/mpmq/tPsSAvHY1XRhtqKaE7TaSQkqRy69farkIR0Xs0.yTjltvKvv28kZtLO1"; + }; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + emacs + aspell + emacs-all-the-icons-fonts + wget + firefox + alacritty + git + thunderbird + okular + texlive.combined.scheme-full + rustup + usbutils + starship + ]; + + #services.emacs.enable = true; + #services.emacs.defaultEditor = true; + + environment.shells = [ pkgs.zsh ]; + environment.pathsToLink = [ "/share/zsh" ]; + + programs.zsh = { + enable = true; + enableCompletion = true; + enableGlobalCompInit = true; + autosuggestions.enable = true; + syntaxHighlighting = { + enable = true; + highlighters = [ "main" "brackets" "root" "line" ]; + #styles = { cursor = "standout,underline"; }; + }; + setOptions = [ "auto_pushd" "correct" "extendedglob" "nocaseglob" "rcexpandparam" "numericglobsort" "nobeep" "appendhistory" ]; + }; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + programs.mtr.enable = true; + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + # services.openssh.enable = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + environment.sessionVariables = rec { + XDG_CACHE_HOME = "\${HOME}/.cache"; + XDG_CONFIG_HOME = "\${HOME}/.config"; + XDG_BIN_HOME = "\${HOME}/.local/bin"; + XDG_DATA_HOME = "\${HOME}/.local/share"; + + PATH = [ + "\${XDG_BIN_HOME}" + ]; + }; + + fonts = { + enableDefaultFonts = true; + fonts = with pkgs; [ + hasklig + # corefonts # not free + liberation_ttf + comic-relief + dejavu_fonts + gyre-fonts + open-sans + noto-fonts + noto-fonts-emoji + noto-fonts-extra + roboto + roboto-mono + (nerdfonts.override { fonts = [ "Hasklig" ]; }) + material-icons + weather-icons + ]; + + fontconfig = { + enable = true; + # defaultFonts = { + # serif = [ "TeX Gyre Heros" ]; + # emoji = [ "Noto Color Emoji" ]; + # sansSerif = [ "TeX Gyre Pagella" ]; + # monospace = [ "Hasklug Nerd Font Mono" ]; + # }; + }; + }; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "21.05"; # Did you read the comment? + +} + diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..43d6e91 --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,38 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" "sdhci_pci" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/da267a3c-34e3-4218-933f-10738ee61eb6"; + fsType = "ext4"; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/9ebd7aff-629b-449b-83d8-6381a04eb708"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/DE6D-C383"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/0069f1fa-dd8e-4c0a-8f01-a576af29909e"; } + ]; + + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + # high-resolution display + hardware.video.hidpi.enable = lib.mkDefault true; +} diff --git a/programs/emacs/default.el b/programs/emacs/default.el new file mode 100644 index 0000000..c238618 --- /dev/null +++ b/programs/emacs/default.el @@ -0,0 +1,333 @@ +(require 'package) +(setq package-enable-at-startup nil) +(package-initialize) + +(load-theme 'spacemacs-dark t) + +;; Tab-width +(setq tab-width 2) + +;; prolog +(setq auto-mode-alist (append '(("\\.pl$" . prolog-mode)) auto-mode-alist)) +(setq auto-mode-alist (append '(("\\.lp$" . prolog-mode)) auto-mode-alist)) +(setq auto-mode-alist (append '(("\\.rls$" . prolog-mode)) auto-mode-alist)) + +;; spellchecking +(setq ispell-dictionary "british") +(add-hook 'LaTeX-mode-hook '(lambda () (flyspell-mode 1))) + +;; ido +(ido-mode 1) +(setq ido-enable-flex-matching t); flexible matching +(define-key (cdr ido-minor-mode-map-entry) [remap write-file] nil) ;do not suggest name when save as +;; make ido show suggestions one per line and not in one line +;; (make-local-variable 'ido-decorations) +;; (setf (nth 2 ido-decorations) "\n") + + +;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;;;;;;;;;;;;;;; org-mode ;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(bind-key "C-c l" 'org-toggle-link-display) ;shows org links in plain text + +(require 'org-roam) +(require 'org-roam-protocol) +(require 'ox-md) +(setq org-roam-directory "~/org-notes") +(setq org-roam-dailies-directory "~/org-notes/daily") +(add-hook 'after-init-hook 'org-roam-mode) ;init org-roam at startup +(bind-key [f8] 'org-roam-jump-to-index) ;jump to org roam index +(bind-key "C-c n f" 'org-roam-find-file) ; find a note +(bind-key "C-c n c" 'org-roam-capture) ; create a note +(bind-key "C-c n i" 'org-roam-insert) ;insert a link +(bind-key "C-c n l" 'org-roam-insert) ;insert a link +(bind-key "C-c n b" 'org-roam) ;shows backlink window +(bind-key "C-c n t" 'org-roam-tag-add) ;adds an org roam tag +(bind-key "C-c n d" 'org-roam-dailies-capture-date) ;adds notes to daily event cards + + +(setq org-roam-completion-system 'ivy) + +(setq org-roam-capture-templates + '(("d" "default" plain (function org-roam--capture-get-point) + "%?" + :file-name "%<%Y%m%d%H%M%S>-${slug}" + :head "#+title: ${title}\n#+roam_tags: %^{org-roam-tags}\n" + :unnarrowed t))) + +(setq org-roam-server-host "127.0.0.1" + org-roam-server-port 8080 + org-roam-server-authenticate nil + org-roam-server-export-inline-images t + org-roam-server-serve-files nil + org-roam-server-served-file-extensions '("pdf" "mp4" "ogv") + org-roam-server-network-poll t + org-roam-server-network-arrows nil + org-roam-server-network-label-truncate t + org-roam-server-network-label-truncate-length 60 + org-roam-server-network-label-wrap-length 20) + +;; tally-list +(defun coffee-tally-add (n) + (interactive "nN: ") + (org-entry-put + nil "COFFEETALLY" + (format "%s" (+ n (string-to-number + (or (org-entry-get nil "COFFEETALLY") "0")))))) + + +;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;;;;;;;;;;;;;;;; MAGIT ;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(use-package magit + :defer t + :commands (magit-blame magit-log magit-status) + :bind (("" . magit-blame) + ("" . magit-log) + ("" . magit-status)) + :custom + (magit-commit-signoff t) + (magit-define-global-key-bindings t) + (magit-revert-buffers 'silent t) + (magit-use-overlays nil)) + + +(custom-set-variables + '(inhibit-startup-screen t) + '(org-angeda-files '("~/org-notes/daily/" "~/org-notes/")) + ) + +;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;;;;;;;;;;;;;;;; LaTeX ;;;;;;;;;;;;;;;;; +;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(add-hook 'LateX-mode-hook 'turn-on-reftex) +;; auctex +(load "auctex.el" nil t t) +(load "preview-latex.el" nil t t) +(setq TeX-toggle-debug-warnings t) +(setq TeX-toggle-debug-bad-boxes t) +(setq TeX-PDF-mode t) +;; reftex +(setq reftex-plug-into-AUCTeX t) + +;; ##### Don't forget to configure +;; ##### Okular to use emacs in +;; ##### "Configuration/Configure Okular/Editor" +;; ##### => Editor => Emacsclient. (you should see +;; ##### emacsclient -a emacs --no-wait +%l %f +;; ##### in the field "Command". + +;; ##### Always ask for the master file +;; ##### when creating a new TeX file. +;(setq-default TeX-master nil) + +;; ##### Enable synctex correlation. From Okular just press +;; ##### Shift + Left click to go to the good line. +(setq TeX-source-correlate-mode t + TeX-source-correlate-start-server t) + +;; ### Set Okular as the default PDF viewer. +(eval-after-load "tex" + '(setcar (cdr (assoc 'output-pdf TeX-view-program-selection)) "Okular")) + +(use-package company-reftex + :defer t + :init + (with-eval-after-load 'company + (add-to-list 'company-backends '(company-reftex-labels company-reftex-citations)))) +(use-package company-auctex + :defer t + :init + (with-eval-after-load 'company + (company-auctex-init))) +(use-package company-bibtex + :defines company-backends + :defer t + :init + (with-eval-after-load 'company + (add-to-list 'company-backends '(company-bibtex)))) + +;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;;;;;;;;;;;;;;;; projectile ;;;;;;;;;;;;;;;;; +;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(use-package projectile + :init + (projectile-mode t) + :bind-keymap (("C-c p" . projectile-command-map)) + :preface + (defun se/projectile-project-root (orig-fn &rest args) + "Disable projectile-modelining on remote hosts because it's unusably slow." + (unless (file-remote-p default-directory) + (apply orig-fn args))) + :config + (advice-add 'projectile-project-root :around #'se/projectile-project-root) + :custom + (projectile-enable-caching t) + (projectile-file-exists-remote-cache-expire (* 10 60)) + (projectile-switch-project-action 'projectile-find-file) + (projectile-find-dir-includes-top-level t) + (projectile-completion-system 'default) + (projectile-globally-ignored-file-suffixes + '(".synctex.gz" ".bcf" ".blg" ".run.xml" ".thm" ".toc" ".out" ".idx" ".ilg" ".ind" ".tdo" ".bbl" ".aux" ".log")) + (projectile-mode-line '(:eval (format " [%s]" (projectile-project-name)))) + (projectile-project-root-files-bottom-up + '(".projectile" ".hg" "_darcs" ".fslckout" "_FOSSIL_" ".bzr" ".git"))) +(use-package projectile-ripgrep + :bind (:map projectile-command-map + ("s s" . 'projectile-ripgrep)) + :after projectile) + +;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;;;;;;;;;;;;;;;; Rust ;;;;;;;;;;;;;;;;; +;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; rustic + +;(push 'rustic-clippy flycheck-checkers) + +;; company mode +(add-hook 'rustic-mode-hook 'company-mode) + + +;; lsp mode + +(setq lsp-rust-analyzer-server-display-inlay-hints t) +(setq lsp-rust-analyzer-cargo-watch-command "clippy") +(setq lsp-keymap-prefix "C-l") + +;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;;;;;;;;;;;;;;;; beacon ;;;;;;;;;;;;;;;;; +;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + +(use-package beacon + :diminish beacon-mode + :defer t + :init + (beacon-mode t) + :custom + (beacon-blink-delay 0.1) + (beacon-blink-duration 0.2) + (beacon-blink-when-focused t) + (beacon-blink-when-point-moves-horizontally 10) + (beacon-blink-when-point-moves-vertically 5) + (beacon-color "#2aa198") + (beacon-size 16)) + + +(custom-set-variables + ;; custom-set-variables was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(inhibit-startup-screen t) + '(org-agenda-files '("~/org-notes/daily/" "~/org-notes/")) + '(package-selected-packages + '(projectile-ripgrep projectile yaml-mode ox-pandoc use-package treemacs-all-the-icons treemacs-magit ivy org-roam-server org-roam ob-rust magit zenburn-theme treemacs spacemacs-theme rustic monokai-theme moe-theme lsp-ui gruvbox-theme company-lsp bind-key))) +(custom-set-faces + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + ) + +(use-package highlight-indentation + :diminish highlight-indentation-mode + :commands highlight-indentation-mode + :defer t + :hook ((text-mode prog-mode) . highlight-indentation-mode)) +(use-package multiple-cursors + :bind (("C-S-c C-S-c" . mc/edit-lines) + ("C->" . mc/mark-next-like-this) + ("C-<" . mc/mark-previous-like-this) + ("C-c C-<" . mc/mark/all-like-this))) + + +;; direnv +(use-package direnv + :config + (direnv-mode t)) + +;; dap +(use-package dap-mode + :after lsp-mode + :custom + (dap-mode t) + (dap-ui-mode t)) + +;; flycheck +(use-package flycheck + :demand t + :custom + (flycheck-highlighting-mode 'sexps) + (flycheck-mode-line-prefix "")) + +;; flyspell +(use-package flyspell + :defer t + :hook (prog-mode . flyspell-prog-mode) + :custom + (flyspell-mode-line-string nil)) + +;; lsp +(use-package lsp-mode + :after flycheck + :commands lsp + :preface + :hook ((( + ; ada-mode + clojure-mode + cmake-mode + c++-mode + css-mode + ;; dockerfile-mode + js2-mode + f90-mode + html-mode + haskell-mode + java-mode + json-mode + ;; lua-mode + ;; markdown-mode + nix-mode + ;; ocaml-mode + ;; pascal-mode + ;; perl-mode + ;; php-mode + ;; prolog-mode + python-mode + ;; ess-mode + ;; ruby-mode + rust-mode + ;; sql-mode + typescript-mode + vue-mode + ;; xml-mode + ;; yaml-mode + web-mode + ) . lsp) + (lsp-mode . flycheck-mode) + (sh-mode . (lambda () + (unless (apply #'derived-mode-p '(direnv-envrc-mode)) + (lsp-mode t))))) + :diminish eldoc-mode + :custom + (lsp-keymap-prefix "C-c") + (lsp-eldoc-render-all t) + (lsp-file-watch-threshold 5000) + (lsp-ui-doc-border "#586e75") + (lsp-ui-doc-header t) + (lsp-ui-doc-include-signature t)) + ;:custom-face + ;(lsp-ui-sideline-code-action ((t (:foreground "#b58900")))) + ;(lsp-ui-sideline-current-symbol ((t (:foreground "#d33682" :box (:line-width -1 :color "#d33682") :weight ultra-bold :height 0.99))))) + +;; misc +(use-package academic-phrases + :defer t + :commands + (academic-phrases + academic-phrases-by-section)) diff --git a/programs/emacs/default.nix b/programs/emacs/default.nix new file mode 100644 index 0000000..224f35d --- /dev/null +++ b/programs/emacs/default.nix @@ -0,0 +1,85 @@ +{ config, lib, pkgs, ... }: + +let + defaultEl = ./default.el; + + defaultConfig = pkgs.runCommand "default.el" { } '' + mkdir -p $out/share/emacs/site-lisp + cp ${defaultEl} $out/share/emacs/site-lisp/default.el + ''; + + emacsPackage = (pkgs.emacsPackagesGen pkgs.emacsUnstable).emacsWithPackages + (epkgs: + #let + # lpkgs = import ./packages.nix { + # inherit config lib pkgs epkgs; + # }; + #in + #[ (defaultConfig lpkgs) ] ++ (with pkgs; [ + # aspell + # emacs-all-the-icons-fonts + # gnupg + # nixpkgs-fmt + #]) + [(with epkgs.elpaPackages; [ auctex org flymake ])] + ++ (with epkgs.melpaStablePackages; [ ]) ++ (with epkgs.melpaPackages; [ + academic-phrases + add-hooks + alert + all-the-icons + all-the-icons-dired + beacon + bln-mode + cargo-mode + company + company-auctex + company-bibtex + company-flx + company-quickhelp + company-reftex + dockerfile-mode + docker-compose-mode + flycheck + free-keys + highlight-indentation + ivy + json-mode + less-css-mode + lsp-mode + magit + multiple-cursors + nix-mode + nixpkgs-fmt + org-bullets + org-pdftools + org-roam + pasp-mode + pdf-tools + projectile + projectile-ripgrep + rustic + spacemacs-theme + sparql-mode + use-package + yaml-mode + ])); + #]) ++ (with lpkgs; [ + # defaultencrypt + # ligatures + # javacc-mode + # org-roam-ui + #] ++ lpkgs.packagesForBinaries)); +in +{ + services.emacs = { + enable = true; + defaultEditor = true; + package = emacsPackage; + }; + + nixpkgs.overlays = [ + (import (builtins.fetchTarball { + url = https://github.com/nix-community/emacs-overlay/archive/master.tar.gz; + })) + ]; +} \ No newline at end of file