From 7055caa668349092f4636225723ec1ec6c86ccad Mon Sep 17 00:00:00 2001 From: Alexandre LUCAZEAU Date: Tue, 24 May 2022 21:25:16 +0200 Subject: [PATCH] ADD x201 host --- hosts/x201/nixos/configuration.nix | 200 ++++++++++++ hosts/x201/nixos/hardware-configuration.nix | 37 +++ hosts/x201/nixos/scanner.nix | 24 ++ hosts/x201/nixos/services.nix | 64 ++++ hosts/x201/nixos/synergy.nix | 32 ++ hosts/x201/nixpkgs/colorschemes/nord.theme | 9 + hosts/x201/nixpkgs/configs/i3config | 144 +++++++++ hosts/x201/nixpkgs/configs/init.el | 150 +++++++++ hosts/x201/nixpkgs/configs/starship.toml | 103 ++++++ hosts/x201/nixpkgs/emacs.nix | 39 +++ hosts/x201/nixpkgs/git.nix | 35 ++ hosts/x201/nixpkgs/gnupg.nix | 15 + hosts/x201/nixpkgs/home.nix | 23 ++ hosts/x201/nixpkgs/i3status.nix | 51 +++ hosts/x201/nixpkgs/mails.nix | 51 +++ hosts/x201/nixpkgs/mpd.nix | 66 ++++ hosts/x201/nixpkgs/nixpkgs | 1 + hosts/x201/nixpkgs/packages.nix | 33 ++ hosts/x201/nixpkgs/polybar.nix | 341 ++++++++++++++++++++ hosts/x201/nixpkgs/starship.nix | 11 + hosts/x201/nixpkgs/terminalrc | 36 +++ hosts/x201/nixpkgs/variables.nix | 12 + 22 files changed, 1477 insertions(+) create mode 100644 hosts/x201/nixos/configuration.nix create mode 100644 hosts/x201/nixos/hardware-configuration.nix create mode 100644 hosts/x201/nixos/scanner.nix create mode 100644 hosts/x201/nixos/services.nix create mode 100644 hosts/x201/nixos/synergy.nix create mode 100644 hosts/x201/nixpkgs/colorschemes/nord.theme create mode 100644 hosts/x201/nixpkgs/configs/i3config create mode 100644 hosts/x201/nixpkgs/configs/init.el create mode 100644 hosts/x201/nixpkgs/configs/starship.toml create mode 100644 hosts/x201/nixpkgs/emacs.nix create mode 100644 hosts/x201/nixpkgs/git.nix create mode 100644 hosts/x201/nixpkgs/gnupg.nix create mode 100644 hosts/x201/nixpkgs/home.nix create mode 100644 hosts/x201/nixpkgs/i3status.nix create mode 100644 hosts/x201/nixpkgs/mails.nix create mode 100644 hosts/x201/nixpkgs/mpd.nix create mode 120000 hosts/x201/nixpkgs/nixpkgs create mode 100644 hosts/x201/nixpkgs/packages.nix create mode 100644 hosts/x201/nixpkgs/polybar.nix create mode 100644 hosts/x201/nixpkgs/starship.nix create mode 100644 hosts/x201/nixpkgs/terminalrc create mode 100644 hosts/x201/nixpkgs/variables.nix diff --git a/hosts/x201/nixos/configuration.nix b/hosts/x201/nixos/configuration.nix new file mode 100644 index 0000000..769a83f --- /dev/null +++ b/hosts/x201/nixos/configuration.nix @@ -0,0 +1,200 @@ +# 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, lib, pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + + ./hardware-configuration.nix + ./services.nix + ./scanner.nix + ]; + + # Use the GRUB 2 boot loader. + boot.loader.grub.devices = [ "/dev/sda" ]; + boot.loader.grub.enable = true; + boot.loader.grub.version = 2; + boot.loader.grub.enableCryptodisk = true; + boot.loader.supportsInitrdSecrets = true; +# boot.loader.grub.efiSupport = true; + # boot.loader.efi.canTouchEfiVariables = true; + # boot.loader.grub.gfxmodeEfi = "1024x768"; + + # boot.loader.grub.efiSupport = true; + # boot.loader.grub.efiInstallAsRemovable = true; + # boot.loader.efi.efiSysMountPoint = "/boot/efi"; + # Define on which hard drive you want to install Grub. + # boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only + # # Plymouth boot splash screen + boot.plymouth.enable = true; + + # Clear /tmp during boot + boot.cleanTmpDir = true; + boot.initrd.kernelModules = [ "i915" ]; + boot.kernelParams = [ "i915.enable_fbc=1" ]; + # Enable microcode updates for Intel CPU + hardware.cpu.intel.updateMicrocode = true; + # Enable Kernel same-page merging + hardware.ksm.enable = true; + + # Enable all the firmware + hardware.enableAllFirmware = true; + # Enable all the firmware with a license allowing redistribution. (i.e. free firmware and firmware-linux-nonfree) + hardware.enableRedistributableFirmware = true; + + # Enable OpenGL drivers + hardware.opengl.enable = true; + hardware.opengl.extraPackages = with pkgs; [ + vaapiIntel + vaapiVdpau + libvdpau-va-gl + ]; + networking.hostName = "nix201"; # Define your hostname. + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "Europe/Paris"; + + # 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.enp0s25.useDHCP = true; + networking.interfaces.wlp0s29u1u2.useDHCP = true; + networking.interfaces.wlp2s0.useDHCP = true; + + nixpkgs.config.allowUnfree = true; + + networking.firewall.enable = true; + + i18n.defaultLocale = "fr_FR.UTF-8"; + console = { + font = "Lat2-Terminus16"; + keyMap = "fr"; + }; + +fonts = { + fontDir.enable = true; + enableGhostscriptFonts = true; + fonts = with pkgs; [ + corefonts + vistafonts + inconsolata + terminus_font + proggyfonts + dejavu_fonts + font-awesome-ttf + font-awesome + nerdfonts + source-code-pro + source-sans-pro + source-serif-pro + ]; +}; + + + # 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_US.UTF-8"; + # console = { + # font = "Lat2-Terminus16"; + # keyMap = "us"; + # }; + + # Enable the X11 windowing system. + # services.xserver.enable = true; + + + # 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; + + # Enable touchpad support (enabled default in most desktopManager). + services.xserver.libinput.enable = true; + + system.stateVersion = "21.11"; # Did you read the comment? + users = { + #users.ntp.group = "ntp"; + groups.ntp = {}; + defaultUserShell = "/run/current-system/sw/bin/fish"; + extraUsers.alexandre = { + isNormalUser = true; + home = "/home/alexandre"; + description = "alexandre"; + extraGroups = [ "wheel" "networkmanager" "docker" "libvirtd" "scanner" " +lp" ]; + hashedPassword = "$6$7m77oPQxa$W9YnRLo1X2eqztBHwpoH8diHGkBno5O39AMyL9Qm8y8I6uW63H2Nwx4p239OG5zhOxA8J1lZvHTQ3hKPSP9mT/"; + }; + }; + + environment.systemPackages = with pkgs; [ + home-manager + neovim + git + tmux + ncdu + rclone + borgbackup + openssl + lftp + google-fonts + synergy + ]; + + # Define a user account. Don't forget to set a password with ‘passwd’. + # users.users.jane = { + # isNormalUser = true; + # extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. + # }; + + # List packages installed in system profile. To search, run: + # $ nix search wget + # environment.systemPackages = with pkgs; [ + # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + # wget + # firefox + # ]; + + # 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; + services.openssh.permitRootLogin = "no"; + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + networking.firewall.allowedTCPPorts = [ 24800 6600 ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # 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). + + services.fstrim.enable = true; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; +} + diff --git a/hosts/x201/nixos/hardware-configuration.nix b/hosts/x201/nixos/hardware-configuration.nix new file mode 100644 index 0000000..0489da6 --- /dev/null +++ b/hosts/x201/nixos/hardware-configuration.nix @@ -0,0 +1,37 @@ +# 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 = [ "ehci_pci" "ahci" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ "dm-snapshot" ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + boot.initrd.luks.devices = { + "partitions" = { + device = "/dev/sda2"; + preLVM = true; + }; +}; + + + fileSystems."/" = + { device = "/dev/disk/by-uuid/0759e05c-11ab-431a-b0d8-ad33b17ba9f1"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/B51B-EF04"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/x201/nixos/scanner.nix b/hosts/x201/nixos/scanner.nix new file mode 100644 index 0000000..94ba7ec --- /dev/null +++ b/hosts/x201/nixos/scanner.nix @@ -0,0 +1,24 @@ +{ config, lib, pkgs, ... } : { + +# hardware.sane = { +# enable = true; +# dsseries.enable = true; +# }; + + # Allow unfree software for libsane-dsseries only + nixpkgs.config.allowUnfreePredicate = (pkg: builtins.elem (builtins.parseDrvName pkg.pname).name + [ + "libsane-dsseries" + ]); + services.printing.enable = true; + services.printing.drivers = [ pkgs.brlaser ]; + # Enable sane and brscan4 for DSP-7055 + hardware = { + sane = { + enable = true; + brscan4 = { + enable = true; + }; + }; + }; +} diff --git a/hosts/x201/nixos/services.nix b/hosts/x201/nixos/services.nix new file mode 100644 index 0000000..8965865 --- /dev/null +++ b/hosts/x201/nixos/services.nix @@ -0,0 +1,64 @@ +{ config, pkgs, ... }: + +{ + + hardware = { + pulseaudio = { + enable = true; + }; + }; + + # upgrade + + programs = { + fish.enable = true; + ssh = { + setXAuthLocation = true; + forwardX11 = true; + }; + }; + + + # SERVICES + services = { + + clamav = { + daemon.enable = true; + updater.enable = true; + }; + + ntp.enable = true; + tlp.enable = true; + +# udev.extraRules = '' +# ACTION=="remove", ENV{ID_VENDOR_ID}=="1050", ENV{ID_MODEL_ID}=="0407", RUN+="/usr/bin/lockscreen-all" +# ''; + + xserver = { + enable = true; + autorun = true; + #desktopManager.gnome.enable = true; + windowManager.i3.enable = true; + displayManager.defaultSession = "none+i3"; + layout = "fr"; + xkbOptions = "eurosign:e"; + desktopManager = { + xterm.enable = false; + xfce.enable = true; + }; + }; + + }; + + nixpkgs.config = { + + packageOverrides = pkgs: { + polybar = pkgs.polybar.override { + i3Support = true; + pulseSupport = true; + }; + }; + + }; + +} diff --git a/hosts/x201/nixos/synergy.nix b/hosts/x201/nixos/synergy.nix new file mode 100644 index 0000000..43966f6 --- /dev/null +++ b/hosts/x201/nixos/synergy.nix @@ -0,0 +1,32 @@ +{ config, lib, pkgs, ... } : { +services = { +synergy.server = { + enable = true; + screenName = "nix201"; + autoStart = true; +}; +}; +environment.etc."synergy-server.conf" = { text = '' + section: screens + nix201: + Alexos: + HPnix: + end + + section: links + x201: + left = Alexos + right = HPnix + Alexos: + right = nix201 + HPnix: + left = nix201 + end + + section: options + keystroke(alt+left) = switchInDirection(left) + keystroke(alt+right) = switchInDirection(right) + keystroke(shift+control+akt+super) = switchInDirection(nix201) + end + ''; }; +} diff --git a/hosts/x201/nixpkgs/colorschemes/nord.theme b/hosts/x201/nixpkgs/colorschemes/nord.theme new file mode 100644 index 0000000..5bdd426 --- /dev/null +++ b/hosts/x201/nixpkgs/colorschemes/nord.theme @@ -0,0 +1,9 @@ +[Scheme] +Name=Nord +ColorCursor=#D8DEE9 +ColorForeground=#D8DEE9 +ColorBackground=#2E3440 +TabActivityColor=#88C0D0 +ColorPalette=#3B4252;#BF616A;#A3BE8C;#EBCB8B;#81A1C1;#B48EAD;#88C0D0;#E5E9F0;#4C566A;#BF616A;#A3BE8C;#EBCB8B;#81A1C1;#B48EAD;#8FBCBB;#ECEFF4 +ColorBold=#D8DEE9 +ColorBoldUseDefault=FALSE diff --git a/hosts/x201/nixpkgs/configs/i3config b/hosts/x201/nixpkgs/configs/i3config new file mode 100644 index 0000000..f0cf354 --- /dev/null +++ b/hosts/x201/nixpkgs/configs/i3config @@ -0,0 +1,144 @@ +# version : 20220121 + +set $mod Mod4 +set $ALT Mod1 + +# Couleurs barre de titre et contour des fenetres +set $blue #005588 +set $gray1 #484848 +set $gray2 #333333 + +set $ws1 "1: console" +set $ws2 "2: office" +set $ws3 "3: web" + +# Couleur des fenetres avec et sans focus +client.focused $gray1 $gray1 #FFFFFF #333333 +client.focused_inactive $gray2 $gray2 #FFFFFF #000000 +client.unfocused $gray2 $gray2 #FFFFFF #000000 + +# Police de caracteres pour les titres des fenetres. ISO 10646 = Unicode +font pango:Hack 10 + +# wallpaper +exec --no-startup-id feh --bg-scale /home/alexandre/images/SF.jpg + +# Redimensionnement de fenetres +mode "resize" { + bindsym h resize shrink width 10 px or 10 ppt + bindsym j resize grow height 10 px or 10 ppt + bindsym k resize shrink height 10 px or 10 ppt + bindsym l resize grow width 10 px or 10 ppt + + # Retour au mode normal: Enter ou Escape ou q ou ^[ + bindsym Return mode "default" + bindsym q mode "default" + bindsym Escape mode "default" + bindcode Control+34 mode "default" +} +bindsym $mod+s mode "resize" + +# Tue la fenetre avec le focus +bindsym $mod+Shift+A kill + +# split in horizontal orientation +bindsym $mod+h split h + +# split in vertical orientation +bindsym $mod+v split v + +# change container layout (stacked, tabbed, toggle split) +bindsym $mod+p layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+e layout toggle split + +# toggle tiling / floating +bindsym $mod+Shift+space floating toggle +# +# # change focus between tiling / floating windows +bindsym $mod+space focus mode_toggle +# +# # focus the parent container +bindsym $mod+a focus parent +# +# Change la fenetre ayant le focus +bindsym $mod+Shift+Left move left +bindsym $mod+Shift+Down move down +bindsym $mod+Shift+Up move up +bindsym $mod+Shift+Right move right + +# Met la fenetre avec le focus en mode plein écran +bindsym $mod+f fullscreen + +# Deplacement entre les bureaux +bindsym $mod+ampersand workspace $ws1 +bindsym $mod+eacute workspace $ws2 +bindsym $mod+quotedbl workspace $ws3 +bindsym $mod+apostrophe workspace 4 +bindsym $mod+parenleft workspace 5 +bindsym $mod+minus workspace 6 +bindsym $mod+egrave workspace 7 +bindsym $mod+underscore workspace 8 +bindsym $mod+ccedilla workspace 9 +bindsym $mod+agrave workspace 10 + +# Déplacement de la fenetre ayant le focus d'un bureau à l'autre +bindsym $mod+Shift+1 move container to workspace $ws1 +bindsym $mod+Shift+2 move container to workspace $ws2 +bindsym $mod+Shift+3 move container to workspace $ws3 +bindsym $mod+Shift+4 move container to workspace 4 +bindsym $mod+Shift+5 move container to workspace 5 +bindsym $mod+Shift+6 move container to workspace 6 +bindsym $mod+Shift+7 move container to workspace 7 +bindsym $mod+Shift+8 move container to workspace 8 +bindsym $mod+Shift+9 move container to workspace 9 +bindsym $mod+Shift+0 move container to workspace 10 + +# Recharge le fichier de configuration +bindsym $mod+Shift+C reload + +# Redemarre i3 mais concerve ce qui est lancé. Utilisable pour les MAJ +bindsym $mod+Shift+R restart + +# sort d'i3 +bindsym $mod+Shift+E exit + +# lance dmenu (le lanceur de pgm. la barre de dmenu est noir) +bindsym $mod+d exec rofi -show drun -show-icons -modi drun + +# status bar +bar { + font pango:DejaVu Sans Mono, FontAwesome 12 + position top + status_command i3status-rs ~/.config/i3status-rust/config-bottom.toml + colors { + separator #666666 + background #222222 + statusline #dddddd + focused_workspace #0088CC #0088CC #ffffff + active_workspace #333333 #333333 #ffffff + inactive_workspace #333333 #333333 #888888 + urgent_workspace #2f343a #900000 #ffffff + } +} + +# alt+win+l : verouille la session, image de : +bindsym $mod+$ALT+l exec i3lock -ti ~/images/coffee_time.png + +# blocage automatique de l'ecran en cas d'inactivité +exec xautolock -detectsleep -locker 'i3lock -ti ~/images/coffee_time.png' + +# Capture d'ecran +bindsym Print exec scrot -u '%Y-%m-%d-%T_$wx$h_scrot.png' -e 'mv $f ~/Screenshots/' + +# start a terminal +bindsym $mod+Return exec "LIBGL_ALWAYS_SOFTWARE=1 alacritty" +bindsym $mod+m exec "i3-sensible-terminal -e ncmpcpp" + +# Assigne les applications aux workspaces +assign [class="firefox"] $ws3 +assign [class="emacs"] $ws2 + +# programmes au démarrage +exec --no-startup-id nm-applet +exec --no-startup-id nextcloud diff --git a/hosts/x201/nixpkgs/configs/init.el b/hosts/x201/nixpkgs/configs/init.el new file mode 100644 index 0000000..f091402 --- /dev/null +++ b/hosts/x201/nixpkgs/configs/init.el @@ -0,0 +1,150 @@ +;;(scroll-bar-mode -1) +;;(tool-bar-mode -1) +;;(tooltip-mode -1) +;;(menu-bar-mode -1) +(set-fringe-mode 10) +;;(set-face-attribute 'default nil :font "JetBrains Mono" :height 150) +(global-set-key (kbd "C-c c") 'org-capture) +(global-set-key (kbd "C-c a") 'org-agenda) + +(setq disabled-command-function nil) +(setq inhibit-startup-screen t) +(setq visible-bell t) +(setq flycheck-check-syntax-automatically '(mode-enabled save)) + +;; 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"))) + +(setq calendar-week-start-day 1) + +(setq user-full-name "Alexandre LUCAZEAU") +(setq user-mail-address "alexandre@dri.fr") +(setq mail-user-agent 'gnus-user-agent) + +(setq gnus-select-method + '(nnimap "dri" + (nnimap-address "dri.fr") + (nnimap-server-port 143) + (nnimap-stream starttls) + (nnimap-authinfo-file "~/.authinfo.gpg"))) + +(setq gnus-message-archive-group "nnimap+dri:Sent") +(setq gnus-gcc-mark-as-read t) +(setq nnmail-expiry-target "nnimap+dri:Trash") +(setq nnmail-expiry-wait 'immediate) +(setq send-mail-function 'smtpmail-send-it) +(setq message-send-mail-function 'smtpmail-send-it) +(setq smtpmail-smtp-server "dri.fr") +(setq smtpmail-smtp-service 587) +(setq message-citation-line-function 'message-insert-formatted-citation-line) +(setq message-citation-line-format "On %d/%m/%Y %H:%M, %N wrote:") + +(defun default-web-indent-mode () + (setq indent-tabs-mode nil) + (setq tab-width 2) + (setq web-mode-markup-indent-offset 2) + (setq web-mode-css-indent-offset 2) + (setq web-mode-code-indent-offset 2)) + +(use-package doom-themes + :init (load-theme 'doom-nord t) + :init (doom-themes-org-config)) + +(use-package direnv + :config (direnv-mode)) + +(use-package lsp-mode + :config (setq lsp-keymap-prefix "C-c l") + :config (setq lsp-signature-auto-activate t) + :config (setq lsp-enable-on-type-formatting nil) + :config (lsp-enable-which-key-integration t) + :hook (lsp-mode . electric-pair-mode)) + +(use-package web-mode + :mode ("\\.json\\'" . web-mode) + :mode ("\\.html?\\'" . web-mode) + :mode ("\\.s?css\\'" . web-mode) + :mode ("\\.[jt]sx?\\'" . web-mode) + :hook (web-mode . lsp-deferred) + :hook (web-mode . default-web-indent-mode)) + +(use-package nix-mode + :mode ("\\.nix\\'" . nix-mode) + :hook (nix-mode . lsp-deferred)) + +(use-package rust-mode + :hook (rust-mode . lsp-deferred) + :config (setq rust-format-on-save t)) + +(use-package company + :config (setq company-idle-delay 0.25) + :config (setq company-minimum-prefix-length 1) + :bind (:map company-active-map ("" . company-select-next)) + :bind (:map company-active-map ("" . company-select-previous))) + +(use-package yasnippet + :hook (lsp-mode . yas-minor-mode) + :hook (yas-minor-mode . yas-reload-all) + :config (setq yas-snippet-dirs '("/etc/nixos/programs/emacs/snippets"))) + +(use-package prettier-js + :after (web-mode) + :hook (web-mode . prettier-js-mode)) + +(use-package smartparens + :bind ("C-c s s" . sp-splice-sexp) + :bind ("C-c s r" . sp-rewrap-sexp)) + +(use-package bbdb + :init (bbdb-initialize 'gnus 'message) + :init (bbdb-mua-auto-update-init 'gnus 'message) + :config (setq bbdb-file "~/Nextcloud/13_Org/contacts/bbdb") + :config (setq bbdb-mua-auto-update-p 'create)) + +(use-package org + :config + (setq org-agenda-files + "~/Nextcloud/13_Org/agenda.org") + (setq org-refile-use-outline-path 'file) + (setq org-refile-targets + '(("~/Nextcloud/13_Org/DRI.org" :maxlevel . 3) + ("~/Nextcloud/13_Org/perso.org" :level . 1) + ("~/Nextcloud/13_Org/pizajoffre.org" :level . 1))) + (setq org-todo-keywords + '((sequence "TODO(t)" "PENDING(p)" "|" "CANCELLED(c)" "DONE(d)"))) + (setq org-todo-keyword-faces + '(("TODO" . (:foreground "#c678dd" :weight bold)) + ("PENDING" . (:background "#3f444a" :foreground "#ff6c6b" :weight bold)))) + (setq org-capture-templates + '(("i" "Inbox" entry (file "~/Nextcloud/13_Org/DRI.org") "* TODO %i%?") + ("a" "Agenda" entry (file "~/Nextcloud/13_Org/agenda.org") "* TODO %i%?\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+0d\"))"))) + (setq org-agenda-custom-commands + '(("t" "Today" tags-todo "+LEVEL=1+CATEGORY=\"tasks\"|+SCHEDULED<=\"\"|+DEADLINE<=\"\"")))) + +(use-package magit) + +(use-package ledger-mode) + +(use-package projectile + :init (projectile-global-mode) + :config (setq projectile-enable-caching nil) + :config (setq projectile-project-search-path (cddr (directory-files "~/code" t))) + :custom (projectile-completion-system 'ivy) + :bind-keymap ("C-c p" . projectile-command-map)) + +(use-package counsel-projectile + :after (counsel projectile) + :init (counsel-projectile-mode)) + +(use-package which-key + :init (which-key-mode) + :config (setq which-key-idle-delay 0.5)) + +(setq TeX-PDF-mode t) diff --git a/hosts/x201/nixpkgs/configs/starship.toml b/hosts/x201/nixpkgs/configs/starship.toml new file mode 100644 index 0000000..3147666 --- /dev/null +++ b/hosts/x201/nixpkgs/configs/starship.toml @@ -0,0 +1,103 @@ +# _____ __ __ _ +# / ___// /_____ ___________/ /_ (_)___ +# \__ \/ __/ __ `/ ___/ ___/ __ \/ / __ \ +# ___/ / /_/ /_/ / / (__ ) / / / / /_/ / +# /____/\__/\__,_/_/ /____/_/ /_/_/ .___/ +# /_/ + +[directory] +truncation_length = 8 +truncation_symbol = "…/" + +[cmd_duration] +show_milliseconds = true +# format = "took [$duration](bold yellow) " + +[status] +style = "red" +symbol = "💥 " +format = '[\[$symbol$status\]]($style) ' +disabled = false + +[git_branch] +symbol = "🌱 " + +[git_status] +ahead = "⇡🏎💨${count}" +diverged = "⇕⇡😵${ahead_count}⇣${behind_count}" +behind = "⇣😰${count}" +conflicted = "🏳" +untracked = "🤷‍" +stashed = "📦" +modified = "📝" +staged = '[++\($count\)](green)' +renamed = "👅" +deleted = "🗑" + +[battery] +full_symbol = "🔋" +charging_symbol = "⚡️" +discharging_symbol = "💀" + +[[battery.display]] # "bold red" style when capacity is between 0% and 10% +threshold = 10 +style = "bold red" + +[[battery.display]] # "bold yellow" style when capacity is between 10% and 30% +threshold = 30 +style = "bold yellow" + +[[battery.display]] +threshold = 100 +style = "bold green" + +# __ +# / / ____ _____ ____ ___ ______ _____ ____ _____ +# / / / __ `/ __ \/ __ `/ / / / __ `/ __ `/ _ \/ ___/ +# / /___/ /_/ / / / / /_/ / /_/ / /_/ / /_/ / __(__ ) +# /_____/\__,_/_/ /_/\__, /\__,_/\__,_/\__, /\___/____/ +# /____/ /____/ + +[cmake] +#symbol = "C " +symbol = " " + +[dotnet] +format = "[$symbol($version )]($style)" +symbol = "•NET " +#symbol = " " + +[golang] +symbol = "GO " +#symbol = "ﳑ " + +[java] +symbol = "Java " +#symbol = " " + +[nodejs] +format = "via [$symbol]($style)" +#symbol = "NodeJS " +symbol = "JS " +#symbol = " " + +[lua] +symbol = "Lua " +#symbol = " " + +[perl] +symbol = "Perl " + +[python] +symbol = "Py " +#symbol = " " +#symbol = " " + +[ruby] +symbol = "Ruby " +#symbol = " " +#symbol = " " + +[rust] +symbol = "Rs " +#symbol = " " diff --git a/hosts/x201/nixpkgs/emacs.nix b/hosts/x201/nixpkgs/emacs.nix new file mode 100644 index 0000000..456e82f --- /dev/null +++ b/hosts/x201/nixpkgs/emacs.nix @@ -0,0 +1,39 @@ +{ ... }: + +{ + services.emacs.enable = true; + programs.emacs = { + enable = true; + extraPackages = (epkgs: + (with epkgs; [ + use-package + doom-themes + lsp-mode + web-mode + nix-mode + rust-mode + ledger-mode + direnv + company + yasnippet + prettier-js + smartparens + org + magit + bbdb + projectile + ivy + counsel + counsel-projectile + lsp-ivy + which-key + elpaPackages.org + ])); + }; + + home.file = { + ".emacs.d/init.el" = { + source = ./configs/init.el; + }; + }; +} diff --git a/hosts/x201/nixpkgs/git.nix b/hosts/x201/nixpkgs/git.nix new file mode 100644 index 0000000..aafe0a3 --- /dev/null +++ b/hosts/x201/nixpkgs/git.nix @@ -0,0 +1,35 @@ +{ config, pkgs, ... }: +{ + programs.git = { + enable = true; + userEmail = "lucazeau.alexandre@gmail.com"; + userName = "Alexandre LUCAZEAU"; + aliases = { + ignore = "!gi() { curl -sL https://www.toptal.com/developers/gitignore/api/$@ ;}; gi"; + }; + extraConfig = { + "color" = { + "ui" = true; + }; + "init" = { + defaultBranch = "main"; + }; + "color \"diff-highlight\"" = { + oldNormal = "red bold"; + oldHighlight = "red bold 52"; + newNormal = "green bold"; + newHighlight = "green bold 22"; + }; + "color \"diff\"" = { + meta = 11; + frag = "magenta bold"; + commit = "yellow bold"; + old = "red bold"; + new = "green bold"; + whitespace = "red reverse"; + }; + }; + #signing.key = "GPG-KEY-ID"; + #signing.signByDefault = true; + }; +} diff --git a/hosts/x201/nixpkgs/gnupg.nix b/hosts/x201/nixpkgs/gnupg.nix new file mode 100644 index 0000000..7af5dcb --- /dev/null +++ b/hosts/x201/nixpkgs/gnupg.nix @@ -0,0 +1,15 @@ +{ config, pkgs, ... }:{ + home.packages = with pkgs; [ + pass + gnupg + pinentry-curses + ]; + services = { + # lorri.enable = true; + gpg-agent = { + enable = true; + enableSshSupport = true; + pinentryFlavor = "curses"; + }; + }; +} diff --git a/hosts/x201/nixpkgs/home.nix b/hosts/x201/nixpkgs/home.nix new file mode 100644 index 0000000..27cba47 --- /dev/null +++ b/hosts/x201/nixpkgs/home.nix @@ -0,0 +1,23 @@ +{ pkgs, config, ... }: { + imports = [ + ./packages.nix + ./gnupg.nix + ./git.nix + ./variables.nix + ./starship.nix + #./mails.nix + ./mpd.nix + ./emacs.nix + ./i3status.nix + ]; + home.keyboard = { + layout = "fr"; + variant = "bepo"; + }; + xdg.configFile = { + "i3/config".source = ./configs/i3config; + }; +} + +# https://git.0xee.eu/0xee/nix-home/src/commit/b1bffdd8e56e093480c3ba7ed12b0141a4c6f9b1/desktop/polybar-config +#https://raw.githubusercontent.com/Litarvan/nix-litarvan/master/kilin/polybar.nix diff --git a/hosts/x201/nixpkgs/i3status.nix b/hosts/x201/nixpkgs/i3status.nix new file mode 100644 index 0000000..5abb845 --- /dev/null +++ b/hosts/x201/nixpkgs/i3status.nix @@ -0,0 +1,51 @@ +{ config, pkgs, ... }:{ + + programs.i3status-rust = { + enable = true; + bars = { + bottom = { + blocks = [ + { + block = "disk_space"; + path = "/"; + alias = "/"; + info_type = "available"; + unit = "GB"; + interval = 60; + warning = 20.0; + alert = 10.0; + } + { + block = "memory"; + display_type = "memory"; + format_mem = "{mem_used_percents}"; + format_swap = "{swap_used_percents}"; + } + { + block = "cpu"; + interval = 1; + } + { + block = "load"; + interval = 1; + format = "{1m}"; + } + { block = "sound"; } + { + block = "backlight"; + } + { + block = "battery"; + } + { + block = "time"; + interval = 60; + format = "%a %d/%m %R"; + } + ]; + icons = "material-nf"; + theme = "nord-dark"; + }; + }; + }; +} diff --git a/hosts/x201/nixpkgs/mails.nix b/hosts/x201/nixpkgs/mails.nix new file mode 100644 index 0000000..f4e6b1a --- /dev/null +++ b/hosts/x201/nixpkgs/mails.nix @@ -0,0 +1,51 @@ +{ pkgs, ... }: +{ + programs.mbsync.enable = true; + programs.msmtp.enable = true; + programs.notmuch = { + enable = true; + hooks = { + preNew = "mbsync --all"; + }; + }; + accounts.email = { + accounts.dri = { + address = "alexandre@dri.fr"; + gpg = { + key = "464CAA7A718D4CE84F03DFFE8B2EB421411BF613"; + signByDefault = true ; + }; + imap = { + host = "imap.dri.fr"; + tls = { + enable = false; + }; + }; + folders = { + inbox = "INBOX"; + }; + mbsync = { + enable = true; + create = "maildir"; + + }; + msmtp.enable = true; + notmuch.enable = true; + primary = true; + realName = "LUCAZEAU Alexandre"; + userName = "1847_alexandre"; + signature = { + text = '' + Avant Vente + ''; + showsignature = "append"; + }; + password = "JNdMKb05ndM5:\)"; + #passwordCommand = "gpg --quiet --for-your-eyes-only --no-tty --decrypt ~/.password-store/mails.gpg"; + smtp = { + host = "smtp.dri.fr"; + port = 587; + }; + }; + }; +} diff --git a/hosts/x201/nixpkgs/mpd.nix b/hosts/x201/nixpkgs/mpd.nix new file mode 100644 index 0000000..851fd1f --- /dev/null +++ b/hosts/x201/nixpkgs/mpd.nix @@ -0,0 +1,66 @@ +{ config, pkgs, ... }: + +{ + services.mpd = { + enable = true; + musicDirectory = "~/Nextcloud/Musique"; + network.listenAddress = "any"; + extraConfig = '' + zeroconf_enabled "no" + + restore_paused "yes" + replaygain "track" + + audio_output { + type "pulse" + name "pulse" + } + + audio_output { + type "fifo" + name "fifo" + path "${config.services.mpd.dataDir}/fifo" + format "44100:16:2" + } + ''; + }; + + programs.ncmpcpp = { + enable = true; + package = pkgs.ncmpcpp.override { visualizerSupport = true; taglibSupport = false; }; + mpdMusicDir = null; # does not work (not of type `null or path') + settings = { + # Visualizer + visualizer_fifo_path = "${config.services.mpd.dataDir}/fifo"; + visualizer_in_stereo = "yes"; + visualizer_look = "+|"; + visualizer_output_name = "fifo"; + visualizer_sync_interval = "15"; + visualizer_type = "spectrum"; + + # Song list formatting + song_columns_list_format = builtins.concatStringsSep " " [ + "(6f)[green]{NE}" + "(45)[white]{t|f:Title}" + "(20)[]{a}" + "(25)[cyan]{b}" + "(5f)[blue]{P}" + "(7f)[magenta]{l}" + ]; + + # Display lists in column mode by default + browser_display_mode = "columns"; + search_engine_display_mode = "columns"; + + # Faster seeking + seek_time = 5; + + # More modern UI + user_interface = "alternative"; + }; + }; + + home.packages = with pkgs; [ + mpc_cli + ]; +} diff --git a/hosts/x201/nixpkgs/nixpkgs b/hosts/x201/nixpkgs/nixpkgs new file mode 120000 index 0000000..da8a3d7 --- /dev/null +++ b/hosts/x201/nixpkgs/nixpkgs @@ -0,0 +1 @@ +.config/nixpkgs \ No newline at end of file diff --git a/hosts/x201/nixpkgs/packages.nix b/hosts/x201/nixpkgs/packages.nix new file mode 100644 index 0000000..161e8c9 --- /dev/null +++ b/hosts/x201/nixpkgs/packages.nix @@ -0,0 +1,33 @@ +{ pkgs, ... }: { + home.packages = with pkgs; [ + jq + nextcloud-client + libreoffice + htop + neomutt + notmuch + isync + zathura + rofi + rofi-pass + simple-scan + brightnessctl + gimp + scrot + papirus-icon-theme + audio-recorder + starship + inkscape + firefox + poppler_utils + texlive.combined.scheme-full + hugo + eww + polybar + alacritty + youtube-dl + barrier + zola + keepassxc + ]; +} diff --git a/hosts/x201/nixpkgs/polybar.nix b/hosts/x201/nixpkgs/polybar.nix new file mode 100644 index 0000000..0304a81 --- /dev/null +++ b/hosts/x201/nixpkgs/polybar.nix @@ -0,0 +1,341 @@ +{ pkgs, ... }: + +# Created By Aditya Shakya @adi1090x +# Edited and ported to Nix by Litarvan + +let + bg = "#272727"; + fg = "#CACACA"; + ac = "#1E88E5"; + mf = "#383838"; +in + { +# enable = true; + + package = pkgs.polybar.override { + i3GapsSupport = true; + alsaSupport = true; + }; + +# script = '' +# ${pkgs.xorg.xrandr}/bin/xrandr --listactivemonitors | \ +# ${pkgs.gnugrep}/bin/grep -oP '(HDMI\-\d+|eDP\-\d+)' | \ +# ${pkgs.findutils}/bin/xargs -P1 -I{} ${pkgs.bash}/bin/bash -c "MONITOR={} polybar -q -r main" +# ''; + + script = "polybar -q -r main &"; + + config = { + "global/wm" = { + margin-bottom = 0; + margin-top = 0; + }; + + "bar/main" = { +# monitor = "$\{env:MONITOR:}"; + + monitor-strict = false; + override-redirect = false; + + bottom = true; + fixed-center = true; + + width = "100%"; + height = 36; + + offset-x = "0%"; + offset-y = "0%"; + + background = bg; + foreground = fg; + + radius-top = "0.0"; + radius-bottom = "0.0"; + + overline-size = 6; + underline-size = 6; + overline-color = bg; + underline-color = bg; + + border-top-size = 4; + border-color = ac; + + padding = 0; + + module-margin-left = 0; + module-margin-right = 0; + + font-0 = "Termsyn:size=12;2"; + font-1 = "Siji:size=12;2"; + font-2 = "xos4 Terminus:size = 12;1"; + + modules-left = "i3 cpu"; + modules-center = "memory alsa battery backlight"; + modules-right = "network date"; + + spacing = 0; + + dim-value = "1."; + + tray-position = "right"; + tray-detached = false; + tray-maxsize = 16; + tray-background = bg; + tray-offset-x = 0; + tray-offset-y = 0; + tray-padding = 0; + tray-scale = "1.0"; + + enable-ipc = true; + }; + + "settings" = { + throttle-output = 5; + throttle-output-for = 10; + throttle-input-for = 30; + + screenchange-reload = false; + + compositing-background = "source"; + compositing-foreground = "over"; + compositing-overline = "over"; + comppositing-underline = "over"; + compositing-border = "over"; + + pseudo-transparency = "false"; + }; + + "module/alsa" = { + type = "internal/alsa"; + + format-volume = "VOL "; + format-volume-background = mf; + format-volume-underline = bg; + format-volume-overline = bg; + format-volume-padding = 2; + format-volume-margin = 2; + + label-volume = "%percentage%%"; + + format-muted-background = mf; + format-muted-underline = bg; + format-muted-overline = bg; + format-muted-padding = 2; + format-muted-margin = 2; + + label-muted = "MUTED"; + label-muted-foreground = ac; + }; + + "module/backlight" = { + type = "internal/xbacklight"; + + card = "intel_backlight"; # TODO: Better way to fill this + + format = "LGT