From 60b419fc85154d9027bd6a5861f8bb8b7d2ff880 Mon Sep 17 00:00:00 2001 From: tzlil Date: Sun, 5 Mar 2023 15:11:22 +0200 Subject: readd swaylock 30 sec, remove some headers from caddy --- hosts/vps/website.nix | 17 ++-- mixins/dev.nix | 21 +++++ mixins/emacs/default.nix | 33 ++++++++ mixins/emacs/init.el | 213 +++++++++++++++++++++++++++++++++++++++++++++++ mixins/sway.nix | 14 ++-- profiles/user.nix | 2 +- 6 files changed, 286 insertions(+), 14 deletions(-) create mode 100644 mixins/dev.nix create mode 100644 mixins/emacs/default.nix create mode 100644 mixins/emacs/init.el diff --git a/hosts/vps/website.nix b/hosts/vps/website.nix index ff5d0d9..c1aad64 100644 --- a/hosts/vps/website.nix +++ b/hosts/vps/website.nix @@ -9,23 +9,28 @@ default = '' header { -Server + -Date + -Last-Modified + -Etag + -Accept-Ranges # disable indexing by search engines X-Robots-Tag "noindex, nofollow" - # disable FLoC tracking - Permissions-Policy interest-cohort=() + + # disable FLoC tracking + # Permissions-Policy interest-cohort=() # enable HSTS - Strict-Transport-Security max-age=31536000; + # Strict-Transport-Security max-age=31536000; # disable clients from sniffing the media type - X-Content-Type-Options nosniff + # X-Content-Type-Options nosniff # clickjacking protection - X-Frame-Options DENY + # X-Frame-Options DENY # keep referrer data off of HTTP connections - Referrer-Policy no-referrer-when-downgrade + # Referrer-Policy no-referrer-when-downgrade } ''; }; diff --git a/mixins/dev.nix b/mixins/dev.nix new file mode 100644 index 0000000..5d9487c --- /dev/null +++ b/mixins/dev.nix @@ -0,0 +1,21 @@ +{ + pkgs, + lib, + config, + inputs, + ... +}: { + imports = [ + inputs.home-manager.nixosModules."home-manager" + ]; + config = { + home-manager.users.tzlil = {pkgs, ...} @ hm: { + home = { + packages = with pkgs; [ + ]; + }; + programs = { + }; + }; + }; +} diff --git a/mixins/emacs/default.nix b/mixins/emacs/default.nix new file mode 100644 index 0000000..a22523e --- /dev/null +++ b/mixins/emacs/default.nix @@ -0,0 +1,33 @@ +{ + pkgs, + lib, + config, + inputs, + ... +}: { + imports = [ + inputs.home-manager.nixosModules."home-manager" + ]; + config = { + home-manager.users.tzlil = { + pkgs, + config, + nixosConfig, + ... + } @ hm: { + home = { + packages = with pkgs; [ + + ]; + }; + services.emacs = { + enable = true; + defaultEditor = true; + }; + programs.emacs = { + enable = true; + extraConfig = builtins.readFile ./init.el + }; + }; + } +} diff --git a/mixins/emacs/init.el b/mixins/emacs/init.el new file mode 100644 index 0000000..c9a34b6 --- /dev/null +++ b/mixins/emacs/init.el @@ -0,0 +1,213 @@ +;; --------------------- INITIALIZE ----------------------------------------- +;; ------------------------------------------------------------------------------------- + +;; SETUP YOUR PROXY IF NEEDED +;; (setq url-proxy-services +;; '(("no_proxy" . "^\\(localhost\\|10.*\\)") +;; ("http" . "company.com:8080") +;; ("https" . "company.com:8080"))) + + + + + + +;; ------------------------------------------------------------------------------------- +;; ---------------------------- THEME ------------------------------------------- +;; ------------------------------------------------------------------------------------- + +(load-theme 'wombat) +;; a great font: https://www.fontyukle.net/en/Monaco.ttf +(condition-case nil + (set-default-font "Monaco") + (error nil)) + +(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. + '(default ((t (:inherit nil :stipple nil :background "#242424" :foreground "#f6f3e8" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 113 :width normal :foundry "APPL" :family "Monaco")))) + '(fringe ((t (:background "#242424")))) + '(linum ((t (:inherit (shadow default) :background "#191919" :foreground "#505050"))))) + + + + + +;; ------------------------------------------------------------------------------------- +;; --------------------- ENHANCEMENTS ------------------------------------------- +;; ------------------------------------------------------------------------------------- + +;; remove unecessary UI +(menu-bar-mode -1) +(scroll-bar-mode 0) +(tool-bar-mode 0) +(setq visible-bell 1) +(setq ring-bell-function 'ignore) + +;; startup screen +(setq inhibit-splash-screen t) +(setq inhibit-startup-message t) +(setq initial-scratch-message nil) + +;; remove whitespace before saving +(add-hook 'before-save-hook 'whitespace-cleanup) + +;; faster to quit +(fset 'yes-or-no-p 'y-or-n-p) + +;; highlight selected text +(transient-mark-mode t) + +;; set path +;;(setenv "PATH" (concat "/usr/local/bin:" (getenv "PATH"))) +;;(add-to-list 'exec-path "/usr/local/bin") + +;; display matching parenthesis +(show-paren-mode 1) + +;; move faster up and down faster +(global-set-key (kbd "M-n") (kbd "C-u 5 C-n")) +(global-set-key (kbd "M-p") (kbd "C-u 5 C-p")) + +;; usefull stuff before saving +(add-hook 'before-save-hook 'delete-trailing-whitespace) +(add-hook 'before-save-hook '(lamdba () (require 'saveplace)(setq-default save-place t))) + +;; refresh buffers when any file change +(global-auto-revert-mode t) + +;; display time +(load "time" t t) +(display-time) + +;; track recently opened file +(recentf-mode t) +(global-set-key (kbd "C-x C-r") 'recentf-open-files) +(setq recentf-max-saved-items 1000) +(setq recentf-max-menu-items 50) + +;; display pictures and other compressed files +(setq auto-image-file-mode t) +(setq auto-compression-mode t) + +;; line and column numbering +(column-number-mode 1) +(line-number-mode 1) + +;; code folding +(global-set-key (kbd "C-c C-d") 'hs-hide-all) +(global-set-key (kbd "C-c C-f") 'hs-show-all) +(global-set-key (kbd "C-c C-c") 'hs-toggle-hiding) +(add-hook 'prog-mode-hook #'(lambda () (hs-minor-mode t) )) + +;; Search using regexp +(global-set-key "\C-s" 'isearch-forward-regexp) +(global-set-key "\C-r" 'isearch-backward-regexp) + +;; Usable on OSX and windows +;; (setq mac-command-modifier 'meta) +;; (setq mac-option-modifier 'alt) +;; (setq mac-right-option-modifier 'super) +;; (setq w32-get-true-file-attributes nil) +;; (setq vc-handled-backends nil) +;; (remove-hook 'find-file-hooks 'vc-find-file-hook) + +;; scroll +(setq scroll-step 1) +(setq scroll-conservatively 10) +(setq scroll-margin 7) +(setq scroll-conservatively 5) + +;; indentation +(setq-default indent-tabs-mode nil) +(setq-default tab-width 4) +(setq standard-indent 4) +(setq indent-line-function 'insert-tab) +(setq tab-width 4) +(setq tab-stop-list '(4 8 12 16 20 24 28 32 36 40 4--:--:-- --:--:-- --:--:-- 11647 +4 48 52 56 60 64 68 72 76 80)) +(setq indent-tabs-mode nil) + +;; disable backup files +(setq make-backup-files nil) + +;; auto wraping +(set-default 'truncate-lines t) +(add-hook 'text-mode-hook (lambda () (setq truncate-lines nil))) + +;; setup ido for selecting file +(ido-mode) +(setq ido-enable-flex-matching t) +(setq resize-mini-windows t) +(add-hook 'minibuffer-setup-hook + (lambda () (setq truncate-lines nil))) +(setq ido-decorations '("\n-> " "" "\n " "\n ..." + "[" "]" " [No match]" " [Matched]" + " [Not readable]" " [Too big]" " [Confirm]")) +(add-to-list 'ido-ignore-buffers "*Messages*") +(add-to-list 'ido-ignore-buffers "*Buffer*") +(add-to-list 'ido-ignore-buffers "*ESS*") +(add-to-list 'ido-ignore-buffers "*NeoTree*") +(add-to-list 'ido-ignore-buffers "*Completions*") +(add-to-list 'ido-ignore-buffers "*Help*") +(custom-set-faces + '(ido-subdir ((t (:inherit 'font-lock-keyword-face)))) + '(ido-first-match ((t (:inherit 'font-lock-comment-face)))) + '(ido-only-match ((t (:inherit 'font-lock-comment-face))))) + + +;; line wrap +(setq linum-format "%d ") +;;(global-linum-mode 1) + +;; usefull shortcuts +(global-set-key [f3] 'comment-region) +(global-set-key [f4] 'uncomment-region) +(global-set-key [f5] 'eshell) +(global-set-key [f11] 'toggle-frame-fullscreen) +(global-set-key (kbd "C-h C-s") 'info-apropos) + +;; ARTIST MODE +(eval-after-load "artist" '(define-key artist-mode-map [(down-mouse-3)] 'artist-mouse-choose-operation)) + +;; EWW - emacs web browser +;; (setq eww-search-prefix "https://www.google.com.au/search?q=") +;; (setq shr-color-visible-luminance-min 78) ;; improve readability (especially for google search) +;;(setq url-user-agent "User-Agent: Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7\n") +;; (global-set-key (kbd "C-c b") 'eww) + +;; Setup the package manager +;;(defun load-package-manager () +;; (package-initialize) +;; (require 'package) +;; (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))) +;;(add-hook 'after-init-hook 'load-package-manager) + + + +;; Hide left line indicator +(setf (cdr (assq 'continuation fringe-indicator-alist)) + '(nil nil) ;; no continuation indicators + ;; '(nil right-curly-arrow) ;; right indicator only + ;; '(left-curly-arrow nil) ;; left indicator only + ;; '(left-curly-arrow right-curly-arrow) ;; default + ) + + +;; Window split line +(set-face-attribute 'vertical-border nil :foreground "#303030") + + + +;; ------------------------------------------------------------------------------------- +;; --------------------- PLUGINS ----------------------------------------- +;; ------------------------------------------------------------------------------------- + +;; Our plugins configuration will leave under the conf folder, so let's load this up: +;;(mapc +;; (lambda(path) (load-file path)) +;; (condition-case nil +;; (directory-files "~/.emacs.d/conf/" t "\.el$") +;; (error (make-directory "~/.emacs.d/conf/")))) diff --git a/mixins/sway.nix b/mixins/sway.nix index e7c71db..79c20d0 100644 --- a/mixins/sway.nix +++ b/mixins/sway.nix @@ -87,13 +87,13 @@ in { in { enable = false; systemdTarget = "graphical-session.target"; - # timeouts = [ - # # auto-lock after 30 seconds - # { - # timeout = 30; - # command = fadelock.outPath; - # } - # ]; + timeouts = [ + # auto-lock after 30 seconds + { + timeout = 30; + command = fadelock.outPath; + } + ]; events = [ { event = "before-sleep"; diff --git a/profiles/user.nix b/profiles/user.nix index 0a3bebe..18e6a35 100644 --- a/profiles/user.nix +++ b/profiles/user.nix @@ -31,7 +31,7 @@ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMDyzrs9sbstv3KFK5FV8qYlSknnEy8Cn+qch4dJLmHA" ]; }; - + nix.settings.allowed-users = ["root" "tzlil"]; nix.settings.trusted-users = ["root" "tzlil"]; -- cgit 1.4.1