Initial shared NixOS modules
This commit is contained in:
27
flake.lock
generated
Normal file
27
flake.lock
generated
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1750506804,
|
||||||
|
"narHash": "sha256-VLFNc4egNjovYVxDGyBYTrvVCgDYgENp5bVi9fPTDYc=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "4206c4cb56751df534751b058295ea61357bbbaa",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
36
flake.nix
Normal file
36
flake.nix
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
description = "Timo's Shared Nix Modules";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, ... }:
|
||||||
|
{
|
||||||
|
# System Modules
|
||||||
|
nixosModules.default = { ... }: {
|
||||||
|
imports = [
|
||||||
|
./system/default/editor.nix
|
||||||
|
./system/default/nix.nix
|
||||||
|
./system/default/packages.nix
|
||||||
|
./system/default/system.nix
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Home Manager Modules
|
||||||
|
homeManagerModules.default = { ... }: {
|
||||||
|
imports = [
|
||||||
|
./home/default/bash.nix
|
||||||
|
./home/default/basic.nix
|
||||||
|
./home/default/direnv.nix
|
||||||
|
./home/default/git.nix
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
homeManagerModules.develop = { ... }: {
|
||||||
|
imports = [
|
||||||
|
./home/develop/emacs.nix
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
10
home/default/bash.nix
Normal file
10
home/default/bash.nix
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
programs.bash = {
|
||||||
|
enable = true;
|
||||||
|
historyFileSize = 2000000000;
|
||||||
|
historySize = 100000000;
|
||||||
|
shellOptions = [ "histappend" "cmdhist" ];
|
||||||
|
historyControl = [ "ignoredups" "ignorespace" ];
|
||||||
|
};
|
||||||
|
}
|
||||||
9
home/default/basic.nix
Normal file
9
home/default/basic.nix
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{ config, lib, ... }:
|
||||||
|
{
|
||||||
|
# Let Home Manager install and manage itself.
|
||||||
|
programs.home-manager.enable = true;
|
||||||
|
|
||||||
|
# Home Manager needs a bit of information about you and the paths it should manage.
|
||||||
|
home.username = lib.mkDefault "tb";
|
||||||
|
home.homeDirectory = lib.mkDefault "/home/${config.home.username}";
|
||||||
|
}
|
||||||
11
home/default/direnv.nix
Normal file
11
home/default/direnv.nix
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
programs.direnv = {
|
||||||
|
enable = true;
|
||||||
|
enableBashIntegration = true;
|
||||||
|
|
||||||
|
nix-direnv = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
21
home/default/git.nix
Normal file
21
home/default/git.nix
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
programs.git = {
|
||||||
|
enable = true;
|
||||||
|
lfs.enable = true;
|
||||||
|
|
||||||
|
extraConfig = {
|
||||||
|
pull.ff = "only";
|
||||||
|
|
||||||
|
merge.conflictstyle = "zdiff3";
|
||||||
|
init.defaultBranch = "main";
|
||||||
|
diff.algorithm = "histogram";
|
||||||
|
|
||||||
|
transfer.fsckobjects = true;
|
||||||
|
fetch.fsckobjects = true;
|
||||||
|
receive.fsckObjects = true;
|
||||||
|
|
||||||
|
log.date = "iso";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
128
home/develop/emacs.nix
Normal file
128
home/develop/emacs.nix
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
programs.emacs = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
# Optionally provide extra packages not in the configuration file.
|
||||||
|
extraPackages = epkgs: with epkgs; [
|
||||||
|
|
||||||
|
# === SEARCH AND FILE UTILITIES ===
|
||||||
|
ag # Silver searcher integration for fast text search
|
||||||
|
|
||||||
|
# === WEB AND SERVER CONFIGURATION ===
|
||||||
|
apache-mode # Syntax highlighting for Apache config files
|
||||||
|
nginx-mode # Syntax highlighting for Nginx config files
|
||||||
|
|
||||||
|
# === HARDWARE AND EMBEDDED DEVELOPMENT ===
|
||||||
|
arduino-mode # Arduino sketch development support
|
||||||
|
|
||||||
|
# === DOCUMENT PREPARATION ===
|
||||||
|
auctex # Comprehensive LaTeX editing environment
|
||||||
|
pandoc-mode # Pandoc document converter integration
|
||||||
|
|
||||||
|
# === PROGRAMMING LANGUAGE SUPPORT ===
|
||||||
|
basic-mode # BASIC programming language support
|
||||||
|
bison-mode # Bison parser generator syntax
|
||||||
|
cmake-mode # CMake build system configuration
|
||||||
|
coffee-mode # CoffeeScript programming language
|
||||||
|
csharp-mode # C# programming language
|
||||||
|
groovy-mode # Groovy/Jenkins pipeline scripting
|
||||||
|
haskell-mode # Haskell functional programming
|
||||||
|
js2-mode # Enhanced JavaScript editing mode
|
||||||
|
lua-mode # Lua scripting language
|
||||||
|
php-mode # PHP web development
|
||||||
|
python-mode # Python programming language
|
||||||
|
scala-mode # Scala programming language
|
||||||
|
|
||||||
|
# === MARKUP AND DATA FORMATS ===
|
||||||
|
csv-mode # Comma-separated values file editing
|
||||||
|
dockerfile-mode # Docker container definition files
|
||||||
|
jinja2-mode # Jinja2 template engine syntax
|
||||||
|
markdown-mode # Markdown markup language
|
||||||
|
nix-mode # Nix expression language (NixOS configs)
|
||||||
|
protobuf-mode # Protocol Buffers schema definitions
|
||||||
|
qml-mode # Qt QML user interface markup
|
||||||
|
yaml-mode # YAML configuration files
|
||||||
|
gnuplot-mode # Gnuplot script editing and plotting integration
|
||||||
|
|
||||||
|
# === TEXT COMPLETION AND PRODUCTIVITY ===
|
||||||
|
company # Text completion framework
|
||||||
|
smex # Enhanced M-x command with history
|
||||||
|
|
||||||
|
# === USER INTERFACE ENHANCEMENTS ===
|
||||||
|
diminish # Hide minor modes from the mode line
|
||||||
|
smooth-scrolling # Smoother scrolling experience
|
||||||
|
rainbow-delimiters # Color-code nested parentheses/brackets
|
||||||
|
|
||||||
|
# === ENVIRONMENT AND PROJECT MANAGEMENT ===
|
||||||
|
direnv # Environment variable management per directory
|
||||||
|
projectile # Project interaction and navigation library
|
||||||
|
|
||||||
|
# === LANGUAGE SERVER PROTOCOL (LSP) ===
|
||||||
|
# Modern language support with intelligent features
|
||||||
|
eglot # Built-in LSP client (simpler alternative to lsp-mode)
|
||||||
|
lsp-mode # Comprehensive Language Server Protocol client
|
||||||
|
lsp-java # Java language server integration
|
||||||
|
lsp-metals # Scala language server (Metals) integration
|
||||||
|
eglot-java # Java support for eglot LSP client
|
||||||
|
sbt-mode # Scala Build Tool integration
|
||||||
|
dap-mode # Debug Adapter Protocol for debugging support
|
||||||
|
|
||||||
|
# === SYNTAX CHECKING ===
|
||||||
|
flycheck # On-the-fly syntax checking framework
|
||||||
|
|
||||||
|
# === VERSION CONTROL ===
|
||||||
|
git-link # Generate links to Git repository web interfaces
|
||||||
|
magit # Comprehensive Git porcelain for Emacs
|
||||||
|
|
||||||
|
# === TEXT EDITING ENHANCEMENTS ===
|
||||||
|
goto-last-change # Jump to the location of last edit
|
||||||
|
iedit # Edit multiple occurrences of text simultaneously
|
||||||
|
bm # Visual bookmarks for quick navigation
|
||||||
|
|
||||||
|
# === CODE FORMATTING AND CLEANUP ===
|
||||||
|
web-beautify # Format and beautify web code (HTML/CSS/JS)
|
||||||
|
whitespace-cleanup-mode # Automatically clean up whitespace on save
|
||||||
|
|
||||||
|
# === PARENTHESES AND STRUCTURE EDITING ===
|
||||||
|
paredit # Balanced parentheses editing for Lisp-like languages
|
||||||
|
smartparens # Smart handling of pairs (parentheses, quotes, etc.)
|
||||||
|
|
||||||
|
# === SNIPPETS AND TEMPLATES ===
|
||||||
|
yasnippet # Template system for inserting code snippets
|
||||||
|
quelpa-use-package # Package management for packages not in MELPA
|
||||||
|
|
||||||
|
# === VISUAL THEMES ===
|
||||||
|
grandshell-theme # Dark theme with good contrast
|
||||||
|
leuven-theme # Light theme designed for readability
|
||||||
|
|
||||||
|
# === TREE-SITTER GRAMMARS ===
|
||||||
|
# Modern syntax highlighting and parsing using tree-sitter
|
||||||
|
treesit-grammars.with-all-grammars # All available tree-sitter language grammars
|
||||||
|
|
||||||
|
# === TREE-SITTER BASED MODES ===
|
||||||
|
# These modes use tree-sitter for better performance and accuracy
|
||||||
|
awk-ts-mode # AWK script editing with tree-sitter
|
||||||
|
dart-mode # Dart programming (Flutter development)
|
||||||
|
graphql-ts-mode # GraphQL query language with tree-sitter
|
||||||
|
jq-ts-mode # jq JSON processor with tree-sitter
|
||||||
|
markdown-ts-mode # Markdown with tree-sitter parsing
|
||||||
|
mermaid-ts-mode # Mermaid diagram syntax with tree-sitter
|
||||||
|
scala-ts-mode # Scala with tree-sitter (alternative to scala-mode)
|
||||||
|
swift-ts-mode # Swift programming with tree-sitter
|
||||||
|
|
||||||
|
#"dired+"
|
||||||
|
#dired-copy-paste
|
||||||
|
#frame-cmds
|
||||||
|
#frame-fns
|
||||||
|
#sourcepair
|
||||||
|
#zoom-frm
|
||||||
|
];
|
||||||
|
|
||||||
|
extraConfig = ''
|
||||||
|
(setq standard-indent 2)
|
||||||
|
|
||||||
|
(load-theme 'grandshell t)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
8
system/default/editor.nix
Normal file
8
system/default/editor.nix
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
# Configure nano as a more user-friendly editor
|
||||||
|
environment.variables = {
|
||||||
|
EDITOR = "nano";
|
||||||
|
VISUAL = "nano";
|
||||||
|
};
|
||||||
|
}
|
||||||
56
system/default/nix.nix
Normal file
56
system/default/nix.nix
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
# Nix package manager configuration
|
||||||
|
nix = {
|
||||||
|
settings = {
|
||||||
|
# Enable experimental features for modern Nix functionality
|
||||||
|
# - "nix-command": Enables the new unified 'nix' command interface
|
||||||
|
# - "flakes": Enables Nix flakes for reproducible and composable configurations
|
||||||
|
experimental-features = "nix-command flakes";
|
||||||
|
|
||||||
|
# Specify which users are allowed to run nix commands
|
||||||
|
allowed-users = [ "tb" ];
|
||||||
|
|
||||||
|
# Users who can act as trusted users (can override settings)
|
||||||
|
# Trusted users can use --option flags and import from derivations
|
||||||
|
trusted-users = [ "root" "tb" ];
|
||||||
|
|
||||||
|
# Show more lines of build output on failure
|
||||||
|
log-lines = 50;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Automatic garbage collection configuration
|
||||||
|
# Helps manage disk space by cleaning up unused store paths
|
||||||
|
gc = {
|
||||||
|
# Enable automatic garbage collection
|
||||||
|
automatic = true;
|
||||||
|
|
||||||
|
# Delete store paths older than 30 days during garbage collection
|
||||||
|
options = "--delete-older-than 30d";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Automatic store optimization configuration
|
||||||
|
# Reduces disk usage by hard-linking identical files in the Nix store
|
||||||
|
optimise = {
|
||||||
|
# Enable automatic store optimization
|
||||||
|
# This deduplicates files to save disk space
|
||||||
|
automatic = true;
|
||||||
|
|
||||||
|
# Run optimization weekly
|
||||||
|
dates = [ "weekly" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Nixpkgs package collection configuration
|
||||||
|
nixpkgs = {
|
||||||
|
config = {
|
||||||
|
# Allow installation of packages with non-free licenses
|
||||||
|
# This includes proprietary software like Discord, Slack, etc.
|
||||||
|
# Without this, only free/open-source packages can be installed
|
||||||
|
allowUnfree = true;
|
||||||
|
|
||||||
|
# Allow packages marked as broken (use with caution)
|
||||||
|
#allowBroken = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
143
system/default/packages.nix
Normal file
143
system/default/packages.nix
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
# Default commandline utility packages.
|
||||||
|
# These are installed on all systems for essential functionality.
|
||||||
|
# Organized by category for maintainability.
|
||||||
|
|
||||||
|
{ config, pkgs, ... }: {
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
|
||||||
|
# === CORE SYSTEM UTILITIES ===
|
||||||
|
# Essential command-line tools for basic system operations
|
||||||
|
|
||||||
|
bc # Command-line calculator
|
||||||
|
coreutils # Basic file, shell and text manipulation utilities
|
||||||
|
file # Determine file types
|
||||||
|
which # Locate commands in PATH
|
||||||
|
|
||||||
|
# === TEXT EDITORS AND VIEWERS ===
|
||||||
|
# Basic text editing and viewing capabilities
|
||||||
|
|
||||||
|
nano # Simple, user-friendly text editor
|
||||||
|
|
||||||
|
# === VERSION CONTROL ===
|
||||||
|
# Source code management
|
||||||
|
|
||||||
|
git # Distributed version control system
|
||||||
|
|
||||||
|
# === SEARCH AND FILTERING ===
|
||||||
|
# Tools for finding and processing text/files
|
||||||
|
|
||||||
|
gnugrep # Pattern matching and text search
|
||||||
|
ripgrep # Fast text search tool (rg)
|
||||||
|
|
||||||
|
# === FILE MANAGERS ===
|
||||||
|
# Interactive file management
|
||||||
|
|
||||||
|
mc # Midnight Commander - text-based file manager
|
||||||
|
|
||||||
|
# === NETWORK UTILITIES ===
|
||||||
|
# Network diagnostics and file transfer
|
||||||
|
|
||||||
|
curl # Command-line HTTP client
|
||||||
|
nmap # Network exploration and security auditing
|
||||||
|
openssl # Cryptographic toolkit and SSL/TLS library
|
||||||
|
wget # File downloader
|
||||||
|
|
||||||
|
# === SYNC AND BACKUP ===
|
||||||
|
# File synchronization and backup tools
|
||||||
|
|
||||||
|
rclone # Cloud storage sync tool
|
||||||
|
rsync # Fast, versatile file copying tool
|
||||||
|
|
||||||
|
# === FILE UTILITIES ===
|
||||||
|
# File manipulation and organization
|
||||||
|
|
||||||
|
jq # JSON processor
|
||||||
|
ncdu # Disk usage analyzer with ncurses interface
|
||||||
|
pv # Progress viewer for data through pipes
|
||||||
|
renameutils # Bulk file renaming utilities
|
||||||
|
|
||||||
|
# === COMPRESSION AND ARCHIVES ===
|
||||||
|
# Support for various compression formats
|
||||||
|
|
||||||
|
lzip # Lzip compression
|
||||||
|
pigz # Parallel gzip implementation
|
||||||
|
unzip # Extract ZIP archives
|
||||||
|
xz # XZ compression utilities
|
||||||
|
zip # Create ZIP archives
|
||||||
|
zstd # Zstandard compression
|
||||||
|
|
||||||
|
# === SYSTEM MONITORING ===
|
||||||
|
# Performance monitoring and system information
|
||||||
|
|
||||||
|
bmon # Network bandwidth monitor
|
||||||
|
htop # Interactive process viewer
|
||||||
|
lsof # List open files and network connections
|
||||||
|
|
||||||
|
# === TERMINAL AND SHELL ===
|
||||||
|
# Terminal functionality and shell tools
|
||||||
|
|
||||||
|
screen # Terminal multiplexer
|
||||||
|
rxvt-unicode-unwrapped.terminfo # Terminal info for urxvt
|
||||||
|
|
||||||
|
# === DEVELOPMENT TOOLS ===
|
||||||
|
# Development and debugging utilities
|
||||||
|
|
||||||
|
xxd # Hex dump utility
|
||||||
|
|
||||||
|
# === HARDWARE UTILITIES ===
|
||||||
|
# Hardware information and diagnostics
|
||||||
|
|
||||||
|
lshw # Hardware information tool
|
||||||
|
pciutils # PCI bus utilities (lspci)
|
||||||
|
smartmontools # Hard drive health monitoring
|
||||||
|
|
||||||
|
# === DISK AND STORAGE ===
|
||||||
|
# Storage testing and management
|
||||||
|
|
||||||
|
disk-filltest # Disk testing utility
|
||||||
|
|
||||||
|
] ++ (if pkgs.stdenv.isLinux then [
|
||||||
|
# === LINUX-SPECIFIC PACKAGES ===
|
||||||
|
# Packages that are only available/useful on Linux systems
|
||||||
|
|
||||||
|
# --- KERNEL AND SYSTEM ---
|
||||||
|
|
||||||
|
config.boot.kernelPackages.cpupower # CPU frequency utilities
|
||||||
|
|
||||||
|
# --- NETWORK ADMINISTRATION ---
|
||||||
|
|
||||||
|
iptables # Firewall administration
|
||||||
|
ethtool # Ethernet device configuration
|
||||||
|
|
||||||
|
# --- HARDWARE MANAGEMENT ---
|
||||||
|
|
||||||
|
hdparm # Hard disk parameter tuning
|
||||||
|
usbutils # USB device utilities (lsusb)
|
||||||
|
dmidecode # DMI/SMBIOS information
|
||||||
|
|
||||||
|
# --- PROCESS AND SYSTEM MONITORING ---
|
||||||
|
|
||||||
|
iotop # I/O monitoring by process
|
||||||
|
psmisc # Additional process utilities (killall, pstree)
|
||||||
|
|
||||||
|
# --- COMPRESSION (Linux-specific) ---
|
||||||
|
|
||||||
|
unrar # Extract RAR archives (non-free)
|
||||||
|
|
||||||
|
# --- FILE SYSTEM UTILITIES ---
|
||||||
|
|
||||||
|
inotify-tools # File system event monitoring
|
||||||
|
sshfs # Mount remote filesystems over SSH
|
||||||
|
|
||||||
|
] else [
|
||||||
|
]) ++ (if pkgs.stdenv.isDarwin then [
|
||||||
|
|
||||||
|
# === MACOS-SPECIFIC PACKAGES ===
|
||||||
|
# Packages specifically for macOS systems
|
||||||
|
|
||||||
|
# Currently empty - add macOS-specific tools here as needed
|
||||||
|
# Examples: darwin.apple_sdk.frameworks.Security
|
||||||
|
|
||||||
|
] else []);
|
||||||
|
}
|
||||||
15
system/default/system.nix
Normal file
15
system/default/system.nix
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
# Environment package management
|
||||||
|
# Remove unnecessary default packages to keep system minimal
|
||||||
|
# Default packages usually include basic utilities that might not be needed
|
||||||
|
environment.defaultPackages = [ ];
|
||||||
|
|
||||||
|
# Clean up temporary files on every boot
|
||||||
|
# This prevents /tmp from accumulating old files and filling up
|
||||||
|
boot.tmp.cleanOnBoot = true;
|
||||||
|
|
||||||
|
# Disable coredumps to prevent filling up /var/lib/systemd/coredump/
|
||||||
|
# Coredumps can quickly consume large amounts of disk space
|
||||||
|
systemd.coredump.enable = false;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user