Skip to content

Instantly share code, notes, and snippets.

@juxuanu
Last active May 2, 2024 17:04
Show Gist options
  • Save juxuanu/d9327709fb56ffacb6e3e1e4ff8ad94a to your computer and use it in GitHub Desktop.
Save juxuanu/d9327709fb56ffacb6e3e1e4ff8ad94a to your computer and use it in GitHub Desktop.
Nix configuration
# This config: https://gist.githubusercontent.com/juxuanu/d9327709fb56ffacb6e3e1e4ff8ad94a/raw/configuration.nix
# Flatpak apps: https://gist.githubusercontent.com/juxuanu/819267fed67cf5308a8efea42298c2d2/raw/flatpak-list.txt
{ config, pkgs, ... }:
let
unstableTarball =
fetchTarball
https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz;
in
{
imports =
[ # Computer-specific configs, usually generated by ‘nixos-generate-config’
./hardware-configuration.nix
];
# Make unstable packages available (`pkgs.unstable.<package>`)
nixpkgs.config = {
packageOverrides = pkgs: with pkgs; {
unstable = import unstableTarball {
config = config.nixpkgs.config;
};
};
};
boot = {
# Bootloader
loader = {
timeout = 0;
systemd-boot = {
enable = true;
consoleMode = "max";
};
efi.canTouchEfiVariables = true;
};
supportedFilesystems = ["xfs" "ext4" "ntfs3" "f2fs" "btrfs"];
initrd = {
supportedFilesystems = ["xfs" "ext4" "ntfs3" "f2fs" "btrfs"];
kernelModules = ["amdgpu"];
systemd.enable = true;
};
kernelParams = ["nowatchdog" "quiet" "splash" "loglevel=3" "udev.log_priority=3" "rd.udev.log_level=3" "rd.systemd.show_status=false" "mitigations=off"];
kernel.sysctl = {
"vm.max_map_count" = 2147483642; # Some Wine/Proton games need this
"fs.inotify.max_user_watches" = 1048576; # IDEA IDEs with big projects need this
"fs.file-max" = 524288; # Some games need this
"net.core.default_qdisc" = "fq"; # Makes network go brrrr (1/2)
"net.ipv4.tcp_congestion_control" = "bbr"; # Makes network go brrrr (2/2)
};
plymouth.enable = true;
consoleLogLevel = 3;
tmp.useTmpfs = true;
kernelPackages = pkgs.unstable.linuxKernel.packages.linux_zen;
};
hardware = {
cpu = {
intel.updateMicrocode = true;
amd.updateMicrocode = true;
};
bluetooth.enable = true;
opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
enableRedistributableFirmware = true;
};
systemd = {
oomd = {
enable = true;
enableUserServices = true;
};
};
zramSwap.enable = true;
networking = {
hostName = "icar-nixos";
networkmanager.enable = true;
usePredictableInterfaceNames = true;
};
# Set your time zone.
time.timeZone = "Europe/Madrid";
console.useXkbConfig = true;
i18n = {
extraLocaleSettings = {
LC_ADDRESS = "ca_ES.UTF-8";
LC_IDENTIFICATION = "ca_ES.UTF-8";
LC_MEASUREMENT = "ca_ES.UTF-8";
LC_MONETARY = "ca_ES.UTF-8";
LC_NAME = "ca_ES.UTF-8";
LC_NUMERIC = "ca_ES.UTF-8";
LC_PAPER = "ca_ES.UTF-8";
LC_TELEPHONE = "ca_ES.UTF-8";
LC_TIME = "ca_ES.UTF-8";
LANGUAGE = "ca_ES:es_ES:en_US";
};
supportedLocales = ["ca_ES.UTF-8/UTF-8" "en_US.UTF-8/UTF-8" "es_ES.UTF-8/UTF-8"];
defaultLocale = "ca_ES.UTF-8";
};
services = {
xserver = {
enable = true;
displayManager.gdm.enable = true;
desktopManager.gnome = {
enable = true;
extraGSettingsOverridePackages = [ pkgs.gnome.mutter ];
extraGSettingsOverrides = ''
[org.gnome.mutter]
experimental-features=['scale-monitor-framebuffer', 'kms-modifiers']
'';
};
xkb = {
variant = "cat";
model = "pc105";
layout = "es";
};
};
printing.enable = true;
avahi = {
enable = true;
nssmdns = true;
};
flatpak.enable = true;
fwupd.enable = true;
timesyncd.enable = true;
#dbus.implementation = "broker";
acpid.enable = true;
gvfs.enable = true;
ollama = {
enable = true;
acceleration = "rocm";
};
#tailscale = {
# enable = true;
# extraUpFlags = [ "--ssh" ];
#};
};
virtualisation.docker = {
enable = true;
autoPrune.enable = true;
};
xdg.portal.enable = true;
# Enable sound with pipewire.
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
wireplumber.enable = true;
};
# Don't forget to set a password with ‘passwd’.
users.users.icar = {
isNormalUser = true;
description = "Ícar Nin Solana";
extraGroups = ["networkmanager" "wheel" "audio" "video" "input" "rtkit" "kvm" "adbusers" "docker"];
shell = pkgs.zsh;
packages = with pkgs; [
protonmail-bridge
];
initialPassword = "password";
};
users.users.worldcoo = {
isNormalUser = true;
description = "Worldcoo";
extraGroups = ["networkmanager" "wheel" "audio" "video" "input" "rtkit" "kvm" "adbusers" "docker"];
shell = pkgs.zsh;
initialPassword = "password";
};
security = {
polkit.enable = true;
sudo.extraConfig = ''
Defaults pwfeedback
'';
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
environment = {
etc.pw-96khz = {
target = "pipewire/pipewire.conf.d/99-playback-96khz.conf";
text = ''
context.properties = {
default.clock.rate = 96000
default.clock.allowed-rates = [ 44100 48000 88200 96000 176400 192000 ]
}
'';
};
# System-wide pkgs
systemPackages = with pkgs; [
aspell
aspellDicts.ca
cargo-show-asm
cargo-edit
cargo-expand
cargo-generate
cargo-make
cargo-update
ccache
cmake
elfutils
ffmpegthumbnailer
game-devices-udev-rules
gcc
gdb
gettext
# TODO: gtuber
highlight
hplip
hspell
hunspell
# TODO: hunspellDicts.ca_ES
jdk
lazygit
gnumake
mangohud
mold
ninja
pkgconf
nufraw-thumbnailer
sourceHighlight
sshfs
gnome.sushi
vkd3d-proton
webp-pixbuf-loader
webrtc-audio-processing
gnomeExtensions.pip-on-top
gnomeExtensions.gsconnect
gnomeExtensions.caffeine
gnomeExtensions.just-perfection
gnomeExtensions.appindicator
rnnoise-plugin
sccache
gnome.adwaita-icon-theme
python311Packages.pygments
meson
pkg-config
djmount
unstable.mise
# Programming langs
nim2
clojure
leiningen # clojure
dotnet-sdk
dotnet-runtime
dotnet-aspnetcore
elixir
erlang
gleam
go
lua
luajit
luaformatter
nodejs_20
deno
bun
corepack
python3
rustup
typescript
typst
vala
flutter
android-tools
#swift
# GUI
android-studio
corectrl
gnome.dconf-editor
ghidra
gnome.gnome-tweaks
godot3
handbrake
scenebuilder
lapce
lazydocker
libreoffice-fresh
rpi-imager
gnome.simple-scan
stellarium
tmux
ventoy
vscode
wireshark
unstable.jetbrains.webstorm
unstable.jetbrains.pycharm-professional
unstable.jetbrains.goland
#unstable.jetbrains.clion
unstable.jetbrains.rust-rover
bruno
firefox
ungoogled-chromium
helvum
dconf
tidal-hifi
gnome-builder
distrobox
unstable.ckan
unstable.zed-editor
unstable.reaper
mission-center
# CLI
wget
neovim
htop
wl-clipboard
aria
asciinema
bacon
banner
bat
binutils
bottom
btop
clolcat
cabextract
certbot
colordiff
# TODO: crawley
ddrescue
docker-compose
dosfstools
duf
dxvk
ed
ethtool
evtest
eza
fd
file
gamemode
gamescope
gawk
glances
glow
gperftools
gnugrep
ripgrep
groff
gzip
helix
httpie
hw-probe
hwinfo
inetutils
inxi
iotop
iptables
python311Packages.ipython
ix
lsb-release
lshw
magic-wormhole
miniserve
unstable.mpv
ncdu
nmap
yazi
netcat
openssh
ouch
pandoc
parallel
patch
patchelf
pdfgrep
perf-tools
python311Packages.nuitka
pv
qemu
rclone
restic
rsync
ruffle
sbctl
scrcpy
gnused
shellcheck
skim
smartmontools
strace
supabase-cli
squashfsTools
tcpdump
tectonic
terraform
tesseract
texliveFull
traceroute
trash-cli
tree
unar
waypipe
which
whois
wireguard-tools
yt-dlp
zellij
zip
zlib-ng
zola
zoxide
zpaq
pipx
ffmpeg
tldr
((import (builtins.fetchTarball "https://github.com/fufexan/nix-gaming/archive/master.tar.gz")).packages.${pkgs.system}).wine-ge
nvtop
imagemagick
steam-run
flatpak-builder
gnupg
unstable.corepack
conda
# Lang servers
nodePackages.bash-language-server
nimlsp
clojure-lsp
gopls
java-language-server
lua-language-server
vala-language-server
# Themes and icons
adw-gtk3
];
shells = with pkgs; [bashInteractive zsh];
variables = {
GPG_TTY = "$(tty)";
LS_COLORS = "di=27";
DIFFPROG = "nvim -d";
GIT_EDITOR = "nvim";
BAT_THEME = "Monokai Extended";
PAGER = "bat -p";
EDITOR = "nvim";
QT_QPA_PLATFORM = "wayland";
_JAVA_AWT_WM_NONREPARENTING = "1"; # Java XWayland fix
MANPAGER = "sh -c 'col -bx | bat -l man -p'";
MANROFFOPT = "-c";
};
sessionVariables.NIXOS_OZONE_WL = "1";
};
fonts = {
enableDefaultPackages = true; # Those fonts you expect every distro to have.
packages = with pkgs; [
source-code-pro
source-sans-pro
source-serif-pro
nerdfonts
fira-code-nerdfont
noto-fonts
noto-fonts-cjk-sans
noto-fonts-cjk-serif
noto-fonts-color-emoji
noto-fonts-monochrome-emoji
fira-mono
hack-font
helvetica-neue-lt-std
takao
terminus_font
iosevka
caladea
carlito
ibm-plex
jetbrains-mono
winePackages.fonts
open-sans
roboto
roboto-slab
symbola
liberation_ttf
cantarell-fonts
cascadia-code
];
fontconfig = {
cache32Bit = true;
defaultFonts = {
monospace = ["Hack Nerd Font Mono"];
serif = ["Cantarell"];
sansSerif = ["Cantarell"];
};
allowBitmaps = false;
};
fontDir.enable = true; # Needed by Flatpak to access fonts
};
# Some programs need more than to be declared in systemPackages
programs = {
evince.enable = true; # Thumbnailer is available this way
git = {
enable = true;
lfs.enable = true;
};
zsh = {
enable = true;
syntaxHighlighting.enable = true;
autosuggestions.enable = true;
enableCompletion = true;
shellAliases = {
ffmpeg-vaapi = "ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128";
pandoc = "pandoc --pdf-engine=tectonic";
c = "cat";
btm = "btm --color=default";
b = "bat -pp";
markdown-render = "glow -p";
cleanup = "nix-store --gc; flatpak uninstall --unused; pnpm store prune";
ls = "exa --time-style=iso --icons --header --color=always --group-directories-first --git";
ll = "exa --time-style=iso -l --icons --header --color=always --group-directories-first --git";
lla = "exa --time-style=iso -la --icons --header --color=always --group-directories-first --git";
grep = "grep --color=auto";
df = "df -h";
free = "free -m";
psmem = "ps auxf | sort -nr -k 4";
pscpu = "ps auxf | sort -nr -k 3";
pls = "sudo !!";
tree = "tree --si --dirsfirst";
o = "xdg-open";
se = "sudoedit";
diff = "colordiff";
docker-clean = "docker ps -aq | xargs -r docker stop && docker system prune -f";
gs = "git status --short";
gl = "git log --oneline";
gp = "git pull --rebase";
trm = "trash-put";
v = "nvim";
cd = "z";
p = "pnpm";
};
};
starship.enable = true;
nix-ld.enable = true;
};
nix = {
settings = {
auto-optimise-store = true;
max-jobs = "auto";
substituters = ["https://nix-gaming.cachix.org"];
trusted-public-keys = ["nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4="];
};
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
};
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It‘s perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.11"; # Did you read the comment?
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment