diff --git a/modules/utilities/epfl.nix b/modules/utilities/epfl.nix index 81c469f..7f4f137 100644 --- a/modules/utilities/epfl.nix +++ b/modules/utilities/epfl.nix @@ -1,7 +1,8 @@ -_: { +{self, ...}: { flake.nixosModules.epfl = {pkgs, ...}: { environment.systemPackages = with pkgs; [ openconnect + self.packages.${pkgs.system}.custom-mountEpflDrive ]; }; @@ -42,4 +43,27 @@ _: { }; }; }; + perSystem = {pkgs, ...}: { + packages.custom-mountEpflDrive = pkgs.writeShellApplication { + name = "custom-mountEpflDrive"; + runtimeInputs = with pkgs; [ + rclone + libnotify + ]; + text = '' + REMOTE_NAME="epfl" + MOUNT_POINT="$HOME/epfl/drive" + + if rclone listremotes | rg "^''${REMOTE_NAME}:"; then + echo "Mounting ''${REMOTE_NAME}..." + rclone mount "''${REMOTE_NAME}:" "$MOUNT_POINT" --vfs-cache-mode writes --allow-non-empty & + else + notify-send "rclone mount failed" \ + "Remote ''${REMOTE_NAME} not found.\nConfigure rclone and create the dir ~/epfl/drive/ or comment out the exec line in hyprland.lua." + echo "Remote ''${REMOTE_NAME} not found. Configure rclone or comment out the exec line in hyprland.lua." + fi + ''; + }; + }; + } diff --git a/other/hyprland/hyprland.lua b/other/hyprland/hyprland.lua index f57dfa8..d001e2c 100644 --- a/other/hyprland/hyprland.lua +++ b/other/hyprland/hyprland.lua @@ -940,6 +940,7 @@ hl.on("hyprland.start", function() hl.exec_cmd("awww img WALLPAPER/PATH/PLACEHOLDER") hl.exec_cmd("awww-daemon") hl.exec_cmd("custom-checkKdrive && custom-mountkdrive") + hl.exec_cmd("custom-mountEpflDrive") hl.exec_cmd("custom-gitnotify") hl.exec_cmd("sleep 4 & caelestia-shell") hl.exec_cmd("sleep 20 && ngcp pull --automatic")