chore: make system-nix compatible with non-wsl installs

nix-components
pegasust 2022-11-14 08:59:12 -07:00
parent 9192baf8ad
commit 6ea3f60166
4 changed files with 6 additions and 89 deletions

View File

@ -47,10 +47,13 @@
enable = true; enable = true;
# settings = myLib.fromYaml (builtins.readFile ../alacritty/alacritty.yml); # settings = myLib.fromYaml (builtins.readFile ../alacritty/alacritty.yml);
}; };
# nix: Propagates the environment with packages and vars when enter (children of)
# a directory with shell.nix-compatible and .envrc
programs.direnv = { programs.direnv = {
enable = true; enable = true;
nix-direnv.enable = true; nix-direnv.enable = true;
}; };
# z <path> as smarter cd
programs.zoxide = { programs.zoxide = {
enable = true; enable = true;
enableZshIntegration = true; enableZshIntegration = true;

View File

@ -1,31 +1,12 @@
{ lib, pkgs, config, modulesPath, ... }: { lib, pkgs, config, modulesPath, ... }:
with lib; with lib;
let
nixos-wsl = import ./nixos-wsl;
in
{ {
imports = [ imports = [
/etc/nixos/hardware-configuration.nix
"${modulesPath}/profiles/minimal.nix" "${modulesPath}/profiles/minimal.nix"
./hardware-configuration.nix
nixos-wsl.nixosModules.wsl
]; ];
system.stateVersion = "22.05"; system.stateVersion = "22.05";
wsl = {
enable = true;
automountPath = "/mnt";
defaultUser = "nixos"; # if change defaultUser, make sure uid to be 1000 (first user)
startMenuLaunchers = true;
automountOptions = "drvfs,metadata,uid=1000,gid=100";
# Enable native Docker support
# docker-native.enable = true;
# Enable integration with Docker Desktop (needs to be installed)
docker-desktop.enable = true;
};
# users.users.<defaultUser>.uid = 1000; # users.users.<defaultUser>.uid = 1000;
# networking.hostName = "nixos"; # networking.hostName = "nixos";

View File

@ -1,65 +0,0 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports = [ ];
boot.initrd.availableKernelModules = [ ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/sdd";
fsType = "ext4";
};
fileSystems."/usr/lib/wsl/drivers" =
{ device = "drivers";
fsType = "drvfs";
};
fileSystems."/usr/lib/wsl/lib" =
{ device = "lib";
fsType = "drvfs";
};
fileSystems."/mnt/wsl" =
{ device = "tmpfs";
fsType = "tmpfs";
};
fileSystems."/mnt/c" =
{ device = "C:";
fsType = "drvfs";
};
fileSystems."/mnt/d" =
{ device = "D:";
fsType = "drvfs";
};
fileSystems."/mnt/f" =
{ device = "F:";
fsType = "drvfs";
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.bond0.useDHCP = lib.mkDefault true;
# networking.interfaces.bonding_masters.useDHCP = lib.mkDefault true;
# networking.interfaces.dummy0.useDHCP = lib.mkDefault true;
# networking.interfaces.eth0.useDHCP = lib.mkDefault true;
# networking.interfaces.sit0.useDHCP = lib.mkDefault true;
# networking.interfaces.tunl0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View File

@ -6,13 +6,11 @@ let
in in
{ {
imports = [ imports = [
./hardware-configuration.nix /etc/nixos/hardware-configuration.nix
nixos-wsl.nixosModules.wsl nixos-wsl.nixosModules.wsl
configuration.nix ./configuration.nix
]; ];
system.stateVersion = "22.05";
wsl = { wsl = {
enable = true; enable = true;
automountPath = "/mnt"; automountPath = "/mnt";