Move WSL from standalone Home Manager to NixOS

This commit is contained in:
Oliver Davies 2024-12-30 15:41:43 +00:00
parent d1e0abf4c5
commit c5afed5767
10 changed files with 324 additions and 92 deletions

View file

@ -0,0 +1,118 @@
{
headless ? false,
hostname,
inputs,
outputs,
pkgs,
self,
system,
username,
...
}:
{
home-manager = {
extraSpecialArgs = {
inherit
hostname
inputs
outputs
headless
self
system
username
;
};
useGlobalPkgs = true;
useUserPackages = true;
users."${username}" = import "${self}/nix/home/${username}";
};
nixpkgs = {
config = {
allowUnfree = true;
};
overlays = [
outputs.overlays.additions
outputs.overlays.modifications
outputs.overlays.stable-packages
];
};
nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
# # Enable networking
# networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "Europe/London";
# Select internationalisation properties.
i18n.defaultLocale = "en_GB.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_GB.UTF-8";
LC_IDENTIFICATION = "en_GB.UTF-8";
LC_MEASUREMENT = "en_GB.UTF-8";
LC_MONETARY = "en_GB.UTF-8";
LC_NAME = "en_GB.UTF-8";
LC_NUMERIC = "en_GB.UTF-8";
LC_PAPER = "en_GB.UTF-8";
LC_TELEPHONE = "en_GB.UTF-8";
LC_TIME = "en_GB.UTF-8";
};
# Configure console keymap
console.keyMap = "uk";
users.users.${username} = {
description = "Oliver Davies";
isNormalUser = true;
extraGroups = [
"docker"
"media"
"networkmanager"
"wheel"
];
packages = with pkgs; [ ];
};
security.sudo.wheelNeedsPassword = false;
environment.systemPackages =
with pkgs;
[
]
++ pkgs.lib.optionals (!headless) [
];
system.stateVersion = "22.11";
nix = {
extraOptions = ''
trusted-users = root ${username}
'';
gc = {
automatic = true;
dates = "daily";
options = "--delete-older-than 7d";
};
optimise.automatic = true;
settings = {
auto-optimise-store = true;
experimental-features = [
"nix-command"
"flakes"
];
warn-dirty = false;
};
};
}

View file

@ -0,0 +1,14 @@
{ username, ... }:
{
imports = [
../common
./configuration.nix
];
wsl = {
enable = true;
defaultUser = username;
};
}

View file

@ -7,6 +7,7 @@
};
desktop = {
autorandr.enable = true;
gaming.enable = true;
peek.enable = true;
};

View file

@ -7,6 +7,7 @@
features = {
desktop = {
autorandr.enable = true;
gaming.enable = true;
i3.enable = true;
peek.enable = true;