Files
nix-config/hosts/desktop/configuration.nix
2024-07-26 13:42:28 -05:00

264 lines
6.3 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{
config,
outputs,
lib,
pkgs,
...
}:
let
user = "matt";
password = "$y$j9T$EkPXmsmIMFFZ.WRrBYCxS1$P0kwo6e4.WM5DsqUcEqWC3MrZp5KfCjxffraMFZWu06";
hostname = "matt-nixos";
resetNetworkScript = pkgs.writeScriptBin "reset-network" ''
#!/usr/bin/env bash
echo "checking network..."
if nmcli -t -f STATE general | grep -q "connected"; then
exit 0
else
echo "resetting network..."
echo 1 | tee /sys/bus/pci/devices/0000\:09\:00.0/reset
rmmod iwlwifi
modprobe iwlwifi
fi
'';
in
{
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
./boot.nix
./filesystems.nix
# ../../cachix/cachix.nix
../default.nix
];
specialisation = {
plasma.configuration = {
apps.discover-wrapped.enable = false;
services = {
# Enable Desktop Environment.
displayManager = {
sddm.enable = true;
sddm.wayland.enable = true;
sddm.theme = "breeze";
defaultSession = "plasma";
};
desktopManager.plasma6.enable = true;
# Enable Flatpak
flatpak.enable = false;
};
# xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-kde ];
};
gnome.configuration = {
services = {
xserver = {
desktopManager.gnome.enable = true;
# Enable Desktop Environment.
displayManager = {
gdm.enable = true;
gdm.wayland = true;
defaultSession = "gnome";
};
};
# Enable Flatpak
flatpak.enable = false;
};
environment = {
systemPackages = with pkgs; [
gnome-tweaks
gnomeExtensions.appindicator
gnomeExtensions.arcmenu
gnomeExtensions.dash-to-panel
gnomeExtensions.tiling-assistant
];
};
# xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
};
cosmic.configuration = {
services = {
desktopManager.cosmic.enable = true;
displayManager.cosmic-greeter.enable = true;
};
};
};
share.hardware.amd = {
enable = true;
lact.enable = true;
};
share.gaming.enable = true;
# Services configs
services = {
# Enable the X11 windowing system.
xserver = {
enable = true;
};
# enable auto discovery of printers
avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
borgbackup.jobs.home-matt = {
encryption.mode = "repokey";
encryption.passCommand = "cat /root/borg";
environment.BORG_RSH = "ssh -i /home/matt/.ssh/id_ed25519";
repo = "/media/nas/backup/desktop-nix/borg/home";
compression = "auto,zstd";
inhibitsSleep = true;
paths = "/home/matt";
exclude = [
"/home/matt/Games"
"/home/matt/1TB"
];
};
btrfs = {
autoScrub.enable = true;
autoScrub.fileSystems = [
"/nix"
"/root"
"/etc"
"/var/log"
"/home"
];
};
ratbagd.enable = true;
};
systemd.services = {
fix-wifi = {
path = [
pkgs.bash
pkgs.networkmanager
pkgs.kmod
];
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
Type = "oneshot";
ExecStart = [ "${resetNetworkScript}/bin/reset-network" ];
};
};
# rsync-home = {
# path = [ pkgs.bash pkgs.rsync ];
# script = ''
# rsync -rtpogv --progress --ignore-existing --exclude={'/home/matt/Games/*', '/home/matt/1TB/*'} -lHzs /home/matt /media/nas/backup/desktop-nix/home
# '';
# };
};
# Networking configs
networking = {
hostName = hostname;
# Enable Network Manager
networkmanager.enable = true;
networkmanager.wifi.powersave = false;
networkmanager.settings.connectivity.uri = "http://nmcheck.gnome.org/check_network_status.txt";
};
# Time config
time = {
hardwareClockInLocalTime = false;
};
virtualisation.libvirtd.enable = true;
programs.gamemode.enable = true;
# Configure environment
environment = {
# List packages installed in system profile. To search, run:
# $ nix search wget
systemPackages = with pkgs; [
aha
aspell
aspellDicts.en
aspellDicts.en-computers
aspellDicts.en-science
borgbackup
clinfo
direnv
efibootmgr
gparted
grsync
kmod
lact
nano
onlyoffice-bin
os-prober
papirus-icon-theme
pciutils
rsync
sbctl
vim
vulkan-tools
wget
# winetricks (all versions)
winetricks
# native wayland support (unstable)
wineWowPackages.waylandFull
];
sessionVariables = {
STEAM_FORCE_DESKTOPUI_SCALING = "1";
};
};
# Configure nixpkgs
nixpkgs.config.permittedInsecurePackages = [
# ...
];
# Define a user account. Don't forget to set a password with passwd.
users.users."${user}" = {
isNormalUser = true;
extraGroups = [
"wheel"
"networkmanager"
"ratbagd"
]; # Enable sudo for the user.
shell = pkgs.zsh;
};
# This option defines the first version of NixOS you have installed on this particular machine,
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
#
# Most users should NEVER change this value after the initial install, for any reason,
# even if you've upgraded your system to a new NixOS release.
#
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
# so changing it will NOT upgrade your system.
#
# This value being lower than the current NixOS release does NOT mean your system is
# out of date, out of support, or vulnerable.
#
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
# and migrated your data accordingly.
#
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "23.11"; # Did you read the comment?
}