networking: improve timing when updating
[julm/julm-nix.git] / hosts / oignon.nix
index 762d01eac1456929e6bb7d3d208c3f2ad0d0b2ca..b0951cc7c88d965a877225fbbfe6b1b802528615 100644 (file)
@@ -4,12 +4,11 @@
     ../nixos/profiles/builder.nix
     ../nixos/profiles/debug.nix
     ../nixos/profiles/graphical.nix
+    ../nixos/profiles/irssi.nix
     ../nixos/profiles/lang-fr.nix
     ../nixos/profiles/printing.nix
-    ../nixos/profiles/security.nix
-    ../nixos/profiles/system.nix
+    ../nixos/profiles/radio.nix
     ../nixos/profiles/tor.nix
-    ../nixos/profiles/irssi.nix
     oignon/backup.nix
     oignon/hardware.nix
     oignon/networking.nix
@@ -42,6 +41,7 @@
       "dialout"
       "lp"
       "networkmanager"
+      "plugdev" # For rtl-sdr
       "scanner"
       "tor"
       "video"
       secret-key-files = /run/credentials/nix-daemon.service/${hostName}.key
     '';
     settings = {
-      trusted-users = [ config.users.users."julm".name ];
       substituters = [
         #"http://nix-localcache.losurdo.wg"
         "ssh://nix-ssh@losurdo.wg?priority=30"
       ];
       trusted-public-keys = map lib.readFile [
-        ../hosts/losurdo/nix/key.pub
+        ../users/nix/ssh/losurdo.pub
       ];
     };
     nixPath = lib.mkForce [ "nixpkgs=${inputs.nixpkgs}" ];
 
   services.davfs2.enable = true;
 
+  systemd.automounts = [
+    { where = "/mnt/aubergine"; automountConfig.TimeoutIdleSec = "5 min"; }
+  ];
   fileSystems =
-    # Use the user's gpg-agent session to query
-    # for the password of the SSH key when auto-mounting.
     let
-      sshAsUser = user:
-        pkgs.writeScript "sshAsUser-${user}" ''
-          exec ${pkgs.sudo}/bin/sudo -i -u ${user} \
+      # Use the user's gpg-agent session to query
+      # for the password of the SSH key when auto-mounting.
+      sshAsUser =
+        pkgs.writeScript "sshAsUser" ''
+          user="$1"; shift
+          exec ${pkgs.sudo}/bin/sudo -i -u "$user" \
             ${pkgs.openssh}/bin/ssh "$@"
         '';
       options =
         [
-          "noatime"
-          "noexec"
-          "nosuid"
           "user"
           "uid=julm"
           "gid=users"
           "allow_other"
+          "exec" # Override "user"'s noexec
+          "noatime"
+          "nosuid"
           "_netdev"
-          "ssh_command=${sshAsUser "julm"}" #  "reconnect"
+          "ssh_command=${sshAsUser}\\040julm"
           "noauto"
           "x-gvfs-hide"
           "x-systemd.automount"
           # Disconnect approximately 2*15=30 seconds after a network failure
           "ServerAliveCountMax=1"
           "ServerAliveInterval=15"
+          "dir_cache=no"
+          #"reconnect"
         ];
     in
     {
   ];
 
   services.xserver = {
+    layout = "fr,us(altgr-intl)";
     desktopManager = {
       session = [
         # Let the session be generated by home-manager