From 2b60fa5807f8bfc101cb9831ae2181aea71466b0 Mon Sep 17 00:00:00 2001 From: Tasia Iso Date: Sun, 2 Feb 2025 21:36:53 +0100 Subject: [PATCH] power --- hosts/jo/configuration.nix | 104 +++++++++++++++------------- hosts/jo/hardware-configuration.nix | 34 +++++---- 2 files changed, 74 insertions(+), 64 deletions(-) diff --git a/hosts/jo/configuration.nix b/hosts/jo/configuration.nix index b22c75b..4484ab2 100644 --- a/hosts/jo/configuration.nix +++ b/hosts/jo/configuration.nix @@ -7,54 +7,53 @@ }: let sshKeys = import ../../crypto/ssh-keys.nix; in { - imports = - [ - # Defaults - ./hardware-configuration.nix - ../../common/base.nix - ../../common/full-install.nix + imports = [ + # Defaults + ./hardware-configuration.nix + ../../common/base.nix + ../../common/full-install.nix - # Localization - ../../common/locales/en.nix - ../../common/locales/de-keymap.nix + # Localization + ../../common/locales/en.nix + ../../common/locales/de-keymap.nix - # Hardware - # ../../common/hardware/tpm2.nix - ../../common/hardware/wireless.nix - ../../common/hardware/ssd.nix - # ../../common/hardware/btrfs.nix - # ../../common/components/lanzaboote.nix + # Hardware + # ../../common/hardware/tpm2.nix + ../../common/hardware/wireless.nix + ../../common/hardware/ssd.nix + # ../../common/hardware/btrfs.nix + # ../../common/components/lanzaboote.nix - # Software components - # ../../common/components/de/greetd.nix - # ../../common/components/de/sway.nix - # ../../common/components/de/plasma6.nix + # Software components + # ../../common/components/de/greetd.nix + # ../../common/components/de/sway.nix + # ../../common/components/de/plasma6.nix - # Programs - # ../../common/programs/steam.nix + # Programs + # ../../common/programs/steam.nix - # Services - # ../../common/services/auditd.nix - # ../../common/services/nix-gc.nix - # ../../common/services/opensnitch.nix - # ../../common/services/adguardhome.nix - ../../common/services/syncthing.nix - # ../../common/services/usbguard.nix - # ../../common/services/autoupgrade.nix + # Services + # ../../common/services/auditd.nix + # ../../common/services/nix-gc.nix + # ../../common/services/opensnitch.nix + # ../../common/services/adguardhome.nix + ../../common/services/syncthing.nix + # ../../common/services/usbguard.nix + # ../../common/services/autoupgrade.nix - # Home-manager - # ../../home/tasia/home.nix + # Home-manager + # ../../home/tasia/home.nix - inputs.agenix.nixosModules.default - ../../common/components/wifi-secrets.nix + inputs.agenix.nixosModules.default + ../../common/components/wifi-secrets.nix - # inputs.thymis.nixosModules.thymis-controller - # Personal modules - # ../../modules/nixos/tildefriends.nix - # ./yubikey.nix - # ./rtl-sdr.nix - ]; -boot.loader.systemd-boot.enable = lib.mkForce false; + # inputs.thymis.nixosModules.thymis-controller + # Personal modules + # ../../modules/nixos/tildefriends.nix + # ./yubikey.nix + # ./rtl-sdr.nix + ]; + boot.loader.systemd-boot.enable = lib.mkForce false; # Bootloader. boot.loader.grub.enable = true; boot.loader.grub.device = "/dev/sda"; @@ -65,10 +64,18 @@ boot.loader.systemd-boot.enable = lib.mkForce false; "/crypto_keyfile.bin" = null; }; - boot.loader.grub.enableCryptodisk=true; + services.logind.extraConfig = '' + # don’t shutdown when power button is short-pressed + HandleLidSwitch=ignore + HandleLidSwitchExternalPower=ignore + HandleLidSwitchDocked=ignore + ''; -services.tailscale.enable = true; -services.syncthing.guiAddress = "0.0.0.0:8384"; + + boot.loader.grub.enableCryptodisk = true; + + services.tailscale.enable = true; + services.syncthing.guiAddress = "0.0.0.0:8384"; boot.initrd.luks.devices."luks-7aa6742e-020d-49aa-a458-78ea5c3b85f8".keyFile = "/crypto_keyfile.bin"; networking.hostName = "jo"; # Define your hostname. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. @@ -80,7 +87,7 @@ services.syncthing.guiAddress = "0.0.0.0:8384"; # Enable networking networking.networkmanager.enable = true; -users.users.tasia.openssh.authorizedKeys.keys = [ + users.users.tasia.openssh.authorizedKeys.keys = [ sshKeys.tasia.cave ]; @@ -93,7 +100,7 @@ users.users.tasia.openssh.authorizedKeys.keys = [ # xkbVariant = ""; # }; - services.syncthing = { + services.syncthing = { user = "tasia"; dataDir = lib.mkForce "/home/tasia/Sync/data"; configDir = lib.mkForce "/home/tasia/Sync/configuration"; @@ -106,15 +113,15 @@ users.users.tasia.openssh.authorizedKeys.keys = [ users.users.tasia = { isNormalUser = true; description = "Tasia"; - extraGroups = [ "networkmanager" "wheel" ]; + extraGroups = ["networkmanager" "wheel"]; packages = with pkgs; []; }; # List packages installed in system profile. To search, run: # $ nix search wget environment.systemPackages = with pkgs; [ - # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. - # wget + # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + # wget ]; # Some programs need SUID wrappers, can be configured further or are @@ -143,5 +150,4 @@ users.users.tasia.openssh.authorizedKeys.keys = [ # Before changing this value read the documentation for this option # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). system.stateVersion = "23.11"; # Did you read the comment? - } diff --git a/hosts/jo/hardware-configuration.nix b/hosts/jo/hardware-configuration.nix index 088c483..7f611fc 100644 --- a/hosts/jo/hardware-configuration.nix +++ b/hosts/jo/hardware-configuration.nix @@ -1,27 +1,31 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - { - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = [ "uhci_hcd" "ehci_pci" "ahci" "firewire_ohci" "usbhid" "usb_storage" "sd_mod" "sr_mod" "sdhci_pci" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["uhci_hcd" "ehci_pci" "ahci" "firewire_ohci" "usbhid" "usb_storage" "sd_mod" "sr_mod" "sdhci_pci"]; + boot.initrd.kernelModules = []; + boot.kernelModules = []; + boot.extraModulePackages = []; - fileSystems."/" = - { device = "/dev/disk/by-uuid/e867382a-7ecb-4a93-bf7c-c972be061180"; - fsType = "btrfs"; - options = [ "subvol=@" ]; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/e867382a-7ecb-4a93-bf7c-c972be061180"; + fsType = "btrfs"; + options = ["subvol=@"]; + }; boot.initrd.luks.devices."luks-7aa6742e-020d-49aa-a458-78ea5c3b85f8".device = "/dev/disk/by-uuid/7aa6742e-020d-49aa-a458-78ea5c3b85f8"; - swapDevices = [ ]; + swapDevices = []; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's