dotfiles/nixos/configuration.nix

246 lines
6.9 KiB
Nix
Raw Normal View History

2024-07-30 13:46:11 +01:00
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ config, lib, pkgs, ... }:
let berkeley-mono = pkgs.stdenv.mkDerivation {
name = "berkeley-mono";
version = "1.007";
src = /home/user/Dropbox/berkeley-fonts;
installPhase = ''
mkdir -p $out/share/fonts/truetype/berkeley-mono
cp -r $src/* $out/share/fonts/truetype/berkeley-mono
'';
};
in {
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "zbook"; # Define your hostname.
# Pick only one of the below networking options.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
# Set your time zone.
time.timeZone = "Asia/Shanghai";
# Configure network proxy if necessary
networking.nameservers = [
"8.8.8.8"
"1.1.1.1"
];
# networking.proxy.default = "http://127.0.0.1:7897/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
2024-07-30 13:46:11 +01:00
# Select internationalisation properties.
# i18n.defaultLocale = "en_US.UTF-8";
# console = {
# font = "Lat2-Terminus16";
# keyMap = "us";
# useXkbConfig = true; # use xkb.options in tty.
# };
fonts = {
packages = with pkgs; [
noto-fonts
noto-fonts-emoji
source-han-sans
source-han-serif
(nerdfonts.override {
fonts = [
"JetBrainsMono"
];
})
berkeley-mono
];
};
i18n.inputMethod = {
enabled = "fcitx5";
fcitx5.addons = with pkgs; [
fcitx5-mozc
fcitx5-gtk
fcitx5-chinese-addons
fcitx5-rime
];
};
# Enable the X11 windowing system.
services.xserver = {
enable = true;
dpi = 160;
windowManager.awesome = {
enable = true;
luaModules = with pkgs.luaPackages; [
luarocks
luadbi-mysql
];
};
};
2024-08-03 11:19:28 +01:00
services.logind.extraConfig = "IdleAction=ignore";
2024-07-30 13:46:11 +01:00
services.displayManager = {
sddm.enable = true;
defaultSession = "none+awesome";
};
# services.networking.wireless.userControlled = true;
services.blueman.enable = true;
# Configure keymap in X11
services.xserver.xkb.layout = "us";
services.xserver.xkb.options = "eurosign:e,caps:escape";
# Enable CUPS to print documents.
# services.printing.enable = true;
hardware.enableAllFirmware = true;
services.xserver.videoDrivers = ["nvidia"];
hardware.opengl.enable = true;
hardware.nvidia = {
modesetting.enable = true;
powerManagement.finegrained = false;
open = false; # Do not use open-source kernel module
nvidiaSettings = true;
prime = {
offload = {
enable = true;
enableOffloadCmd = true;
};
amdgpuBusId = "PCI:101:0:0";
nvidiaBusId = "PCI:1:0:0";
};
package = config.boot.kernelPackages.nvidiaPackages.mkDriver {
version = "535.154.05";
sha256_64bit = "sha256-fpUGXKprgt6SYRDxSCemGXLrEsIA6GOinp+0eGbqqJg=";
sha256_aarch64 = "sha256-G0/GiObf/BZMkzzET8HQjdIcvCSqB1uhsinro2HLK9k=";
openSha256 = "sha256-wvRdHguGLxS0mR06P5Qi++pDJBCF8pJ8hr4T8O6TJIo=";
settingsSha256 = "sha256-9wqoDEWY4I7weWW05F4igj1Gj9wjHsREFMztfEmqm10=";
persistencedSha256 = "sha256-d0Q3Lk80JqkS1B54Mahu2yY/WocOqFFbZVBh+ToGhaE=";
};
};
# Enable sound.
hardware.pulseaudio = {
enable = true;
package = pkgs.pulseaudioFull;
extraConfig = ''
load-module module-switch-on-connect
'';
};
hardware.bluetooth = {
enable = true;
settings = {
General = {
Enable = "Source,Sink,Media,Socket";
Experimental = true;
};
};
};
hardware.bluetooth.powerOnBoot = true;
# OR
# services.pipewire = {
# enable = true;
# pulse.enable = true;
# };
# Enable touchpad support (enabled default in most desktopManager).
services.libinput.enable = true;
nixpkgs.config.allowUnfree = true;
# Define a user account. Don't forget to set a password with passwd.
users.users.user = {
isNormalUser = true;
2024-08-03 11:19:28 +01:00
extraGroups = [ "wheel" "wireshark" ]; # Enable sudo for the user.
2024-07-30 13:46:11 +01:00
packages = with pkgs; [
2024-08-06 06:11:39 +01:00
# home-manager
2024-07-30 13:46:11 +01:00
contour
vivaldi
# firefox
# tree
];
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
neovim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
wget
sqlite
# clash-verge-rev
2024-07-30 13:46:11 +01:00
bind
pciutils
2024-08-03 11:19:28 +01:00
iptables
2024-07-30 13:46:11 +01:00
];
# 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;
};
# Clash
programs.clash-verge = {
enable = true;
autoStart = true;
tunMode = true;
};
2024-08-03 11:19:28 +01:00
# Wireshark
programs.wireshark.enable = true;
2024-07-30 13:46:11 +01:00
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh.enable = true;
2024-08-06 06:11:39 +01:00
services.openvpn.servers = {
htb = { config = '' config /home/user/Downloads/starting_point_bzw.ovpn ''; };
};
2024-07-30 13:46:11 +01:00
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
networking.firewall.enable = false;
# Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configuration.nix.
system.copySystemConfiguration = true;
# This option defines the first version of NixOS you have installed on this particular machine,
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
#
# Most users should NEVER change this value after the initial install, for any reason,
# even if you've upgraded your system to a new NixOS release.
#
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
# so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
# to actually do that.
#
# This value being lower than the current NixOS release does NOT mean your system is
# out of date, out of support, or vulnerable.
#
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
# and migrated your data accordingly.
#
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "24.05"; # Did you read the comment?
}