some bash runbook to illustrate mounting errors on nixos-wsl
parent
8fb58aeb35
commit
202e250cbf
|
@ -20,7 +20,6 @@
|
||||||
};
|
};
|
||||||
programs.tmux = {
|
programs.tmux = {
|
||||||
enable = true;
|
enable = true;
|
||||||
shell = "zsh";
|
|
||||||
extraConfig = builtins.readFile ../tmux/.tmux.conf;
|
extraConfig = builtins.readFile ../tmux/.tmux.conf;
|
||||||
};
|
};
|
||||||
programs.exa = {
|
programs.exa = {
|
||||||
|
@ -66,6 +65,7 @@
|
||||||
a="add"; c="commit"; ca="commit --ammend"; cm="commit -m";
|
a="add"; c="commit"; ca="commit --ammend"; cm="commit -m";
|
||||||
lol="log --graph --decorate --pretty=oneline --abbrev-commit";
|
lol="log --graph --decorate --pretty=oneline --abbrev-commit";
|
||||||
lola="log --graph --decorate --pretty=oneline --abbrev-commit --all";
|
lola="log --graph --decorate --pretty=oneline --abbrev-commit --all";
|
||||||
|
sts="status";
|
||||||
};
|
};
|
||||||
extraConfig = {
|
extraConfig = {
|
||||||
merge = {tool="vimdiff"; conflictstyle="diff3";};
|
merge = {tool="vimdiff"; conflictstyle="diff3";};
|
||||||
|
|
|
@ -18,7 +18,7 @@ in
|
||||||
automountPath = "/mnt";
|
automountPath = "/mnt";
|
||||||
defaultUser = "nixos"; # if change defaultUser, make sure uid to be 1000 (first user)
|
defaultUser = "nixos"; # if change defaultUser, make sure uid to be 1000 (first user)
|
||||||
startMenuLaunchers = true;
|
startMenuLaunchers = true;
|
||||||
|
automountOptions = "drvfs,metadata,uid=1000,gid=100";
|
||||||
# Enable native Docker support
|
# Enable native Docker support
|
||||||
# docker-native.enable = true;
|
# docker-native.enable = true;
|
||||||
|
|
||||||
|
|
|
@ -18,12 +18,12 @@
|
||||||
|
|
||||||
fileSystems."/usr/lib/wsl/drivers" =
|
fileSystems."/usr/lib/wsl/drivers" =
|
||||||
{ device = "drivers";
|
{ device = "drivers";
|
||||||
fsType = "9p";
|
fsType = "drvfs";
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/usr/lib/wsl/lib" =
|
fileSystems."/usr/lib/wsl/lib" =
|
||||||
{ device = "lib";
|
{ device = "lib";
|
||||||
fsType = "9p";
|
fsType = "drvfs";
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/mnt/wsl" =
|
fileSystems."/mnt/wsl" =
|
||||||
|
@ -32,18 +32,18 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/mnt/c" =
|
fileSystems."/mnt/c" =
|
||||||
{ device = "C:\134";
|
{ device = "C:";
|
||||||
fsType = "9p";
|
fsType = "drvfs";
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/mnt/d" =
|
fileSystems."/mnt/d" =
|
||||||
{ device = "D:\134";
|
{ device = "D:";
|
||||||
fsType = "9p";
|
fsType = "drvfs";
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/mnt/f" =
|
fileSystems."/mnt/f" =
|
||||||
{ device = "F:\134";
|
{ device = "F:";
|
||||||
fsType = "9p";
|
fsType = "drvfs";
|
||||||
};
|
};
|
||||||
|
|
||||||
swapDevices = [ ];
|
swapDevices = [ ];
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
# This is used when we need to refresh hardware-configuration.nix
|
||||||
|
# Basically what this does is to mount the drives, then ask nixos-generate-config
|
||||||
|
# to regenerate hardware-configuration.nix for us.
|
||||||
|
# Manual on nixos-generate-config [here](https://www.mankier.com/8/nixos-generate-config)
|
||||||
|
SCRIPT_DIR=$(realpath $(dirname $0))
|
||||||
|
${SCRIPT_DIR}/felia-mount.sh
|
||||||
|
sudo nixos-generate-config
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
SCRIPT_DIR=$(realpath $(dirname $0))
|
||||||
|
|
||||||
|
function mntDrive() {
|
||||||
|
WSL_DRIVE=$(echo $1 | tr '[:upper:]' '[:lower:]')
|
||||||
|
${SCRIPT_DIR}/mount-windrive.sh $1 $WSL_DRIVE
|
||||||
|
echo "ls /mnt/${WSL_DRIVE}"
|
||||||
|
ls /mnt/${WSL_DRIVE}
|
||||||
|
}
|
||||||
|
|
||||||
|
mntDrive C
|
||||||
|
mntDrive D
|
||||||
|
mntDrive F
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# https://linuxnightly.com/mount-and-access-hard-drives-in-windows-subsystem-for-linux-wsl/
|
||||||
|
# Usage: scripts/mount-windrive.sh C # /mnt/c -> C:\
|
||||||
|
|
||||||
|
WIN_DRIVE_CHAR=${1:-"C"}
|
||||||
|
WSL_DRIVE_CHAR=${2:-$(echo $WIN_DRIVE_CHAR | tr '[:upper:]' '[:lower:]')}
|
||||||
|
|
||||||
|
sudo umount "/mnt/${WSL_DRIVE_CHAR}"
|
||||||
|
sudo mount -t drvfs "${WIN_DRIVE_CHAR}:" "/mnt/${WSL_DRIVE_CHAR}"
|
||||||
|
|
Loading…
Reference in New Issue