FIX : error repo

This commit is contained in:
Alexandre LUCAZEAU 2023-07-15 19:07:55 +02:00
parent 200afd51b1
commit 2eca5e8af4
15 changed files with 729 additions and 0 deletions

29
modules/common.nix Normal file
View File

@ -0,0 +1,29 @@
{ config, pkgs, ...}:
{
#environment.variables.EDITOR = "nvim";
environment.systemPackages = with pkgs; [
gitAndTools.gitFull
unzip
zip
tmux
lshw
bc
#neovim
ncdu
nixos-option
bat
procs
plocate
lsd
age
lsd
htop
];
# Nix Garbage Collector
nix.gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
}

216
modules/configs/init.el Normal file
View File

@ -0,0 +1,216 @@
;; Keyboard-centric user interface
(setq inhibit-startup-message t)
(scroll-bar-mode -1)
(tool-bar-mode -1)
(menu-bar-mode -1)
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
;; Comment/uncomment this line to enable MELPA Stable if desired. See `package-archive-priorities`
;; and `package-pinned-packages`. Most users will not need or want to do this.
;;(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
(package-initialize)
(column-number-mode 't) ; show current column in status bar
(add-hook 'text-mode-hook 'turn-on-auto-fill)
(set-fringe-mode 10)
;; Use 4 spaces for one tab visually.
(setq tab-width 4)
(show-paren-mode t) ; highlight matching open and close parentheses
(global-hl-line-mode) ; highlight current line
(global-visual-line-mode t) ; wrap long lines
(setq split-window-preferred-function
'visual-fill-column-split-window-sensibly) ; wrap at window boundary
(global-whitespace-mode) ; enable whitespace handling by default
(setq
whitespace-style ; see (apropos 'whitespace-style)
'(face ; viz via faces
trailing ; trailing blanks visualized
lines-tail ; lines beyond whitespace-line-column visualized
space-before-tab
space-after-tab
newline ; lines with only blanks visualized
indentation ; spaces used for indent when config wants tabs
empty ; empty lines at beginning or end or buffer
)
whitespace-line-column 150) ; column at which whitespace-mode says the line is too long
;;(set-face-attribute 'default nil :font "JetBrains Mono" :height 150)
;; themes
(use-package doom-themes
:init (load-theme 'doom-nord t)
:init (doom-themes-org-config))
(setq disabled-command-function nil)
(setq inhibit-startup-screen t)
(setq visible-bell t)
;; Only y/n answers
(defalias 'yes-or-no-p 'y-or-n-p)
;; Save what you enter into minibuffer prompts
(setq history-length 25)
(savehist-mode 1)
;; Remember and restore the last cursor location of opened files
(save-place-mode 1)
;; Backup
(setq version-control t ;; Use version numbers for backups.
kept-new-versions 10 ;; Number of newest versions to keep.
kept-old-versions 0 ;; Number of oldest versions to keep.
delete-old-versions t ;; Don't ask to delete excess backup versions.
backup-by-copying t) ;; Copy all files, don't rename them.
(setq vc-make-backup-files t)
(setq backup-directory-alist '(("" . "~/.emacs.d/backup")))
(defvar emacs-autosave-directory
(concat user-emacs-directory "autosaves/")
"This variable dictates where to put auto saves. It is set to a
directory called autosaves located wherever your .emacs.d/ is
located.")
;; Sets all files to be backed up and auto saved in a single directory.
(setq backup-directory-alist
`((".*" . ,emacs-autosave-directory))
auto-save-file-name-transforms
`((".*" ,emacs-autosave-directory t)))
(setq calendar-week-start-day 1)
(use-package nix-mode
:mode ("\\.nix\\'" . nix-mode)
:hook (nix-mode . lsp-deferred))
(use-package magit)
(setq magit-fetch-modules-jobs 16); fetch 16 modules in parallel
(use-package which-key
:init (which-key-mode)
:config (setq which-key-idle-delay 0.5))
(autoload 'markdown-mode "markdown-mode"
"Major mode for editing Markdown files" t)
(add-to-list 'auto-mode-alist
'("\\.\\(?:md\\|markdown\\|mkd\\|mdown\\|mkdn\\|mdwn\\)\\'" . markdown-mode))
(autoload 'gfm-mode "markdown-mode"
"Major mode for editing GitHub Flavored Markdown files" t)
(add-to-list 'auto-mode-alist '("README\\.md\\'" . gfm-mode))
;; org-mode
(require 'org)
(require 'org-mouse)
(setq org-startup-folded t
org-pretty-entities t
org-hide-emphasis-markers t
org-startup-with-inline-images t
org-agenda-include-deadlines t
org-image-actual-width '(300))
;; files with ".org" open in org-mode
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
(setq org-agenda-files '("/home/alexandre/Nextcloud/PRIVE/13_Org/backlog.org" "/home/alexandre/Nextcloud/PRIVE/13_Org/notes"))
(setq org-directory (concat (getenv "HOME") "/Nextcloud/PRIVE/13_Org/notes"))
(setq org-default-notes-file "~/Nextcloud/PRIVE/13_Org/backlog.org")
(setq org-todo-keywords '((type "TODO" "En cours" "WAIT" "CANCELED" "DONE")))
(setf org-todo-keyword-faces '(("TODO" . (:foreground "cyan" :background "steelblue" :bold t :weight bold))
("En cours" . (:foreground "yellow" :background "red" :bold t :weight bold))
("En attente de réponse" . (:foreground "yellow" :background "magenta2" :bold t :weight bold))
("CANCELED" . (:foreground "gray" :background "dime grey" :bold t :weight bold))
("DONE" . (:foreground "gray50" :background "gray30"))))
;; tags
(setq org-tag-alist '(("DEVIS" . ?d) ("PROJETS" . ?p) ("CLIENT" . ?c) ("PROSPECT" . ?o) ("INTERNE" . ?i) ("AO" . ?a) ("PJ" . ?z) ("AVV" . ?v) ("LEGACY" . ?l) ("ROC" . ?r)))
(setq org-tag-faces
'(
("DEVIS" . (:foreground "OrangeRed" :weight bold))
("ROC" . (:foreground "OrangeRed" :weight bold))
("PJ" . (:foreground "brightyellow" :weight bold))
("PROJET" . (:foreground "IndianRed1" :weight bold))
("INTERNE" . (:foreground "LimeGreen" :weight bold))
("LEGACY" . (:foreground "LimeGreen" :weight bold))
("CLIENT" . (:foreground "Orange" :weight bold))
("PROSPECT" . (:foreground "MediumPurple3" :weight bold))
("AO" . (:foreground "HotPink2" :weight bold))
)
)
;; org-capture use to add note to backlog file. At the end of day, use org-refile to dispatch to good note
;; https://sachachua.com/blog/2014/11/using-org-mode-keep-process-journal/
(setq org-capture-templates
'(("t" "TODO" entry (file+datetree "~/Nextcloud/PRIVE/13_Org/backlog.org")
"* TODO %? %^G \n %U" :empty-lines 1)
("s" "Scheduled TODO" entry (file+datetree "~/Nextcloud/PRIVE/13_Org/backlog.org")
"* TODO %? %^G \nSCHEDULED: %^t\n %U" :empty-lines 1)
("l" "Link" entry (file "~/Nextcloud/PRIVE/13_Org/backlog.org")
"* TODO %a %? %^G\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n")
("j" "Journal entry" plain
(file+datetree+prompt "~/Nextcloud/PRIVE/13_Org/journal.org")
"%K ****** %a\n%i\n%?\n")
("n" "Note dans le journal" entry (file "~/Nextcloud/PRIVE/13_Org/journal.org")
"* %? %^G\n%U" :empty-lines 1)))
;; Org-Roam basic configuration
(use-package org-roam
:after org
:init
(setq org-roam-v2-ack t) ;; Acknowledge V2 upgrade
:custom
(org-roam-directory (file-truename org-directory))
(org-roam-completion-everywhere t)
:bind (("C-c n l" . org-roam-buffer-toggle)
("C-c n f" . org-roam-node-find)
("C-c n o" . org-open-at-point)
("C-c n j" . org-roam-dailies-capture-today)
("C-c n i" . org-roam-node-insert))
:config
(org-roam-setup)
(org-roam-db-autosync-mode)
)
;; caldav
;;(setq org-caldav-url "https://next20.produhost.net/remote.php/dav/alexandre")
;;(setq org-caldav-calendars
;; '((:calendar-id "alexandre-dri"
;; :files ("~/Nextcloud/PRIVE/13_Org/calendar/alexandre-dri.org")
;; :inbox "~/Nextcloud/PRIVE/13_Org/calendar/alexandre-dri-inbox.org")))
;;(setq org-icalendar-include-todo 'all
;; org-caldav-sync-todo t)
;;
(use-package org-journal
:ensure t
:defer t
:init
;; Change default prefix key; needs to be set before loading org-journal
(setq org-journal-prefix-key "C-c j ")
:config
(setq org-journal-file-type=weekly
org-journal-date-format "%A, %d %B %Y"))
;;;; Index org file and backlog file
(defvar org-gtd-file "~/Nextcloud/PRIVE/13_Org/DRI.org")
(defvar org-backlog-file "~/Nextcloud/PRIVE/13_Org/backlog.org")
;; Open DRI.org when I hit C-c g
(defun gtd ()
"Open the GTD file."
(interactive)
(find-file org-gtd-file))
;; Open backlog.org when I hit file hit C-c b
(defun gtb ()
"Open the backlog file."
(interactive)
(find-file org-backlog-file))
;; keybinding
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cg" 'gtd)
(global-set-key "\C-cb" 'gtb)

View File

@ -0,0 +1,44 @@
[General]
clientVersion=3.6.4git
confirmExternalStorage=false
crashReporter=true
monoIcons=false
newBigFolderSizeLimit=500
optionalServerNotifications=true
showCallNotifications=true
updateSegment=67
useNewBigFolderSizeLimit=false
[Accounts]
0\Folders\1\ignoreHiddenFiles=false
0\Folders\1\journalPath=.sync_70e356a9188d.db
0\Folders\1\localPath=/home/alexandre/Nextcloud/PRIVE/
0\Folders\1\paused=false
0\Folders\1\targetPath=/
0\Folders\1\version=2
0\Folders\1\virtualFilesMode=off
0\authType=webflow
0\dav_user=alexandre
0\serverVersion=25.0.1.1
0\url=https://next.atlanticaweb.fr
0\user=@Invalid()
0\version=1
0\webflow_user=alexandre
1\Folders\3\ignoreHiddenFiles=false
1\Folders\3\journalPath=.sync_214037720ec4.db
1\Folders\3\localPath=/home/alexandre/Nextcloud/DRI/
1\Folders\3\paused=false
1\Folders\3\targetPath=/
1\Folders\3\version=2
1\Folders\3\virtualFilesMode=off
1\authType=webflow
1\dav_user=alexandre
1\serverVersion=26.0.2.1
1\url=https://next20.produhost.net
1\user=@Invalid()
1\version=1
1\webflow_user=alexandre
version=2
[Settings]
geometry="@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\x3=\0\0\0\xab\0\0\x5\xd4\0\0\x3\x1f\0\0\x3?\0\0\0\xab\0\0\x5\xd2\0\0\x3\x1d\0\0\0\0\0\0\0\0\a\x80\0\0\x3?\0\0\0\xab\0\0\x5\xd2\0\0\x3\x1d)"

50
modules/emacs.nix Normal file
View File

@ -0,0 +1,50 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
multimarkdown
];
services.emacs.enable = true;
programs.emacs = {
enable = true;
extraPackages = (epkgs:
(with epkgs; [
use-package
dash
doom-themes
lsp-mode
web-mode
nix-mode
rust-mode
ledger-mode
direnv
company
yasnippet
prettier-js
smartparens
org
org-journal
org-roam
org-msg
org-caldav
magit
evil
bbdb
projectile
flycheck
ivy
counsel
counsel-projectile
lsp-ivy
which-key
elpaPackages.org
markdown-mode
]));
};
home.file = {
".emacs.d/init.el" = {
source = ./configs/init.el;
};
};
}

22
modules/gitea.nix Normal file
View File

@ -0,0 +1,22 @@
{ config, pkgs, lib, ... }:
{
services.gitea = {
enable = true; # Enable Gitea
appName = "git.atlanticaweb.fr"; # Give the site a name
database = {
type = "sqlite3"; # Database type
};
settings.server = {
ROOT_URL = "https://git.atlanticaweb.fr/"; # Root web URL
HTTP_PORT = 3001; # Provided unique port
DOMAIN = "git.atlanticaweb.fr"; # Domain name
};
dump.enable = true;
dump.backupDir = "/srv/backup/gitea";
lfs.enable = true;
settings.service.DISABLEREGISTRATION = true; # comment this line for the first user admin
};
}

142
modules/grafana.nix Normal file
View File

@ -0,0 +1,142 @@
{ config, pkgs, ...}:
let
caddyDir = "/var/lib/caddy";
in
{
services.grafana = {
enable = true;
settings.server = {
domain = "sup.atlanticaweb.fr";
http_port = 2342;
http_addr = "192.168.10.108";
};
};
services.prometheus = {
enable = true;
port = 9001;
exporters = {
node = {
enable = true;
enabledCollectors = [ "systemd" ];
port = 9002;
};
};
scrapeConfigs = [
{
job_name = "sup";
static_configs = [{
targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.node.port}" ];
}];
}
{
job_name = "nextcloud";
static_configs = [{
targets = [ "192.168.10.114:${toString config.services.prometheus.exporters.node.port}" ];
}];
}
{
job_name = "pizzajoffre";
static_configs = [{
targets = [ "37.187.103.8:${toString config.services.prometheus.exporters.node.port}" ];
}];
}
{
job_name = "pve-exporter";
static_configs = [{
targets = [ "192.168.10.112:9221" ];
}];
metrics_path = "/pve" ;
}
{
job_name = "backup";
static_configs = [{
targets = [ "163.172.80.106:${toString config.services.prometheus.exporters.node.port}" ];
}];
}
{
job_name = "dell-5590";
static_configs = [{
targets = [ "192.168.10.100:${toString config.services.prometheus.exporters.node.port}" ];
}];
}
{
job_name = "temperatures";
static_configs = [{
targets = [ "192.168.10.116:9521" ];
}];
metric_relabel_configs = [
{
source_labels = [ "device" ];
target_label = "device";
regex = "c9:5e:c5:16:23:4d" ;
replacement = "I";
}
{
source_labels = [ "device" ];
target_label = "device";
regex = "e4:9b:e7:3f:b1:24" ;
replacement = "J Perso";
}
{
source_labels = [ "device" ];
target_label = "device";
regex = "ff:a4:06:f3:18:5e" ;
replacement = "H - réserve ";
}
{
source_labels = [ "device" ];
target_label = "device";
regex = "f7:69:1d:2f:f9:6a" ;
replacement = "G - gris";
}
{
source_labels = [ "device" ];
target_label = "device";
regex = "fd:7c:46:30:5b:18" ;
replacement = "E - Table";
}
{
source_labels = [ "device" ];
target_label = "device";
regex = "e7:ef:27:89:c4:05" ;
replacement = "A CODIGEL";
}
{
source_labels = [ "device" ];
target_label = "device";
regex = "d4:1e:62:36:d0:4b" ;
replacement = "B - INFRICO";
}
{
source_labels = [ "device" ];
target_label = "device";
regex = "ec:c3:0f:ef:fe:b5" ;
replacement = "C";
}
{
source_labels = [ "device" ];
target_label = "device";
regex = "f5:fd:dd:c4:29:c1" ;
replacement = "D - HAIER";
}
{
source_labels = [ "device" ];
target_label = "device";
regex = "c8:8e:34:24:2c:89" ;
replacement = "F - salle";
}
];
}
];
};
users.users.caddy = {
group = "caddy";
uid = config.ids.uids.caddy;
home = caddyDir;
createHome = true;
extraGroups = [ "users" ];
};
users.groups.caddy.gid = config.ids.uids.caddy;
}

12
modules/navidrome.nix Normal file
View File

@ -0,0 +1,12 @@
{ config, pkgs, lib, ... }:
{
services.navidrome = {
enable = true;
settings = {
MusicFolder = "/var/lib/nextcloud/data/alexandre/files/Musique/";
Address = "0.0.0.0";
Port = "4533";
};
};
}

15
modules/neovim.nix Normal file
View File

@ -0,0 +1,15 @@
{ pkgs, ... }: {
programs.neovim = {
enable = true ;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
plugins = with pkgs.vimPlugins;[
nvim-lspconfig
nvim-treesitter.withAllGrammars
plenary-nvim
gruvbox-material
mini-nvim
];
};
}

View File

@ -0,0 +1,12 @@
{ config, pkgs, lib, ... }:
{
services.prometheus = {
exporters = {
node = {
enable = true;
enabledCollectors = [ "systemd" ];
port = 9002;
};
};
};
}

42
modules/rest-server.nix Normal file
View File

@ -0,0 +1,42 @@
{ lib, config, pkgs, ... }:
let
caddyDir = "/var/lib/caddy";
in
{
services.restic.server = {
enable = true;
extraFlags = [ "--no-auth" ];
dataDir = "/var/lib/backup";
prometheus = true;
listenAddress = "127.0.0.1:8080";
};
networking = {
firewall.enable = true;
firewall.allowedTCPPorts = [ 80 443 ];
};
services.caddy = {
enable = true;
email = "lucazeau.alexandre@gmail.com";
config = ''
{
storage file_system {
root ${caddyDir}
}
}
https://back.atlanticaweb.fr {
reverse_proxy http://127.0.0.1:8080
}
'';
};
users.users.caddy = {
group = "caddy";
uid = config.ids.uids.caddy;
home = caddyDir;
createHome = true;
extraGroups = [ "users" ];
};
users.groups.caddy.gid = config.ids.uids.caddy;
}

10
modules/rust.nix Normal file
View File

@ -0,0 +1,10 @@
{ config, pkgs, ...}:
with import <nixpkgs> {};
{
home.packages = [
pkgs.gcc
pkgs.rustc
pkgs.cargo
pkgs.cargo-edit
];
}

13
modules/smtp.nix Normal file
View File

@ -0,0 +1,13 @@
{
programs.msmtp = {
enable = true;
accounts.default = {
auth = true;
tls = true;
host = "ssl0.ovh.net";
from = "supervision@pizzajoff.re";
user = "supervision@pizzajoff.re";
passwordeval = "cat /tmp/fic";
};
};
}

66
modules/tmux.nix Normal file
View File

@ -0,0 +1,66 @@
{ pkgs, config, ... }:
{
programs.tmux = {
enable = true;
shortcut = "b";
# aggressiveResize = true; -- Disabled to be iTerm-friendly
baseIndex = 1;
# newSession = true;
# Stop tmux+escape craziness.
escapeTime = 0;
secureSocket = true;
plugins = with pkgs; [
tmuxPlugins.better-mouse-mode
tmuxPlugins.sidebar
tmuxPlugins.nord
];
extraConfig = ''
# scrollback size
set -g history-limit 50000
# https://old.reddit.com/r/tmux/comments/mesrci/tmux_2_doesnt_seem_to_use_256_colors/
set -g default-terminal "xterm-256color"
set -ga terminal-overrides ",*256col*:Tc"
set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q'
set-environment -g COLORTERM "truecolor"
# Mouse works as expected
set-option -g mouse on
# Redraw the client (if interrupted by wall, etc)
bind R refresh-client
# reload tmux config with ctrl + b + r
unbind r
bind r \
source-file ~/.tmux.conf \;\
display 'Reloaded tmux config.'
# C + control q to kill sessio
unbind q
unbind C-q
bind-key q kill-session
bind-key C-q kill-session
# Switching panes with alt
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Visual Activity Monitoring between windows
setw -g monitor-activity on
set -g visual-activity on
# Show tmux positions in titles
set -g set-titles on
# Attach to a session if runs otherwise create a new one
new-session -n DRI
'';
};
# programs.tmate = {
# enable = true;
# FIXME: This causes tmate to hang.
# extraConfig = config.xdg.configFile."tmux/tmux.conf".text;
# };
}

15
modules/transmission.nix Normal file
View File

@ -0,0 +1,15 @@
{ config, pkgs, lib, ... }:
{
services.transmission = {
enable = true;
openFirewall = true;
openRPCPort = true;
settings = {
rpc-bind-address = "0.0.0.0";
rpc-whitelist = "192.168.10.*";
rpc-whitelist-enable = true;
};
};
#networking.firewall.allowedTCPPorts = [ 9091 ];
}

41
modules/users.nix Normal file
View File

@ -0,0 +1,41 @@
{ config, pkgs, ...}:
{
users = {
groups = {
alexandre = {};
};
users = {
alexandre = {
isNormalUser = true;
createHome = true;
home = "/home/alexandre";
description = "Alexandre LUCAZEAU";
extraGroups = [ "wheel" "docker" "plocate" ];
group = "alexandre";
shell = pkgs.fish;
openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKUA1RW6JwZasspAp8qmFRFnlV5WXjhLfStAAkM+KYLv lucazeau.alexandre@gmail.com" ];
};
};
};
programs.git = {
enable = true;
config.user.email = "lucazeau.alexandre@gmail.com";
config.user.name = "Alexandre LUCAZEAU";
config.init.defaultBranch = "main";
config.core.sshCommand = "ssh -i ~/.ssh/id_ed25519-perso";
};
programs.fish.enable = true;
programs.fish.shellAliases = {
ll = "ls -l";
ls = "lsd";
# vi = "nvim";
# vim = "nvim";
};
security.sudo = {
enable = true;
execWheelOnly = true;
extraRules = [
{ users = [ "alexandre" ]; commands = [ { command = "ALL"; options = [ "NOPASSWD" ]; } ]; }
];
};
}