mirror of
https://github.com/Ascyii/nixos.git
synced 2026-01-01 06:44:26 -05:00
Initial commit unclean
This commit is contained in:
28
modules/hardware/bootmode.nix
Normal file
28
modules/hardware/bootmode.nix
Normal file
@@ -0,0 +1,28 @@
|
||||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkOption types;
|
||||
in
|
||||
{
|
||||
options.bootMode = mkOption {
|
||||
type = types.enum [ "uefi" "legacy" ];
|
||||
default = "uefi";
|
||||
description = "Select boot mode: 'uefi' or 'legacy'.";
|
||||
};
|
||||
|
||||
config = {
|
||||
boot.consoleLogLevel = 0;
|
||||
boot.kernelParams = [ "quiet" "udev.log_level=3" ];
|
||||
|
||||
boot.loader = if config.bootMode == "uefi" then {
|
||||
efi.canTouchEfiVariables = true;
|
||||
systemd-boot.enable = true;
|
||||
timeout = 0;
|
||||
} else {
|
||||
grub.enable = true;
|
||||
grub.device = "/dev/sda"; # <- replace with actual target disk
|
||||
timeout = 0;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
20
modules/hardware/gaming.nix
Normal file
20
modules/hardware/gaming.nix
Normal file
@@ -0,0 +1,20 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
########## TEsting
|
||||
|
||||
# Load nvidia driver for Xorg and Wayland
|
||||
services.steam.enable = true;
|
||||
services.xserver.videoDrivers = ["nvidia"];
|
||||
|
||||
# Enable OpenGL
|
||||
# Optional nvidia
|
||||
hardware.graphics = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
hardware.nvidia = {
|
||||
modesetting.enable = true;
|
||||
open = false;
|
||||
};
|
||||
};
|
||||
95
modules/hardware/laptop.nix
Normal file
95
modules/hardware/laptop.nix
Normal file
@@ -0,0 +1,95 @@
|
||||
{ pkgs, config, lib, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkOption types;
|
||||
in
|
||||
{
|
||||
|
||||
options.batMode = mkOption {
|
||||
type = types.enum [ "single" "double" ];
|
||||
default = "single";
|
||||
description = "Select 'single' for one battery and 'double' for dual setup";
|
||||
};
|
||||
|
||||
# Dont run a tandem with tlp
|
||||
#options.services.auto-cpufreq.enable = true;
|
||||
#options.services.auto-cpufreq.settings = {
|
||||
# battery = {
|
||||
# governor = "powersave";
|
||||
# turbo = "never";
|
||||
# };
|
||||
# charger = {
|
||||
# governor = "performance";
|
||||
# turbo = "auto";
|
||||
# };
|
||||
#};
|
||||
|
||||
config = {
|
||||
powerManagement.powertop.enable = true;
|
||||
services.upower = {
|
||||
enable = true;
|
||||
|
||||
# In accordance with the waybar battery colors
|
||||
percentageLow = 30;
|
||||
percentageCritical = 20;
|
||||
percentageAction = 10;
|
||||
|
||||
#percentageAction = "PowerOff";
|
||||
criticalPowerAction = "PowerOff"; # This can destroy work
|
||||
usePercentageForPolicy = true;
|
||||
};
|
||||
|
||||
services.tlp = if config.batMode == "single" then {
|
||||
enable = true;
|
||||
settings = {
|
||||
#Optional helps save long term battery health
|
||||
# Going almost full because the other bat is also charged
|
||||
# 0 NEW first
|
||||
START_CHARGE_THRESH_BAT0 = 65;
|
||||
STOP_CHARGE_THRESH_BAT0 = 85;
|
||||
|
||||
CPU_SCALING_GOVERNOR_ON_AC = "performance";
|
||||
#CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
|
||||
|
||||
#CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
|
||||
CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
|
||||
|
||||
CPU_MIN_PERF_ON_AC = 0;
|
||||
CPU_MAX_PERF_ON_AC = 100;
|
||||
CPU_MIN_PERF_ON_BAT = 0;
|
||||
CPU_MAX_PERF_ON_BAT = 65;
|
||||
|
||||
|
||||
};
|
||||
} else {
|
||||
enable = true;
|
||||
settings = {
|
||||
# Have to keep it this way or
|
||||
# Otherwise the buil in stop at 5% stops worky
|
||||
# The problem is here that only the second battery gets seen from the charging cap
|
||||
# Workaround. Just charge the battery when you use it and then turn manually the battery off
|
||||
# I mean it is the state you generate now that you can use on any laptop. so
|
||||
CPU_SCALING_GOVERNOR_ON_AC = "performance";
|
||||
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
|
||||
|
||||
CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
|
||||
CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
|
||||
|
||||
CPU_MIN_PERF_ON_AC = 0;
|
||||
CPU_MAX_PERF_ON_AC = 100;
|
||||
CPU_MIN_PERF_ON_BAT = 0;
|
||||
CPU_MAX_PERF_ON_BAT = 75;
|
||||
|
||||
# 0 NEW first
|
||||
START_CHARGE_THRESH_BAT0 = 60;
|
||||
STOP_CHARGE_THRESH_BAT0 = 85;
|
||||
|
||||
# 1 OLD second
|
||||
START_CHARGE_THRESH_BAT1 = 60;
|
||||
STOP_CHARGE_THRESH_BAT1 = 85;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
21
modules/hardware/virt.nix
Normal file
21
modules/hardware/virt.nix
Normal file
@@ -0,0 +1,21 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
# Enable common container config files in /etc/containers
|
||||
# virtualisation.containers.enable = true;
|
||||
# virtualisation = {
|
||||
# podman = {
|
||||
# enable = true;
|
||||
# dockerSocket.enable = true;
|
||||
# dockerCompat = true;
|
||||
# defaultNetwork.settings.dns_enabled = true;
|
||||
# };
|
||||
# };
|
||||
#
|
||||
# # Useful other development tools
|
||||
# environment.systemPackages = with pkgs; [
|
||||
# dive # look into docker image layers
|
||||
# podman-tui # status of containers in the terminal
|
||||
# docker-compose # start group of containers for dev
|
||||
# ];
|
||||
virtualisation.docker.enable = true;
|
||||
}
|
||||
58
modules/hardware/workstation.nix
Normal file
58
modules/hardware/workstation.nix
Normal file
@@ -0,0 +1,58 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
# Experiments with services
|
||||
systemd = {
|
||||
timers."sync-manage-hourly" = {
|
||||
enable = false;
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig = {
|
||||
OnBootSec = "10s"; # Start 10 seconds after boot
|
||||
OnUnitActiveSec = "1h"; # Repeat every hour
|
||||
Unit = "sync-manage.service"; # Points to the service unit
|
||||
};
|
||||
};
|
||||
services = {
|
||||
"shutdown-script" = {
|
||||
enable = false;
|
||||
description = "Run custom script on shutdown";
|
||||
after = [ "shutdown.target" ]; # Ensure it runs during shutdown
|
||||
script = "/home/jonas/projects/scripts/check_git.sh"; # Specify the path to your script
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "jonas"; # Run as jonas
|
||||
WorkingDirectory = "/home/jonas"; # Set working directory to jonas' home
|
||||
execStop = "/home/jonas/projects/scripts/check_git.sh"; # Specify the path to your script
|
||||
# To ensure the script finishes before the system powers off
|
||||
TimeoutStopSec = "30"; # You can adjust this if necessary
|
||||
};
|
||||
# To ensure the script finishes before the system powers off
|
||||
};
|
||||
"sync-manage" = {
|
||||
script = ''
|
||||
# Run the script from jonas' home directory
|
||||
/home/jonas/projects/scripts/sync_manage.sh
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "jonas"; # Run as jonas
|
||||
WorkingDirectory = "/home/jonas"; # Set working directory to jonas' home
|
||||
};
|
||||
};
|
||||
"sync-manage-shutdown" = {
|
||||
enable = false;
|
||||
script = ''
|
||||
# Check if the system is connected to Wi-Fi
|
||||
/home/jonas/projects/scripts/sync_manage.sh
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "jonas"; # Run as jonas
|
||||
ExecStop = "/usr/bin/true";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user