moved files to make more sense and added experimental desktop configuration

This commit is contained in:
Greg Leyda 2022-07-12 16:54:56 -04:00 committed by ISnortPennies
parent 22c5b6f826
commit 50fae0b2eb
38 changed files with 533 additions and 191 deletions

22
modules/boot.nix Executable file
View file

@ -0,0 +1,22 @@
{pkgs, config, lib, modulesPath, ...}:
{
boot = {
kernelPackages = pkgs.linuxPackages_latest;
blacklistedKernelModules = [ "nouveau" "lbm-nouveau" "pcspkr" ];
kernelParams = [ "fbcon=nodefer" "bgrt_disable" "quiet" "splash" ];
plymouth = {
enable = true;
theme = "breeze";
logo = ../images/nixos.png;
};
loader = {
systemd-boot = {
enable = true;
consoleMode = "max";
editor = false;
};
efi.canTouchEfiVariables = true;
timeout = 0;
};
};
}

14
modules/fonts.nix Executable file
View file

@ -0,0 +1,14 @@
{ pkgs, ... }:
{
fonts = {
fonts = with pkgs; [overpass nerdfonts-overpass material-design-icons];
fontconfig = {
enable = true;
defaultFonts = {
serif = ["Overpass" "Overpass Nerd Font" "Material Design Icons"];
sansSerif = ["Overpass" "Overpass Nerd Font" "Material Design Icons"];
monospace = ["Overpass Mono" "OverpassMono Nerd Font" "Material Design Icons" ];
};
};
};
}

51
modules/misc.nix Normal file
View file

@ -0,0 +1,51 @@
{ config, pkgs, lib, ... }:
{
networking = {
firewall.enable = true;
useDHCP = lib.mkDefault true;
networkmanager. enable = true;
};
qt5 = {
enable = true;
style = "gtk2";
platformTheme = "gtk2";
};
programs = {
zsh.enable = true;
dconf.enable = true;
};
time.timeZone = "America/New_York";
services = {
gvfs.enable = true;
timesyncd = {
enable = true;
servers = [
"time.google.com"
"time2.google.com"
];
};
};
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
useXkbConfig = true;
};
# Enable sound.
security.rtkit.enable = true;
hardware.pulseaudio = {
enable = true;
support32Bit = true;
package = pkgs.pulseaudioFull;
};
nixpkgs.config.pulseaudio = true;
#enable ssh
programs.mtr.enable = true;
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
services.openssh.enable = true;
}

18
modules/nvidia.nix Normal file
View file

@ -0,0 +1,18 @@
{ config, ... }:
{
hardware = {
nvidia = {
nvidiaPersistenced = true;
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.stable;
modesetting.enable = true;
};
opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
};
}

52
modules/packages.nix Executable file
View file

@ -0,0 +1,52 @@
{ config, pkgs, callPackage, ... }:
{
environment.systemPackages = with pkgs; [
#single commands
nano
wget
neofetch
htop
efibootmgr
maim
curlFull
#lightdm
lightdm
lightdm-mini-greeter
#needed utils
pipewire
xorg.xf86videoamdgpu
mesa
mesa-demos
pciutils
git
dash
binutils
#user/gui
discord
spotify
spotify-tray
vlc
bitwarden
protonvpn-gui
gimp
qbittorrent
feh
#explicit xfce4 for bspwm
xarchive
xfce.catfish
xfce.mousepad
xfce.xfce4-power-manager
#shiny
brightnessctl
playerctl
networkmanager_dmenu
networkmanagerapplet
dmenu
qsudo
flashfocus
pavucontrol
gpick
xclip
alsa-utils
];
}

9
modules/prime.nix Executable file
View file

@ -0,0 +1,9 @@
{ config, ... }:
{
hardware.nvidia.prime = {
sync.enable = true;
amdgpuBusId = "PCI:5:0:0";
nvidiaBusId = "PCI:1:0:0";
};
}

28
modules/scripts.nix Normal file
View file

@ -0,0 +1,28 @@
{ pkgs, ... }:
let
update-system = pkgs.writeScriptBin "update-system" ''
#!${pkgs.stdenv.shell}
nix flake update /etc/nixos/#
'';
clean-store = pkgs.writeScriptBin "clean-store" ''
#!${pkgs.stdenv.shell}
nix-collect-garbage -d
nix-store --gc
'';
apply-users = pkgs.writeScriptBin "apply-users" ''
#!${pkgs.stdenv.shell}
nix build /etc/nixos/#homeManagerConfiguration.gerg.activationPackage
./result/activate
rm -rf ./result
'';
apply-system = pkgs.writeScriptBin "apply-system" ''
#!${pkgs.stdenv.shell}
nixos-rebuild switch --flake /etc/nixos/#
'';
in {
environment.systemPackages = [ update-system clean-store apply-users apply-system ];
}

7
modules/thunar.nix Normal file
View file

@ -0,0 +1,7 @@
{pkgs, ...}:
{
programs.thunar = {
enable = true;
plugins = with pkgs.xfce; [ thunar-volman thunar-archive-plugin thunar-media-tags-plugin];
};
}

50
modules/vfio.nix Normal file
View file

@ -0,0 +1,50 @@
{
boot = {
kernelParams = [ "amd_iommu=on" ];
boot.kernelModules = [ "vfio_virqfd" "vfio_pci" "vfio_iommu_type1" "vfio" ];
initrd.kernelModules = [ "vfio_virqfd" "vfio_pci" "vfio_iommu_type1" "vfio" ];
extraModprobeConfig = "options vfio-pci ids=10de:228e,10de:2504";
};
virtualisation = {
libvirtd = {
enable = true;
qemu = {
runAsRoot = false;
ovmf = {
enable = true;
package = pkgs.OVMFFull;
};
};
};
};
environment.systemPackages = with pkgs; [ virt-manager ];
systemd.services.libvirtd.preStart = let
qemuHook = pkgs.writeScript "qemu-hook" ''
#!${pkgs.stdenv.shell}
GUEST_NAME="$1"
OPERATION="$2"
SUB_OPERATION="$3"
if [ "$GUEST_NAME" == "Main_VM" ]; then
if [ "$OPERATION" == "start" ]; then
systemctl set-property --runtime -- user.slice AllowedCPUs=0,1,2,6,7,8
systemctl set-property --runtime -- system.slice AllowedCPUs=0,1,2,6,7,8
systemctl set-property --runtime -- init.scope AllowedCPUs=0,1,2,6,7,8
fi
if [ "$OPERATION" == "stopped" ]; then
systemctl set-property --runtime -- user.slice AllowedCPUs=0-11
systemctl set-property --runtime -- system.slice AllowedCPUs=0-11
systemctl set-property --runtime -- init.scope AllowedCPUs=0-11
fi
fi
'';
in ''
mkdir -p /var/lib/libvirt/hooks
chmod 755 /var/lib/libvirt/hooks
# Copy hook files
ln -sf ${qemuHook} /var/lib/libvirt/hooks/qemu
'';
}

69
modules/xserver.nix Executable file
View file

@ -0,0 +1,69 @@
{config, ... }:
{
services.xserver = {
enable = true;
videoDrivers =
if (config.networking.hostName == "gerg-laptop")
then ["modesetting" "nvidia"]
else [ "nvidia" ];
layout = "us";
libinput.enable = true;
desktopManager = {
xterm.enable = false;
};
windowManager.bspwm = {
enable = true;
};
displayManager = {
defaultSession = "none+bspwm";
lightdm = {
enable = true;
greeters.mini = {
enable = true;
extraConfig = ''
[greeter]
user = gerg
show-password-label = false
password-label-text =
invalid-password-text =
show-input-cursor = false
password-alignment = center
password-input-width = 19
show-image-on-all-monitors = true
[greeter-hotkeys]
mod-key = meta
shutdown-key = s
restart-key = r
hibernate-key = h
suspend-key = u
[greeter-theme]
font = "OverpassMono Nerd Font"
font-size = 1.1em
font-weight = bold
font-style = normal
text-color = "#7AA2F7"
error-color = "#DB4B4B"
background-image = "/etc/nixos/images/stars-1080.jpg"
background-color = "#000000"
window-color = "#000000"
border-color = "#000000"
border-width = 2px
layout-space = 15
password-character = -1
password-color = "#7AA2F7"
password-background-color = "#24283B"
password-border-color = "#000000"
password-border-width = 2px
password-border-radius = 0.341125em
'';
};
};
};
};
}