4
hosts/common/system/configs/cpu/default.nix
Normal file
4
hosts/common/system/configs/cpu/default.nix
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
imports = [ ./options.nix ];
|
||||||
|
}
|
17
hosts/common/system/configs/cpu/options.nix
Normal file
17
hosts/common/system/configs/cpu/options.nix
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{ lib, ... }:
|
||||||
|
{
|
||||||
|
options.hardware.cpu =
|
||||||
|
with lib;
|
||||||
|
with types;
|
||||||
|
{
|
||||||
|
cores = mkOption {
|
||||||
|
type = ints.positive;
|
||||||
|
description = "The number of cpu cores.";
|
||||||
|
};
|
||||||
|
|
||||||
|
threads = mkOption {
|
||||||
|
type = ints.positive;
|
||||||
|
description = "The number of cpu threads.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
@@ -26,6 +26,7 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# uuidgen -r | tr -d -
|
||||||
# https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/administration/systemd-state.section.md
|
# https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/administration/systemd-state.section.md
|
||||||
# https://github.com/NixOS/nixpkgs/pull/286140/files
|
# https://github.com/NixOS/nixpkgs/pull/286140/files
|
||||||
# https://git.eisfunke.com/config/nixos/-/blob/e65e1dc21d06d07b454005762b177ef151f8bfb6/nixos/machine-id.nix
|
# https://git.eisfunke.com/config/nixos/-/blob/e65e1dc21d06d07b454005762b177ef151f8bfb6/nixos/machine-id.nix
|
||||||
|
12
hosts/common/system/configs/tlp/default.nix
Normal file
12
hosts/common/system/configs/tlp/default.nix
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
services.tlp = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
CPU_SCALING_GOVERNOR_ON_AC = "performance";
|
||||||
|
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
|
||||||
|
CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
|
||||||
|
CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
20
hosts/common/user/configs/console/yt-dlp/default.nix
Normal file
20
hosts/common/user/configs/console/yt-dlp/default.nix
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
user ? throw "user argument is required",
|
||||||
|
home ? throw "home argument is required",
|
||||||
|
}:
|
||||||
|
{ config, ... }:
|
||||||
|
{
|
||||||
|
home-manager.users.${user}.programs.yt-dlp = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
live-from-start = true;
|
||||||
|
concurrent-fragments = config.hardware.cpu.threads;
|
||||||
|
lazy-playlist = true;
|
||||||
|
cookies-from-browser = "firefox";
|
||||||
|
embed-subs = true;
|
||||||
|
sub-langs = "all,-live_chat";
|
||||||
|
embed-thumbnail = true;
|
||||||
|
fixup = "detect_or_warn";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
@@ -91,13 +91,13 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
xdg.mimeApps.defaultApplications = {
|
xdg.mimeApps.defaultApplications = lib.attrsets.genAttrs [
|
||||||
"text/html" = "firefox.desktop";
|
"text/html"
|
||||||
"x-scheme-handler/http" = "firefox.desktop";
|
"x-scheme-handler/http"
|
||||||
"x-scheme-handler/https" = "firefox.desktop";
|
"x-scheme-handler/https"
|
||||||
"x-scheme-handler/about" = "firefox.desktop";
|
"x-scheme-handler/about"
|
||||||
"x-scheme-handler/unknown" = "firefox.desktop";
|
"x-scheme-handler/unknown"
|
||||||
};
|
] (_: "firefox.desktop");
|
||||||
|
|
||||||
home.sessionVariables.DEFAULT_BROWSER = lib.meta.getExe pkgs.firefox;
|
home.sessionVariables.DEFAULT_BROWSER = lib.meta.getExe pkgs.firefox;
|
||||||
|
|
||||||
|
@@ -12,6 +12,7 @@
|
|||||||
device = "/dev/disk/by-id/nvme-SAMSUNG_MZVL22T0HBLB-00BL2_S64RNE0R602762";
|
device = "/dev/disk/by-id/nvme-SAMSUNG_MZVL22T0HBLB-00BL2_S64RNE0R602762";
|
||||||
})
|
})
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
|
../../common/system/configs/tlp
|
||||||
../.
|
../.
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -19,7 +20,13 @@
|
|||||||
|
|
||||||
# https://github.com/NixOS/nixos-hardware/tree/master/lenovo/legion/16achg6
|
# https://github.com/NixOS/nixos-hardware/tree/master/lenovo/legion/16achg6
|
||||||
hardware = {
|
hardware = {
|
||||||
cpu.amd.updateMicrocode = true;
|
enableAllFirmware = true;
|
||||||
|
|
||||||
|
cpu = {
|
||||||
|
cores = 8;
|
||||||
|
threads = 16;
|
||||||
|
amd.updateMicrocode = true;
|
||||||
|
};
|
||||||
|
|
||||||
nvidia = {
|
nvidia = {
|
||||||
modesetting.enable = true;
|
modesetting.enable = true;
|
||||||
@@ -45,23 +52,12 @@
|
|||||||
rocmPackages.clr.icd
|
rocmPackages.clr.icd
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
enableAllFirmware = true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
xserver.videoDrivers = [ "nvidia" ];
|
xserver.videoDrivers = [ "nvidia" ];
|
||||||
fstrim.enable = true;
|
fstrim.enable = true;
|
||||||
tlp = {
|
tlp.settings.DISK_DEVICES = "nvme0n1 nvme1n1";
|
||||||
enable = true;
|
|
||||||
settings = {
|
|
||||||
DISK_DEVICES = "nvme0n1 nvme1n1";
|
|
||||||
CPU_SCALING_GOVERNOR_ON_AC = "performance";
|
|
||||||
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
|
|
||||||
CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
|
|
||||||
CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
|
@@ -5,6 +5,7 @@
|
|||||||
../common/system/configs/brightnessctl
|
../common/system/configs/brightnessctl
|
||||||
../common/system/configs/btop
|
../common/system/configs/btop
|
||||||
../common/system/configs/btrfs
|
../common/system/configs/btrfs
|
||||||
|
../common/system/configs/cpu
|
||||||
../common/system/configs/docker
|
../common/system/configs/docker
|
||||||
../common/system/configs/fastfetch
|
../common/system/configs/fastfetch
|
||||||
../common/system/configs/getty
|
../common/system/configs/getty
|
||||||
|
@@ -30,6 +30,7 @@ in
|
|||||||
(import ../common/user/configs/console/tree { inherit user home; })
|
(import ../common/user/configs/console/tree { inherit user home; })
|
||||||
(import ../common/user/configs/console/wget { inherit user home; })
|
(import ../common/user/configs/console/wget { inherit user home; })
|
||||||
(import ../common/user/configs/console/xdg { inherit user home; })
|
(import ../common/user/configs/console/xdg { inherit user home; })
|
||||||
|
(import ../common/user/configs/console/yt-dlp { inherit user home; })
|
||||||
(import ../common/user/configs/console/zsh { inherit user home; })
|
(import ../common/user/configs/console/zsh { inherit user home; })
|
||||||
(import ../common/user/configs/gui/ags { inherit user home; })
|
(import ../common/user/configs/gui/ags { inherit user home; })
|
||||||
(import ../common/user/configs/gui/bluetooth { inherit user home; })
|
(import ../common/user/configs/gui/bluetooth { inherit user home; })
|
||||||
|
Reference in New Issue
Block a user