整理很多东西

This commit is contained in:
陈浩南 2023-07-23 00:09:54 +08:00
parent f3f3000fa9
commit 64194760d2
6 changed files with 199 additions and 187 deletions

View File

@ -286,11 +286,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1689524878,
"narHash": "sha256-auh9qvI/bGlKIZTamiI4J371ZsNtP8yk/TKCFXBDn6Q=",
"lastModified": 1690031053,
"narHash": "sha256-6ikGMvZ5hBL1ChBncEG9cYZkgYHXzq4jRF8gBougWqw=",
"owner": "CHN-beta",
"repo": "nixpkgs",
"rev": "ece52e008044c2810ff7a75f3287d4610daf2b26",
"rev": "b568ffd587d59272d6a7adaf454c3d49e343aa5b",
"type": "github"
},
"original": {

View File

@ -134,6 +134,7 @@
(inputs.nur-xddxdd.overlays.custom args.config.boot.kernelPackages.nvidia_x11) final prev; }
)
inputs.nixd.overlays.default
inputs.nix-alien.overlays.default
];
config.allowUnfree = true;
};
@ -220,6 +221,7 @@
{
hostname = "chn-PC";
march = "alderlake";
type = "workstation";
};
virtualization =
{
@ -244,7 +246,6 @@
./modules/networking/wall_client.nix
./modules/networking/xmunet.nix
./modules/networking/chn-PC.nix
./modules/packages/terminal.nix
./modules/packages/gui.nix
./modules/packages/hpc.nix
[ ./modules/users/root.nix {} ]

View File

@ -15,8 +15,8 @@
}).pkgs;
in
{
pandoc = generic-pkgs.pandoc;
fwupd = generic-pkgs.fwupd;
# pandoc = generic-pkgs.pandoc;
# fwupd = generic-pkgs.fwupd;
}
)];
};

View File

@ -24,15 +24,15 @@ inputs:
# config.nixpkgs.config.replaceStdenv = { pkgs }: pkgs.ccacheStdenv;
# only replace stdenv for large and tested packages
# config.programs.ccache.packageNames = [ "webkitgtk" "libreoffice" "tensorflow" "linux" "chromium" ];
config.nixpkgs.overlays = [(final: prev:
{
libreoffice-qt = prev.libreoffice-qt.override (prev: { unwrapped = prev.unwrapped.override
(prev: { stdenv = final.ccacheStdenv.override { stdenv = prev.stdenv; }; }); });
python3 = prev.python3.override { packageOverrides = python-final: python-prev:
{
tensorflow = python-prev.tensorflow.override
{ stdenv = final.ccacheStdenv.override { stdenv = python-prev.tensorflow.stdenv; }; };
};};
# config.nixpkgs.overlays = [(final: prev:
# {
# libreoffice-qt = prev.libreoffice-qt.override (prev: { unwrapped = prev.unwrapped.override
# (prev: { stdenv = final.ccacheStdenv.override { stdenv = prev.stdenv; }; }); });
# python3 = prev.python3.override { packageOverrides = python-final: python-prev:
# {
# tensorflow = python-prev.tensorflow.override
# { stdenv = final.ccacheStdenv.override { stdenv = python-prev.tensorflow.stdenv; }; };
# };};
# # webkitgtk = prev.webkitgtk.override (prev:
# # { stdenv = final.ccacheStdenv.override { stdenv = prev.stdenv; }; enableUnifiedBuilds = false; });
# wxGTK31 = prev.wxGTK31.override { stdenv = final.ccacheStdenv.override { stdenv = prev.wxGTK31.stdenv; }; };
@ -50,7 +50,7 @@ inputs:
# # { stdenv = prev.linuxPackages_xanmod_latest.kernel.buildPackages.stdenv; };
# # };
# # };
})];
# })];
# config.programs.ccache.packageNames = [ "libreoffice-unwrapped" ];
}

View File

@ -1,62 +0,0 @@
inputs:
{
config =
{
environment.systemPackages = with inputs.pkgs;
[
beep neofetch screen dos2unix tldr gnugrep pv
pciutils usbutils lshw powertop compsize iotop iftop smartmontools htop intel-gpu-tools btop wayland-utils clinfo
glxinfo vulkan-tools
ksh
vim nano
wget aria2 curl yt-dlp
tree git autojump exa
nix-output-monitor inputs.topInputs.nix-alien.packages.x86_64-linux.nix-alien nix-template
apacheHttpd certbot-full
pigz rar unrar upx unzip zip lzip
util-linux snapper
ocrmypdf pdfgrep
openssl ssh-to-age gnupg age sops
ipset iptables iproute2 dig nettools
gcc clang-tools
sshfs kio-fuse
pam_u2f
e2fsprogs
trash-cli tmux adb-sync pdfchain wgetpaste httplib clang magic-enum xtensor
go rustc boost cereal cxxopts valgrind
lsd zellij broot
nil nixd
p7zip appimage-run file todo-txt-cli pandoc
];
programs =
{
nix-index-database.comma.enable = true;
nix-index.enable = true;
command-not-found.enable = false;
zsh =
{
enable = true;
syntaxHighlighting.enable = true;
autosuggestions.enable = true;
enableCompletion = true;
ohMyZsh =
{
enable = true;
plugins = [ "git" "colored-man-pages" "extract" "history-substring-search" "autojump" ];
customPkgs = with inputs.pkgs; [ zsh-nix-shell ];
};
};
adb.enable = true;
gnupg.agent =
{
enable = true;
enableSSHSupport = true;
};
};
services =
{
fwupd.enable = true;
udev.packages = [ inputs.pkgs.yubikey-personalization ];
};
};
}

View File

@ -3,116 +3,189 @@ inputs:
options.nixos.system = let inherit (inputs.lib) mkOption types; in
{
hostname = mkOption { type = types.nonEmptyStr; };
march = mkOption { type = types.nullOr types.nonEmptyStr; };
march = mkOption { type = types.nullOr types.nonEmptyStr; };
type = mkOption { type = types.enum [ "headless" "desktop" "workstation" ]; default = "headless"; };
};
config = let inherit (inputs.lib) mkMerge mkIf; inherit (inputs.localLib) mkConditional stripeTabs; in mkMerge
[
# generic
{
nix =
{
settings =
{
system-features = [ "big-parallel" "nixos-test" "benchmark" ];
experimental-features = [ "nix-command" "flakes" ];
keep-outputs = true;
keep-failed = true;
auto-optimise-store = true;
};
daemonIOSchedClass = "idle";
daemonCPUSchedPolicy = "idle";
registry =
{
nixpkgs.flake = inputs.topInputs.nixpkgs;
nixos-config.flake = inputs.topInputs.self;
};
};
services =
{
udev.extraRules = stripeTabs
''
ACTION=="add|change", KERNEL=="[sv]d[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="bfq"
ACTION=="add|change", KERNEL=="nvme[0-9]n[0-9]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="bfq"
'';
dbus.implementation = "broker";
};
networking.networkmanager.enable = true;
programs = { dconf.enable = true; nix-ld.enable = true; };
nixpkgs.config.allowUnfree = true;
time.timeZone = "Asia/Shanghai";
system =
{
stateVersion = "22.11";
configurationRevision = inputs.topInputs.self.rev or "dirty";
};
boot =
{
kernel.sysctl =
{
"net.core.rmem_max" = 67108864;
"net.core.wmem_max" = 67108864;
"net.ipv4.tcp_rmem" = "4096 87380 67108864";
"net.ipv4.tcp_wmem" = "4096 65536 67108864";
"net.ipv4.tcp_mtu_probing" = true;
"net.ipv4.tcp_tw_reuse" = true;
"vm.swappiness" = 10;
"net.ipv4.tcp_max_syn_backlog" = 8388608;
"net.core.netdev_max_backlog" = 8388608;
"net.core.somaxconn" = 8388608;
"vm.oom_kill_allocating_task" = true;
"vm.oom_dump_tasks" = false;
"vm.overcommit_memory" = 1;
"dev.i915.perf_stream_paranoid" = false;
};
supportedFilesystems = [ "ntfs" ];
consoleLogLevel = 7;
};
hardware.enableAllFirmware = true;
systemd =
{
extraConfig = stripeTabs
"
DefaultTimeoutStopSec=10s
DefaultLimitNOFILE=1048576:1048576
";
user.extraConfig = "DefaultTimeoutStopSec=10s";
services =
{
nix-daemon =
{
serviceConfig = { CacheDirectory = "nix"; Slice = "-.slice"; Nice = "19"; };
environment = { TMPDIR = "/var/cache/nix"; };
};
systemd-tmpfiles-setup = { environment = { SYSTEMD_TMPFILES_FORCE_SUBVOL = "0"; }; };
};
timers.systemd-tmpfiles-clean.enable = false;
};
}
# hostname
{ networking.hostName = inputs.config.nixos.system.hostname; }
# march
(
mkConditional (inputs.config.nixos.system.march != null)
{
nixpkgs =
{
hostPlatform = { system = "x86_64-linux"; gcc =
{ arch = inputs.config.nixos.system.march; tune = inputs.config.nixos.system.march; }; };
config.qchem-config.optArch = inputs.config.nixos.system.march;
};
nix.settings.system-features = [ "gccarch-${inputs.config.nixos.system.march}" ];
boot.kernelPatches =
[{
name = "native kernel";
patch = null;
extraStructuredConfig =
{
GENERIC_CPU = inputs.lib.kernel.no;
"M${inputs.lib.strings.toUpper inputs.config.nixos.system.march}" = inputs.lib.kernel.yes;
};
}];
}
{ nixpkgs.hostPlatform = inputs.lib.mkDefault "x86_64-linux"; }
)
];
# generic
{
nix =
{
settings =
{
system-features = [ "big-parallel" "nixos-test" "benchmark" ];
experimental-features = [ "nix-command" "flakes" ];
keep-outputs = true;
keep-failed = true;
auto-optimise-store = true;
};
daemonIOSchedClass = "idle";
daemonCPUSchedPolicy = "idle";
registry =
{
nixpkgs.flake = inputs.topInputs.nixpkgs;
nixos-config.flake = inputs.topInputs.self;
};
};
services =
{
udev.extraRules = stripeTabs
''
ACTION=="add|change", KERNEL=="[sv]d[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="bfq"
ACTION=="add|change", KERNEL=="nvme[0-9]n[0-9]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="bfq"
'';
dbus.implementation = "broker";
};
networking.networkmanager.enable = true;
programs = { dconf.enable = true; nix-ld.enable = true; };
nixpkgs.config.allowUnfree = true;
time.timeZone = "Asia/Shanghai";
system =
{
stateVersion = "22.11";
configurationRevision = inputs.topInputs.self.rev or "dirty";
};
boot =
{
kernel.sysctl =
{
"net.core.rmem_max" = 67108864;
"net.core.wmem_max" = 67108864;
"net.ipv4.tcp_rmem" = "4096 87380 67108864";
"net.ipv4.tcp_wmem" = "4096 65536 67108864";
"net.ipv4.tcp_mtu_probing" = true;
"net.ipv4.tcp_tw_reuse" = true;
"vm.swappiness" = 10;
"net.ipv4.tcp_max_syn_backlog" = 8388608;
"net.core.netdev_max_backlog" = 8388608;
"net.core.somaxconn" = 8388608;
"vm.oom_kill_allocating_task" = true;
"vm.oom_dump_tasks" = false;
"vm.overcommit_memory" = 1;
"dev.i915.perf_stream_paranoid" = false;
};
supportedFilesystems = [ "ntfs" ];
consoleLogLevel = 7;
};
hardware.enableAllFirmware = true;
systemd =
{
extraConfig = stripeTabs
"
DefaultTimeoutStopSec=10s
DefaultLimitNOFILE=1048576:1048576
";
user.extraConfig = "DefaultTimeoutStopSec=10s";
services =
{
nix-daemon =
{
serviceConfig = { CacheDirectory = "nix"; Slice = "-.slice"; Nice = "19"; };
environment = { TMPDIR = "/var/cache/nix"; };
};
systemd-tmpfiles-setup = { environment = { SYSTEMD_TMPFILES_FORCE_SUBVOL = "0"; }; };
};
timers.systemd-tmpfiles-clean.enable = false;
};
}
# hostname
{ networking.hostName = inputs.config.nixos.system.hostname; }
# march
(
mkConditional (inputs.config.nixos.system.march != null)
{
nixpkgs =
{
hostPlatform = { system = "x86_64-linux"; gcc =
{ arch = inputs.config.nixos.system.march; tune = inputs.config.nixos.system.march; }; };
config.qchem-config.optArch = inputs.config.nixos.system.march;
};
nix.settings.system-features = [ "gccarch-${inputs.config.nixos.system.march}" ];
boot.kernelPatches =
[{
name = "native kernel";
patch = null;
extraStructuredConfig =
{
GENERIC_CPU = inputs.lib.kernel.no;
"M${inputs.lib.strings.toUpper inputs.config.nixos.system.march}" = inputs.lib.kernel.yes;
};
}];
}
{ nixpkgs.hostPlatform = inputs.lib.mkDefault "x86_64-linux"; }
)
# type
(
mkMerge
[
{
environment.systemPackages = with inputs.pkgs;
[
# shell
ksh
# basic tools
beep dos2unix gnugrep pv tmux
# lsxx
pciutils usbutils lshw wayland-utils clinfo glxinfo vulkan-tools util-linux
# top
iotop iftop htop
# editor
vim nano
# downloader
wget aria2 curl yt-dlp
# file manager
tree git autojump exa trash-cli lsd zellij broot file
# compress
pigz rar upx unzip zip lzip p7zip
# file system management
sshfs e2fsprogs adb-sync
# disk management
smartmontools
# encryption and authentication
apacheHttpd openssl ssh-to-age gnupg age sops
# networking
ipset iptables iproute2 dig nettools
# nix tools
nix-output-monitor nix-template appimage-run nil nixd nix-alien
# development
gcc go rustc
# move to other place
kio-fuse pam_u2f
pdfchain wgetpaste httplib clang magic-enum xtensor
boost cereal cxxopts valgrind
todo-txt-cli pandoc
# nix-ld
];
programs =
{
nix-index-database.comma.enable = true;
nix-index.enable = true;
zsh =
{
enable = true;
syntaxHighlighting.enable = true;
autosuggestions.enable = true;
enableCompletion = true;
ohMyZsh =
{
enable = true;
plugins = [ "git" "colored-man-pages" "extract" "history-substring-search" "autojump" ];
customPkgs = with inputs.pkgs; [ zsh-nix-shell ];
};
};
command-not-found.enable = false;
adb.enable = true;
gnupg.agent = { enable = true; enableSSHSupport = true; };
};
services =
{
fwupd.enable = true;
udev.packages = [ inputs.pkgs.yubikey-personalization ];
};
}
]
)
];
}