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
2024-03-15 07:21:36 +00:00
username = " s p y 4 x " ;
userFullName = " A n t o n S h u b i n " ;
2024-03-15 09:04:57 +00:00
2024-03-15 07:21:36 +00:00
gdrivePath = " / h o m e / ${ username } / g d r i v e " ;
2024-03-11 16:59:45 +00:00
curBin = " / r u n / c u r r e n t - s y s t e m / s w / b i n " ;
2024-03-15 09:04:57 +00:00
nixFolder = " / e t c / n i x o s " ;
sshConfigPath = " ${ nixFolder } / p r i v a t e / s s h - c o n f i g " ;
sshConfig = if builtins . pathExists " ${ sshConfigPath } " then builtins . readFile " ${ sshConfigPath } " else " # p r i v a t e s s h c o n f i g f i l e d i d n ' t e x i s t t o i n s e r t i t ' s c o n t e n t h e r e " ;
aliasesPath = " ${ nixFolder } / a l i a s e s . s h " ;
aliases = if builtins . pathExists " ${ aliasesPath } " then builtins . readFile " ${ aliasesPath } " else " # a l i a s e s f i l e d i d n ' t e x i s t t o i n s e r t i t ' s c o n t e n t h e r e " ;
2024-03-15 07:21:36 +00:00
home-manager = builtins . fetchTarball " h t t p s : / / g i t h u b . c o m / n i x - c o m m u n i t y / h o m e - m a n a g e r / a r c h i v e / r e l e a s e - 2 3 . 1 1 . t a r . g z " ;
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
2024-03-15 07:21:36 +00:00
( import " ${ home-manager } / n i x o s " )
] ;
2024-03-06 14:17:11 +00:00
# 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 ;
2024-03-15 07:21:36 +00:00
networking . hostName = " ${ username } - p c " ;
2024-03-06 14:17:11 +00:00
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-15 08:58:34 +00:00
# Define a user account. Don't forget to set a password with ‘ passwd’ .
users . users . spy4x = {
isNormalUser = true ;
description = userFullName ;
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 "
] ;
shell = pkgs . zsh ;
} ;
2024-03-15 07:21:36 +00:00
home-manager . users . spy4x = {
home . stateVersion = " 2 3 . 1 1 " ;
home . username = username ;
home . homeDirectory = " / h o m e / ${ username } " ;
home . packages = with pkgs ; [
2024-03-15 08:58:34 +00:00
# Shell tools BEGIN
2024-03-06 14:17:11 +00:00
git
2024-03-10 10:29:35 +00:00
gnumake # Source for "make" command
htop # System monitor viewer
2024-03-16 16:20:42 +00:00
zip
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-16 16:08:49 +00:00
envsubst # Is used in homelab deploy for building homepage
2024-03-15 08:58:34 +00:00
zsh
zsh-powerlevel10k
# Shell tools END
2024-03-06 14:17:11 +00:00
2024-03-15 08:58:34 +00:00
# Work BEGIN
2024-03-06 14:17:11 +00:00
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
2024-03-23 15:18:07 +00:00
# GitHub Copilot BEGIN
# A fix for "Failed to initiate the GitHub login process. Please try again."
# Execute next command, but replace the name of the Product (WebStorm2023.2 to a newer version or other product)
# (yes, /run/current-system/sw/bin/copilot-agent might not exist, but it's a symlink to the actual binary)
# ln -fs /run/current-system/sw/bin/copilot-agent ~/.local/share/JetBrains//WebStorm2023.2/github-copilot-intellij/copilot-agent/bin/copilot-agent-linux
github-copilot-intellij-agent
# GitHub Copilot END
2024-03-06 14:17:11 +00:00
upwork
slack
2024-03-22 06:57:16 +00:00
ffmpeg # for Roley project, check if still actual after 01.01.2025
awscli # for Roley project, check if still actual after 01.01.2025
google-cloud-sdk # for TOD project, check if still actual after 01.01.2025
2024-03-15 08:58:34 +00:00
# Work END
2024-03-06 14:17:11 +00:00
2024-03-15 08:58:34 +00:00
# Other BEGIN
2024-03-06 14:17:11 +00:00
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-24 10:14:00 +00:00
bottles # Gaming time! Wine wrapper for Windows games and apps
2024-03-15 08:58:34 +00:00
# Other END
2024-03-06 14:17:11 +00:00
] ;
2024-03-15 07:52:31 +00:00
programs . ssh . enable = true ;
programs . ssh . extraConfig = ''
$ { sshConfig }
'' ;
2024-03-06 14:17:11 +00:00
} ;
programs . steam . enable = true ; # Install Steam for games management
2024-03-15 08:58:34 +00:00
programs . zsh = {
enable = true ;
syntaxHighlighting . enable = true ;
autosuggestions . enable = true ;
ohMyZsh . enable = true ;
promptInit = " s o u r c e ${ pkgs . zsh-powerlevel10k } / s h a r e / z s h - p o w e r l e v e l 1 0 k / p o w e r l e v e l 1 0 k . z s h - t h e m e " ;
} ;
2024-03-06 14:17:11 +00:00
# Shell aliases and other init
environment . interactiveShellInit = ''
2024-03-15 09:04:57 +00:00
$ { aliases }
2024-03-06 14:17:11 +00:00
'' ;
2024-03-15 07:52:31 +00:00
2024-03-06 14:17:11 +00:00
# Enable automatic login for the user.
services . xserver . displayManager . autoLogin . enable = true ;
2024-03-15 07:21:36 +00:00
services . xserver . displayManager . autoLogin . user = username ;
2024-03-06 14:17:11 +00:00
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 " ;
2024-03-15 07:21:36 +00:00
User = username ;
2024-03-11 16:59:45 +00:00
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
}