mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-03-17 23:14:07 +01:00
feat: redesign the project structure
This commit is contained in:
@@ -1,5 +1,27 @@
|
||||
{ pkgs, lib, ... }:
|
||||
{
|
||||
# # enable flakes globally
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
|
||||
# Auto upgrade nix package and the daemon service.
|
||||
services.nix-daemon.enable = true;
|
||||
# Use this instead of services.nix-daemon.enable if you
|
||||
# don't wan't the daemon service to be managed for you.
|
||||
# nix.useDaemon = true;
|
||||
|
||||
nix.package = pkgs.nix;
|
||||
|
||||
programs.nix-index.enable = true;
|
||||
|
||||
# Add ability to used TouchID for sudo authentication
|
||||
security.pam.enableSudoTouchIdAuth = true;
|
||||
|
||||
# Keyboard
|
||||
system.keyboard.enableKeyMapping = true;
|
||||
system.keyboard.remapCapsLockToEscape = true;
|
||||
|
||||
# Set your time zone.
|
||||
time.timeZone = "Asia/Shanghai";
|
||||
|
||||
# Create /etc/zshrc that loads the nix-darwin environment.
|
||||
programs.zsh.enable = true;
|
||||
@@ -8,9 +30,6 @@
|
||||
# `home-manager` currently has issues adding them to `~/Applications`
|
||||
# Issue: https://github.com/nix-community/home-manager/issues/1341
|
||||
environment.systemPackages = with pkgs; [
|
||||
alacritty
|
||||
jq
|
||||
bat
|
||||
];
|
||||
|
||||
# Fonts
|
||||
@@ -58,10 +58,10 @@
|
||||
"Iosevka"
|
||||
];})
|
||||
|
||||
(pkgs.callPackage ../fonts/icomoon-feather-icon-font.nix { })
|
||||
(pkgs.callPackage ../../fonts/icomoon-feather-icon-font.nix { })
|
||||
|
||||
# arch linux icon, used temporarily in waybar
|
||||
(pkgs.callPackage ../fonts/archcraft-icon-font.nix { })
|
||||
(pkgs.callPackage ../../fonts/archcraft-icon-font.nix { })
|
||||
|
||||
];
|
||||
|
||||
@@ -105,76 +105,17 @@
|
||||
# List packages installed in system profile. To search, run:
|
||||
# $ nix search wget
|
||||
environment.systemPackages = with pkgs; [
|
||||
vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
|
||||
neovim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
|
||||
wget
|
||||
curl
|
||||
git # used by nix flakes
|
||||
git-lfs # used by huggingface models
|
||||
|
||||
# networking tools
|
||||
ethtool
|
||||
iperf3
|
||||
nmap
|
||||
socat
|
||||
ldns # replacement of dig, it provide the command `drill`
|
||||
|
||||
# system tools
|
||||
sysstat
|
||||
lm_sensors # for `sensors` command
|
||||
|
||||
# misc
|
||||
findutils
|
||||
file
|
||||
which
|
||||
tree
|
||||
gnused
|
||||
gnutar
|
||||
gawk
|
||||
p7zip
|
||||
xz
|
||||
zstd
|
||||
cifs-utils # for mounting windows shares
|
||||
|
||||
(python3.withPackages(ps: with ps; [
|
||||
ipython
|
||||
pandas
|
||||
requests
|
||||
pyquery
|
||||
]))
|
||||
|
||||
# need to run `conda-install` before using it
|
||||
# need to run `conda-shell` before using command `conda`
|
||||
conda
|
||||
|
||||
# video/audio tools
|
||||
libva-utils
|
||||
nvtop
|
||||
vdpauinfo
|
||||
vulkan-tools
|
||||
glxinfo
|
||||
glmark2
|
||||
|
||||
# minimal screen capture tool, used by i3 blur lock to take a screenshot
|
||||
# print screen key is also bound to this tool in i3 config
|
||||
scrot
|
||||
|
||||
neofetch
|
||||
xfce.thunar # xfce4's file manager
|
||||
nnn # terminal file manager
|
||||
xdg-user-dirs
|
||||
|
||||
# embedded development
|
||||
minicom
|
||||
|
||||
# remote desktop(rdp connect)
|
||||
remmina
|
||||
freerdp # required by remmina
|
||||
|
||||
devenv.packages."${pkgs.system}".devenv
|
||||
];
|
||||
|
||||
# replace default editor with vim
|
||||
environment.variables.EDITOR = "vim";
|
||||
# replace default editor with neovim
|
||||
environment.variables.EDITOR = "nvim";
|
||||
|
||||
# Enable sound with pipewire.
|
||||
sound.enable = true;
|
||||
96
modules/nixos/core-server.nix
Normal file
96
modules/nixos/core-server.nix
Normal file
@@ -0,0 +1,96 @@
|
||||
{ config, pkgs, devenv, ... }:
|
||||
|
||||
{
|
||||
# enable flakes globally
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
|
||||
# Set your time zone.
|
||||
time.timeZone = "Asia/Shanghai";
|
||||
|
||||
# Select internationalisation properties.
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
|
||||
i18n.extraLocaleSettings = {
|
||||
LC_ADDRESS = "zh_CN.UTF-8";
|
||||
LC_IDENTIFICATION = "zh_CN.UTF-8";
|
||||
LC_MEASUREMENT = "zh_CN.UTF-8";
|
||||
LC_MONETARY = "zh_CN.UTF-8";
|
||||
LC_NAME = "zh_CN.UTF-8";
|
||||
LC_NUMERIC = "zh_CN.UTF-8";
|
||||
LC_PAPER = "zh_CN.UTF-8";
|
||||
LC_TELEPHONE = "zh_CN.UTF-8";
|
||||
LC_TIME = "zh_CN.UTF-8";
|
||||
};
|
||||
|
||||
# all fonts are linked to /nix/var/nix/profiles/system/sw/share/X11/fonts
|
||||
fonts = {
|
||||
# use fonts specified by user rather than default ones
|
||||
enableDefaultFonts = false;
|
||||
fontDir.enable = true;
|
||||
|
||||
fonts = with pkgs; [
|
||||
# icon fonts
|
||||
material-design-icons
|
||||
font-awesome
|
||||
|
||||
# 思源系列字体是 Adobe 主导的。其中汉字部分被称为「思源黑体」和「思源宋体」,是由 Adobe + Google 共同开发的
|
||||
source-sans # 无衬线字体,不含汉字。字族名叫 Source Sans 3 和 Source Sans Pro,以及带字重的变体,加上 Source Sans 3 VF
|
||||
source-han-sans # 思源黑体
|
||||
|
||||
# nerdfonts
|
||||
(nerdfonts.override { fonts = [
|
||||
"FiraCode"
|
||||
"JetBrainsMono"
|
||||
"Iosevka"
|
||||
];})
|
||||
];
|
||||
|
||||
# user defined fonts
|
||||
# the reason there's Noto Color Emoji everywhere is to override DejaVu's
|
||||
# B&W emojis that would sometimes show instead of some Color emojis
|
||||
fontconfig.defaultFonts = {
|
||||
sansSerif = [ "Noto Sans" "Noto Color Emoji" ];
|
||||
monospace = [ "JetBrainsMono Nerd Font" "Noto Color Emoji" ];
|
||||
emoji = [ "Noto Color Emoji" ];
|
||||
};
|
||||
};
|
||||
|
||||
# networking.firewall.allowedTCPPorts = [ ... ];
|
||||
# networking.firewall.allowedUDPPorts = [ ... ];
|
||||
# Or disable the firewall altogether.
|
||||
networking.firewall.enable = false;
|
||||
|
||||
# Enable the OpenSSH daemon.
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
settings = {
|
||||
X11Forwarding = true;
|
||||
PermitRootLogin = "no"; # disable root login
|
||||
PasswordAuthentication = false; # disable password login
|
||||
};
|
||||
openFirewall = true;
|
||||
};
|
||||
|
||||
# Allow unfree packages
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
# 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
|
||||
curl
|
||||
aria2
|
||||
git # used by nix flakes
|
||||
git-lfs # used by huggingface models
|
||||
];
|
||||
|
||||
# replace default editor with neovim
|
||||
environment.variables.EDITOR = "nvim";
|
||||
|
||||
# for power management
|
||||
services.power-profiles-daemon = {
|
||||
enable = true;
|
||||
};
|
||||
services.upower.enable = true;
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
# copy from https://github.com/NixOS/nixpkgs/issues/119433#issuecomment-1326957279
|
||||
# mainly for flatpak
|
||||
# bindfs resolves all symlink, allowing all fonts to be accessed at /usr/share/fonts, without letting /nix into the sandbox.
|
||||
|
||||
# bindfs resolves all symlink,
|
||||
# allowing all fonts to be accessed at `/usr/share/fonts`
|
||||
# without letting /nix into the sandbox.
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
@@ -1,6 +1,8 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
# this params has problem with home-manager,
|
||||
# so defined as NixOS Module here.
|
||||
nixpkgs.config.permittedInsecurePackages = [
|
||||
"electron-19.0.7" # required by wechat-uos, and it's already EOL
|
||||
"openssl-1.1.1t" # OpenSSL 1.1 is reaching its end of life on 2023/09/11
|
||||
@@ -70,5 +70,7 @@
|
||||
mpc-cli # command-line mpd client
|
||||
ncmpcpp # a mpd client with a UI
|
||||
networkmanagerapplet # provide GUI app: nm-connection-editor
|
||||
|
||||
xfce.thunar # xfce4's file manager
|
||||
];
|
||||
}
|
||||
@@ -36,7 +36,10 @@
|
||||
xbindkeys # bind keys to commands
|
||||
xorg.xbacklight # control screen brightness, the same as light
|
||||
xorg.xdpyinfo # get screen information
|
||||
scrot # minimal screen capture tool, used by i3 blur lock to take a screenshot
|
||||
sysstat # get system information
|
||||
|
||||
xfce.thunar # xfce4's file manager
|
||||
];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user