mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-11 14:49:23 +08:00
Compare commits
8 Commits
63c647ceba
...
d92b202b8e
| Author | SHA1 | Date | |
|---|---|---|---|
| d92b202b8e | |||
| 4c3cb5fe5f | |||
| 2147ba2f2d | |||
| 58b1c596db | |||
| 2e278b2dba | |||
| 72067d23c5 | |||
| 94670e9cbe | |||
| 3ab4ecb5d2 |
@@ -12,7 +12,6 @@ inputs:
|
||||
vfat."/dev/disk/by-partlabel/${clusterName}-${nodeName}-boot" = "/boot";
|
||||
btrfs."/dev/disk/by-partlabel/${clusterName}-${nodeName}-root1" =
|
||||
{ "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
|
||||
nfs."nas.ts.chn.moe:/" = { mountPoint = "/nix/remote/nas"; neededForBoot = false; };
|
||||
};
|
||||
nixpkgs.cuda.capabilities =
|
||||
[
|
||||
|
||||
6
flake.lock
generated
6
flake.lock
generated
@@ -1144,11 +1144,11 @@
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1767053975,
|
||||
"narHash": "sha256-Zt1zWeJw0d2irAgC3lOfGgcAlDEUEzWG4kHV6BVhbqY=",
|
||||
"lastModified": 1767223621,
|
||||
"narHash": "sha256-Q0vXLCj8m9i87XfoyhKkHNIq8hjoNKEoysxU6uS+6o4=",
|
||||
"owner": "CHN-beta",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "9a8b7c7d8195a2dd2bf130bdcf3326f0d21e827b",
|
||||
"rev": "1768cfa9daffab526e6573114c4c94353ee49d80",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -45,6 +45,7 @@ let
|
||||
"409test" = "192.168.1.5";
|
||||
};
|
||||
tinc = import ./tinc.nix;
|
||||
tailscale = import ./tailscale.nix;
|
||||
in
|
||||
{
|
||||
"" =
|
||||
@@ -82,3 +83,6 @@ in
|
||||
// lib.mapAttrs'
|
||||
(n: v: lib.nameValuePair "tinc0.${n}" { type = "A"; value = "192.168.85.${builtins.toString v}"; })
|
||||
tinc
|
||||
// lib.mapAttrs'
|
||||
(n: v: lib.nameValuePair "${n}.ts" { type = "A"; value = "100.97.101.${builtins.toString v}"; })
|
||||
tailscale
|
||||
|
||||
10
flake/dns/config/tailscale.nix
Normal file
10
flake/dns/config/tailscale.nix
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
vps4 = 7;
|
||||
vps6 = 2;
|
||||
vps9 = 6;
|
||||
pc = 1;
|
||||
nas = 3;
|
||||
srv2-node0 = 4;
|
||||
srv2-node1 = 5;
|
||||
srv2-node2 = 8;
|
||||
}
|
||||
76
flake/lib/buildNixpkgsConfig/btop.patch
Normal file
76
flake/lib/buildNixpkgsConfig/btop.patch
Normal file
@@ -0,0 +1,76 @@
|
||||
diff --git a/src/btop_config.cpp b/src/btop_config.cpp
|
||||
index eaaa577..3074a08 100644
|
||||
--- a/src/btop_config.cpp
|
||||
+++ b/src/btop_config.cpp
|
||||
@@ -234,6 +234,7 @@ namespace Config {
|
||||
{"custom_gpu_name4", "#* Custom gpu4 model name, empty string to disable."},
|
||||
{"custom_gpu_name5", "#* Custom gpu5 model name, empty string to disable."},
|
||||
#endif
|
||||
+ {"btrfs_group_subvolumes", "#* Show only the first subvolume of a btrfs filesystem."},
|
||||
};
|
||||
|
||||
std::unordered_map<std::string_view, string> strings = {
|
||||
@@ -336,6 +337,7 @@ namespace Config {
|
||||
#endif
|
||||
{"terminal_sync", true},
|
||||
- {"save_config_on_exit", true}
|
||||
+ {"save_config_on_exit", true},
|
||||
+ {"btrfs_group_subvolumes", false},
|
||||
};
|
||||
std::unordered_map<std::string_view, bool> boolsTmp;
|
||||
|
||||
diff --git a/src/btop_menu.cpp b/src/btop_menu.cpp
|
||||
index 75ec31c..cfaec39 100644
|
||||
--- a/src/btop_menu.cpp
|
||||
+++ b/src/btop_menu.cpp
|
||||
@@ -724,6 +724,15 @@ namespace Menu {
|
||||
"kernel as used memory.",
|
||||
"",
|
||||
"True or False."},
|
||||
+ {
|
||||
+ "btrfs_group_subvolumes",
|
||||
+ "(Linux) Show only first BTRFS subvolume.",
|
||||
+ "",
|
||||
+ "Set to true to only show the first BTRFS",
|
||||
+ "subvolume mounted per disk.",
|
||||
+ "",
|
||||
+ "True or False.",
|
||||
+ }
|
||||
},
|
||||
{
|
||||
{"graph_symbol_net",
|
||||
diff --git a/src/linux/btop_collect.cpp b/src/linux/btop_collect.cpp
|
||||
index eebaa50..37d5745 100644
|
||||
--- a/src/linux/btop_collect.cpp
|
||||
+++ b/src/linux/btop_collect.cpp
|
||||
@@ -2117,6 +2117,7 @@ namespace Mem {
|
||||
auto use_fstab = Config::getB("use_fstab");
|
||||
auto only_physical = Config::getB("only_physical");
|
||||
auto zfs_hide_datasets = Config::getB("zfs_hide_datasets");
|
||||
+ auto btrfs_group_subvolumes = Config::getB("btrfs_group_subvolumes");
|
||||
auto& disks = mem.disks;
|
||||
static std::unordered_map<string, future<pair<disk_info, int>>> disks_stats_promises;
|
||||
ifstream diskread;
|
||||
@@ -2177,6 +2178,7 @@ namespace Mem {
|
||||
vector<string> found;
|
||||
found.reserve(last_found.size());
|
||||
string dev, mountpoint, fstype;
|
||||
+ std::unordered_set<string> found_btrfs_subvolumes;
|
||||
while (not diskread.eof()) {
|
||||
std::error_code ec;
|
||||
diskread >> dev >> mountpoint >> fstype;
|
||||
@@ -2198,6 +2200,14 @@ namespace Mem {
|
||||
size_t zfs_dataset_name_start = 0;
|
||||
if (fstype == "zfs" && (zfs_dataset_name_start = dev.find('/')) != std::string::npos && zfs_hide_datasets) continue;
|
||||
|
||||
+ //? skip BtrFS subvolumes
|
||||
+ if (btrfs_group_subvolumes and fstype == "btrfs") {
|
||||
+ string devname = fs::canonical(dev, ec).filename();
|
||||
+ if (!found_btrfs_subvolumes.insert(devname).second) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if ((not use_fstab and not only_physical)
|
||||
or (use_fstab and v_contains(fstab, mountpoint))
|
||||
or (not use_fstab and only_physical and v_contains(fstypes, fstype))) {
|
||||
@@ -72,6 +72,7 @@ in platformConfig //
|
||||
google-chrome = prev.google-chrome.override (prev:
|
||||
{ commandLineArgs = prev.commandLineArgs or "" + " --disable-features=GlobalShortcutsPortal"; });
|
||||
xray = prev.xray.overrideAttrs (prev: { patches = prev.patches or [] ++ [ ./xray.patch ]; });
|
||||
btop = prev.btop.overrideAttrs (prev: { patches = prev.patches or [] ++ [ ./btop.patch ]; });
|
||||
}
|
||||
// (
|
||||
let
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{ inputs, localLib }:
|
||||
let
|
||||
singles = [ "nas" "pc" "vps4" "vps6" "vps9" "r2s" ];
|
||||
singles = [ "nas" "pc" "vps4" "vps6" "vps9" ];
|
||||
cluster = { srv1 = 3; srv2 = 3; };
|
||||
deviceModules = builtins.listToAttrs
|
||||
(
|
||||
|
||||
@@ -44,14 +44,17 @@
|
||||
tokenPath = inputs.self.nixosConfigurations.pc.config.nixos.system.sops.secrets."acme/token".path;
|
||||
octodns = pkgs.octodns.withProviders (_: with pkgs.octodns-providers; [ cloudflare ]);
|
||||
};
|
||||
archive = pkgs.writeText "archive" (builtins.concatStringsSep "\n" (builtins.concatLists
|
||||
[
|
||||
(inputs.nixpkgs.lib.mapAttrsToList
|
||||
(_: v: (v.extendModules { modules = [{ config.system.includeBuildDependencies = true; }]; })
|
||||
.config.system.build.toplevel)
|
||||
inputs.self.outputs.nixosConfigurations)
|
||||
[ src ]
|
||||
(builtins.attrValues inputs)
|
||||
]));
|
||||
archive =
|
||||
let
|
||||
systemWithBuildDeps = system:
|
||||
(system.extendModules { modules = [{ config.system.includeBuildDependencies = true; }]; })
|
||||
.config.system.build.toplevel;
|
||||
systems = inputs.nixpkgs.lib.mapAttrs (_: v: systemWithBuildDeps v) inputs.self.outputs.nixosConfigurations;
|
||||
inputListFile = pkgs.writeText "input-list"
|
||||
(builtins.concatStringsSep "\n" (builtins.attrValues inputs));
|
||||
archive = pkgs.writeText "archive" (builtins.concatStringsSep "\n"
|
||||
((builtins.attrValues systems) ++ [ src inputListFile ]));
|
||||
in
|
||||
archive // { passthru = archive.passthru // systems // { inherit src; inputs = inputListFile; }; };
|
||||
}
|
||||
// (builtins.mapAttrs (_: v: v.config.system.build.toplevel) inputs.self.outputs.nixosConfigurations)
|
||||
|
||||
19
modules/packages/btop.nix
Normal file
19
modules/packages/btop.nix
Normal file
@@ -0,0 +1,19 @@
|
||||
{ lib, pkgs, config, ... }:
|
||||
{
|
||||
options.nixos.packages.btop = lib.mkOption { type = lib.types.nullOr (lib.types.submodule {}); default = {}; };
|
||||
config = let inherit (config.nixos.packages) btop; in lib.mkIf (btop != null)
|
||||
{
|
||||
nixos =
|
||||
{
|
||||
packages.packages._packages = [ pkgs.btop ];
|
||||
user.sharedModules =
|
||||
[{
|
||||
config.programs.btop =
|
||||
{
|
||||
enable = true;
|
||||
settings.btrfs_group_subvolumes = true;
|
||||
};
|
||||
}];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -10,11 +10,11 @@ inputs:
|
||||
[
|
||||
# basic tools
|
||||
beep dos2unix gnugrep pv tmux screen parallel tldr cowsay jq yq ipfetch localPackages.pslist
|
||||
fastfetch reptyr duc ncdu progress libva-utils ksh neofetch dateutils glib
|
||||
fastfetch reptyr duc ncdu progress libva-utils ksh neofetch dateutils glib cryptsetup
|
||||
# lsxx
|
||||
pciutils usbutils lshw util-linux lsof dmidecode lm_sensors hwloc acpica-tools ethtool
|
||||
# top
|
||||
iotop iftop htop btop powertop s-tui
|
||||
iotop iftop htop powertop s-tui
|
||||
# editor
|
||||
nano bat
|
||||
# downloader
|
||||
|
||||
@@ -39,6 +39,7 @@ inputs:
|
||||
};
|
||||
xdg.portal.extraPortals = (builtins.map (p: inputs.pkgs."xdg-desktop-portal-${p}") [ "gtk" "wlr" "gnome" ]);
|
||||
qt = { enable = true; platformTheme = "qt5ct"; };
|
||||
gtk.iconCache.enable = true;
|
||||
i18n.inputMethod =
|
||||
{
|
||||
enable = true;
|
||||
|
||||
Reference in New Issue
Block a user