From c8839b737ed5b88ed73f7bac03340f11db03f543 Mon Sep 17 00:00:00 2001 From: Dmitrii Gudov Date: Tue, 23 Dec 2025 14:20:26 +0300 Subject: [PATCH] remove trash --- depr/new_script.sh | 11 ---- depr/remove-all-bckps.sh | 18 ------ depr/update-home-manager.sh | 24 ------- depr/update-nixos.sh | 30 --------- flake.lock | 18 +++--- flake.nix | 2 +- hosts/template/configuration.nix | 2 +- nixos/WIP/custom-low-power.nix | 66 -------------------- nixos/WIP/low-power.nix | 104 ------------------------------- 9 files changed, 11 insertions(+), 264 deletions(-) delete mode 100644 depr/new_script.sh delete mode 100755 depr/remove-all-bckps.sh delete mode 100755 depr/update-home-manager.sh delete mode 100755 depr/update-nixos.sh delete mode 100644 nixos/WIP/custom-low-power.nix delete mode 100644 nixos/WIP/low-power.nix diff --git a/depr/new_script.sh b/depr/new_script.sh deleted file mode 100644 index 82f6dea..0000000 --- a/depr/new_script.sh +++ /dev/null @@ -1,11 +0,0 @@ -# NixOS -sudo nixos-rebuild switch --flake .#myhost \ - --override-input personal path:/home/$USER/.config/nix/personal.nix \ - --override-input hw path:/etc/nixos/hardware-configuration.nix - -# Home Manager only -home-manager switch --flake .#$(nix eval --raw --expr '(import ./personal.stub.nix).username') \ - --override-input personal path:/home/$USER/.config/nix/personal.nix - -sudo nixos-rebuild switch --flake . \ - --override-input hw path:/etc/nixos/hardware-configuration.nix \ No newline at end of file diff --git a/depr/remove-all-bckps.sh b/depr/remove-all-bckps.sh deleted file mode 100755 index 177e223..0000000 --- a/depr/remove-all-bckps.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -if [[ $EUID -ne 0 ]]; then - echo "This script must be run as root (sudo)." 1>&2 - exit 1 -fi - -echo "Removing all backups in /etc/nixos..." -rm -rf /etc/nixos.bak.* - -echo "Removing all backups in $HOME/.config/home-manager..." -rm -rf $HOME/.config/home-manager.bak.* - -echo "Run nix-collect-garbage" -nix-collect-garbage --delete-older-than 7d - -echo "Done!" \ No newline at end of file diff --git a/depr/update-home-manager.sh b/depr/update-home-manager.sh deleted file mode 100755 index 1465fdb..0000000 --- a/depr/update-home-manager.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -# ---------------- CONFIG ---------------- -SRC_FOLDER="./home-manager" # source folder in your repo -DEST_FOLDER="$HOME/.config/home-manager" # target folder -# ---------------------------------------- - -# Create backup if destination exists -if [ -d "$DEST_FOLDER" ]; then - BACKUP_DIR="$DEST_FOLDER.bak.$(date +%Y%m%d%H%M%S)" - echo "Creating backup of existing configuration at $BACKUP_DIR..." - cp -r "$DEST_FOLDER" "$BACKUP_DIR" -fi - -echo "Copying Home Manager configuration from '$SRC_FOLDER' to '$DEST_FOLDER'..." -mkdir -p "$DEST_FOLDER" -cp -a "$SRC_FOLDER/." "$DEST_FOLDER/" - -echo "Running home-manager switch..." -nix flake update "$DEST_FOLDER" -home-manager switch --flake ~/.config/home-manager - -echo "Done! Backup (if any) stored at $BACKUP_DIR" diff --git a/depr/update-nixos.sh b/depr/update-nixos.sh deleted file mode 100755 index 6d678dc..0000000 --- a/depr/update-nixos.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -# ---------------- CONFIG ---------------- -SRC_FOLDER="./nixos" # folder in your repo -DEST_FOLDER="/etc/nixos" # target folder -# ---------------------------------------- - -# Check for root -if [[ $EUID -ne 0 ]]; then - echo "This script must be run as root (sudo)." 1>&2 - exit 1 -fi - -echo "Copying files from '$SRC_FOLDER' to '$DEST_FOLDER'..." - -# Backup existing /etc/nixos (optional) -BACKUP_DIR="/etc/nixos.bak.$(date +%Y%m%d%H%M%S)" -echo "Backing up current /etc/nixos to $BACKUP_DIR" -cp -r "$DEST_FOLDER" "$BACKUP_DIR" - -# Copy files -cp -a "$SRC_FOLDER/." "$DEST_FOLDER/" - -echo "Done! Files from '$SRC_FOLDER' have been copied to '$DEST_FOLDER'." -# echo "You may now run 'sudo nixos-rebuild switch' if needed." - -nixos-rebuild switch --fast - -echo "Done!" diff --git a/flake.lock b/flake.lock index bb5970b..4c1fff1 100644 --- a/flake.lock +++ b/flake.lock @@ -60,11 +60,11 @@ ] }, "locked": { - "lastModified": 1765605144, - "narHash": "sha256-RM2xs+1HdHxesjOelxoA3eSvXShC8pmBvtyTke4Ango=", + "lastModified": 1766292113, + "narHash": "sha256-sWTtmkQujRpjWYCnZc8LWdDiCzrRlSBPrGovkZpLkBI=", "owner": "nix-community", "repo": "home-manager", - "rev": "90b62096f099b73043a747348c11dbfcfbdea949", + "rev": "fdec8815a86db36f42fc9c8cb2931cd8485f5aed", "type": "github" }, "original": { @@ -94,11 +94,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1765311797, - "narHash": "sha256-mSD5Ob7a+T2RNjvPvOA1dkJHGVrNVl8ZOrAwBjKBDQo=", + "lastModified": 1766201043, + "narHash": "sha256-eplAP+rorKKd0gNjV3rA6+0WMzb1X1i16F5m5pASnjA=", "owner": "nixos", "repo": "nixpkgs", - "rev": "09eb77e94fa25202af8f3e81ddc7353d9970ac1b", + "rev": "b3aad468604d3e488d627c0b43984eb60e75e782", "type": "github" }, "original": { @@ -207,11 +207,11 @@ ] }, "locked": { - "lastModified": 1765589985, - "narHash": "sha256-jsaE3UG7BpthBJZtaXCCuH1rYdQBauUA3Otv3NF20FM=", + "lastModified": 1766410104, + "narHash": "sha256-Eh+TUdb4CGscBLG3Q6QOQOjEdPCmHPClGyeHf4F67Mk=", "owner": "0xc000022070", "repo": "zen-browser-flake", - "rev": "c79311e5b4f299ab3713b23dfbc98c853bb5f070", + "rev": "eaff1bc54b9a8bd698c2dc47823400460e9f38a0", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index fe4ef01..e002deb 100644 --- a/flake.nix +++ b/flake.nix @@ -34,7 +34,7 @@ nixpkgs.lib.nixosSystem { inherit system; - specialArgs = { inherit inputs username gitName gitEmail hostName; }; + specialArgs = { inherit inputs username gitName gitEmail; }; modules = [ ./hosts/${hostName}/configuration.nix diff --git a/hosts/template/configuration.nix b/hosts/template/configuration.nix index 2303428..4c453c0 100644 --- a/hosts/template/configuration.nix +++ b/hosts/template/configuration.nix @@ -1,7 +1,7 @@ { config, pkgs, ... }: { - networking.hostName = "hostname"; + networking.hostName = hostname; imports = [ ../../nixos/custom.nix ./hardware-configuration.nix ]; services.desktopManager.gnome.enable = true; diff --git a/nixos/WIP/custom-low-power.nix b/nixos/WIP/custom-low-power.nix deleted file mode 100644 index 3887309..0000000 --- a/nixos/WIP/custom-low-power.nix +++ /dev/null @@ -1,66 +0,0 @@ -# # Возможно проблемы с оптимизацией USB (лагает клавиатура/мышь) - -{ config, lib, vars, ... }: -let - cfg = config.custom; - hasBattery = lib.any (x: lib.strings.hasPrefix "BAT" x) - (builtins.attrNames (builtins.readDir "/sys/class/power_supply")); -in { - options.custom = { - battery.enable = lib.mkOption { - default = hasBattery; - description = "Enable better battery support"; - type = lib.types.bool; - }; - }; - - # config = lib.mkIf cfg.battery.enable { - config = { - boot.kernelParams = [ "amd_pstate=active" ]; - - powerManagement.powertop.enable = - true; # enable powertop auto tuning on startup. - - services.system76-scheduler.settings.cfsProfiles.enable = - true; # Better scheduling for CPU cycles - thanks System76!!! - # services.thermald.enable = - # true; # Enable thermald, the temperature management daemon. (only necessary if on Intel CPUs) - services.power-profiles-daemon.enable = - false; # Disable GNOMEs power management - services.tlp = { - enable = true; # Enable TLP (better than gnomes internal power manager) - settings = { - CPU_BOOST_ON_AC = 1; - CPU_BOOST_ON_BAT = 0; - CPU_HWP_DYN_BOOST_ON_AC = 1; - CPU_HWP_DYN_BOOST_ON_BAT = 0; - CPU_SCALING_GOVERNOR_ON_AC = "performance"; - CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; - CPU_SCALING_MIN_FREQ_ON_BAT = 0; - CPU_ENERGY_PERF_POLICY_ON_AC = "performance"; - CPU_ENERGY_PERF_POLICY_ON_BAT = "power"; - - AMDGPU_ABM_LEVEL_ON_AC = 0; - AMDGPU_ABM_LEVEL_ON_BAT = 0; - PLATFORM_PROFILE_ON_AC = "performance"; - PLATFORM_PROFILE_ON_BAT = "low-power"; - PCIE_ASPM_ON_BAT = "powersupersave"; - SATA_LINKPWR_ON_AC = "med_power_with_dipm"; - SATA_LINKPWR_ON_BAT = "min_power"; - RUNTIME_PM_ON_AC = "on"; - RUNTIME_PM_ON_BAT = "auto"; - SOUND_POWER_SAVE_ON_AC = 0; - SOUND_POWER_SAVE_ON_BAT = 1; - SOUND_POWER_SAVE_CONTROLLER = "Y"; - CPU_MAX_PERF_ON_AC = 100; - CPU_MAX_PERF_ON_BAT = 50; - NMI_WATCHDOG = 0; - - USB_AUTOSUSPEND = 0; - USB_BLACKLIST_BTUSB = 0; - START_CHARGE_THRESH_BAT0 = 0; - STOP_CHARGE_THRESH_BAT0 = 1; - }; - }; - }; -} diff --git a/nixos/WIP/low-power.nix b/nixos/WIP/low-power.nix deleted file mode 100644 index f35eb90..0000000 --- a/nixos/WIP/low-power.nix +++ /dev/null @@ -1,104 +0,0 @@ -{ inputs, config, lib, pkgs, ... }: { - #@# modules/low-power.nix: setup to maximize on-battery lifetime - #@# contains: - options = { - nyx.low-power.enable = - lib.mkEnableOption "enables low profile optimizations to reduce watt use"; - }; - config = lib.mkIf config.nyx.low-power.enable { - #@# * steam, lutris etc. - boot = { - kernelParams = [ - "pcie_aspm.policy=powersupersave" - "amd_pstate=passive" # use schedutil scaling for Ryzen 7940HS - "mitigations=auto" - ]; - - extraModprobeConfig = '' - # AMD iGPU tuning - options amdgpu dc=1 - options amdgpu deep_color=1 - options amdgpu aspm=1 - # Force dGPU off by default to save power (only use when explicitly requested) - options amdgpu runpm=1 - ''; - }; - - networking.networkmanager.wifi.powersave = true; - programs.sway.xwayland.enable = false; - services.pipewire.jack.enable = false; - powerManagement.enable = true; - powerManagement.cpuFreqGovernor = "schedutil"; - services.power-profiles-daemon.enable = false; - - services.tlp = { - enable = true; - settings = { - TLP_DEFAULT_MODE = "BAT"; - CPU_SCALING_GOVERNOR_ON_AC = "schedutil"; - CPU_SCALING_GOVERNOR_ON_BAT = "schedutil"; - CPU_ENERGY_PERF_POLICY_ON_AC = "balance_power"; - CPU_ENERGY_PERF_POLICY_ON_BAT = "power"; - PCIE_ASPM_ON_AC = "default"; - PCIE_ASPM_ON_BAT = "powersupersave"; - RUNTIME_PM_ON_AC = "auto"; - RUNTIME_PM_ON_BAT = "auto"; - USB_AUTOSUSPEND = "1"; - WIFI_PWR_ON_AC = "on"; - WIFI_PWR_ON_BAT = "on"; - DEVICES_TO_DISABLE_ON_BAT = "bluetooth"; - DEVICES_TO_DISABLE_ON_STARTUP = "bluetooth"; - DISK_IDLE_SECS_ON_AC = "60"; - DISK_IDLE_SECS_ON_BAT = "30"; - SATA_LINKPWR_ON_AC = "med_power_with_dipm"; - SATA_LINKPWR_ON_BAT = "min_power"; - SOUND_POWER_SAVE_ON_AC = "1"; - SOUND_POWER_SAVE_ON_BAT = "1"; - PLATFORM_PROFILE_ON_AC = "balanced"; - PLATFORM_PROFILE_ON_BAT = "low-power"; - }; - }; - powerManagement.powertop.enable = true; - services.thermald.enable = true; - - services.switcherooControl.enable = true; - hardware = { - opengl = { - enable = true; - extraPackages = with pkgs; [ mesa ]; - }; - amdgpu.overdrive.enable = lib.mkForce false; - }; - - services.printing.enable = false; - hardware.bluetooth.enable = lib.mkForce false; - services.avahi.enable = false; - services.fwupd.enable = true; - services.locate.enable = false; - services.journald.extraConfig = '' - SystemMaxUse=200M - RuntimeMaxUse=100M - MaxRetentionSec=1month - ''; - # programs.ssh.startAgent = true; - services.openssh.enable = lib.mkForce false; - # libvirt - # nsncd (?) - # - services.tailscale.enable = lib.mkForce false; - programs.java.enable = lib.mkForce false; - services.upower.enable = lib.mkForce false; - services = { - xserver.windowManager.fvwm2.gestures = lib.mkForce false; - libinput.enable = lib.mkForce false; - }; - hardware.opentabletdriver.enable = lib.mkForce false; - programs.kdeconnect.enable = lib.mkForce false; - services.mullvad-vpn.enable = lib.mkForce false; - - virtualisation = { - docker.enable = lib.mkForce false; - libvirtd.enable = lib.mkForce false; - }; - }; -}