separate xorg and i3

This commit is contained in:
Noah Masur 2022-04-28 21:56:21 -04:00
parent 2a225debe5
commit 2a5c896322
9 changed files with 110 additions and 92 deletions

View File

@ -41,8 +41,11 @@
./nixos/configuration.nix
./nixos/hardware-configuration.nix
./nixos/home.nix
./modules/desktop/xorg.nix
./modules/desktop/i3.nix
./modules/system/timezone.nix
./modules/system/doas.nix
./modules/system/user.nix
./modules/gaming
./modules/services/keybase.nix
./modules/applications/firefox.nix

View File

@ -1,5 +1,12 @@
{ pkgs, lib, user, gui, ... }:
{
home-manager.users.${user}.home.packages = [ (lib.mkIf gui pkgs.firefox) ];
config = lib.mkIf gui {
home-manager.users.${user}.home.packages = [ pkgs.firefox ];
# Required for setting GTK theme (for preferred-color-scheme in browser)
services.dbus.packages = [ pkgs.dconf ];
programs.dconf.enable = true;
};
}

5
modules/desktop/i3.nix Normal file
View File

@ -0,0 +1,5 @@
{ ... }: {
services.xserver.windowManager = { i3 = { enable = true; }; };
}

53
modules/desktop/xorg.nix Normal file
View File

@ -0,0 +1,53 @@
{ pkgs, ... }: {
# Enable the X11 windowing system.
services.xserver = {
enable = true;
# Enable touchpad support
libinput.enable = true;
# Disable mouse acceleration
libinput.mouse.accelProfile = "flat";
libinput.mouse.accelSpeed = "1.15";
# Keyboard responsiveness
autoRepeatDelay = 250;
autoRepeatInterval = 40;
# Configure keymap in X11
layout = "us";
xkbOptions = "eurosign:e,caps:swapescape";
# Login screen
displayManager = {
lightdm = {
enable = true;
# Make the login screen dark
greeters.gtk.theme.name = "Adwaita-dark";
# Put the login screen on the left monitor
greeters.gtk.extraConfig = ''
active-monitor=0
'';
};
setupCommands = ''
${pkgs.xorg.xrandr}/bin/xrandr --output DisplayPort-0 \
--mode 1920x1200 \
--pos 1920x0 \
--rotate left \
--output HDMI-0 \
--primary \
--mode 1920x1080 \
--pos 0x559 \
--rotate normal \
--output DVI-0 --off \
--output DVI-1 --off \
'';
};
};
}

View File

@ -16,4 +16,7 @@
};
# Used for icons in Vim
fonts.fonts = with pkgs; [ nerdfonts ];
}

View File

@ -1,5 +1,7 @@
{ pkgs, user, ... }: {
users.users.${user}.shell = pkgs.fish;
home-manager.users.${user} = {
programs.fish = {
enable = true;

20
modules/system/user.nix Normal file
View File

@ -0,0 +1,20 @@
{ user, ... }: {
# Define a user account. Don't forget to set a password with passwd.
users.users.${user} = {
# Create a home directory for human user
isNormalUser = true;
# Automatically create a password to start
initialPassword = "changeme";
# Enable sudo privileges
extraGroups = [
"wheel" # Sudo privileges
"i2c" # Access to external monitors
];
};
}

View File

@ -2,7 +2,7 @@
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, user, ... }:
{ config, pkgs, user, font, ... }:
{
nixpkgs.config.allowUnfree = true;
@ -22,61 +22,6 @@
networking.interfaces.enp0s31f6.useDHCP = true;
networking.interfaces.wlp3s0.useDHCP = true;
# Enable the X11 windowing system.
services.xserver = {
enable = true;
windowManager = { i3 = { enable = true; }; };
# Enable touchpad support
libinput.enable = true;
# Disable mouse acceleration
libinput.mouse.accelProfile = "flat";
libinput.mouse.accelSpeed = "1.15";
# Keyboard responsiveness
autoRepeatDelay = 250;
autoRepeatInterval = 40;
# Configure keymap in X11
layout = "us";
xkbOptions = "eurosign:e,caps:swapescape";
# Login screen
displayManager = {
lightdm = {
enable = true;
# Make the login screen dark
greeters.gtk.theme.name = "Adwaita-dark";
# Put the login screen on the left monitor
greeters.gtk.extraConfig = ''
active-monitor=0
'';
};
setupCommands = ''
${pkgs.xorg.xrandr}/bin/xrandr --output DisplayPort-0 \
--mode 1920x1200 \
--pos 1920x0 \
--rotate left \
--output HDMI-0 \
--primary \
--mode 1920x1080 \
--pos 0x559 \
--rotate normal \
--output DVI-0 --off \
--output DVI-1 --off \
'';
};
};
# Required for setting GTK theme (for preferred-color-scheme in browser)
services.dbus.packages = with pkgs; [ dconf ];
programs.dconf.enable = true;
# Mouse config
services.ratbagd.enable = true;
@ -86,31 +31,11 @@
# Install fonts
fonts.fonts = with pkgs; [
victor-mono # Used for Vim and Terminal
nerdfonts # Used for icons in Vim
font.package # Used for Vim and Terminal
font-awesome # Icons for i3
# siji # More icons for Polybar
];
fonts.fontconfig.defaultFonts.monospace = [ "Victor Mono" ];
# Define a user account. Don't forget to set a password with passwd.
users.users.${user} = {
# Create a home directory for human user
isNormalUser = true;
# Automatically create a password to start
initialPassword = "changeme";
# Enable sudo privileges
extraGroups = [
"wheel" # Sudo privileges
"i2c" # Access to external monitors
];
# Use the fish shell
shell = pkgs.fish;
};
fonts.fontconfig.defaultFonts.monospace = [ font.name ];
# List packages installed in system profile. To search, run:
# $ nix search wget

View File

@ -4,27 +4,27 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" ];
boot.initrd.availableKernelModules =
[ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/f0313f58-971a-46e3-9191-909fe5eb7f7e";
fsType = "ext4";
};
fileSystems."/" = {
device = "/dev/disk/by-uuid/f0313f58-971a-46e3-9191-909fe5eb7f7e";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/FB26-799C";
fsType = "vfat";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/FB26-799C";
fsType = "vfat";
};
swapDevices = [ ];
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
hardware.cpu.intel.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware;
}