Some lsp refactor. Made webdav finally work with some internet search

This commit is contained in:
2025-08-31 22:38:24 +02:00
parent b781a9f492
commit 85fbdb5795
14 changed files with 224 additions and 181 deletions

8
modules/common/sops.nix Normal file
View File

@@ -0,0 +1,8 @@
{ ... }:
{
sops.defaultSopsFile = ./../../secrets.yaml;
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
sops.age.keyFile = "/var/lib/sops-nix/key.txt";
sops.age.generateKey = true;
}

View File

@@ -3,6 +3,7 @@
{
# Basic services
services.locate.enable = true;
services.openssh.enable = true;
# Nix fun
nixpkgs.config.allowUnfree = true;

View File

@@ -1,26 +1,26 @@
{ config, ... }:
{
hardware.graphics = {
enable = true;
};
services.xserver.videoDrivers = ["nvidia"];
hardware.nvidia = {
modesetting.enable = true;
powerManagement.enable = false;
open = false;
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
hardware.graphics = { enable = true; };
services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia = {
modesetting.enable = true;
powerManagement.enable = false;
open = false;
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
# Cuda for blender long build times
#environment.systemPackages = with pkgs; [
# (blender.override {
# cudaSupport = true;
# })
#];
#environment.systemPackages = with pkgs; [
# (blender.override {
# cudaSupport = true;
# })
#];
# This causes very long build times
#nixpkgs.config.cudaSupport = true;
#hardware.enableAllFirmware = true;
# This causes very long build times
#nixpkgs.config.cudaSupport = true;
#hardware.enableAllFirmware = true;
}

View File

@@ -1,39 +1,37 @@
{ inputs, ... }:
{
imports = [
inputs.xremap-flake.nixosModules.default
];
imports = [ inputs.xremap-flake.nixosModules.default ];
services.xremap = {
withHypr = true;
userName = "jonas";
config = {
modmap = [
{
name = "Capslock to esc and ctrl";
remap = {
"CAPSLOCK" = {
"alone" = "ESC";
"held" = "CTRL_L";
};
"ESC" = "CAPSLOCK";
};
}
{
name = "Switch super and alt";
remap = {
"SUPER_L" = {
"alone" = "ALT_L";
"held" = "ALT_L";
};
"ALT_L" = {
"alone" = "SUPER_L";
"held" = "SUPER_L";
};
};
}
];
};
};
services.xremap = {
withHypr = true;
userName = "jonas";
config = {
modmap = [
{
name = "Capslock to esc and ctrl";
remap = {
"CAPSLOCK" = {
"alone" = "ESC";
"held" = "CTRL_L";
};
"ESC" = "CAPSLOCK";
};
}
{
name = "Switch super and alt";
remap = {
"SUPER_L" = {
"alone" = "ALT_L";
"held" = "ALT_L";
};
"ALT_L" = {
"alone" = "SUPER_L";
"held" = "SUPER_L";
};
};
}
];
};
};
}

View File

@@ -1,67 +1,65 @@
{ config, lib, ... }:
let
inherit (lib) mkOption types;
in
{
let inherit (lib) mkOption types;
in {
options.batMode = mkOption {
type = types.enum [ "single" "double" ];
default = "single";
};
options.batMode = mkOption {
type = types.enum [ "single" "double" ];
default = "single";
};
config = {
powerManagement.powertop.enable = true;
services.upower = {
enable = true;
config = {
powerManagement.powertop.enable = true;
services.upower = {
enable = true;
# In accordance with the waybar battery colors
percentageLow = 30;
percentageCritical = 20;
percentageAction = 10;
# In accordance with the waybar battery colors
percentageLow = 30;
percentageCritical = 20;
percentageAction = 10;
criticalPowerAction = "PowerOff"; # This can destroy work
usePercentageForPolicy = true;
};
criticalPowerAction = "PowerOff"; # This can destroy work
usePercentageForPolicy = true;
};
services.tlp = if config.batMode == "single" then {
enable = true;
settings = {
START_CHARGE_THRESH_BAT0 = 65;
STOP_CHARGE_THRESH_BAT0 = 85;
services.tlp = if config.batMode == "single" then {
enable = true;
settings = {
START_CHARGE_THRESH_BAT0 = 65;
STOP_CHARGE_THRESH_BAT0 = 85;
CPU_SCALING_GOVERNOR_ON_AC = "performance";
CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
CPU_SCALING_GOVERNOR_ON_AC = "performance";
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 = {
CPU_SCALING_GOVERNOR_ON_AC = "performance";
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
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 = {
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_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;
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 is first
START_CHARGE_THRESH_BAT0 = 60;
STOP_CHARGE_THRESH_BAT0 = 85;
# 0 is first
START_CHARGE_THRESH_BAT0 = 60;
STOP_CHARGE_THRESH_BAT0 = 85;
# 1 is second
START_CHARGE_THRESH_BAT1 = 60;
STOP_CHARGE_THRESH_BAT1 = 85;
};
};
# 1 is second
START_CHARGE_THRESH_BAT1 = 60;
STOP_CHARGE_THRESH_BAT1 = 85;
};
};
};
};
}

View File

@@ -1,9 +1,5 @@
{ ... }:
{
networking = {
networkmanager = {
wifi.powersave = true;
};
};
networking = { networkmanager = { wifi.powersave = true; }; };
}

View File

@@ -1,11 +1,11 @@
{ pkgs, ... }:
{
# Scanning over the network support
hardware.sane.enable = true;
hardware.sane.extraBackends = [ pkgs.sane-airscan ];
hardware.sane.disabledDefaultBackends = [ "escl" ];
services.udev.packages = [ pkgs.sane-airscan ];
services.avahi.enable = true;
services.avahi.nssmdns = true;
# Scanning over the network support
hardware.sane.enable = true;
hardware.sane.extraBackends = [ pkgs.sane-airscan ];
hardware.sane.disabledDefaultBackends = [ "escl" ];
services.udev.packages = [ pkgs.sane-airscan ];
services.avahi.enable = true;
services.avahi.nssmdns = true;
}

View File

@@ -1,20 +1,22 @@
{ inputs, ... }:
{ ... }:
{
imports = [ inputs.sops-nix.nixosModules.sops ];
# For web mounting
services.davfs2.enable = true;
# Maybe the failed encryption is due to the btrfs system please remove this in the future
# Load the secret
sops = {
defaultSopsFile = ./../../secrets.yaml;
age.keyFile = "/home/jonas/.config/sops/age/keys.txt";
secrets = { webdav_secret = { path = "/etc/davfs2/secrets"; }; };
secrets = {
webdav_authstring = {
mode = "0600";
path = "/etc/davfs2/secrets";
};
};
};
systemd.mounts = [{
description = "WebDAV mount point";
description = "Webdav mount point";
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
what = "https://dav.hahn1.one";
where = "/mnt/webdav";
@@ -22,4 +24,12 @@
options = "uid=1000,gid=1000,file_mode=0664,dir_mode=2775,_netdev";
mountConfig.TimeoutSec = "5s";
}];
# Is this too much power drain?
systemd.automounts = [{
description = "Webdav automount";
where = "/mnt/webdav";
wantedBy = [ "multi-user.target" ];
automountConfig = { TimeoutIdleSec = "2m"; };
}];
}