2024-03-06 14:17:11 +00:00
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘ nixos-help’ ).
{ config , pkgs , lib , . . . }:
let
sshConfigPath = ./ssh-config.nix ;
2024-03-11 16:59:45 +00:00
gdrivePath = " / h o m e / s p y 4 x / g d r i v e " ;
curBin = " / r u n / c u r r e n t - s y s t e m / s w / b i n " ;
2024-03-06 14:17:11 +00:00
in
{
imports =
2024-03-10 10:29:35 +00:00
[
# Include the results of the hardware scan.
2024-03-06 14:17:11 +00:00
./hardware-configuration.nix
] ++ lib . optional ( builtins . pathExists sshConfigPath ) sshConfigPath ;
# Bootloader.
boot . loader . grub . enable = true ;
boot . loader . grub . device = " / d e v / n v m e 0 n 1 " ;
boot . loader . grub . useOSProber = true ;
networking . hostName = " s p y 4 x - p c " ;
networking . networkmanager . enable = true ;
2024-03-10 10:29:35 +00:00
networking = {
firewall = {
enable = true ;
allowedTCPPorts = [
2024-03-11 16:59:45 +00:00
# BEGIN Web server to debug apps from mobile
80
4200
4201
5173
5174
8080
8081
# END Web server to debug apps from mobile
2024-03-10 10:29:35 +00:00
53317 # LocalSend
] ;
} ;
} ;
2024-03-06 14:17:11 +00:00
# Allow install "unfree" apps, like Google Chrome or WebStorm
nixpkgs . config . allowUnfree = true ;
time . timeZone = " A s i a / S i n g a p o r e " ;
i18n . defaultLocale = " e n _ S G . U T F - 8 " ;
i18n . extraLocaleSettings = {
LC_ADDRESS = " e n _ S G . U T F - 8 " ;
LC_IDENTIFICATION = " e n _ S G . U T F - 8 " ;
LC_MEASUREMENT = " e n _ S G . U T F - 8 " ;
LC_MONETARY = " e n _ S G . U T F - 8 " ;
LC_NAME = " e n _ S G . U T F - 8 " ;
LC_NUMERIC = " e n _ S G . U T F - 8 " ;
LC_PAPER = " e n _ S G . U T F - 8 " ;
LC_TELEPHONE = " e n _ S G . U T F - 8 " ;
LC_TIME = " e n _ S G . U T F - 8 " ;
} ;
# Enable the X11 windowing system.
services . xserver . enable = true ;
# Enable the GNOME Desktop Environment.
services . xserver . displayManager . gdm . enable = true ;
services . xserver . desktopManager . gnome . enable = true ;
# Configure keymap in X11
services . xserver = {
layout = " u s " ;
xkbVariant = " " ;
} ;
# Activate and configure Docker
virtualisation . docker . enable = true ;
virtualisation . docker . autoPrune . enable = true ;
# virtualisation.docker.enableNvidia = true; # experiment for Roley?
# 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 ;
} ;
2024-03-15 04:40:29 +00:00
# Logitech devices manager "Solaar". Gives necessary permissions to run it without "sudo.
hardware . logitech . wireless . enable = true ;
hardware . logitech . wireless . enableGraphical = true ;
2024-03-06 14:17:11 +00:00
# Define a user account. Don't forget to set a password with ‘ passwd’ .
users . users . spy4x = {
isNormalUser = true ;
description = " A n t o n S h u b i n " ;
extraGroups = [
" n e t w o r k m a n a g e r "
" w h e e l "
" b l u e t o o t h "
" d o c k e r "
] ;
packages = with pkgs ; [
# Shell tools
git
2024-03-10 10:29:35 +00:00
gnumake # Source for "make" command
htop # System monitor viewer
2024-03-06 14:17:11 +00:00
unzip
2024-03-10 10:29:35 +00:00
killall # Kill processes by name instead of PID
ncdu # Disk space usage stats, per folder, nested
libwebp # Convert images into .webp format
wl-clipboard # Wayland's clipboard copy/paste cli tools
2024-03-06 14:17:11 +00:00
tree
2024-03-10 10:29:35 +00:00
nixpkgs-fmt # Formatter for .nix files. Like Prettier.
2024-03-06 14:17:11 +00:00
# Work
nodejs_21
nodePackages . pnpm
2024-03-10 10:29:35 +00:00
vscode-fhs # Wrapped variant of vscode which launches in a FHS compatible environment. Should allow for easy usage of extensions without nix-specific modifications.
2024-03-06 14:17:11 +00:00
jetbrains . webstorm
upwork
slack
2024-03-10 10:29:35 +00:00
ffmpeg # for Roley project
2024-03-06 14:17:11 +00:00
awscli
# Other
google-chrome
2024-03-10 10:29:35 +00:00
bitwarden # Password manager client
2024-03-06 14:17:11 +00:00
vlc
2024-03-10 10:29:35 +00:00
obs-studio # Video recorder and stream software
localsend # Share files/text/data with other devices in local network without internet. OSS alternative to AirDrop.
2024-03-11 16:59:45 +00:00
rclone # Sync Google Drive with a local folder
2024-03-06 14:17:11 +00:00
] ;
} ;
programs . steam . enable = true ; # Install Steam for games management
# Shell aliases and other init
environment . interactiveShellInit = ''
alias copy = ' wl-copy < '
alias build = ' sudo nixos-rebuild switch'
2024-03-10 12:30:36 +00:00
alias rs = ' rsync - avhzru - P'
alias rsh = ' rsync - avhzru - P - e ssh'
2024-03-06 14:17:11 +00:00
'' ;
# Enable automatic login for the user.
services . xserver . displayManager . autoLogin . enable = true ;
services . xserver . displayManager . autoLogin . user = " s p y 4 x " ;
2024-03-11 16:59:45 +00:00
# RClone Google Drive service
systemd . services . rclone-gdrive-mount = {
# Ensure the service starts after the network is up
wantedBy = [ " m u l t i - u s e r . t a r g e t " ] ;
after = [ " n e t w o r k - o n l i n e . t a r g e t " ] ;
requires = [ " n e t w o r k - o n l i n e . t a r g e t " ] ;
# Service configuration
serviceConfig = {
Type = " s i m p l e " ;
ExecStartPre = " ${ curBin } / m k d i r - p ${ gdrivePath } " ;
2024-03-13 08:25:31 +00:00
ExecStart = " ${ pkgs . rclone } / b i n / r c l o n e m o u n t g d r i v e : ${ gdrivePath } - - v f s - c a c h e - m o d e f u l l - - v f s - c a c h e - m a x - a g e 7 2 h - - v f s - c a c h e - m a x - s i z e 1 0 0 G - - v f s - r e a d - a h e a d 2 G " ;
2024-03-11 16:59:45 +00:00
ExecStop = " ${ curBin } / f u s e r m o u n t - u ${ gdrivePath } " ;
Restart = " o n - f a i l u r e " ;
RestartSec = " 1 0 s " ;
User = " s p y 4 x " ;
Group = " u s e r s " ;
Environment = [ " P A T H = / r u n / w r a p p e r s / b i n / : $ P A T H " ] ; # Required environments
} ;
} ;
2024-03-06 14:17:11 +00:00
# Workaround for GNOME autologin: https://github.com/NixOS/nixpkgs/issues/103746#issuecomment-945091229
systemd . services . " g e t t y @ t t y 1 " . enable = false ;
systemd . services . " a u t o v t @ t t y 1 " . enable = false ;
system . stateVersion = " 2 3 . 1 1 " ;
2024-03-10 10:29:35 +00:00
}