Skip to content

Instantly share code, notes, and snippets.

@sicet7
Last active June 7, 2025 09:41
Show Gist options
  • Save sicet7/57486deaaeb2aafdbea34c71538334df to your computer and use it in GitHub Desktop.
Save sicet7/57486deaaeb2aafdbea34c71538334df to your computer and use it in GitHub Desktop.
My Nixos Configuration
# 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
home-manager = builtins.fetchTarball "https://github.com/nix-community/home-manager/archive/release-25.05.tar.gz";
dotnetPkg = pkgs.dotnetCorePackages.sdk_8_0;
forcedUnstable = import
(builtins.fetchTarball https://github.com/nixos/nixpkgs/tarball/nixpkgs-unstable)
# reuse the current configuration
{ config = config.nixpkgs.config; };
fixFlameshotScript = pkgs.writeShellScriptBin "flameshot-screenshot" ''
#!/bin/sh
env QT_QPA_PLATFORM=wayland flameshot gui
'';
in
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
<nixos-hardware/framework/16-inch/7040-amd>
(import "${home-manager}/nixos")
];
# Bootloader.
boot.loader = {
efi = {
canTouchEfiVariables = true;
};
# Setup grub to use osprober
grub = {
enable = true;
device = "nodev";
useOSProber = true;
efiSupport = true;
};
};
# Configure Networking
networking = {
hostName = "sicet7-nixos-framework"; # Hostname
enableIPv6 = false; # Disable IPv6
# Network Manager
networkmanager = {
enable = true;
};
# Firewall
firewall = {
enable = true;
allowedTCPPorts = [
8099
9000
9001
9002
9003
9004
];
allowedUDPPorts = [
8099
9000
9001
9002
9003
9004
];
};
};
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Set your time zone.
time.timeZone = "Europe/Copenhagen";
# Select internationalisation properties.
i18n.defaultLocale = "en_DK.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "da_DK.UTF-8";
LC_IDENTIFICATION = "da_DK.UTF-8";
LC_MEASUREMENT = "da_DK.UTF-8";
LC_MONETARY = "da_DK.UTF-8";
LC_NAME = "da_DK.UTF-8";
LC_NUMERIC = "da_DK.UTF-8";
LC_PAPER = "da_DK.UTF-8";
LC_TELEPHONE = "da_DK.UTF-8";
LC_TIME = "da_DK.UTF-8";
};
hardware.graphics.enable = true;
# Enable OpenGL
# hardware.opengl = {
# enable = true;
# driSupport = true;
# driSupport32Bit = true;
# };
# Enable Touchpad support.
services.libinput.enable = true;
# Configure xserver service.
services.xserver = {
enable = true;
# Configure Graphics Drivers
#videoDrivers = ["nvidia"];
# Configure keymap in X11
xkb = {
layout = "dk";
variant = "";
};
# Configure Gnome Display Manger
displayManager = {
gdm = {
enable = true;
wayland = true;
autoSuspend = false;
};
};
# Configure GNOME Desktop Manger
desktopManager = {
# Enable GNOME desktop.
gnome.enable = true;
# Enable XTerm console.
xterm.enable = true;
};
};
# Configure console keymap
console.keyMap = "dk-latin1";
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable bluetooth
hardware.bluetooth.enable = true;
hardware.bluetooth.settings = {
General = {
Enable = "Source,Sink,Media,Socket";
};
};
# Enable sound with pipewire.
# sound.enable = true;
#hardware.pulseaudio.enable = false;
services.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
environment.gnome.excludePackages = with pkgs.gnome; [
pkgs.gnome-tour # guided tour and greeter
pkgs.epiphany # web browser
pkgs.totem # video player
pkgs.cheese # photo booth
pkgs.simple-scan # document scanner
pkgs.geary # email client
pkgs.seahorse # password manager
pkgs.gedit # old text editor
pkgs.gnome-connections # "New" RDP client that dosent work.
];
# Configure fonts
fonts = {
packages = with pkgs; [
nerd-fonts.sauce-code-pro
nerd-fonts.symbols-only
nerd-fonts.fira-code
];
fontconfig = {
enable = true;
defaultFonts.monospace = [ "SourceCodePro Nerd Font" ];
};
fontDir.enable = true;
};
# Global Level program Config
programs = {
# Enable dconf program.
dconf = {
enable = true;
};
# Enable ZSH Globally to allow for shell switch
zsh = {
enable = true;
};
# Nano config (installed by default)
nano = {
nanorc = ''
set autoindent
set tabsize 4
set tabstospaces
set numbercolor white
'';
syntaxHighlight = true;
};
xwayland = {
enable = true;
};
};
# Virtualization
virtualisation = {
# Docker
docker = {
enable = true;
};
# Libvirtd
libvirtd = {
enable = true;
qemu = {
# Virutal TPM
swtpm = {
enable = true;
};
# Secure boot
ovmf = {
enable = true;
packages = [ pkgs.OVMFFull.fd ];
};
};
};
# USB Redirection
spiceUSBRedirection = {
enable = true;
};
};
# Enable Spice guest vdagent daemon
services.spice-vdagentd.enable = true;
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.sicet7 = {
isNormalUser = true;
description = "Martin René Sørensen";
extraGroups = [ "networkmanager" "wheel" "docker" "libvirtd" ];
shell = pkgs.zsh;
};
# Home Manager
home-manager.useUserPackages = true;
home-manager.useGlobalPkgs = true;
# Home Manager (users)
home-manager.users.sicet7 = { lib, config, ... }: {
home.stateVersion = "23.11";
# User packages
home.packages = with pkgs; [
# Browser
google-chrome
# Music and Video playback
vlc
spotify
# Image Editor
gimp
# Remote Desktop
#anydesk
# Open Broadcaster Software
obs-studio
# Screenshot utillity
flameshot
# REST Client
insomnia
# File sharing
localsend
# Jetbrains tooling
jetbrains.rider
jetbrains.goland
jetbrains.webstorm
jetbrains.phpstorm
jetbrains.datagrip
# Communications :-)
signal-desktop
slack
discord
];
# Command Aliases
home.shellAliases = {
mv = "mv -iv";
rm = "rm -v";
df = "df -h";
du = "du -hs";
ds = "docker stats --format=\"table {{.Name}}\t{{.CPUPerc}}\t{{.MemPerc}}\t{{.MemUsage}}\t{{.NetIO}}\"";
gotop = "gotop --color=nord";
gedit = "gnome-text-editor";
};
# Dconf Settings
dconf.settings = {
"org/gnome/TextEditor" = {
custom-font = "SauceCodePro Nerd Font Semi-Bold 12";
highlight-current-line = false;
indent-style = "space";
show-grid = false;
show-map = false;
style-scheme = "Adwaita-dark";
tab-width = lib.hm.gvariant.mkUint32 4;
use-system-font = false;
};
"org/gnome/desktop/calendar" = {
show-weekdate = true;
};
"org/gnome/desktop/interface" = {
clock-show-seconds = true;
clock-show-weekday = true;
color-scheme = "prefer-dark";
document-font-name = "Source Code Pro 11";
enable-hot-corners = false;
font-antialiasing = "rgba";
font-hinting = "slight";
font-name = "Source Code Pro 11";
gtk-theme = "Adwaita-dark";
};
"org/gnome/desktop/session" = {
idle-delay = lib.hm.gvariant.mkUint32 0;
};
"org/gnome/desktop/screensaver" = {
lock-enabled = false;
};
"org/gnome/desktop/wm/preferences" = {
button-layout = "close,minimize,maximize:appmenu";
};
"org/gnome/nautilus/preferences" = {
search-filter-time-type = "last_modified";
};
"org/gnome/settings-daemon/plugins/power" = {
power-button-action = "interactive";
sleep-inactive-ac-type = "nothing";
};
"org/gnome/shell" = {
favorite-apps = [
"google-chrome.desktop"
"org.gnome.Nautilus.desktop"
];
};
"org/gnome/settings-daemon/plugins/media-keys" = {
custom-keybindings = [
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/terminal/"
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/flameshot/"
];
};
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/flameshot" = {
binding = "Print";
command = "${fixFlameshotScript}/bin/flameshot-screenshot";
name = "flameshot";
};
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/terminal" = {
binding = "<Control><Alt>t";
command = "xterm -e tmux";
name = "Open Terminal";
};
"org/gnome/mutter" = {
workspaces-only-on-primary = true;
};
"org/gnome/shell/app-switcher" = {
current-workspace-only = true;
};
"org/gnome/tweaks" = {
show-extensions-notice = false;
};
"org/gnome/shell/keybindings" = {
show-screenshot-ui = [];
};
};
# Services (sicet7)
services = {
flameshot = {
enable = true;
settings = {
General = {
savePath = "${config.home.homeDirectory}/Pictures/Screenshots";
savePathFixed = true;
showHelp = false;
filenamePattern = "%F_%H-%M-%S";
};
};
};
};
# Programs (sicet7)
programs = {
# GIT Config
git = {
enable = true;
userName = "Martin René Sørensen";
userEmail = "[email protected]";
aliases = {
assume = "update-index --assume-unchanged";
unassume = "update-index --no-assume-unchanged";
assumed = "!git ls-files -v | grep ^h | cut -c 3-";
ours = "!f() { git checkout --ours \$@ && git add \$@; }; f";
theirs = "!f() { git checkout --theirs \$@ && git add \$@; }; f";
unstage = "reset HEAD";
recreate = "!f() { [[ -n \$@ ]] && git checkout \"\$@\" && git unpublish && git checkout master && git branch -D \"\$@\" && git checkout -b \"\$@\" && git publish; }; f";
lcf = "diff-tree --no-commit-id --name-only -r";
rr = "!f() { git remote update \"\$1\" --prune; }; f";
diww = "!f() { git diff -w \"\$1^\" \"\$1\"; }; f";
cho = "checkout";
st = "status";
stauts = "status";
stuats = "status";
sta = "status";
chp = "cherry-pick";
tree = "log --graph";
};
extraConfig = {
core = {
fileMode = false;
symlinks = false;
};
merge = {
ff = false;
};
pull = {
ff = "only";
};
push = {
autoSetupRemote = true;
};
init = {
defaultBranch = "master";
};
pager = {
branch = false;
};
safe = {
directory = "${config.home.homeDirectory}/Dev/*";
};
};
};
# ZSH Config
zsh = {
enable = true;
#enableAutosuggestions = true;
#enableCompletion = true;
envExtra = ''
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#606060"
'';
initContent = ''
export PATH="$PATH:/home/sicet7/.dotnet/tools"
enter () {
local shellFile="default.nix"
if [ $# -lt 1 ] || [ $# -ge 3 ]; then
echo "Invalid amount of arguments."
return 1
fi
if [ $# -eq 2 ]; then
local shellVersion="$2"
shellFile="''${shellVersion/\./_}.nix"
fi
local shellFilePath="$HOME/.my-nix-shells/$1/$shellFile"
if [ -f "$shellFilePath" ]; then
nix-shell --command zsh "$shellFilePath"
return 0
fi
echo "$shellFilePath does not exist"
return 1
};
b64d () {
local len=$(( ''${#1} % 4 ))
local padded_b64=""
if [ ''${len} = 2 ]; then
padded_b64="''${1}=="
elif [ ''${len} = 3 ]; then
padded_b64="''${1}="
else
padded_b64="''${1}"
fi
echo -n "$padded_b64" | tr -- "-_" "+/" | base64 -d
};
shop () {
nix-shell --command zsh --packages "$@"
};
'';
plugins = with pkgs; [
{
name = "zsh-autosuggestions";
src = fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-autosuggestions";
rev = "v0.7.0";
sha256 = "28b518a54bb80c746e990677c39f66f5a4d6e9304a3025e5d9470a8b8b8c77bc";
};
}
{
name = "zsh-syntax-highlighting";
src = fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-syntax-highlighting";
rev = "0.7.1";
sha256 = "80e1b434b95a25fa2d25fb3e49484680b4cd3a718b8e8aa7529e7857d685260f";
};
}
{
name = "zsh-completions";
src = fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-completions";
rev = "0.35.0";
sha256 = "1851e5663207516c32795a02a6cce09f80262cf49213c51535f4668ac9e19298";
};
}
];
oh-my-zsh = {
enable = true;
};
};
# StarShip Config
starship = {
enable = true;
settings = {
time = {
disabled = false;
use_12hr = false;
};
nix_shell = {
format = "$state ";
impure_msg = "[\\[](bold red)[\$name](bold blue)[\\]](bold red)";
pure_msg = "[\\[](bold green)[\$name](bold blue)[\\]](bold green)";
unknown_msg = "[\\[](bold yellow)[\$name](bold blue)[\\]](bold yellow)";
};
sudo = {
disabled = false;
};
};
};
# TMUX Config
tmux = {
enable = true;
clock24 = true;
baseIndex = 1;
historyLimit = 10000;
escapeTime = 0;
shell = "${pkgs.zsh}/bin/zsh";
terminal = "screen-256color";
extraConfig = ''
# Prevent tmux from renaming my windows.
set-option -g allow-rename off
# Start new windows and panes from the same path
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
# Change panes with <LALT>+<Arrow Keys>
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Next and previous windows on <prefix>(h or j)
bind h previous-window
bind j next-window
# bind T to top current window
bind-key T swap-window -t 1
# Copy Tmux buffer to system buffer with xclip (<prefix> + y)
bind y run "tmux save-buffer - | xsel -ib"
'';
plugins = with pkgs.tmuxPlugins; [
{
plugin = dracula;
extraConfig = ''
set -g @dracula-show-battery false
set -g @dracula-show-network false
set -g @dracula-show-weather false
set -g @dracula-military-time true
set -g @dracula-show-timezone false
set -g @dracula-cpu-usage true
set -g @dracula-ram-usage true
set -g @dracula-day-month true
set -g @dracula-plugins "cpu-usage ram-usage time"
set -g @dracula-left-icon-padding 1
'';
}
];
};
};
home.file = let
myDotFiles = pkgs.fetchFromGitHub {
owner = "sicet7";
repo = "nix";
rev = "1.0.8";
hash = "sha256-VeyMpqY0lP8GyzCZt7tEw+6qIXTeCZRuceQ39FTtzwU=";
};
in {
# XTERM Configuration
".Xresources".text = ''
XTerm*faceName: Source Code Pro,Source Code Pro Semibold
XTerm*faceSize: 12
XTerm*Background: Grey19
XTerm*Foreground: white
XTerm*VT100*selectToClipboard: true
'';
".my-nix-shells".source = "${myDotFiles}/shells";
};
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
fixFlameshotScript
# Packages for accessing web resources.
wget
curl
# DNS and Networking tools
dig
# Tool to access the X clipboard from a console application
xsel
# Programming Tools
go
dotnetPkg
mono
(php81.buildEnv {
extensions = { all, ... }: with all; [
filter
openssl
fileinfo
iconv
simplexml
tokenizer
xmlreader
xmlwriter
amqp
bcmath
bz2
curl
gd
imap
intl
ldap
mbstring
mysqli
mysqlnd
pdo_mysql
pgsql
pdo_pgsql
sqlsrv
pdo_sqlsrv
sqlite3
pdo_sqlite
pdo_odbc
mongodb
redis
zip
soap
sockets
sodium
pdo
ftp
dom
zlib
exif
posix
pcntl
ctype
xdebug
gettext
shmop
sysvmsg
sysvsem
sysvshm
imagick
xsl
readline
];
})
nodejs_20
# Tools
mysql80
postgresql
gnumake
openssl
zip
gparted
ffmpeg_7-full
# Code editor
forcedUnstable.vscode
forcedUnstable.code-cursor
# Java
jdk
# Markdown
pandoc
#Vulkan
vulkan-tools
# Terminal file manager
lf
# The unix "watch" command
unixtools.watch
# Process viewers
htop
gotop
#btop
# Docker Compose
docker-compose
# Remote desktop tools
remmina
forcedUnstable.anydesk
# Virtualization software
virt-manager
virt-viewer
win-virtio
spice
spice-gtk
spice-protocol
win-spice
# VPN
wireguard-tools
# PGP
gnupg
# Install Gnome Packages.
baobab # disk usage analyzer
eog # image viewer
yelp # help viewer
evince # document viewer
file-roller # archive manager
# more gnome apps
gnome-calculator
gnome-calendar
gnome-characters
gnome-clocks
gnome-contacts
gnome-font-viewer
gnome-logs
gnome-maps
gnome-music
gnome-system-monitor
gnome-weather
gnome-disk-utility
gnome-tweaks
gnome-screenshot
#ODBC Driver install
unixODBC
];
#ODBC Drivers
environment.unixODBCDrivers = [
pkgs.unixODBCDrivers.msodbcsql18
pkgs.unixODBCDrivers.sqlite
pkgs.unixODBCDrivers.psql
pkgs.unixODBCDrivers.mariadb
];
environment.sessionVariables = {
NIXOS_OZONE_WL = "1";
};
environment.variables = rec {
DOTNET_ROOT="${dotnetPkg}";
};
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# 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 = "24.05"; # Did you read the comment?
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment