- `wireguard` for `hs`
- gnome keyring for VSCode to make Copilot work
- uninstalled local `Hydra` on `pc`
- VSCode -> VSCodeFHS
- Emacs
  - typescript
  - solidity
  - envrc mode
This commit is contained in:
Andrea Ciceri 2022-06-26 12:35:43 +02:00
parent 3668e2d3d0
commit 0ee819715f
No known key found for this signature in database
GPG key ID: A1FC89532D1C5654
10 changed files with 127 additions and 47 deletions

View file

@ -204,10 +204,10 @@
recommendedTlsSettings = true; recommendedTlsSettings = true;
clientMaxBodySize = "10G"; # max file size for uploads clientMaxBodySize = "10G"; # max file size for uploads
commonHttpConfig = '' commonHttpConfig = ''
log_format upstream_time '$remote_addr - $remote_user [$time_local] ' log_format upstream_time '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent ' '"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"' '"$http_referer" "$http_user_agent"'
'rt=$request_time uct="$upstream_connect_time" uht="$upstream_header_time" urt="$upstream_response_time"'; 'rt=$request_time uct="$upstream_connect_time" uht="$upstream_header_time" urt="$upstream_response_time"';
''; '';
virtualHosts = { virtualHosts = {
"torrent.ccr.ydns.eu" = { "torrent.ccr.ydns.eu" = {
@ -314,9 +314,54 @@
allowedUDPPorts = [ allowedUDPPorts = [
137 # samba 137 # samba
138 # 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 = { security.acme = {
acceptTerms = true; acceptTerms = true;
email = "andrea.ciceri@autistici.org"; email = "andrea.ciceri@autistici.org";

View file

@ -5,6 +5,8 @@
system.stateVersion = "22.05"; system.stateVersion = "22.05";
services.gnome.gnome-keyring.enable = true; # test for VSCode, it works. TODO: move away from here
boot = { boot = {
initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
initrd.kernelModules = [ ]; initrd.kernelModules = [ ];
@ -76,14 +78,4 @@
allowPing = true; 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;
};
} }

View file

@ -24,6 +24,7 @@ emacsWithPackages (
evil-collection evil-collection
evil-tree-edit evil-tree-edit
fira-code-mode fira-code-mode
flycheck-status-emoji
git-auto-commit-mode git-auto-commit-mode
go-translate go-translate
good-scroll good-scroll
@ -54,6 +55,7 @@ emacsWithPackages (
origami origami
pkgs.emacs28Packages.tree-sitter-langs pkgs.emacs28Packages.tree-sitter-langs
pkgs.emacs28Packages.tsc pkgs.emacs28Packages.tsc
prettier
projectile projectile
psc-ide psc-ide
psci psci
@ -61,8 +63,10 @@ emacsWithPackages (
rainbow-delimiters rainbow-delimiters
rainbow-identifiers rainbow-identifiers
scad-mode scad-mode
solidity-mode
sudo-utils sudo-utils
symex symex
tide
tree-edit tree-edit
tree-sitter tree-sitter
treemacs treemacs
@ -71,6 +75,7 @@ emacsWithPackages (
treemacs-magit treemacs-magit
treemacs-persp treemacs-persp
treemacs-projectile treemacs-projectile
typescript-mode
use-package use-package
visual-fill-column visual-fill-column
which-key which-key

View file

@ -8,6 +8,7 @@
home.packages = with pkgs; [ home.packages = with pkgs; [
ack ack
fx
ranger ranger
umoria umoria
droidcam droidcam
@ -20,8 +21,6 @@
gtk_engines gtk_engines
gsettings-desktop-schemas gsettings-desktop-schemas
lxappearance lxappearance
yarn
yarn2nix
python39Packages.poetry python39Packages.poetry
texlive.combined.scheme-full texlive.combined.scheme-full
gphoto2 gphoto2

View file

@ -47,6 +47,9 @@
poppler_utils poppler_utils
python3Full python3Full
rnix-lsp rnix-lsp
nodePackages.typescript-language-server
nodePackages.eslint
nodejs
silver-searcher silver-searcher
unzip unzip
( (
@ -60,7 +63,6 @@
} }
) )
] ++ (if pkgs.system == "x86_64-linux" then [ ] ++ (if pkgs.system == "x86_64-linux" then [
python-language-server
] ++ (with easy-ps; [ ] ++ (with easy-ps; [
ffmpegthumbnailer ffmpegthumbnailer
]) else [ ]); ]) else [ ]);

View file

@ -1,3 +1,5 @@
(envrc-global-mode)
(setq backup-directory-alist `(("." . "~/.saves")) (setq backup-directory-alist `(("." . "~/.saves"))
backup-by-copying t backup-by-copying t
delete-old-versions 6 delete-old-versions 6

View file

@ -1,6 +1,6 @@
(use-package nix-mode (use-package nix-mode
:mode "\\.nix\\'" :mode "\\.nix\\'"
:config (setq format-on-save t) :config (setq format-on-save t)
:bind ("<f8>" . (lambda () (interactive) (setq format-on-save (not format-on-save)) )) :bind ("<f8>" . (lambda () (interactive) (setq format-on-save (not format-on-save)) ))
:hook :hook
(before-save . (lambda () (when (format-on-save) (lsp-format-buffer))))) (before-save . (lambda () (when (format-on-save) (lsp-format-buffer)))))

View file

@ -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)

View file

@ -17,7 +17,9 @@
(require 'config-python) (require 'config-python)
(require 'config-spelling) (require 'config-spelling)
(require 'config-nix) (require 'config-nix)
(require 'config-typescript)
(require 'config-purescript) (require 'config-purescript)
(require 'config-solidity)
(require 'config-scad) (require 'config-scad)
(require 'config-translate) (require 'config-translate)
(require 'config-lisp) (require 'config-lisp)

View file

@ -2,35 +2,37 @@
{ {
programs.vscode = { programs.vscode = {
enable = true; enable = true;
package = pkgs.vscode-fhs;
userSettings = { # userSettings = {
"update.channel" = "none"; # "update.channel" = "none";
"editor" = { # "editor" = {
"formatOnSave" = true; # "formatOnSave" = true;
"fontFamily" = "Fira Code"; # "fontFamily" = "Fira Code";
"fontLigatures" = true; # "fontLigatures" = true;
}; # };
"window"."menuBarVisibility" = "classic"; # "window"."menuBarVisibility" = "classic";
"[nix]"."editor.tabSize" = 2; # "[nix]"."editor.tabSize" = 2;
"nix"."enableLanguageServer" = true; # "nix"."enableLanguageServer" = true;
"github.copilot.enable" = { # "github.copilot.enable" = {
"*" = true; # "*" = true;
}; # };
}; # };
extensions = with pkgs.vscode-extensions; [ # # extensions = with pkgs.vscode-extensions; [
eamodio.gitlens # # eamodio.gitlens
jnoortheen.nix-ide # # jnoortheen.nix-ide
haskell.haskell # # haskell.haskell
justusadam.language-haskell # # justusadam.language-haskell
#ms-python.python # # #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 [ ]);
} }