From 6ea3f6016632cae654a2f347b19a793ed2d5290e Mon Sep 17 00:00:00 2001 From: pegasust Date: Mon, 14 Nov 2022 08:59:12 -0700 Subject: [PATCH] chore: make system-nix compatible with non-wsl installs --- home-nix/home.nix | 3 ++ system-nix/configuration.nix | 21 +-------- system-nix/hardware-configuration.nix | 65 --------------------------- system-nix/wsl-configuration.nix | 6 +-- 4 files changed, 6 insertions(+), 89 deletions(-) delete mode 100644 system-nix/hardware-configuration.nix diff --git a/home-nix/home.nix b/home-nix/home.nix index 6549e14..b53eae5 100644 --- a/home-nix/home.nix +++ b/home-nix/home.nix @@ -47,10 +47,13 @@ enable = true; # 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 = { enable = true; nix-direnv.enable = true; }; + # z as smarter cd programs.zoxide = { enable = true; enableZshIntegration = true; diff --git a/system-nix/configuration.nix b/system-nix/configuration.nix index f50ec80..68464ff 100755 --- a/system-nix/configuration.nix +++ b/system-nix/configuration.nix @@ -1,31 +1,12 @@ { lib, pkgs, config, modulesPath, ... }: - with lib; -let - nixos-wsl = import ./nixos-wsl; -in { imports = [ + /etc/nixos/hardware-configuration.nix "${modulesPath}/profiles/minimal.nix" - ./hardware-configuration.nix - nixos-wsl.nixosModules.wsl ]; 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..uid = 1000; # networking.hostName = "nixos"; diff --git a/system-nix/hardware-configuration.nix b/system-nix/hardware-configuration.nix deleted file mode 100644 index 13b220c..0000000 --- a/system-nix/hardware-configuration.nix +++ /dev/null @@ -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..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; -} diff --git a/system-nix/wsl-configuration.nix b/system-nix/wsl-configuration.nix index 421e194..7663a13 100755 --- a/system-nix/wsl-configuration.nix +++ b/system-nix/wsl-configuration.nix @@ -6,13 +6,11 @@ let in { imports = [ - ./hardware-configuration.nix + /etc/nixos/hardware-configuration.nix nixos-wsl.nixosModules.wsl - configuration.nix + ./configuration.nix ]; - system.stateVersion = "22.05"; - wsl = { enable = true; automountPath = "/mnt";