mirror of
https://github.com/zephrynis/nix-flake.git
synced 2026-02-18 12:11:54 +00:00
Initial NixOS flake-based multi-host setup
Add a NixOS system configuration using flakes, supporting multiple hosts (desktop, laptop, my-machine) with shared and per-host settings. Includes Home Manager integration, user-level and system-level package management, and example hardware configuration placeholders. Provides a README with setup instructions and a .gitignore for common Nix and editor artifacts.
This commit is contained in:
13
.gitignore
vendored
Normal file
13
.gitignore
vendored
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# Nix build results
|
||||||
|
result
|
||||||
|
result-*
|
||||||
|
|
||||||
|
# Temporary files
|
||||||
|
*~
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Hardware configuration (may contain sensitive info)
|
||||||
|
# Uncomment if you don't want to commit hardware configs
|
||||||
|
# hosts/*/hardware-configuration.nix
|
||||||
76
README.md
Normal file
76
README.md
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
# NixOS System Configuration
|
||||||
|
|
||||||
|
This is a NixOS flake configuration for managing your system setup, ricing, and applications across multiple devices.
|
||||||
|
|
||||||
|
## Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
.
|
||||||
|
├── flake.nix # Main flake configuration
|
||||||
|
├── flake.lock # Locked dependency versions
|
||||||
|
├── system/
|
||||||
|
│ └── common.nix # Shared system configuration
|
||||||
|
├── hosts/
|
||||||
|
│ └── my-machine/ # Per-machine configurations
|
||||||
|
│ ├── configuration.nix # Machine-specific settings
|
||||||
|
│ └── hardware-configuration.nix # Hardware-specific settings
|
||||||
|
└── home/
|
||||||
|
└── home.nix # User-level configuration (dotfiles, packages)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Initial Setup
|
||||||
|
|
||||||
|
1. **Generate hardware configuration** on your NixOS machine:
|
||||||
|
```bash
|
||||||
|
nixos-generate-config --show-hardware-config > hardware-configuration.nix
|
||||||
|
```
|
||||||
|
Copy the output to `hosts/my-machine/hardware-configuration.nix`
|
||||||
|
|
||||||
|
2. **Update configuration files**:
|
||||||
|
- Change `my-machine` to your actual hostname throughout the files
|
||||||
|
- Update `yourusername` to your actual username
|
||||||
|
- Adjust timezone, locale, and other personal settings
|
||||||
|
- Choose your desktop environment / window manager
|
||||||
|
|
||||||
|
3. **Update flake inputs**:
|
||||||
|
```bash
|
||||||
|
nix flake update
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **Build and switch to the new configuration**:
|
||||||
|
```bash
|
||||||
|
sudo nixos-rebuild switch --flake .#my-machine
|
||||||
|
```
|
||||||
|
|
||||||
|
## Adding a New Machine
|
||||||
|
|
||||||
|
1. Create a new directory under `hosts/` with your machine's hostname
|
||||||
|
2. Generate and add the hardware configuration
|
||||||
|
3. Create a `configuration.nix` for machine-specific settings
|
||||||
|
4. Add the new machine to `flake.nix` under `nixosConfigurations`
|
||||||
|
5. Build with: `sudo nixos-rebuild switch --flake .#new-machine`
|
||||||
|
|
||||||
|
## Updating the System
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Update flake inputs
|
||||||
|
nix flake update
|
||||||
|
|
||||||
|
# Rebuild system
|
||||||
|
sudo nixos-rebuild switch --flake .#my-machine
|
||||||
|
```
|
||||||
|
|
||||||
|
## Customization Ideas
|
||||||
|
|
||||||
|
- Add window manager configurations (i3, bspwm, Hyprland, etc.)
|
||||||
|
- Configure terminal emulators (Alacritty, Kitty, WezTerm)
|
||||||
|
- Set up status bars (Polybar, Waybar)
|
||||||
|
- Add custom themes and color schemes
|
||||||
|
- Configure rofi, dunst for notifications
|
||||||
|
- Set up wallpaper management with nitrogen or variety
|
||||||
|
|
||||||
|
## Resources
|
||||||
|
|
||||||
|
- [NixOS Manual](https://nixos.org/manual/nixos/stable/)
|
||||||
|
- [Home Manager Manual](https://nix-community.github.io/home-manager/)
|
||||||
|
- [NixOS Wiki](https://nixos.wiki/)
|
||||||
49
flake.lock
generated
Normal file
49
flake.lock
generated
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"home-manager": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1,
|
||||||
|
"narHash": "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "home-manager",
|
||||||
|
"rev": "0000000000000000000000000000000000000000",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"ref": "release-25.05",
|
||||||
|
"repo": "home-manager",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1729618870,
|
||||||
|
"narHash": "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "879bd460b3d3bb3c4c67e863af2c3a7dbbebb87e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-25.05",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"home-manager": "home-manager",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
78
flake.nix
Normal file
78
flake.nix
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
{
|
||||||
|
description = "NixOS system configuration flake with ricing and application management";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
|
||||||
|
|
||||||
|
# Home Manager for user-level configuration and dotfiles
|
||||||
|
home-manager = {
|
||||||
|
url = "github:nix-community/home-manager/release-25.05";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Optional: Hyprland (if you want a tiling Wayland compositor)
|
||||||
|
# hyprland.url = "github:hyprwm/Hyprland";
|
||||||
|
|
||||||
|
# Optional: Other useful inputs
|
||||||
|
# nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, home-manager, ... }@inputs: {
|
||||||
|
# NixOS configuration for your hostname(s)
|
||||||
|
nixosConfigurations = {
|
||||||
|
# Desktop PC configuration
|
||||||
|
desktop = nixpkgs.lib.nixosSystem {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
specialArgs = { inherit inputs; };
|
||||||
|
modules = [
|
||||||
|
# Your hardware configuration
|
||||||
|
./hosts/desktop/hardware-configuration.nix
|
||||||
|
|
||||||
|
# System-wide configuration
|
||||||
|
./hosts/desktop/configuration.nix
|
||||||
|
|
||||||
|
# Common system configuration shared across all machines
|
||||||
|
./system/common.nix
|
||||||
|
|
||||||
|
# Home Manager NixOS module
|
||||||
|
home-manager.nixosModules.home-manager
|
||||||
|
{
|
||||||
|
home-manager.useGlobalPkgs = true;
|
||||||
|
home-manager.useUserPackages = true;
|
||||||
|
home-manager.extraSpecialArgs = { inherit inputs; };
|
||||||
|
|
||||||
|
# Replace "yourusername" with your actual username
|
||||||
|
home-manager.users.yourusername = import ./home/home.nix;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Laptop configuration
|
||||||
|
laptop = nixpkgs.lib.nixosSystem {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
specialArgs = { inherit inputs; };
|
||||||
|
modules = [
|
||||||
|
# Your hardware configuration
|
||||||
|
./hosts/laptop/hardware-configuration.nix
|
||||||
|
|
||||||
|
# System-wide configuration
|
||||||
|
./hosts/laptop/configuration.nix
|
||||||
|
|
||||||
|
# Common system configuration shared across all machines
|
||||||
|
./system/common.nix
|
||||||
|
|
||||||
|
# Home Manager NixOS module
|
||||||
|
home-manager.nixosModules.home-manager
|
||||||
|
{
|
||||||
|
home-manager.useGlobalPkgs = true;
|
||||||
|
home-manager.useUserPackages = true;
|
||||||
|
home-manager.extraSpecialArgs = { inherit inputs; };
|
||||||
|
|
||||||
|
# Replace "yourusername" with your actual username
|
||||||
|
home-manager.users.yourusername = import ./home/home.nix;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
127
home/home.nix
Normal file
127
home/home.nix
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
# Home Manager configuration for user-level dotfiles and applications
|
||||||
|
|
||||||
|
home.username = "yourusername"; # Change this
|
||||||
|
home.homeDirectory = "/home/yourusername"; # Change this
|
||||||
|
|
||||||
|
# Packages to install for this user
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
# Development tools
|
||||||
|
vscode
|
||||||
|
# neovim
|
||||||
|
|
||||||
|
# Browsers
|
||||||
|
firefox
|
||||||
|
# chromium
|
||||||
|
|
||||||
|
# Terminal emulators
|
||||||
|
# alacritty
|
||||||
|
# kitty
|
||||||
|
# wezterm
|
||||||
|
|
||||||
|
# File managers
|
||||||
|
# thunar
|
||||||
|
# ranger
|
||||||
|
# nnn
|
||||||
|
|
||||||
|
# Media
|
||||||
|
# mpv
|
||||||
|
# vlc
|
||||||
|
# spotify
|
||||||
|
|
||||||
|
# Communication
|
||||||
|
# discord
|
||||||
|
# slack
|
||||||
|
|
||||||
|
# Screenshots and screen recording
|
||||||
|
# flameshot
|
||||||
|
# maim
|
||||||
|
# obs-studio
|
||||||
|
|
||||||
|
# System utilities
|
||||||
|
# rofi
|
||||||
|
# dunst
|
||||||
|
# polybar
|
||||||
|
# picom
|
||||||
|
|
||||||
|
# Ricing essentials
|
||||||
|
# lxappearance
|
||||||
|
# nitrogen # wallpaper setter
|
||||||
|
# pywal # color scheme generator
|
||||||
|
|
||||||
|
# Themes and icons
|
||||||
|
# papirus-icon-theme
|
||||||
|
# arc-theme
|
||||||
|
];
|
||||||
|
|
||||||
|
# Git configuration
|
||||||
|
programs.git = {
|
||||||
|
enable = true;
|
||||||
|
userName = "Your Name";
|
||||||
|
userEmail = "your.email@example.com";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Terminal configuration
|
||||||
|
programs.zsh = {
|
||||||
|
enable = true;
|
||||||
|
enableCompletion = true;
|
||||||
|
# autosuggestion.enable = true;
|
||||||
|
# syntaxHighlighting.enable = true;
|
||||||
|
|
||||||
|
shellAliases = {
|
||||||
|
ll = "ls -la";
|
||||||
|
update = "sudo nixos-rebuild switch --flake .#my-machine";
|
||||||
|
# Add more aliases
|
||||||
|
};
|
||||||
|
|
||||||
|
# oh-my-zsh = {
|
||||||
|
# enable = true;
|
||||||
|
# theme = "robbyrussell";
|
||||||
|
# plugins = [ "git" "sudo" ];
|
||||||
|
# };
|
||||||
|
};
|
||||||
|
|
||||||
|
# Bash configuration (if you prefer bash)
|
||||||
|
programs.bash = {
|
||||||
|
enable = true;
|
||||||
|
shellAliases = {
|
||||||
|
ll = "ls -la";
|
||||||
|
update = "sudo nixos-rebuild switch --flake .#my-machine";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Starship prompt
|
||||||
|
# programs.starship = {
|
||||||
|
# enable = true;
|
||||||
|
# settings = {
|
||||||
|
# add_newline = false;
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
|
||||||
|
# GTK theming
|
||||||
|
gtk = {
|
||||||
|
enable = true;
|
||||||
|
# theme = {
|
||||||
|
# name = "Arc-Dark";
|
||||||
|
# package = pkgs.arc-theme;
|
||||||
|
# };
|
||||||
|
# iconTheme = {
|
||||||
|
# name = "Papirus-Dark";
|
||||||
|
# package = pkgs.papirus-icon-theme;
|
||||||
|
# };
|
||||||
|
};
|
||||||
|
|
||||||
|
# Qt theming
|
||||||
|
# qt = {
|
||||||
|
# enable = true;
|
||||||
|
# platformTheme.name = "gtk";
|
||||||
|
# };
|
||||||
|
|
||||||
|
# Let Home Manager manage itself
|
||||||
|
programs.home-manager.enable = true;
|
||||||
|
|
||||||
|
# Home Manager state version
|
||||||
|
home.stateVersion = "25.05";
|
||||||
|
}
|
||||||
63
hosts/desktop/configuration.nix
Normal file
63
hosts/desktop/configuration.nix
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
# Desktop PC specific configuration
|
||||||
|
|
||||||
|
networking.hostName = "desktop";
|
||||||
|
|
||||||
|
# Users configuration
|
||||||
|
users.users.yourusername = { # Change "yourusername" to your actual username
|
||||||
|
isNormalUser = true;
|
||||||
|
description = "Your Name"; # Change this
|
||||||
|
extraGroups = [ "networkmanager" "wheel" "video" "audio" ];
|
||||||
|
shell = pkgs.zsh; # or pkgs.bash
|
||||||
|
};
|
||||||
|
|
||||||
|
# Enable zsh system-wide
|
||||||
|
programs.zsh.enable = true;
|
||||||
|
|
||||||
|
# Display manager and desktop environment / window manager
|
||||||
|
services.xserver = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
# Display manager
|
||||||
|
displayManager.gdm.enable = true;
|
||||||
|
|
||||||
|
# Desktop environment (choose one, or comment all for a standalone WM)
|
||||||
|
# desktopManager.gnome.enable = true;
|
||||||
|
# desktopManager.plasma5.enable = true;
|
||||||
|
|
||||||
|
# Window manager (uncomment if you want a standalone WM)
|
||||||
|
# windowManager.i3.enable = true;
|
||||||
|
# windowManager.bspwm.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Optional: Enable Wayland compositor
|
||||||
|
# programs.hyprland = {
|
||||||
|
# enable = true;
|
||||||
|
# xwayland.enable = true;
|
||||||
|
# };
|
||||||
|
|
||||||
|
# Desktop-specific packages (gaming, streaming, etc.)
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
# Add desktop-specific packages here
|
||||||
|
# discord
|
||||||
|
# steam
|
||||||
|
# obs-studio
|
||||||
|
];
|
||||||
|
|
||||||
|
# Gaming support (uncomment if needed)
|
||||||
|
# programs.steam.enable = true;
|
||||||
|
# programs.gamemode.enable = true;
|
||||||
|
|
||||||
|
# Fonts
|
||||||
|
fonts.packages = with pkgs; [
|
||||||
|
noto-fonts
|
||||||
|
noto-fonts-cjk-sans
|
||||||
|
noto-fonts-emoji
|
||||||
|
liberation_ttf
|
||||||
|
fira-code
|
||||||
|
fira-code-symbols
|
||||||
|
(nerdfonts.override { fonts = [ "FiraCode" "JetBrainsMono" "Iosevka" ]; })
|
||||||
|
];
|
||||||
|
}
|
||||||
40
hosts/desktop/hardware-configuration.nix
Normal file
40
hosts/desktop/hardware-configuration.nix
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
# This file should be generated by running:
|
||||||
|
# nixos-generate-config --show-hardware-config > hardware-configuration.nix
|
||||||
|
#
|
||||||
|
# Run this command on your DESKTOP to get the correct hardware configuration
|
||||||
|
# Then copy the output here.
|
||||||
|
|
||||||
|
{ config, lib, pkgs, modulesPath, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
# PLACEHOLDER: Replace this entire file with your actual hardware configuration
|
||||||
|
# You can generate it by running the command mentioned above on your NixOS system
|
||||||
|
|
||||||
|
boot.initrd.availableKernelModules = [ ];
|
||||||
|
boot.initrd.kernelModules = [ ];
|
||||||
|
boot.kernelModules = [ ];
|
||||||
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
|
fileSystems."/" = {
|
||||||
|
device = "/dev/disk/by-label/nixos";
|
||||||
|
fsType = "ext4";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Swap configuration
|
||||||
|
# swapDevices = [ ];
|
||||||
|
|
||||||
|
# CPU microcode updates (uncomment for your CPU)
|
||||||
|
# hardware.cpu.intel.updateMicrocode = true;
|
||||||
|
# hardware.cpu.amd.updateMicrocode = true;
|
||||||
|
|
||||||
|
# NVIDIA drivers (uncomment if you have an NVIDIA GPU)
|
||||||
|
# services.xserver.videoDrivers = [ "nvidia" ];
|
||||||
|
# hardware.nvidia = {
|
||||||
|
# modesetting.enable = true;
|
||||||
|
# powerManagement.enable = false;
|
||||||
|
# open = false;
|
||||||
|
# nvidiaSettings = true;
|
||||||
|
# };
|
||||||
|
}
|
||||||
85
hosts/laptop/configuration.nix
Normal file
85
hosts/laptop/configuration.nix
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
# Laptop specific configuration
|
||||||
|
|
||||||
|
networking.hostName = "laptop";
|
||||||
|
|
||||||
|
# Users configuration
|
||||||
|
users.users.yourusername = { # Change "yourusername" to your actual username
|
||||||
|
isNormalUser = true;
|
||||||
|
description = "Your Name"; # Change this
|
||||||
|
extraGroups = [ "networkmanager" "wheel" "video" "audio" ];
|
||||||
|
shell = pkgs.zsh; # or pkgs.bash
|
||||||
|
};
|
||||||
|
|
||||||
|
# Enable zsh system-wide
|
||||||
|
programs.zsh.enable = true;
|
||||||
|
|
||||||
|
# Display manager and desktop environment / window manager
|
||||||
|
services.xserver = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
# Display manager
|
||||||
|
displayManager.gdm.enable = true;
|
||||||
|
|
||||||
|
# Desktop environment (choose one, or comment all for a standalone WM)
|
||||||
|
# desktopManager.gnome.enable = true;
|
||||||
|
# desktopManager.plasma5.enable = true;
|
||||||
|
|
||||||
|
# Window manager (uncomment if you want a standalone WM)
|
||||||
|
# windowManager.i3.enable = true;
|
||||||
|
# windowManager.bspwm.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Optional: Enable Wayland compositor
|
||||||
|
# programs.hyprland = {
|
||||||
|
# enable = true;
|
||||||
|
# xwayland.enable = true;
|
||||||
|
# };
|
||||||
|
|
||||||
|
# Laptop-specific power management
|
||||||
|
services.tlp = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
# Battery thresholds (for supported laptops)
|
||||||
|
START_CHARGE_THRESH_BAT0 = 40;
|
||||||
|
STOP_CHARGE_THRESH_BAT0 = 80;
|
||||||
|
|
||||||
|
# CPU scaling
|
||||||
|
CPU_SCALING_GOVERNOR_ON_AC = "performance";
|
||||||
|
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Enable powertop for additional power savings
|
||||||
|
powerManagement.powertop.enable = true;
|
||||||
|
|
||||||
|
# Laptop-specific packages
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
# Add laptop-specific packages here
|
||||||
|
brightnessctl # Screen brightness control
|
||||||
|
acpi # Battery info
|
||||||
|
];
|
||||||
|
|
||||||
|
# Enable touchpad support
|
||||||
|
services.libinput = {
|
||||||
|
enable = true;
|
||||||
|
touchpad = {
|
||||||
|
naturalScrolling = true;
|
||||||
|
tapping = true;
|
||||||
|
disableWhileTyping = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Fonts
|
||||||
|
fonts.packages = with pkgs; [
|
||||||
|
noto-fonts
|
||||||
|
noto-fonts-cjk-sans
|
||||||
|
noto-fonts-emoji
|
||||||
|
liberation_ttf
|
||||||
|
fira-code
|
||||||
|
fira-code-symbols
|
||||||
|
(nerdfonts.override { fonts = [ "FiraCode" "JetBrainsMono" "Iosevka" ]; })
|
||||||
|
];
|
||||||
|
}
|
||||||
34
hosts/laptop/hardware-configuration.nix
Normal file
34
hosts/laptop/hardware-configuration.nix
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
# This file should be generated by running:
|
||||||
|
# nixos-generate-config --show-hardware-config > hardware-configuration.nix
|
||||||
|
#
|
||||||
|
# Run this command on your LAPTOP to get the correct hardware configuration
|
||||||
|
# Then copy the output here.
|
||||||
|
|
||||||
|
{ config, lib, pkgs, modulesPath, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
# PLACEHOLDER: Replace this entire file with your actual hardware configuration
|
||||||
|
# You can generate it by running the command mentioned above on your NixOS system
|
||||||
|
|
||||||
|
boot.initrd.availableKernelModules = [ ];
|
||||||
|
boot.initrd.kernelModules = [ ];
|
||||||
|
boot.kernelModules = [ ];
|
||||||
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
|
fileSystems."/" = {
|
||||||
|
device = "/dev/disk/by-label/nixos";
|
||||||
|
fsType = "ext4";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Swap configuration
|
||||||
|
# swapDevices = [ ];
|
||||||
|
|
||||||
|
# CPU microcode updates (uncomment for your CPU)
|
||||||
|
# hardware.cpu.intel.updateMicrocode = true;
|
||||||
|
# hardware.cpu.amd.updateMicrocode = true;
|
||||||
|
|
||||||
|
# Laptop power management
|
||||||
|
powerManagement.cpuFreqGovernor = "powersave";
|
||||||
|
}
|
||||||
54
hosts/my-machine/configuration.nix
Normal file
54
hosts/my-machine/configuration.nix
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
# Machine-specific configuration
|
||||||
|
|
||||||
|
networking.hostName = "my-machine"; # Change this to your hostname
|
||||||
|
|
||||||
|
# Users configuration
|
||||||
|
users.users.yourusername = { # Change "yourusername" to your actual username
|
||||||
|
isNormalUser = true;
|
||||||
|
description = "Your Name"; # Change this
|
||||||
|
extraGroups = [ "networkmanager" "wheel" "video" "audio" ];
|
||||||
|
shell = pkgs.zsh; # or pkgs.bash
|
||||||
|
};
|
||||||
|
|
||||||
|
# Enable zsh system-wide
|
||||||
|
programs.zsh.enable = true;
|
||||||
|
|
||||||
|
# Display manager and desktop environment / window manager
|
||||||
|
services.xserver = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
# Display manager (choose one)
|
||||||
|
displayManager.gdm.enable = true;
|
||||||
|
# displayManager.sddm.enable = true;
|
||||||
|
# displayManager.lightdm.enable = true;
|
||||||
|
|
||||||
|
# Desktop environment (choose one, or comment all for a standalone WM)
|
||||||
|
# desktopManager.gnome.enable = true;
|
||||||
|
# desktopManager.plasma5.enable = true;
|
||||||
|
# desktopManager.xfce.enable = true;
|
||||||
|
|
||||||
|
# Window manager (uncomment if you want a standalone WM)
|
||||||
|
# windowManager.i3.enable = true;
|
||||||
|
# windowManager.bspwm.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Optional: Enable Wayland compositor
|
||||||
|
# programs.hyprland = {
|
||||||
|
# enable = true;
|
||||||
|
# xwayland.enable = true;
|
||||||
|
# };
|
||||||
|
|
||||||
|
# Fonts
|
||||||
|
fonts.packages = with pkgs; [
|
||||||
|
noto-fonts
|
||||||
|
noto-fonts-cjk-sans
|
||||||
|
noto-fonts-emoji
|
||||||
|
liberation_ttf
|
||||||
|
fira-code
|
||||||
|
fira-code-symbols
|
||||||
|
(nerdfonts.override { fonts = [ "FiraCode" "JetBrainsMono" "Iosevka" ]; })
|
||||||
|
];
|
||||||
|
}
|
||||||
31
hosts/my-machine/hardware-configuration.nix
Normal file
31
hosts/my-machine/hardware-configuration.nix
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# This file should be generated by running:
|
||||||
|
# nixos-generate-config --show-hardware-config > hardware-configuration.nix
|
||||||
|
#
|
||||||
|
# Run this command on your NixOS machine to get the correct hardware configuration
|
||||||
|
# Then copy the output here.
|
||||||
|
|
||||||
|
{ config, lib, pkgs, modulesPath, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
# PLACEHOLDER: Replace this entire file with your actual hardware configuration
|
||||||
|
# You can generate it by running the command mentioned above on your NixOS system
|
||||||
|
|
||||||
|
boot.initrd.availableKernelModules = [ ];
|
||||||
|
boot.initrd.kernelModules = [ ];
|
||||||
|
boot.kernelModules = [ ];
|
||||||
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
|
fileSystems."/" = {
|
||||||
|
device = "/dev/disk/by-label/nixos";
|
||||||
|
fsType = "ext4";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Swap configuration
|
||||||
|
# swapDevices = [ ];
|
||||||
|
|
||||||
|
# CPU microcode updates
|
||||||
|
# hardware.cpu.intel.updateMicrocode = true;
|
||||||
|
# hardware.cpu.amd.updateMicrocode = true;
|
||||||
|
}
|
||||||
71
system/common.nix
Normal file
71
system/common.nix
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
# Common system configuration shared across all machines
|
||||||
|
|
||||||
|
# Bootloader
|
||||||
|
boot.loader.systemd-boot.enable = true;
|
||||||
|
boot.loader.efi.canTouchEfiVariables = true;
|
||||||
|
|
||||||
|
# Networking
|
||||||
|
networking.networkmanager.enable = true;
|
||||||
|
|
||||||
|
# Timezone and locale
|
||||||
|
time.timeZone = "Europe/London";
|
||||||
|
i18n.defaultLocale = "en_US.UTF-8";
|
||||||
|
i18n.extraLocaleSettings = {
|
||||||
|
LC_ADDRESS = "en_US.UTF-8";
|
||||||
|
LC_IDENTIFICATION = "en_US.UTF-8";
|
||||||
|
LC_MEASUREMENT = "en_US.UTF-8";
|
||||||
|
LC_MONETARY = "en_US.UTF-8";
|
||||||
|
LC_NAME = "en_US.UTF-8";
|
||||||
|
LC_NUMERIC = "en_US.UTF-8";
|
||||||
|
LC_PAPER = "en_US.UTF-8";
|
||||||
|
LC_TELEPHONE = "en_US.UTF-8";
|
||||||
|
LC_TIME = "en_US.UTF-8";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Enable sound
|
||||||
|
hardware.pulseaudio.enable = false;
|
||||||
|
security.rtkit.enable = true;
|
||||||
|
services.pipewire = {
|
||||||
|
enable = true;
|
||||||
|
alsa.enable = true;
|
||||||
|
alsa.support32Bit = true;
|
||||||
|
pulse.enable = true;
|
||||||
|
jack.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Enable CUPS for printing
|
||||||
|
services.printing.enable = true;
|
||||||
|
|
||||||
|
# Enable OpenGL
|
||||||
|
hardware.graphics = {
|
||||||
|
enable = true;
|
||||||
|
enable32Bit = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# System-wide packages
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
vim
|
||||||
|
wget
|
||||||
|
curl
|
||||||
|
git
|
||||||
|
htop
|
||||||
|
neofetch
|
||||||
|
unzip
|
||||||
|
zip
|
||||||
|
];
|
||||||
|
|
||||||
|
# Enable flakes
|
||||||
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||||
|
|
||||||
|
# Allow unfree packages
|
||||||
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
|
# Enable networking
|
||||||
|
networking.firewall.enable = true;
|
||||||
|
|
||||||
|
# System state version
|
||||||
|
system.stateVersion = "25.05";
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user