diff --git a/hosts/hs/configuration.nix b/hosts/hs/configuration.nix index f9e38fb..91a32dc 100644 --- a/hosts/hs/configuration.nix +++ b/hosts/hs/configuration.nix @@ -204,10 +204,10 @@ recommendedTlsSettings = true; clientMaxBodySize = "10G"; # max file size for uploads commonHttpConfig = '' - log_format upstream_time '$remote_addr - $remote_user [$time_local] ' - '"$request" $status $body_bytes_sent ' - '"$http_referer" "$http_user_agent"' - 'rt=$request_time uct="$upstream_connect_time" uht="$upstream_header_time" urt="$upstream_response_time"'; + log_format upstream_time '$remote_addr - $remote_user [$time_local] ' + '"$request" $status $body_bytes_sent ' + '"$http_referer" "$http_user_agent"' + 'rt=$request_time uct="$upstream_connect_time" uht="$upstream_header_time" urt="$upstream_response_time"'; ''; virtualHosts = { "torrent.ccr.ydns.eu" = { @@ -314,9 +314,54 @@ allowedUDPPorts = [ 137 # samba 138 # samba + 51820 # wireguard ]; }; + networking.nat.enable = true; + networking.nat.externalInterface = "enp0s10"; + networking.nat.internalInterfaces = [ "wg0" ]; + + networking.wireguard.interfaces = { + # "wg0" is the network interface name. You can name the interface arbitrarily. + wg0 = { + # Determines the IP address and subnet of the server's end of the tunnel interface. + ips = [ "10.100.0.1/24" ]; + + # The port that WireGuard listens to. Must be accessible by the client. + listenPort = 51820; + + # This allows the wireguard server to route your traffic to the internet and hence be like a VPN + # For this to work you have to set the dnsserver IP of your router (or dnsserver of choice) in your clients + postSetup = '' + ${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s 10.100.0.0/24 -o enp0s10 -j MASQUERADE + ''; + + # This undoes the above command + postShutdown = '' + ${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s 10.100.0.0/24 -o enp0s10 -j MASQUERADE + ''; + + # Path to the private key file. + # + # Note: The private key can also be included inline via the privateKey option, + # but this makes the private key world-readable; thus, using privateKeyFile is + # recommended. + privateKeyFile = "/home/ccr/wireguard-keys/private"; + + peers = [ + # List of allowed peers. + { + # Feel free to give a meaning full name + # Public key of the peer (not a file path). + publicKey = "fCwjd75CefC9A7WqO7s3xfOk2nRcoTKfnAzDT6Lc5AA="; + # List of IPs assigned to this peer within the tunnel subnet. Used to configure routing. + allowedIPs = [ "10.100.0.2/32" ]; + } + ]; + }; + }; + security.acme = { acceptTerms = true; email = "andrea.ciceri@autistici.org"; diff --git a/hosts/pc/configuration.nix b/hosts/pc/configuration.nix index b0f448f..eee2191 100644 --- a/hosts/pc/configuration.nix +++ b/hosts/pc/configuration.nix @@ -5,6 +5,8 @@ system.stateVersion = "22.05"; + services.gnome.gnome-keyring.enable = true; # test for VSCode, it works. TODO: move away from here + boot = { initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; initrd.kernelModules = [ ]; @@ -76,14 +78,4 @@ allowPing = true; }; - - services.hydra = { - enable = true; - hydraURL = "http://localhost:3000"; # externally visible URL - notificationSender = "hydra@localhost"; # e-mail of hydra service - # a standalone hydra will require you to unset the buildMachinesFiles list to avoid using a nonexistant /etc/nix/machines - buildMachinesFiles = [ ]; - # you will probably also want, otherwise *everything* will be built from scratch - useSubstitutes = true; - }; } diff --git a/pkgs/emacs/default.nix b/pkgs/emacs/default.nix index b82f8cd..bc81532 100644 --- a/pkgs/emacs/default.nix +++ b/pkgs/emacs/default.nix @@ -24,6 +24,7 @@ emacsWithPackages ( evil-collection evil-tree-edit fira-code-mode + flycheck-status-emoji git-auto-commit-mode go-translate good-scroll @@ -54,6 +55,7 @@ emacsWithPackages ( origami pkgs.emacs28Packages.tree-sitter-langs pkgs.emacs28Packages.tsc + prettier projectile psc-ide psci @@ -61,8 +63,10 @@ emacsWithPackages ( rainbow-delimiters rainbow-identifiers scad-mode + solidity-mode sudo-utils symex + tide tree-edit tree-sitter treemacs @@ -71,6 +75,7 @@ emacsWithPackages ( treemacs-magit treemacs-persp treemacs-projectile + typescript-mode use-package visual-fill-column which-key diff --git a/users/ccr/default.nix b/users/ccr/default.nix index 3969ae9..c7bfa7e 100644 --- a/users/ccr/default.nix +++ b/users/ccr/default.nix @@ -8,6 +8,7 @@ home.packages = with pkgs; [ ack + fx ranger umoria droidcam @@ -20,8 +21,6 @@ gtk_engines gsettings-desktop-schemas lxappearance - yarn - yarn2nix python39Packages.poetry texlive.combined.scheme-full gphoto2 diff --git a/users/profiles/emacs/default.nix b/users/profiles/emacs/default.nix index 742ba3a..1a2b9de 100644 --- a/users/profiles/emacs/default.nix +++ b/users/profiles/emacs/default.nix @@ -47,6 +47,9 @@ poppler_utils python3Full rnix-lsp + nodePackages.typescript-language-server + nodePackages.eslint + nodejs silver-searcher unzip ( @@ -60,7 +63,6 @@ } ) ] ++ (if pkgs.system == "x86_64-linux" then [ - python-language-server ] ++ (with easy-ps; [ ffmpegthumbnailer ]) else [ ]); diff --git a/users/profiles/emacs/emacs.d/config/config-emacs.el b/users/profiles/emacs/emacs.d/config/config-emacs.el index b7b1511..99b35ee 100644 --- a/users/profiles/emacs/emacs.d/config/config-emacs.el +++ b/users/profiles/emacs/emacs.d/config/config-emacs.el @@ -1,3 +1,5 @@ +(envrc-global-mode) + (setq backup-directory-alist `(("." . "~/.saves")) backup-by-copying t delete-old-versions 6 diff --git a/users/profiles/emacs/emacs.d/config/config-nix.el b/users/profiles/emacs/emacs.d/config/config-nix.el index 4151db9..1b14814 100644 --- a/users/profiles/emacs/emacs.d/config/config-nix.el +++ b/users/profiles/emacs/emacs.d/config/config-nix.el @@ -1,6 +1,6 @@ (use-package nix-mode :mode "\\.nix\\'" - :config (setq format-on-save t) + :config (setq format-on-save t) :bind ("" . (lambda () (interactive) (setq format-on-save (not format-on-save)) )) :hook (before-save . (lambda () (when (format-on-save) (lsp-format-buffer))))) diff --git a/users/profiles/emacs/emacs.d/config/config-typescript.el b/users/profiles/emacs/emacs.d/config/config-typescript.el new file mode 100644 index 0000000..7c64cf5 --- /dev/null +++ b/users/profiles/emacs/emacs.d/config/config-typescript.el @@ -0,0 +1,31 @@ +(use-package typescript-mode + :mode "\\.ts\\'") + +(defun setup-tide-mode () + (interactive) + (tide-setup) + (flycheck-mode +1) + (flycheck-status-emoji-mode +1) + + (setq + flycheck-checker 'javascript-eslint + flycheck-check-syntax-automatically '(save mode-enabled)) + (eldoc-mode +1) + (tide-hl-identifier-mode +1) + ;; company is an optional dependency. You have to + ;; install it separately via package-install + ;; `M-x package-install [ret] company` + (company-mode +1)) + +;; aligns annotation to the right hand side +(setq company-tooltip-align-annotations t) + +;; formats the buffer before saving +;;(add-hook 'before-save-hook 'tide-format-before-save) + +;; instead use prettier +(add-hook 'typescript-mode-hook 'prettier-mode) + +(add-hook 'typescript-mode-hook #'setup-tide-mode) + +(provide 'config-typescript) diff --git a/users/profiles/emacs/emacs.d/init.el b/users/profiles/emacs/emacs.d/init.el index 62cd967..acc288b 100644 --- a/users/profiles/emacs/emacs.d/init.el +++ b/users/profiles/emacs/emacs.d/init.el @@ -17,7 +17,9 @@ (require 'config-python) (require 'config-spelling) (require 'config-nix) +(require 'config-typescript) (require 'config-purescript) +(require 'config-solidity) (require 'config-scad) (require 'config-translate) (require 'config-lisp) diff --git a/users/profiles/vscode/default.nix b/users/profiles/vscode/default.nix index 4932c5c..c52cfd0 100644 --- a/users/profiles/vscode/default.nix +++ b/users/profiles/vscode/default.nix @@ -2,35 +2,37 @@ { programs.vscode = { enable = true; + package = pkgs.vscode-fhs; - userSettings = { - "update.channel" = "none"; - "editor" = { - "formatOnSave" = true; - "fontFamily" = "Fira Code"; - "fontLigatures" = true; - }; - "window"."menuBarVisibility" = "classic"; - "[nix]"."editor.tabSize" = 2; - "nix"."enableLanguageServer" = true; - "github.copilot.enable" = { - "*" = true; - }; - }; - extensions = with pkgs.vscode-extensions; [ - eamodio.gitlens - jnoortheen.nix-ide - haskell.haskell - justusadam.language-haskell - #ms-python.python - ]; + # userSettings = { + # "update.channel" = "none"; + # "editor" = { + # "formatOnSave" = true; + # "fontFamily" = "Fira Code"; + # "fontLigatures" = true; + # }; + # "window"."menuBarVisibility" = "classic"; + # "[nix]"."editor.tabSize" = 2; + # "nix"."enableLanguageServer" = true; + # "github.copilot.enable" = { + # "*" = true; + # }; + # }; + # # extensions = with pkgs.vscode-extensions; [ + # # eamodio.gitlens + # # jnoortheen.nix-ide + # # haskell.haskell + # # justusadam.language-haskell + # # #ms-python.python + # # ]; + # }; + +# home.packages = with pkgs; [ +# gnome.gnome-keyring +# stylish-haskell +# ghc +# ] ++ (if pkgs.system == "x86_64-linux" then [ +# haskell-language-server +# ] else [ ]); }; - - home.packages = with pkgs; [ - gnome.gnome-keyring - stylish-haskell - ghc - ] ++ (if pkgs.system == "x86_64-linux" then [ - haskell-language-server - ] else [ ]); }