nixos-config/modules/nixos/_private/suites/desktop.nix

146 lines
4.0 KiB
Nix
Raw Normal View History

# This is where extra desktop goodies can be found.
# As a note, this is not where you set the aesthetics of your graphical sessions.
# That can be found in the `themes` module.
2024-07-16 05:49:36 +00:00
{ config, lib, pkgs, ... }:
let cfg = config.suites.desktop;
2021-11-25 13:45:48 +00:00
in {
options.suites.desktop = {
enable =
lib.mkEnableOption "basic desktop-related services and default programs";
cleanup.enable = lib.mkEnableOption "activation of various cleanup services";
autoUpgrade.enable = lib.mkEnableOption "auto-upgrade service with this system";
};
2021-11-25 13:45:48 +00:00
config = lib.mkIf cfg.enable (lib.mkMerge [
({
# Enable Flatpak for additional options for installing desktop applications.
services.flatpak.enable = true;
xdg.portal.enable = true;
2022-08-20 06:13:54 +00:00
environment.etc =
let
urls = {
"flathub" = {
url = "https://flathub.org/repo/flathub.flatpakrepo";
hash = "sha256-M3HdJQ5h2eFjNjAHP+/aFTzUQm9y9K+gwzc64uj+oDo=";
2022-08-20 06:13:54 +00:00
};
"flathub-beta" = {
url = "https://flathub.org/beta-repo/flathub-beta.flatpakrepo";
hash = "sha256-WCyuPJ+dRjnwJ976/m+jO9oKOk1EEpDZJq2For4PcgY=";
2022-08-20 06:13:54 +00:00
};
"gnome-nightly" = {
url = "https://nightly.gnome.org/gnome-nightly.flatpakrepo";
hash = "sha256-rFluVpCvgs1iy7YKVnkPh3p6YuF4orbVuOhLUUFRyYM=";
2022-08-20 06:13:54 +00:00
};
"kdeapps" = {
url = "https://distribute.kde.org/kdeapps.flatpakrepo";
hash = "sha256-dCF9QQYMmqMuzwAS+HYoPAAtwfzO7aVCl8s4RwhneqI=";
2022-08-20 06:13:54 +00:00
};
};
in
lib.mapAttrs'
2023-08-27 05:41:29 +00:00
(name: remote:
lib.nameValuePair
"flatpak/remotes.d/${name}.flatpakrepo"
{ source = pkgs.fetchurl remote; })
2022-08-20 06:13:54 +00:00
urls;
2022-08-13 00:31:09 +00:00
programs.extra-container.enable = true;
# Enable font-related options for more smoother and consistent experience.
fonts.fontconfig.enable = true;
# Run unpatched binaries with these!
programs.nix-ld = {
enable = true;
2024-01-01 05:56:10 +00:00
libraries =
let
xorgLibs = with pkgs.xorg; [
libX11
libXScrnSaver
libXcomposite
libXcursor
libXdamage
libXext
libXfixes
libXi
libXrandr
libXrender
libXtst
libxcb
libxkbfile
libxshmfence
];
commonLibs = with pkgs; [
alsa-lib
cairo
freetype
dbus
icu
libGL
libnotify
mesa
nss
pango
pipewire
];
in
2024-07-16 05:49:36 +00:00
commonLibs ++ xorgLibs;
};
environment.systemPackages = with pkgs; [
steam-run # For the heathens that still uses FHS.
];
2022-06-09 05:00:07 +00:00
# Enable running GNOME apps outside GNOME.
programs.dconf.enable = true;
2023-12-20 02:44:42 +00:00
# Enable virtual camera.
boot.kernelModules = [ "v4l2loopback" ];
})
(lib.mkIf cfg.cleanup.enable {
# Weekly garbage collection of Nix store.
nix.gc = {
automatic = true;
persistent = true;
dates = "weekly";
2022-02-11 04:31:44 +00:00
options = "--delete-older-than 7d";
};
# Run the optimizer.
nix.optimise = {
automatic = true;
dates = [ "weekly" ];
};
# Journal settings for retention.
services.journald.extraConfig = ''
MaxRetentionSec="3 month"
'';
})
(lib.mkIf cfg.autoUpgrade.enable {
system.autoUpgrade = {
enable = true;
flake = "github:foo-dogsquared/nixos-config";
allowReboot = true;
2022-08-20 06:13:54 +00:00
persistent = true;
rebootWindow = {
lower = "22:00";
upper = "00:00";
};
dates = "weekly";
flags = [
2022-11-19 03:05:31 +00:00
"--update-input"
"nixpkgs"
"--commit-lock-file"
"--no-write-lock-file"
];
randomizedDelaySec = "1min";
};
})
]);
}