nix/testing/configuration.nix
2023-06-29 21:00:39 +09:00

173 lines
3.6 KiB
Nix

{ config, pkgs, ...}: {
# Desktop/Laptop configuration.nix
# Import other files to this config:
imports = [
./home-manager.nix
./variables.nix
];
# Basic configs
time.timeZone = ${timezone}
# Boot settings
boot = {
blacklistedKernelModules = [ "nouveau" ];
cleanTmpDir = true;
};
# Keep the system up-to-date automatically
system = {
stateVersion = ${nixos-version}
autoUpgrade = {
enable = true;
allowReboot = false;
channel = https://channels.nixos.org/nixos-${nixos-version}
};
};
# Networking:
networking = {
hostname = ${hostname};
enableIPv6 = false;
firewall = {
enable = true;
allowedTCPPorts = [ 22 ];
allowedUDPPorts = [ 41641 ];
};
networkmanager = {
enable = true;
};
};
# Create a user:
# https://nixos.org/manual/nixos/stable/index.html#sec-user-management
users.users.${username} = {
isNormalUser = false;
initialPassword = "Password";
description = "${user-full-name}";
extraGroups = [ "wheel", "networkmanager" ];
uid = 1000;
shell = "/bin/bash"
};
# Enable various services:
services = {
openssh = {
enable = true;
};
ntp = {
enable = true;
};
tailscale = {
enable = true;
useRoutingFeatures = "server";
};
# X Display Manager
# https://nixos.org/manual/nixos/stable/index.html#sec-x11
xserver = {
enable = true;
videoDrivers = nvidia;
autorun = true;
layout = "en";
displayManager = {
gdm = {
enable = true;
};
};
desktopManager = {
gnome = {
enable = true;
};
};
# https://nixos.org/manual/nixos/stable/index.html#sec-gnome-enable
# Adding icon themes: https://nixos.org/manual/nixos/stable/index.html#sec-gnome-icons-and-gtk-themes
gnome = {
core-utilities.enable = false;
games.enable = false;
};
};
pipewire = {
enable = true;
alsa.enable = true;
alsa.support32bit = true;
};
};
# NixPkgs configuration
nixpkgs = {
system = "${system-arch}"
config = {
allowUnfree = true;
};
};
# Install various packages
environment = {
systemPackages = with pkgs; [
vim
git
curl
htop
tailscale
iftop
jq
zip
tar
bash
];
# If a GUI is enabled, install GUI apps:
if config.services.xserver.enable then [
pkgs.firefox
pkgs.steam
pkgs.bitwarden
pkgs.lutris
pkgs.vscodium
pkgs.vlc
];
};
# Configure programs
programs = {
bash = {
enableCompletion = true;
enableLsColors = true;
shellAliases = {
d = "docker";
dc = "docker-compose";
de = "docker exec -it";
ddate = "date +%Y.%m.%d";
dday = "date +%A";
e = "emacsclient -nw"; # emacs in a terminal
f = "fossil";
g = "git";
ga = "git add -A";
gb = "git branch";
gc = "git commit";
gca = "git commit -a";
gco = "git checkout";
gd = "git diff";
gl = "git pull --prune";
gp = "git push origin HEAD";
gs = "git status -sb";
hs = "home-manager switch";
ll = "ls -lah";
rm = "rm -i";
tdate = "date +%Y.%m.%d..%H.%M";
ttime = "date +%H.%M";
}
};
firefox = {
# https://nixos.org/manual/nixos/stable/options.html#opt-programs.firefox.preferences
};
vim = {
defaultEditor = true;
};
xwayland = {
enable = true;
};
dconf = {
enable = true;
};
};
}