dotfiles/modules/desktop.nix

204 lines
5 KiB
Nix

{ pkgs, lib, config, ... }:
with lib;
{
nix = {
package = pkgs.nixVersions.unstable;
};
# This adds hyprland cache to cachix and relaxes sandbox
nix.settings = {
substituters = ["https://hyprland.cachix.org"];
trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="];
sandbox = "relaxed";
};
# Use the systemd-boot EFI boot loader.
boot = {
kernelPackages = pkgs.linuxPackages_zen;
kernelParams = [ "mem_sleep_default=deep" "nvme.noacpi=1"];
# initrd.kernelModules = [ "amdgpu" ];
};
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
networking.useDHCP = false;
boot.supportedFilesystems = [ "ntfs" ];
services.xserver = {
enable = true;
autorun = false;
windowManager.awesome = {
enable = true;
package = pkgs.awesome;
};
displayManager = {
startx.enable = true;
sddm = {
enable = false;
};
session = [
{
manage = "desktop";
name = "Hyprland";
start = ''
/home/chris/bin/hyprland &
waitPID=$!
'';
}
];
};
desktopManager.plasma5 = {
enable = true;
runUsingSystemd = true;
};
# desktopManager.gnome.enable = true;
};
security.pam.services.kwallet = {
name = "kwallet";
enableKwallet = true;
};
security.pam.services = {
sddm.enableKwallet = true;
greetd.enableKwallet = true;
swaylock = {};
};
services.greetd = {
enable = true;
settings = rec {
initial_session = {
command = "dbus-run-session startplasma-wayland";
user = "chris";
};
default_session = {
command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time -r --window-padding 2 --cmd 'dbus-run-session startplasma-wayland' -s /etc/greetd/environments";
user = "greeter";
};
plasma_session = {
command = "dbus-run-session startplasma-wayland";
user = "chris";
};
hyprland_session = {
command = "/home/chris/bin/hyprland";
user = "chris";
};
};
};
environment.etc."greetd/environments".text = ''
hyprland
dbus-run-session startplasma-wayland
fish
bash
'';
programs.hyprland = {
enable = true;
};
services.avahi = {
enable = true;
nssmdns = true;
};
# Enable sound.
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
wireplumber.enable = true;
};
# Needed for some pipewire progs and other gtk apps
programs.dconf.enable = true;
environment.variables = {
EDITOR = "emacsclient -t -a";
VISUAL = "emacsclient -c -a";
QT_LOGGING_RULES = "js=true; kwin_scripting=true";
GTK_USE_PORTAL = "1";
# Fixing Qt apps in other environments
# Thought I needed this but apparently they are working fine without it.
# QT_XCB_GL_INTEGRATION = "xcb_egl";
# QT_QPA_PLATFORM_PLUGIN_PATH = "${pkgs.qt5.qtbase.bin}/lib/qt-${pkgs.qt5.qtbase.qtCompatVersion}/plugins/platforms";
WLR_NO_HARDWARE_CURSORS = "1";
};
programs.partition-manager.enable = true;
programs.kdeconnect.enable = true;
# Turn on flatpak
services.flatpak.enable = true;
# Configure keymap in X11
services.xserver.layout = "us";
# services.xserver.xkbOptions = "eurosign:e";
# Enable CUPS to print documents.
services.printing.enable = true;
services.printing.drivers = [ pkgs.gutenprint pkgs.gutenprintBin pkgs.hplipWithPlugin ];
services.usbmuxd.enable = true;
services.fstrim.enable = true;
#######################
# VIRTUALIZATION
#######################
# virtualisation.waydroid.enable = true;
virtualisation.podman.enable = true;
# virtualisation.docker.enable = true;
virtualisation.libvirtd = {
enable = true;
qemu = {
runAsRoot = false;
ovmf = {
enable = true;
packages = [
pkgs.OVMFFull.fd
pkgs.pkgsCross.aarch64-multiplatform.OVMF.fd
];
};
swtpm.enable = true;
};
};
services.samba-wsdd.enable = true;
services.samba = {
enable = true;
extraConfig = ''
workgroup = WORKGROUP
server string = smbnix
netbios name = smbnix
security = user
#use sendfile = yes
#max protocol = smb2
# note: localhost is the ipv6 localhost ::1
hosts allow = 192.168.0. 127.0.0.1 localhost
hosts deny = 0.0.0.0/0
guest account = nobody
map to guest = bad user
'';
shares = {
public = {
path = "/home/chris";
"read only" = false;
browsable = true;
"guest ok" = true;
comment = "Share";
};
};
};
# Android Tools
programs.adb.enable = true;
services.udev.packages = [ pkgs.android-udev-rules ];
}