diff --git a/profiles/basic/default.nix b/profiles/basic/default.nix index 4d8a8d5..6f4859d 100644 --- a/profiles/basic/default.nix +++ b/profiles/basic/default.nix @@ -37,7 +37,6 @@ ); # Set your time zone. - #time.timeZone = "Europe/Paris"; time.timeZone = "Europe/Paris"; # Configure network proxy if necessary @@ -83,7 +82,7 @@ # networking.firewall.allowedTCPPorts = [ ... ]; # networking.firewall.allowedUDPPorts = [ ... ]; # Or disable the firewall altogether. - # networking.firewall.enable = false; + networking.firewall.enable = false; # Copy the NixOS configuration file and link it from the resulting system # (/run/current-system/configuration.nix). This is useful in case you diff --git a/profiles/basic/email-filters.nix b/profiles/basic/email-filters.nix index 4b9b94a..39debee 100644 --- a/profiles/basic/email-filters.nix +++ b/profiles/basic/email-filters.nix @@ -1,10 +1,10 @@ {config, pkgs, lib, ...}: let - filterToString = (f: + filterToString = (m: f: if builtins.isString f - then "(all addresses,contains,${f})" + then "(${m},contains,${f})" else if builtins.isList f - then "OR "+(lib.strings.concatStringsSep " OR " (builtins.map filterToString f)) + then "OR "+(lib.strings.concatStringsSep " OR " (builtins.map (filterToString m) f)) else builtins.throw "Wrong filter content" ); convertFilters = (filz: builtins.map (fil: { @@ -13,7 +13,7 @@ name = "Moving emails to folder "+fil.folder; action = "Move to folder"; actionValue = "imap://mysaa%40hadoly.fr@imap.hadoly.fr/"+(fil.folderEscaped or fil.folder); - condition = filterToString fil.email; + condition = filterToString (fil.matching or "all addresses") fil.email; }) filz); restFilter = (out: { enabled = true; @@ -29,6 +29,7 @@ email = [ "aliens.discussion@ens-lyon.fr" "aliens.discussion@listes.ens-lyon.fr" + "azertoutes@listes.ens-lyon.fr" ]; } { @@ -74,6 +75,8 @@ "trensistor.diffusion@listes.ens-lyon.fr" "aliens.diffusion@ens-lyon.fr" "aliens.diffusion@listes.ens-lyon.fr" + "bde.foyer.diffusion@ens-lyon.fr" + "bde.foyer.diffusion@listes.ens-lyon.fr" "bde.kfet.diffusion@ens-lyon.fr" "bde.kfet.diffusion@listes.ens-lyon.fr" "as-ensl@ens-lyon.fr" @@ -91,6 +94,12 @@ "discourse+noreply@openstreetmap.fr" "grrrndzero@grrrndzero.org" "info@cinefac.fr" + "arcensiel.diffusion@ens-lyon.fr" + "arcensiel.diffusion@listes.ens-lyon.fr" + "bde.absurde@ens-lyon.fr" + "bde.absurde@listes.ens-lyon.fr" + "presences.diffusion@ens-lyon.fr" + "presences.diffusion@listes.ens-lyon.fr" ]; } { @@ -160,8 +169,17 @@ folderEscaped = "Assos/Mod&AOk-ration"; email = [ "sympa@listes.ens-lyon.fr" + "sympa-request@listes.ens-lyon.fr" ]; } + { + folder = "Assos/Modération"; + folderEscaped = "Assos/Mod&AOk-ration"; + email = [ + "sympa@listes.ens-lyon.fr" + ]; + matching = "\\\"reply-to\\\""; + } { folder = "Assos/tous-spam"; email = [ @@ -225,12 +243,14 @@ "no-reply@accounts.google.com" "notifications@discord.com" "help@acct.epicgames.com" + "no-reply+framateam@framasoft.org" ]; } { folder = "Etudes"; email = [ "types-announce@lists.seas.upenn.edu" + "types-announce@LISTS.SEAS.UPENN.EDU" "categories@mq.edu.au" "ice@framalistes.org" "cashreadinggroup@listes.ens-lyon.fr" diff --git a/profiles/basic/email.nix b/profiles/basic/email.nix index f8c7c58..707a180 100644 --- a/profiles/basic/email.nix +++ b/profiles/basic/email.nix @@ -39,6 +39,7 @@ host = "smtp.ens-lyon.fr"; port = 587; tls.enable = true; + tls.useStartTls = true; }; userName = "savrillo"; }; @@ -138,7 +139,6 @@ userName = "mysaa@e.email"; }; - }; } diff --git a/profiles/basic/locale.nix b/profiles/basic/locale.nix index 50dd686..f7f181b 100644 --- a/profiles/basic/locale.nix +++ b/profiles/basic/locale.nix @@ -8,6 +8,21 @@ { # Select internationalisation properties. i18n.defaultLocale = "en_US.UTF-8"; + # Optionally + i18n.extraLocaleSettings = { + LC_CTYPE = "en_US.UTF8"; + LC_ADDRESS = "fr_FR.UTF-8"; + LC_MEASUREMENT = "fr_FR.UTF-8"; + LC_MESSAGES = "en_US.UTF-8"; + LC_MONETARY = "fr_FR.UTF-8"; + LC_NAME = "fr_FR.UTF-8"; + LC_NUMERIC = "fr_FR.UTF-8"; + LC_PAPER = "fr_FR.UTF-8"; + LC_TELEPHONE = "fr_FR.UTF-8"; + LC_TIME = "fr_FR.UTF-8"; + LC_COLLATE = "fr_FR.UTF-8"; + }; + console.keyMap = "fr-bepo"; i18n.inputMethod = { diff --git a/profiles/basic/ssh.nix b/profiles/basic/ssh.nix index 8a14d4a..a666c67 100644 --- a/profiles/basic/ssh.nix +++ b/profiles/basic/ssh.nix @@ -36,6 +36,16 @@ HostName gitlab.aliens-lyon.fr User savrillo IdentityFile /run/secrets/ssh/savrillo@gitlab.ens-lyon.fr + + Host teapot + HostName teapot.ens-lyon.fr + User enverts + IdentityFile /run/secrets/ssh/enverts@teapot.ens-lyon.fr + + Host gitlab.inria.fr + HostName gitlab.inria.fr + User savrillo + IdentityFile /run/secrets/ssh/savrillo@gitlab.inria.fr ''; }; diff --git a/profiles/graphical/default.nix b/profiles/graphical/default.nix index f5b9ea2..f04601d 100644 --- a/profiles/graphical/default.nix +++ b/profiles/graphical/default.nix @@ -12,6 +12,7 @@ ../basic ./kde.nix ./packages.nix + ./thunderbird.nix ]; # Enable the X11 windowing system. diff --git a/profiles/graphical/packages.nix b/profiles/graphical/packages.nix index 2186733..35de27e 100644 --- a/profiles/graphical/packages.nix +++ b/profiles/graphical/packages.nix @@ -4,6 +4,15 @@ pkgs, ... }: + let + list-replace = l: e: e': + (let i = lib.lists.findFirstIndex (a: a == e) (-1) l; in + if (i == (-1)) then builtins.throw "Could not find item in list" else (lib.lists.take i l ++ [e'] ++ lib.lists.drop (i+1) l)); + dovecot-mysaa = pkgs.dovecot.overrideAttrs { + configureFlags = + list-replace (list-replace pkgs.dovecot.configureFlags "--sysconfdir=/etc" "--sysconfdir=/home/mysaa/.local/etc/") + "--localstatedir=/var" "--localstatedir=/home/mysaa/.local/var"; + }; in { environment.systemPackages = with pkgs; [ @@ -23,7 +32,6 @@ edwinkofler.vscode-hyperupcall-pack-java ]; }) - keepassxc libreoffice #hyphenDicts.fr_FR hyphenDicts.en_US @@ -31,69 +39,13 @@ heroic spotify kdiff3 + pdfarranger + anki-bin # Register addons here (and login to anki-server) ]; programs.steam.enable = true; - home-manager.users.mysaa.accounts.email.accounts = { - "hadoly".thunderbird.enable = true; - "personal".thunderbird.enable = true; - "ens".thunderbird.enable = true; - "junk".thunderbird.enable = true; - "google".thunderbird.enable = true; - "bernard".thunderbird.enable = true; - "dmesures".thunderbird.enable = true; - "ecloud".thunderbird.enable = true; - }; - home-manager.users.mysaa.programs.thunderbird = { - enable = true; - profiles.default = { - isDefault = true; - accountsOrder = [ - "hadoly" - "dmesures" - "bernard" - "ens" - "personal" - "junk" - "ecloud" - "google" - ]; - settings = - { } - // lib.attrsets.concatMapAttrs ( - _: account: - lib.optionalAttrs (account.passwordCommand != null) ( - let - id = builtins.hashString "sha256" account.name; - command = lib.concatStringsSep " " account.passwordCommand; - passwordScript = pkgs.writeShellScript "get-password.sh" '' - echo "Got command $1" >> /tmp/thunderpasswordget - ${command} | ${pkgs.netcat}/bin/nc -w 0 -U $1 - ''; - in - lib.optionalAttrs (account.smtp != null) { - "mail.smtpserver.smtp_${id}.passwordCommand" = toString passwordScript; - } - // lib.optionalAttrs (account.imap != null) { - "mail.server.server_${id}.passwordCommand" = toString passwordScript; - } - ) - ) config.home-manager.users.mysaa.accounts.email.accounts; - }; - }; - -# home-manager.users.mysaa.nixpkgs.overlays = [ -# (final: prev: { -# thunderbird-unwrapped = prev.thunderbird-unwrapped.overrideAttrs { -# patches = (prev.thunderbird-unwrapped.patches or [ ]) ++ [ -# ../../packages/add_passwordcommand_smtp.patch -# ../../packages/add_passwordcommand_imap.patch -# ]; -# }; -# }) -# ]; - + home-manager.users.mysaa.programs.keepassxc.enable = true; home-manager.users.mysaa.programs.keepassxc.settings = { General.NumberOfRememberedLastDatabases = 1; General.UseAtomicSaves = false; @@ -104,4 +56,35 @@ GUI.ShowExpiredEntriesOnDatabaseUnlock = false; PasswordGenerator.Length = 24; }; + + virtualisation.virtualbox.host.enable = true; + users.extraGroups.vboxusers.members = [ "mysaa" ]; + + virtualisation.virtualbox.host.enableKvm = true; + virtualisation.virtualbox.host.addNetworkInterface = false; + + home-manager.users.mysaa.systemd.user.services.heroic-launcher = { + Unit = { + Description = "Launching the heroic game launcher"; + After = "network.target"; + }; + Service = { + Type = "simple"; + ExecStart = "${pkgs.heroic}/bin/heroic"; + }; + }; + + home-manager.users.mysaa.systemd.user.timers.weekly-heroic-launcher = { + Unit = { + Description = "Run the heroic game launcher weekly for downloading the free game"; + }; + Timer = { + OnCalendar = "Mon *-*-* 08:00:00 Europe/Paris"; + Persistent = "true"; + Unit = "heroic-launcher.service"; + }; + Install = { + WantedBy = [ "timers.target" ]; + }; + }; } diff --git a/profiles/graphical/thunderbird.nix b/profiles/graphical/thunderbird.nix new file mode 100644 index 0000000..f320999 --- /dev/null +++ b/profiles/graphical/thunderbird.nix @@ -0,0 +1,118 @@ +{ + config, + lib, + pkgs, + ... +}: + let globox-id = "b446944a47d39ae969ebe27f81cf2d8963df7a04dd40e31e61c7c2ecc1ac7437"; + + in { + home-manager.users.mysaa.accounts.email.accounts = { + "hadoly".thunderbird.enable = true; + "personal".thunderbird.enable = true; + "ens".thunderbird.enable = true; + "junk".thunderbird.enable = true; + "google".thunderbird.enable = true; + "bernard".thunderbird.enable = true; + "dmesures".thunderbird.enable = true; + "ecloud".thunderbird.enable = true; + }; + home-manager.users.mysaa.programs.thunderbird = { + enable = true; + package = pkgs.thunderbird.override { + extraPolicies.ExtensionSettings = { + "localfolder@philoux.eu" = { + install_url = "https://addons.thunderbird.net/user-media/addons/_attachments/90003/localfolders-4.2.2-tb.xpi?filehash=sha256%3A71d499b55b360769447e9f08536ee557b0419e84d5914e79c18558d86a21fbd9"; + installation_mode = "force_installed"; + }; + }; + }; + profiles.default = { + isDefault = true; + accountsOrder = [ + "hadoly" + "dmesures" + "bernard" + "ens" + "account_${globox-id}" + "personal" + "junk" + "ecloud" + "google" + ]; + settings = + { + "mail.account.account_${globox-id}.server" = "server_${globox-id}"; + "mail.server.server_${globox-id}.directory" = "/home/mysaa/Globox"; + #user_pref("mail.server.server1.directory-rel", "[ProfD]../../../Globox"); + "mail.server.server_${globox-id}.hostname" = "globox"; + "mail.server.server_${globox-id}.name" = "globox"; + "mail.server.server_${globox-id}.storeContractID" = "@mozilla.org/msgstore/maildirstore;1"; + "mail.server.server_${globox-id}.type" = "none"; + "mail.server.server_${globox-id}.userName" = "nobody"; + + } + // lib.attrsets.concatMapAttrs ( + _: account: + lib.optionalAttrs (account.passwordCommand != null) ( + let + id = builtins.hashString "sha256" account.name; + command = lib.concatStringsSep " " account.passwordCommand; + passwordScript = pkgs.writeShellScript "get-password.sh" '' + echo "Got command $1" >> /tmp/thunderpasswordget + ${command} | ${pkgs.netcat}/bin/nc -w 0 -U $1 + ''; + in + lib.optionalAttrs (account.smtp != null) { + "mail.smtpserver.smtp_${id}.passwordCommand" = toString passwordScript; + } + // lib.optionalAttrs (account.imap != null) { + "mail.server.server_${id}.passwordCommand" = toString passwordScript; + } + ) + ) config.home-manager.users.mysaa.accounts.email.accounts; + }; + }; + + # home-manager.users.mysaa.nixpkgs.overlays = [ + # (final: prev: { + # thunderbird-unwrapped = prev.thunderbird-unwrapped.overrideAttrs { + # patches = (prev.thunderbird-unwrapped.patches or [ ]) ++ [ + # ../../packages/add_passwordcommand_smtp.patch + # ../../packages/add_passwordcommand_imap.patch + # ]; + # }; + # }) + # ]; + /*security.pam.services.dovecot2 = {}; + services.dovecot2 = { + enable = true; + enablePAM = false; + extraConfig = '' + protocols = imap + auth_mechanisms = plain login + service imap-login { + inet_listener imap { + port = 10143 + address = 127.0.0.1 + } + inet_listener imaps { + port = 10993 + address = 127.0.0.1 + } + } + log_path = /home/mysaa/.local/dovecot.log + passdb { + driver = passwd-file + args = /etc/dovecot-passwd + } + userdb { + driver = passwd + } + mail_location = maildir:/home/mysaa/Globox/:LAYOUT=fs + ''; + }; + environment.etc.dovecot-passwd.text = '' + mysaa:{plain}aaaaa + */ +}