nixMain cryptorootm, shared power managment

This commit is contained in:
Kyattsukuro 2026-05-21 04:49:53 +02:00
parent c5f84b4fa2
commit f4363c36f6
11 changed files with 93 additions and 64 deletions

View File

@ -17,3 +17,42 @@ Deployment:
Used as kde config finder, in `~./config` and `~./local/share`: Used as kde config finder, in `~./config` and `~./local/share`:
- `find . -type f -regex '.*\(k\|rc\|pulse\|session\|gtk\|autostart\|xbel\).*'` - `find . -type f -regex '.*\(k\|rc\|pulse\|session\|gtk\|autostart\|xbel\).*'`
### Disc encryption steps
```bash
# Cryptoroot, fs and mount
cryptsetup luksFormat /dev/nvme0n1p2
cryptsetup luksOpen /dev/nvme0n1p2 cryptroot
mkfs.btrfs -L root /dev/mapper/cryptroot
mount /dev/disk/by-label/root /mnt/
# Mount boot
# change type of boot to uefi via fdisk
mkdir /mnt/boot
mount /dev/nvme0n1p1 /mnt/boot/
# Cryptoswap and makeswap
cryptsetup luksFormat /dev/nvme0n1p3 --label cryptoswap
cryptsetup luksOpen /dev/disk/by-label/cryptoswap swap
sudo mkswap /dev/mapper/swap -L swap
# get hw-config
nixos-generate-config --root /mnt/
cp /mnt/etc/nixos/hardware-configuration.nix /
vim /hardware-configuration.nix
# Append:
# swapDevices = [{
# device = "/dev/disk/by-label/swap";
# encrypted = {
# enable = true;
# label = "swap";
# blkDev = "/dev/disk/by-label/cryptoswap";
# };
# }];
# Deploy config
rm -r /mnt/etc/nixos/
cp -r dotfiles-master/dotfiles/root-conf/nixos/ /mnt/etc
cp /hardware-configuration.nix /mnt/etc/nixos/DESTINATION
nixos-install --root /mnt --flake /mnt/etc/nixos#DESTINATION
```

Binary file not shown.

View File

@ -1,4 +1,4 @@
Host 78.46.239.229 168.119.171.217 78.47.196.196 5.75.139.112 mail.bak-it.de web.bak-it.de forum.linksjugend-solid.de backuppc.bak-it.de login.bak-it.de stuff.bak-it.de Host 78.46.239.229 168.119.171.217 78.47.196.196 5.75.139.112 mail.bak-it.de web.bak-it.de cloud.linksjugend-solid.de forum.linksjugend-solid.de backuppc.bak-it.de login.bak-it.de login.linksjugend-solid.de stuff.bak-it.de
User root User root
IdentityFile ~/.ssh/solidProd IdentityFile ~/.ssh/solidProd

View File

@ -1,4 +1,4 @@
; Thunar GtkAccelMap rc-file -*- scheme -*- ; thunar GtkAccelMap rc-file -*- scheme -*-
; this file is an automated accelerator map dump ; this file is an automated accelerator map dump
; ;
; (gtk_accel_path "<Actions>/ThunarDetailsView/expandable-folders" "") ; (gtk_accel_path "<Actions>/ThunarDetailsView/expandable-folders" "")

View File

@ -6,7 +6,7 @@
<property name="last-window-maximized" type="bool" value="true"/> <property name="last-window-maximized" type="bool" value="true"/>
<property name="last-details-view-zoom-level" type="string" value="THUNAR_ZOOM_LEVEL_38_PERCENT"/> <property name="last-details-view-zoom-level" type="string" value="THUNAR_ZOOM_LEVEL_38_PERCENT"/>
<property name="last-details-view-visible-columns" type="string" value="THUNAR_COLUMN_DATE_CREATED,THUNAR_COLUMN_DATE_MODIFIED,THUNAR_COLUMN_GROUP,THUNAR_COLUMN_MIME_TYPE,THUNAR_COLUMN_NAME,THUNAR_COLUMN_OWNER,THUNAR_COLUMN_PERMISSIONS,THUNAR_COLUMN_SIZE"/> <property name="last-details-view-visible-columns" type="string" value="THUNAR_COLUMN_DATE_CREATED,THUNAR_COLUMN_DATE_MODIFIED,THUNAR_COLUMN_GROUP,THUNAR_COLUMN_MIME_TYPE,THUNAR_COLUMN_NAME,THUNAR_COLUMN_OWNER,THUNAR_COLUMN_PERMISSIONS,THUNAR_COLUMN_SIZE"/>
<property name="last-details-view-column-widths" type="string" value="159,159,159,127,92,599,74,580,514,214,118,81,126,156"/> <property name="last-details-view-column-widths" type="string" value="159,159,159,127,92,599,74,375,247,214,118,81,126,156"/>
<property name="last-separator-position" type="int" value="216"/> <property name="last-separator-position" type="int" value="216"/>
<property name="last-show-hidden" type="bool" value="true"/> <property name="last-show-hidden" type="bool" value="true"/>
<property name="misc-single-click" type="bool" value="false"/> <property name="misc-single-click" type="bool" value="false"/>
@ -32,7 +32,7 @@
<property name="misc-folder-item-count" type="string" value="THUNAR_FOLDER_ITEM_COUNT_ALWAYS"/> <property name="misc-folder-item-count" type="string" value="THUNAR_FOLDER_ITEM_COUNT_ALWAYS"/>
<property name="last-details-view-column-order" type="string" value="THUNAR_COLUMN_NAME,THUNAR_COLUMN_DATE_MODIFIED,THUNAR_COLUMN_SIZE,THUNAR_COLUMN_SIZE_IN_BYTES,THUNAR_COLUMN_TYPE,THUNAR_COLUMN_LOCATION,THUNAR_COLUMN_MIME_TYPE,THUNAR_COLUMN_DATE_CREATED,THUNAR_COLUMN_PERMISSIONS,THUNAR_COLUMN_OWNER,THUNAR_COLUMN_GROUP,THUNAR_COLUMN_DATE_ACCESSED,THUNAR_COLUMN_RECENCY,THUNAR_COLUMN_DATE_DELETED"/> <property name="last-details-view-column-order" type="string" value="THUNAR_COLUMN_NAME,THUNAR_COLUMN_DATE_MODIFIED,THUNAR_COLUMN_SIZE,THUNAR_COLUMN_SIZE_IN_BYTES,THUNAR_COLUMN_TYPE,THUNAR_COLUMN_LOCATION,THUNAR_COLUMN_MIME_TYPE,THUNAR_COLUMN_DATE_CREATED,THUNAR_COLUMN_PERMISSIONS,THUNAR_COLUMN_OWNER,THUNAR_COLUMN_GROUP,THUNAR_COLUMN_DATE_ACCESSED,THUNAR_COLUMN_RECENCY,THUNAR_COLUMN_DATE_DELETED"/>
<property name="last-tabs-left" type="array"> <property name="last-tabs-left" type="array">
<value type="string" value="file:///home/someone/.config/yolk/root-conf/nixos/local-pkgs"/> <value type="string" value="file:///mnt/DT01ACA3"/>
</property> </property>
<property name="last-focused-tab-left" type="int" value="0"/> <property name="last-focused-tab-left" type="int" value="0"/>
<property name="last-focused-tab-right" type="int" value="0"/> <property name="last-focused-tab-right" type="int" value="0"/>

View File

@ -190,7 +190,7 @@
"debugger": { "debugger": {
"dock": "bottom", "dock": "bottom",
}, },
"disable_ai": false, "disable_ai": true,
"terminal": { "terminal": {
"toolbar": { "toolbar": {
"breadcrumbs": false, "breadcrumbs": false,

View File

@ -24,26 +24,6 @@ in
networking.hostName = "nixLap"; networking.hostName = "nixLap";
powerManagement.enable = true;
services.power-profiles-daemon.enable = true;
# Suspend first then hibernate when closing the lid
services.logind.settings.Login.lidSwitch = "suspend-then-hibernate";
# Hibernate on power button pressed
services.logind.settings.Login.powerKey = "hibernate";
services.logind.settings.Login.powerKeyLongPress = "poweroff";
# Hibernation
boot.resumeDevice = "/dev/disk/by-label/swap";
# resume offset from: filefrag -v /swapfile # under 0. physical offset
boot.kernelParams = ["mem_sleep_default=freeze" "resume_offset=0" ];
# Define time delay for hibernation
systemd.sleep.settings.Sleep = {
HibernateDelaySec = "30m";
SuspendState = "mem";
};
# Start the driver at boot # Start the driver at boot
systemd.services.fprintd = { systemd.services.fprintd = {
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
@ -144,6 +124,7 @@ in
users.groups.wireshark = {}; users.groups.wireshark = {};
users.users.someone = { users.users.someone = {
isNormalUser = true; isNormalUser = true;
uid = 1000;
description = "someone"; description = "someone";
extraGroups = [ "networkmanager" "wheel" "libvirtd" "wireshark"]; extraGroups = [ "networkmanager" "wheel" "libvirtd" "wireshark"];
packages = with pkgs; []; packages = with pkgs; [];

View File

@ -1,7 +1,3 @@
# Edit this configuration file to define what should be installed on your system. Help is available in the configuration.nix(5) man page and in the NixOS manual
# (accessible by running ‘nixos-help’).
{ config, pkgs, pkgs-unstable, ... }: { config, pkgs, pkgs-unstable, ... }:
let let
optionalPkgs = import ../optional-packages.nix { inherit pkgs; }; optionalPkgs = import ../optional-packages.nix { inherit pkgs; };
@ -18,9 +14,6 @@ in
services.flatpak.enable = true; services.flatpak.enable = true;
# Hybrantion
boot.resumeDevice = "/dev/disk/by-uuid/1942318f-792a-4c0c-9b42-6e146d835bd7";
# Bootloader. # Bootloader.
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
@ -44,15 +37,6 @@ in
SUBSYSTEM=="gpio", KERNEL=="gpiochip*", GROUP="gpio", MODE="0660" SUBSYSTEM=="gpio", KERNEL=="gpiochip*", GROUP="gpio", MODE="0660"
''; '';
services.logind.settings.Login.powerKey = "ignore";
services.logind.settings.Login.powerKeyLongPress = "ignore";
services.logind.settings.Login.rebootKey = "ignore";
systemd.sleep.settings.Sleep = {
SuspendState = "freeze";
};
# Enable openrgb # Enable openrgb
services.hardware.openrgb.enable = true; services.hardware.openrgb.enable = true;
@ -100,6 +84,7 @@ in
users.groups.gpio = {}; users.groups.gpio = {};
users.groups.wireshark = {}; users.groups.wireshark = {};
users.users.someone = { users.users.someone = {
uid = 1000;
isNormalUser = true; isNormalUser = true;
description = "someone"; description = "someone";
extraGroups = [ "wheel" "docker" "libvirtd" "gpio" "wireshark" "adbusers" ]; extraGroups = [ "wheel" "docker" "libvirtd" "gpio" "wireshark" "adbusers" ];
@ -115,12 +100,19 @@ in
shell = pkgs.bash; shell = pkgs.bash;
}; };
# Use lemurs as display manager # Use ly as display manager
services.displayManager.ly = { services.displayManager = {
enable = true; ly = {
settings = { enable = true;
tty = 1; settings = {
tty = 1;
};
}; };
autoLogin = {
enable = true;
user = "someone";
};
defaultSession = "hyprland";
}; };
# Docker # Docker
@ -168,6 +160,7 @@ in
bind # dig, nslookup bind # dig, nslookup
# Hyprland stuff # Hyprland stuff
uwsm # might not be needet, test login without
kitty kitty
dunst dunst
waybar waybar

View File

@ -1,7 +1,7 @@
# Do not modify this file! It was generated by ‘nixos-generate-config’ # Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, nixpkgs, modulesPath, ... }: { config, lib, pkgs, modulesPath, ... }:
{ {
imports = imports =
@ -14,28 +14,26 @@
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" =
{ device = "/dev/disk/by-uuid/4b53ce3e-72b3-4ea4-8656-e90b48da3b65"; { device = "/dev/mapper/cryptroot";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=@" ];
}; };
boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/52e65cdf-08a0-45af-87f2-d83d6a5c2321";
fileSystems."/boot" = fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/9810-0A10"; { device = "/dev/disk/by-uuid/08D8-2E5B";
fsType = "vfat"; fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ]; options = [ "fmask=0022" "dmask=0022" ];
}; };
swapDevices = swapDevices = [{
[ { device = "/dev/disk/by-uuid/1942318f-792a-4c0c-9b42-6e146d835bd7"; } device = "/dev/disk/by-label/swap";
]; encrypted = {
enable = true;
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking label = "swap";
# (the default) this is the recommended approach. When using systemd-networkd it's blkDev = "/dev/disk/by-label/cryptoswap";
# still possible to use this option, but it's recommended to use it in conjunction };
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`. }];
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp6s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp5s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;

View File

@ -36,6 +36,26 @@
networkmanager.enable = true; networkmanager.enable = true;
}; };
powerManagement.enable = true;
services.power-profiles-daemon.enable = true;
# Suspend first then hibernate when closing the lid
services.logind.settings.Login.lidSwitch = "suspend-then-hibernate";
# Hibernate on power button pressed
services.logind.settings.Login.powerKey = "hibernate";
services.logind.settings.Login.powerKeyLongPress = "poweroff";
# Hibernation
boot.resumeDevice = "/dev/disk/by-label/swap";
# resume offset from: filefrag -v /swapfile # under 0. physical offset
boot.kernelParams = ["mem_sleep_default=freeze" "resume_offset=0" ];
# Define time delay for hibernation
systemd.sleep.settings.Sleep = {
HibernateDelaySec = "30m";
SuspendState = "mem";
};
programs.wireshark = { programs.wireshark = {
enable = true; enable = true;
usbmon.enable = true; # Allow USB monitoring usbmon.enable = true; # Allow USB monitoring

View File

@ -95,8 +95,6 @@ if [[ $UPGRADE -eq 1 ]]; then
fi fi
ARGS+="--flake /etc/nixos" ARGS+="--flake /etc/nixos"
echo $ARGS
echo "Running: nixos-rebuild $ARGS" echo "Running: nixos-rebuild $ARGS"
nixos-rebuild $ARGS nixos-rebuild $ARGS
cp /etc/nixos/flake.lock root-conf/nixos/flake.lock cp /etc/nixos/flake.lock root-conf/nixos/flake.lock