From ba08007b414a9daba38900adedb4b8b3aa979245 Mon Sep 17 00:00:00 2001 From: Julien Malka Date: Tue, 21 Nov 2023 11:21:51 +0100 Subject: [PATCH 1/8] print setup --- machines/telecom/default.nix | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/machines/telecom/default.nix b/machines/telecom/default.nix index eafac48..0d173be 100644 --- a/machines/telecom/default.nix +++ b/machines/telecom/default.nix @@ -137,7 +137,25 @@ texlive.combined.scheme-full ]; - services.printing.enable = true; + services.printing = { + enable = true; + extraConf = '' + JobPrivateAccess all + JobPrivateValues none + ''; + clientConf = '' + ServerName localhost + Encryption Required + User jmalka + ''; + + }; + + environment.variables = + { + CUPS_USER = "jmalka"; + }; + services.avahi.enable = true; services.avahi.nssmdns = true; # for a WiFi printer From 9937d9cdb3e038182c47444befec0cc78f617e2f Mon Sep 17 00:00:00 2001 From: Julien Malka Date: Tue, 21 Nov 2023 13:56:43 +0100 Subject: [PATCH 2/8] git: more sensible config --- home-manager-modules/git/default.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/home-manager-modules/git/default.nix b/home-manager-modules/git/default.nix index 5a34d15..98217f4 100644 --- a/home-manager-modules/git/default.nix +++ b/home-manager-modules/git/default.nix @@ -17,7 +17,13 @@ with lib; signByDefault = true; key = "6FC74C847011FD83"; }; - extraConfig.init.defaultBranch = "main"; + extraConfig = { + init.defaultBranch = "main"; + diff.colorMoved = "zebra"; + pull.rebase = true; + fetch.prune = true; + rebase.autoStash = true; + }; }; home.extraActivationPath = [ pkgs.gnupg ]; From 1d1bfd4336060d5964da98def907ce2ac7dfa331 Mon Sep 17 00:00:00 2001 From: Julien Malka Date: Wed, 22 Nov 2023 18:09:11 +0100 Subject: [PATCH 3/8] change shell to zsh --- home-manager-modules/zsh/default.nix | 183 +++++++++++++++++++++++++++ machines/telecom/home-julien.nix | 6 +- users/default.nix | 4 +- users/julien.nix | 2 +- users/status.nix | 1 - 5 files changed, 187 insertions(+), 9 deletions(-) create mode 100644 home-manager-modules/zsh/default.nix diff --git a/home-manager-modules/zsh/default.nix b/home-manager-modules/zsh/default.nix new file mode 100644 index 0000000..98ef9b6 --- /dev/null +++ b/home-manager-modules/zsh/default.nix @@ -0,0 +1,183 @@ +{ config, pkgs, lib, ... }: +let + cfg = config.luj.programs.zsh; + fetchFromGitHub = pkgs.fetchFromGitHub; +in +with lib; +{ + options.luj.programs.zsh = { + enable = mkEnableOption "Enable Zsh"; + }; + + config = mkIf cfg.enable { + + programs.zsh = { + enable = true; + enableCompletion = true; + enableAutosuggestions = true; + history = { save = 1000000; extended = true; ignoreDups = true; }; + initExtra = '' + setopt notify autopushd + unsetopt autocd beep + ZSH_AUTOSUGGEST_STRATEGY=(completion history) + ''; + + shellAliases = { + + ka = "killall"; + mkd = "mkdir -pv"; + + ca = "khal interactive"; + sync_ca = "vsync sync"; + + dnd = "dunstctl set-paused true"; + nodnd = "dunstctl set-paused false"; + + lg = "lazygit"; + g = "git"; + gua = "git remote | xargs -L1 git push --all"; + + v = "$EDITOR"; + sdn = "shutdown now"; + + SU = "systemctl --user"; + SS = "sudo systemctl"; + + + weather = "curl wttr.in"; + v6 = "curl api6.ipify.org"; + v4 = "curl api.ipify.org"; + clbin = "curl -F'clbin=<-' https://clbin.com"; + _0x0 = "curl -F'file=@-' https://0x0.st"; + + phs = "python -m http.server"; + + ls = "eza"; + + rtmv = "rsync -avP"; + archive = "rsync --remove-source-files -avPzz"; + + luks_integrity_check = "gocryptfs -fsck -extpass 'pass Private/LUKS' /boot/luks"; + + fetch-emails = "mbsync --all && notmuch new && afew -t -n -v"; + + nsp = "nix-shell -p"; + ns = "nix-shell"; + + ncg = "sudo nix-collect-garbage --delete-older-than 30d"; + ncga = "sudo nix-collect-garbage -d"; + nso = "sudo nix-store --optimise"; + + lln = "NIX_PATH=\"nixpkgs=$LOCAL_NIXPKGS_CHECKOUT\""; + # Local build + lnb = "NIX_PATH=\"nixpkgs=$LOCAL_NIXPKGS_CHECKOUT\" nom-build '' --no-out-link -A $1"; + # Local shell + lns = "NIX_PATH=\"nixpkgs=$LOCAL_NIXPKGS_CHECKOUT\" nix-shell -p $1"; + # Local test + ltt = ''NIX_PATH=\"nixpkgs=$LOCAL_NIXPKGS_CHECKOUT\" nom-build --no-out-link "$LOCAL_NIXPKGS_CHECKOUT/nixos/tests/$1"''; + }; + + dirHashes = { + config = "/home/julien/dev/nix-config"; + }; + plugins = [ + { + name = "history-search-multi-word"; + src = fetchFromGitHub { + repo = "history-search-multi-word"; + owner = "zdharma-continuum"; + rev = "458e75c16db72596e4d7c6a45619dec285ebdcd7"; + sha256 = "sha256-6B8uoKJm3gWmufsnLJzLEdSm1tQasrs2fUmS0pDsdMw="; + }; + } + { + name = "git-aliases"; + src = fetchFromGitHub { + repo = "git-aliases"; + owner = "mdumitru"; + rev = "c4cfe2cf5cf59a3da6bf3b735a20921a2c06c58d"; + sha256 = "sha256-640qGgVeFaTIQBgYGY05/4wzMCxni0uWLWtByEFM2tE="; + }; + } + { + name = "zsh-bitwarden"; + src = fetchFromGitHub { + repo = "zsh-bitwarden"; + owner = "Game4Move78"; + rev = "8b32434d18765fe95ffc2191f5fb68100d913de7"; + sha256 = "sha256-3zuutTUSdf218+jcn2z7yEGMYkg5VewXm9zO43aIYdI="; + }; + } + { + name = "alias-tips"; + src = fetchFromGitHub { + repo = "alias-tips"; + owner = "djui"; + rev = "4d2cf6f10e5080f3273be06b9801e1fd1f25d28d"; + sha256 = "sha256-0N2DCpMraIXtEc7hMp0OBANNuYhHPLqzJ/hrAFcLma8="; + }; + } + { + name = "auto-notify"; + src = fetchFromGitHub { + repo = "zsh-auto-notify"; + owner = "MichaelAquilina"; + rev = "fb38802d331408e2ebc8e6745fb8e50356344aa4"; + sha256 = "sha256-bY0qLX5Kpt2x4KnfvXjYK2+BhR3zKBgGsCvIxSzApws="; + }; + } + { + name = "nix-shell"; + src = fetchFromGitHub { + repo = "zsh-nix-shell"; + owner = "chisui"; + rev = "f8574f27e1d7772629c9509b2116d504798fe30a"; + sha256 = "sha256-WNa8RljYhkOWk7AZbdTOvYhWw1fR8PjFxH/tnUCbems="; + }; + } + { + name = "syntax-highlighting"; + src = fetchFromGitHub { + repo = "zsh-syntax-highlighting"; + owner = "zsh-users"; + rev = "bb27265aeeb0a22fb77f1275118a5edba260ec47"; + sha256 = "sha256-bD0oKXSw9lucJR+6/O16m7prwA1cP36C0Tvh5mklapw="; + }; + } + { + name = "jq"; + src = fetchFromGitHub { + repo = "jq-zsh-plugin"; + owner = "reegnz"; + rev = "98650d6eac46b5f87aa19f0a3dd321b0105643b8"; + sha256 = "sha256-L2+PW39BZTy8h4yxxZxbKCVVKlfPruM12gRZ9FJ8YD8="; + }; + } + ]; + }; + + # Broot + programs.broot = { + enable = true; + enableZshIntegration = true; + }; + + # Direnv: must have. + programs.direnv = { + enable = true; + enableZshIntegration = true; + nix-direnv.enable = true; + }; + + programs.oh-my-posh = { + enable = true; + enableZshIntegration = true; + useTheme = "catppuccin_mocha"; + }; + + # Misc + programs.lesspipe.enable = true; + + home.packages = with pkgs; [ eza python3 libnotify ]; + }; +} diff --git a/machines/telecom/home-julien.nix b/machines/telecom/home-julien.nix index 0e639e5..c09aef3 100644 --- a/machines/telecom/home-julien.nix +++ b/machines/telecom/home-julien.nix @@ -13,6 +13,7 @@ luj.programs.waybar.enable = true; luj.programs.waybar.interfaceName = "enp0s13f0u1u4u4"; luj.programs.kitty.enable = true; + luj.programs.zsh.enable = true; luj.emails.enable = true; programs.rofi = { @@ -22,11 +23,6 @@ theme = "DarkBlue"; }; - programs.direnv = { - enable = true; - enableFishIntegration = true; - nix-direnv.enable = true; - }; home.pointerCursor = { name = "Adwaita"; diff --git a/users/default.nix b/users/default.nix index 293de80..a84bcb0 100644 --- a/users/default.nix +++ b/users/default.nix @@ -1,10 +1,10 @@ { config, pkgs, lib, ... }: { users.mutableUsers = false; - users.defaultUserShell = pkgs.fish; + users.defaultUserShell = pkgs.zsh; sops.secrets.user-root-password.neededForUsers = true; - programs.fish.enable = true; + programs.zsh.enable = true; users.users.root = { uid = config.ids.uids.root; diff --git a/users/julien.nix b/users/julien.nix index eb520c8..4fa1c9c 100644 --- a/users/julien.nix +++ b/users/julien.nix @@ -6,7 +6,7 @@ isNormalUser = true; home = "/home/julien"; extraGroups = [ "wheel" config.users.groups.keys.name "filerun" "networkmanager" "davfs2" "adbusers" "audio" ]; - shell = pkgs.fish; + shell = pkgs.zsh; passwordFile = config.sops.secrets.user-julien-password.path; }; diff --git a/users/status.nix b/users/status.nix index 2a961e8..b374a64 100644 --- a/users/status.nix +++ b/users/status.nix @@ -4,7 +4,6 @@ isNormalUser = true; home = "/home/status"; extraGroups = [ "wheel" ]; - shell = pkgs.fish; openssh.authorizedKeys.keyFiles = [ (pkgs.fetchurl { url = "https://github.com/JulienMalka.keys"; From 0f869ded2d33ef3dbcdea9c216b45e5e626471f7 Mon Sep 17 00:00:00 2001 From: Julien Malka Date: Wed, 22 Nov 2023 18:09:30 +0100 Subject: [PATCH 4/8] add dunst theme --- home-manager-modules/dunst/default.nix | 44 ++++++++++++++++++++++++++ machines/telecom/home-julien.nix | 4 +-- 2 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 home-manager-modules/dunst/default.nix diff --git a/home-manager-modules/dunst/default.nix b/home-manager-modules/dunst/default.nix new file mode 100644 index 0000000..0693e8f --- /dev/null +++ b/home-manager-modules/dunst/default.nix @@ -0,0 +1,44 @@ +{ config, pkgs, lib, ... }: +let + cfg = config.luj.programs.dunst; +in +with lib; +{ + options.luj.programs.dunst = { + enable = mkEnableOption "Enable Dunst"; + }; + + config = mkIf cfg.enable { + + services.dunst = { + enable = true; + settings = { + global = { + corner_radius = 5; + follow = "mouse"; + frame_color = "#89B4FA"; + frame_width = 0; + separator_color = "frame"; + }; + + urgency_low = { + background = "#1E1E2E"; + foreground = "#CDD6F4"; + }; + urgency_normal = { + background = "#1E1E2E"; + foreground = "#CDD6F4"; + }; + + urgency_critical = { + background = "#1E1E2E"; + foreground = "#CDD6F4"; + frame_color = "#FAB387"; + }; + + }; + + }; + }; + +} diff --git a/machines/telecom/home-julien.nix b/machines/telecom/home-julien.nix index c09aef3..7f0e667 100644 --- a/machines/telecom/home-julien.nix +++ b/machines/telecom/home-julien.nix @@ -13,6 +13,7 @@ luj.programs.waybar.enable = true; luj.programs.waybar.interfaceName = "enp0s13f0u1u4u4"; luj.programs.kitty.enable = true; + luj.programs.dunst.enable = true; luj.programs.zsh.enable = true; luj.emails.enable = true; @@ -89,9 +90,6 @@ layout = "fr"; }; - services.dunst = { - enable = true; - }; programs.chromium = { enable = true; From de15bd0f10e0aae2cac0c3383a6659e9fd17ef7c Mon Sep 17 00:00:00 2001 From: Julien Malka Date: Wed, 22 Nov 2023 18:09:39 +0100 Subject: [PATCH 5/8] improved git config --- home-manager-modules/git/default.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/home-manager-modules/git/default.nix b/home-manager-modules/git/default.nix index 98217f4..4b19f26 100644 --- a/home-manager-modules/git/default.nix +++ b/home-manager-modules/git/default.nix @@ -17,12 +17,17 @@ with lib; signByDefault = true; key = "6FC74C847011FD83"; }; + delta.enable = true; + ignores = [ + ".direnv" + ]; extraConfig = { init.defaultBranch = "main"; diff.colorMoved = "zebra"; pull.rebase = true; fetch.prune = true; rebase.autoStash = true; + push.autoSetupRemote = true; }; }; From adefc610e9ce143ba2cd7692134563c4fdf8bcb2 Mon Sep 17 00:00:00 2001 From: Julien Malka Date: Wed, 22 Nov 2023 18:10:14 +0100 Subject: [PATCH 6/8] telecom: init syncthings --- machines/telecom/default.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/machines/telecom/default.nix b/machines/telecom/default.nix index 0d173be..6effc70 100644 --- a/machines/telecom/default.nix +++ b/machines/telecom/default.nix @@ -128,6 +128,26 @@ hardware.bluetooth.enable = true; + services.syncthing = { + enable = true; + user = "julien"; + group = "users"; + settings.options.urAccepted = -1; + overrideDevices = true; + overrideFolders = true; + devices = { + "tower" = { id = "XEPZZIP-GX73OKE-KNGZA47-XWWGI5G-LNXPU57-BMLXK5M-VNGS5UQ-ZFIZSAK"; }; + }; + folders = { + "dev" = { + path = "/home/julien/dev"; + devices = [ "tower" ]; + }; + }; + }; + + systemd.services.syncthing.serviceConfig.StateDirectory = "syncthing"; + environment.systemPackages = with pkgs; [ tailscale brightnessctl From edc755ef1363830086156f22a37a3d098db58070 Mon Sep 17 00:00:00 2001 From: Julien Malka Date: Wed, 22 Nov 2023 18:10:35 +0100 Subject: [PATCH 7/8] mails: notifications + waybar --- home-manager-modules/mails/default.nix | 9 ++++++++- home-manager-modules/mails/neomuttrc | 8 ++++++++ home-manager-modules/mails/notifymuch | 6 ++++++ home-manager-modules/waybar/default.nix | 9 +++++++-- 4 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 home-manager-modules/mails/notifymuch diff --git a/home-manager-modules/mails/default.nix b/home-manager-modules/mails/default.nix index 6a66024..f12fba7 100644 --- a/home-manager-modules/mails/default.nix +++ b/home-manager-modules/mails/default.nix @@ -132,13 +132,19 @@ with lib; #julien.malka@telecom-paris.fr - notmuch tag +telecom-inbox path:telecom/Inbox/** + notmuch tag +telecom-inbox -- folder:telecom/Inbox + notmuch tag +telecom-gdr-gpl -- folder:telecom/Inbox/gdr-gpl + notmuch tag +telecom-gdr-sec -- folder:telecom/Inbox/gdr-sec + notmuch tag +telecom-infres-tous -- folder:telecom/Inbox/infres-tous + notmuch tag +telecom-tous -- folder:telecom/Inbox/telecom-tous #luj@dgnum.eu notmuch tag +dgnum-inbox path:dgnum/Inbox/** notmuch tag +dgnum-bureau -dgnum-inbox -- path:dgnum/Inbox/Bureau/** notmuch tag +dgnum-nixcon -dgnum-inbox -- path:dgnum/Inbox/NixCon/** + ${pkgs.notifymuch}/bin/notifymuch + ''; }; @@ -150,6 +156,7 @@ with lib; "neomutt/work.profile".source = lib.mkForce ./work.profile; "neomutt/discourse.profile".source = lib.mkForce ./discourse.profile; "neomutt/dgnum.profile".source = lib.mkForce ./dgnum.profile; + "notifymuch/notifymuch.cfg".source = lib.mkForce ./notifymuch; }; diff --git a/home-manager-modules/mails/neomuttrc b/home-manager-modules/mails/neomuttrc index 729f93c..fcd1926 100644 --- a/home-manager-modules/mails/neomuttrc +++ b/home-manager-modules/mails/neomuttrc @@ -45,6 +45,10 @@ virtual-mailboxes "kfet" "notmuch://?query=tag:ens-kfet named-mailboxes "---telecom---" =sep3 virtual-mailboxes "inbox" "notmuch://?query=tag:telecom-inbox +virtual-mailboxes "gdr-gpl" "notmuch://?query=tag:telecom-gdr-gpl +virtual-mailboxes "gdr-sec" "notmuch://?query=tag:telecom-gdr-sec +virtual-mailboxes "tous" "notmuch://?query=tag:telecom-tous +virtual-mailboxes "infres-tous" "notmuch://?query=tag:telecom-infres-tous named-mailboxes "----dgnum----" =sep4 virtual-mailboxes "inbox" "notmuch://?query=tag:dgnum-inbox @@ -92,6 +96,10 @@ folder-hook "ens-dg" 'source ~/.config/neomutt/ens.profile' folder-hook "ens-kfet" 'source ~/.config/neomutt/ens.profile' folder-hook "telecom-inbox" 'source ~/.config/neomutt/telecom.profile' +folder-hook "telecom-gdr-gpl" 'source ~/.config/neomutt/telecom.profile' +folder-hook "telecom-gdr-sec" 'source ~/.config/neomutt/telecom.profile' +folder-hook "telecom-infres-tous" 'source ~/.config/neomutt/telecom.profile' +folder-hook "telecom-tous" 'source ~/.config/neomutt/telecom.profile' folder-hook "work-nixos-discourse" 'source ~/.config/neomutt/discourse.profile' folder-hook "work-dn42" 'source ~/.config/neomutt/work.profile' diff --git a/home-manager-modules/mails/notifymuch b/home-manager-modules/mails/notifymuch new file mode 100644 index 0000000..428a2a8 --- /dev/null +++ b/home-manager-modules/mails/notifymuch @@ -0,0 +1,6 @@ +[notifymuch] +query = is:unread and (tag:work-inbox or tag:ens-inbox or tag:telecom-inbox or tag:dgnum-inbox or tag:dgnum-bureau) +mail_client = kitty -x neomutt -y +recency_interval_hours = 48 +hidden_tags = inbox unread attachment replied sent encrypted signed + diff --git a/home-manager-modules/waybar/default.nix b/home-manager-modules/waybar/default.nix index 02e7482..fbc273d 100644 --- a/home-manager-modules/waybar/default.nix +++ b/home-manager-modules/waybar/default.nix @@ -20,7 +20,7 @@ with lib; layer = "top"; modules-left = [ "custom/nixos" "sway/workspaces" ]; modules-center = [ "clock" ]; - modules-right = [ "network" "battery" ]; + modules-right = [ "custom/mails" "network" "battery" ]; "custom/nixos" = { format = " ❄ "; tooltip = false; @@ -67,6 +67,11 @@ with lib; format-charging = " {capacity}%"; tooltip = false; }; + "custom/mails" = { + format = " {}"; + exec = "${pkgs.notmuch}/bin/notmuch count 'tag:unread and (tag:dgnum-inbox or tag:ens-inbox or tag:work-inbox or tag:telecom-inbox or tag:dgnum-bureau)'"; + interval = 10; + }; }; }; style = '' @@ -114,7 +119,7 @@ with lib; color: #cba6f7; } - #clock, #backlight, #pulseaudio, #bluetooth, #network, #battery{ + #clock, #backlight, #pulseaudio, #bluetooth, #network, #battery, #custom-mails{ border-radius: 10px; background-color: #11111b; color: #cdd6f4; From 1174098be73e421ed3173c6632cbe2c81524c136 Mon Sep 17 00:00:00 2001 From: Julien Malka Date: Wed, 22 Nov 2023 18:11:16 +0100 Subject: [PATCH 8/8] machines: telecom -> fischer --- machines/{telecom => fischer}/default.nix | 2 +- machines/{telecom => fischer}/hardware.nix | 0 machines/{telecom => fischer}/home-julien.nix | 0 machines/{telecom => fischer}/root.jwe | 0 machines/{telecom => fischer}/wallpaper.jpg | Bin 5 files changed, 1 insertion(+), 1 deletion(-) rename machines/{telecom => fischer}/default.nix (99%) rename machines/{telecom => fischer}/hardware.nix (100%) rename machines/{telecom => fischer}/home-julien.nix (100%) rename machines/{telecom => fischer}/root.jwe (100%) rename machines/{telecom => fischer}/wallpaper.jpg (100%) diff --git a/machines/telecom/default.nix b/machines/fischer/default.nix similarity index 99% rename from machines/telecom/default.nix rename to machines/fischer/default.nix index 6effc70..3b24893 100644 --- a/machines/telecom/default.nix +++ b/machines/fischer/default.nix @@ -37,7 +37,7 @@ }; - networking.hostName = "telecom"; + networking.hostName = "fischer"; networking.wireless.enable = false; diff --git a/machines/telecom/hardware.nix b/machines/fischer/hardware.nix similarity index 100% rename from machines/telecom/hardware.nix rename to machines/fischer/hardware.nix diff --git a/machines/telecom/home-julien.nix b/machines/fischer/home-julien.nix similarity index 100% rename from machines/telecom/home-julien.nix rename to machines/fischer/home-julien.nix diff --git a/machines/telecom/root.jwe b/machines/fischer/root.jwe similarity index 100% rename from machines/telecom/root.jwe rename to machines/fischer/root.jwe diff --git a/machines/telecom/wallpaper.jpg b/machines/fischer/wallpaper.jpg similarity index 100% rename from machines/telecom/wallpaper.jpg rename to machines/fischer/wallpaper.jpg