Skip to content

Commit 52073df

Browse files
committed
updates
1 parent 9a4f3ba commit 52073df

File tree

5 files changed

+55
-38
lines changed

5 files changed

+55
-38
lines changed

flake.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
];
149149
extraSpecialArgs = { username = "vagrant"; };
150150
};
151-
151+
152152
# Standalone home-manager configuration for EC2
153153
homeConfigurations.ec2 = home-manager.lib.homeManagerConfiguration {
154154
pkgs = nixpkgsWithOverlays "aarch64-linux";
@@ -160,9 +160,9 @@
160160
homeDirectory = "/home/ubuntu";
161161
stateVersion = "23.11";
162162
};
163-
163+
164164
nixpkgs.config.allowUnfree = true;
165-
165+
166166
# Explicitly specify nix.package for home-manager
167167
nix = {
168168
package = nixpkgs.legacyPackages.aarch64-linux.nix;

systems/aarch64-darwin/homebrew.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
homebrew = {
55
enable = true;
66
taps = [ "FelixKratz/formulae" "hashicorp/tap" ];
7-
brews = [ "mas" "dockutil" "pre-commit" ];
7+
brews = [ "mas" "dockutil" "pre-commit" "rclone" ];
88
casks = [
99
# Security & Password Management
1010
"1password"

systems/aarch64-linux/default.nix

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@
44
imports = [ ./home.nix ];
55

66
# VM-specific packages
7-
environment.systemPackages = with pkgs; [
8-
curl
9-
wget
10-
fuse
11-
fuse3
12-
];
7+
environment.systemPackages = with pkgs; [ curl wget fuse fuse3 ];
138

149
# Environment variables
1510
environment.variables = {
@@ -60,7 +55,7 @@
6055
extraGroups = [ "docker" "fuse" ];
6156
shell = pkgs.zsh;
6257
};
63-
58+
6459
# Add fuse modules explicitly to ensure they're available
6560
boot.supportedFilesystems = [ "fuse" ];
6661
boot.kernelModules = [ "fuse" ];

systems/aarch64-linux/ec2.nix

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@
33
{
44
# EC2-specific configuration
55
# This will override or extend the base vagrant configuration
6-
6+
77
# Additional packages specific to EC2 environment
8-
home.packages = with pkgs; [
9-
awscli2
10-
amazon-ecr-credential-helper
11-
];
12-
8+
home.packages = with pkgs; [ awscli2 amazon-ecr-credential-helper ];
9+
1310
# EC2-specific Git configuration
1411
programs.git.extraConfig = {
1512
credential.helper = "!aws --profile dev codecommit credential-helper $@";

systems/aarch64-linux/rclone.nix

Lines changed: 46 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,35 @@
1212
executable = true;
1313
text = ''
1414
#!/bin/bash
15-
15+
16+
# Backup existing config if present
17+
if [ -f "$HOME/.config/rclone/rclone.conf" ]; then
18+
cp "$HOME/.config/rclone/rclone.conf" "$HOME/.config/rclone/rclone.conf.backup-$(date +%Y%m%d%H%M%S)"
19+
fi
20+
21+
# Check if rclone configuration exists
22+
if [ ! -f "$HOME/.config/rclone/rclone.conf" ]; then
23+
echo "Error: No rclone configuration found at $HOME/.config/rclone/rclone.conf"
24+
echo "Please run 'rclone config' to set up your Google Drive remote before mounting."
25+
exit 1
26+
fi
27+
28+
# Check if gdrive remote exists
29+
if ! rclone listremotes | grep -q "^gdrive:$"; then
30+
echo "Error: No 'gdrive:' remote found in rclone configuration."
31+
echo "Please run 'rclone config' to set up your Google Drive remote before mounting."
32+
exit 1
33+
fi
34+
1635
# Stop any existing rclone processes
1736
pkill -f "rclone mount gdrive:" 2>/dev/null || true
18-
37+
1938
# Create mount directory in /vagrant
2039
mkdir -p $HOME/google-drive
21-
40+
2241
# Create a local cache directory for better performance
2342
mkdir -p $HOME/.cache/rclone
24-
43+
2544
# Mount with highly optimized settings for better performance
2645
rclone mount gdrive: $HOME/google-drive \
2746
--daemon \
@@ -49,7 +68,7 @@
4968
--stats 0 \
5069
--log-level INFO \
5170
--log-file=$HOME/rclone-gdrive.log
52-
71+
5372
echo "Google Drive mounted at $HOME/google-drive with optimized settings"
5473
'';
5574
};
@@ -68,25 +87,22 @@
6887
ExecStop = "${config.home.homeDirectory}/.bin/unmount-gdrive";
6988
Restart = "on-failure";
7089
RestartSec = "30s";
71-
Environment = [
72-
"PATH=${lib.makeBinPath [pkgs.rclone pkgs.fuse pkgs.coreutils]}"
73-
];
90+
Environment =
91+
[ "PATH=${lib.makeBinPath [ pkgs.rclone pkgs.fuse pkgs.coreutils ]}" ];
7492
};
7593

76-
Install = {
77-
WantedBy = ["default.target"];
78-
};
94+
Install = { WantedBy = [ "default.target" ]; };
7995
};
8096

8197
# Create unmount script
8298
home.file.".bin/unmount-gdrive" = {
8399
executable = true;
84100
text = ''
85101
#!/bin/bash
86-
102+
87103
# Unmount Google Drive (from home directory)
88104
fusermount -u $HOME/google-drive
89-
105+
90106
echo "Google Drive unmounted"
91107
'';
92108
};
@@ -96,15 +112,13 @@
96112
executable = true;
97113
text = ''
98114
#!/bin/bash
99-
100-
if pgrep -f "rclone mount gdrive:" > /dev/null; then
115+
116+
# First check the mount point directly - most reliable method
117+
if mountpoint -q "$HOME/google-drive" 2>/dev/null; then
101118
echo "✅ Google Drive is mounted at $HOME/google-drive"
102119
echo "Cache directory: $HOME/.cache/rclone"
103120
echo "Log file: $HOME/rclone-gdrive.log"
104121
105-
# Mount status
106-
mountpoint -q $HOME/google-drive && echo "✅ Mount point verified" || echo "❌ Mount point not active"
107-
108122
# Check disk usage of cache
109123
echo -e "\nCache usage:"
110124
du -sh $HOME/.cache/rclone 2>/dev/null || echo "Cache not yet created"
@@ -113,15 +127,26 @@
113127
echo -e "\nRecent log entries:"
114128
tail -n 5 $HOME/rclone-gdrive.log 2>/dev/null || echo "No log entries yet"
115129
else
116-
echo "❌ Google Drive is not mounted"
130+
# Try several methods to detect the rclone process
131+
if ps aux | grep -v grep | grep -q "[r]clone.*gdrive:"; then
132+
echo "⚠️ Rclone process found but mount point is not active"
133+
else
134+
echo "❌ Google Drive is not mounted"
135+
echo "No rclone process for gdrive found"
136+
fi
137+
138+
# Check if mount directory exists
139+
if [ ! -d "$HOME/google-drive" ]; then
140+
echo "Mount directory does not exist. Run mount-gdrive to create and mount it."
141+
fi
117142
fi
118143
'';
119144
};
120145

121146
# Add zsh aliases for easy mounting/unmounting
122147
programs.zsh.shellAliases = {
123-
"mount-gdrive" = "$HOME/.bin/mount-gdrive";
124-
"unmount-gdrive" = "$HOME/.bin/unmount-gdrive";
148+
"gdrive-mount" = "$HOME/.bin/mount-gdrive";
149+
"gdrive-unmount" = "$HOME/.bin/unmount-gdrive";
125150
"gdrive-status" = "$HOME/.bin/gdrive-status";
126151
};
127152
}

0 commit comments

Comments
 (0)