Hermes: Move WSL config to separate module

This commit is contained in:
Payas Relekar 2022-06-13 10:27:56 +05:30
parent dbc2a39e26
commit 927cad466d
4 changed files with 40 additions and 28 deletions

View file

@ -62,6 +62,7 @@
# Host-specific config
./hosts/hermes/configuration.nix
./hosts/hermes/wsl.nix
./hosts/hermes/syncthing.nix
./hosts/hermes/navidrome.nix
# ./hosts/hermes/backup.nix

View file

@ -1,34 +1,6 @@
{ pkgs, modulesPath, ... }:
{
imports = [
"${modulesPath}/profiles/minimal.nix"
];
# This is important for multiple reasons.
# WSL uses this file to determine default user login,
# auto-mounting directories, hostname for WSL virtual machine etc
wsl = {
enable = true;
automountPath = "/mnt";
defaultUser = "payas";
startMenuLaunchers = true;
wslConf = {
automount = {
enabled = true;
mountFsTab = true;
root = "/mnt/";
options = "metadata,uid=1000,gid=100";
};
network = {
hostname = "hermes";
generateResolvConf = "false";
};
};
};
nixpkgs.config.allowUnfree = true;
system.stateVersion = "22.05";

9
hosts/hermes/wsl.nix Normal file
View file

@ -0,0 +1,9 @@
{ config, ... }:
{
imports = [
../../modules/common-wsl.nix
];
wsl.wslConf.network.hostname = "hermes";
}

30
modules/common-wsl.nix Normal file
View file

@ -0,0 +1,30 @@
{ config, modulesPath, ... }:
{
imports = [
"${modulesPath}/profiles/minimal.nix"
];
# This is important for multiple reasons.
# WSL uses this file to determine default user login,
# auto-mounting directories, hostname for WSL virtual machine etc
wsl = {
enable = true;
automountPath = "/mnt";
defaultUser = "payas";
startMenuLaunchers = true;
wslConf = {
automount = {
enabled = true;
mountFsTab = true;
root = "/mnt/";
options = "metadata,uid=1000,gid=100";
};
network = {
generateResolvConf = "false";
};
};
};
}