nixos/system/desktop.nix

230 lines
6.1 KiB
Nix

{
config,
pkgs,
username,
...
}:
{
nixpkgs.config.chromium.commandLineArgs = "--password-store='gnome-libsecret' --enable-features=UseOzonePlatform --ozone-platform=wayland";
hardware.bluetooth.enable = true;
networking.networkmanager.enable = true;
environment = {
sessionVariables = {
NIXOS_OZONE_WL = "1";
MOZ_ENABLE_WAYLAND = "1";
WEBKIT_DISABLE_COMPOSITING_MODE = "1";
MPLBACKEND = "TkAgg";
GDK_BACKEND = "wayland,x11";
XDG_SESSION_TYPE = "wayland";
QT_QPA_PLATFORM = "wayland";
QT_AUTO_SCREEN_SCALE_FACTOR = "1";
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
};
systemPackages = with pkgs; [
libsecret
libnotify
libarchive
xdg-utils
imagemagick
ffmpeg
hunspell
hunspellDicts.en_GB-large
wl-clipboard
hyprpicker
grim
slurp
swappy
xfce.ristretto
g4music
picard
zotero
evince
libreoffice
webcord
signal-desktop
nomachine-client
];
};
security = {
polkit.enable = true;
pam.loginLimits = [
{
domain = "@users";
item = "rtprio";
type = "-";
value = 1;
}
];
};
programs = {
dconf.enable = true;
xfconf.enable = true;
noisetorch.enable = true;
seahorse.enable = true;
file-roller.enable = true;
thunar = {
enable = true;
plugins = with pkgs.xfce; [
thunar-archive-plugin
thunar-volman
];
};
hyprland = {
enable = true;
xwayland.enable = true;
};
};
gtk.iconCache.enable = true;
qt = {
enable = true;
platformTheme = "gnome";
style = if config.lib.stylix.scheme.variant == "light" then "adwaita" else "adwaita-dark";
};
services = {
xserver.xkb.layout = "gb";
gnome.gnome-keyring.enable = true;
flatpak.enable = true;
printing.enable = true;
tumbler.enable = true;
udisks2.enable = true;
blueman.enable = config.hardware.bluetooth.enable;
gvfs = {
enable = true;
package = pkgs.gnome.gvfs;
};
kanata = {
enable = true;
keyboards.main = {
config = builtins.readFile ./kanata.kbd;
extraDefCfg = "process-unmapped-keys yes";
};
};
pipewire = {
enable = true;
pulse.enable = true;
alsa = {
enable = true;
support32Bit = true;
};
};
greetd = {
enable = true;
settings =
let
default_session.command = "Hyprland";
in
{
inherit default_session;
initial_session = {
inherit (default_session) command;
user = username;
};
};
};
};
xdg.portal = {
enable = true;
config.common.default = "*"; # TODO change for xdg-desktop-portal > 1.17 changes
extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
};
home-manager.users.${username} =
{
config,
pkgs,
osConfig,
...
}:
{
imports = [
./home/hyprland.nix
./home/terminal.nix
./home/browser/firefox.nix
./home/emacs/default.nix
./home/email/default.nix
./home/calendar/default.nix
./home/password-store/default.nix
];
home.file.${config.gtk.gtk2.configLocation}.force = true;
programs.mpv.enable = true;
services = {
syncthing.enable = true;
gammastep = {
inherit (osConfig.location) latitude longitude provider;
enable = true;
tray = false;
};
};
gtk = {
enable = true;
gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc";
iconTheme = {
package = (pkgs.papirus-icon-theme.override { color = "violet"; });
name = if config.lib.stylix.scheme.variant == "light" then "Papirus-Light" else "Papirus-Dark";
};
};
stylix.targets.gtk.extraCss = with config.lib.stylix.scheme.withHashtag; ''
@define-color accent_color ${base0E-hex};
@define-color accent_bg_color ${base0E-hex};
'';
xdg = {
mime.enable = true;
mimeApps =
let
defaultApplications = import ./mimeapps.nix;
in
{
enable = true;
inherit defaultApplications;
associations.added = defaultApplications;
};
userDirs = {
enable = true;
createDirectories = true;
extraConfig = {
XDG_PROJECTS_DIR = "${config.home.homeDirectory}/Projects";
};
};
configFile = {
# Stop programs from overriding mimeapps
"mimeapps.list".force = true;
# Ensure GTK config is set
"gtk-3.0/gtk.css".force = true;
"gtk-3.0/settings.ini".force = true;
"gtk-4.0/gtk.css".force = true;
"gtk-4.0/settings.ini".force = true;
# Set Swappy config so that it saves to Screenshots directory
"swappy/config".text = ''
[Default]
save_dir=${config.xdg.userDirs.pictures}/Screenshots/
save_filename_format=swappy-%Y%m%d-%H%M%S.png
show_panel=false
line_size=5
text_size=${toString config.stylix.fonts.sizes.desktop}
text_font=${config.stylix.fonts.sansSerif.name}
paint_mode=brush
early_exit=false
fill_shape=false
'';
# Matplotlib default figure sizes and font settings
"matplotlib/matplotlibrc".text =
let
inherit (config.stylix) fonts;
in
''
font.family: sans-serif
font.serif: ${fonts.serif.name}, DejaVu Serif
font.sans-serif: ${fonts.sansSerif.name}, DejaVu Sans
font.monospace: ${fonts.monospace.name}, DejaVu Sans Mono
figure.figsize: 8, 6
figure.dpi: 150
figure.autolayout: True
savefig.dpi: 300
'';
# Autostart some programs
"autostart/signal-desktop.desktop".source =
"${pkgs.signal-desktop}/share/applications/signal-desktop.desktop";
};
};
};
}