Compare commits

..

12 Commits

Author SHA1 Message Date
a78d66fbd3 added qmk for the keyboard config 2025-11-16 13:15:48 +01:00
941c51884d added ollama context length explicitly 2025-11-07 21:40:33 +01:00
ddfde55edf everything just works lets leave it like that 2025-11-06 22:10:41 +01:00
9ba39dbff4 setup local llms with websearch 2025-11-06 12:00:23 +01:00
2cbbbddcab added appindicator to gnome 2025-11-03 12:28:44 +01:00
bf441a6979 do not hibernate 2025-11-03 11:51:26 +01:00
60c764324a use old config stlye in git! 2025-11-03 11:37:16 +01:00
1aa72c7a30 split into tower and laptop config 2025-11-03 11:36:56 +01:00
1e738d598b disable dark mode, update and add firefox+jabref 2025-10-15 15:43:19 +02:00
250caeaf32 normal cursor and brave darkmode 2025-09-20 19:21:24 +02:00
6c4c3d54aa update and drop catppuccin 2025-09-19 15:12:01 +02:00
a6871f94a8 stuff 2025-08-06 11:22:10 +02:00
36 changed files with 499 additions and 154 deletions

66
flake.lock generated
View File

@@ -1,23 +1,5 @@
{
"nodes": {
"catppuccin": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1751880463,
"narHash": "sha256-aSQllMKqsTYAUp4yhpspZn0Hj5yIj7Mh4UD5iyk5iMM=",
"owner": "catppuccin",
"repo": "nix",
"rev": "9474347c69e93e392f194dda7a57c641ba4b998e",
"type": "github"
},
"original": {
"owner": "catppuccin",
"repo": "nix",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@@ -25,11 +7,11 @@
]
},
"locked": {
"lastModified": 1751810233,
"narHash": "sha256-kllkNbIqQi3VplgTMeGzuh1t8Gk8TauvkTRt93Km+tQ=",
"lastModified": 1758463745,
"narHash": "sha256-uhzsV0Q0I9j2y/rfweWeGif5AWe0MGrgZ/3TjpDYdGA=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "9b0873b46c9f9e4b7aa01eb634952c206af53068",
"rev": "3b955f5f0a942f9f60cdc9cacb7844335d0f21c3",
"type": "github"
},
"original": {
@@ -41,27 +23,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1750776420,
"narHash": "sha256-/CG+w0o0oJ5itVklOoLbdn2dGB0wbZVOoDm4np6w09A=",
"lastModified": 1762233356,
"narHash": "sha256-cGS3lLTYusbEP/IJIWGgnkzIl+FA5xDvtiHyjalGr4k=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "30a61f056ac492e3b7cdcb69c1e6abdcf00e39cf",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1751741127,
"narHash": "sha256-t75Shs76NgxjZSgvvZZ9qOmz5zuBE8buUaYD28BMTxg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "29e290002bfff26af1db6f64d070698019460302",
"rev": "ca534a76c4afb2bdc07b681dbc11b453bab21af8",
"type": "github"
},
"original": {
@@ -71,11 +37,27 @@
"type": "github"
}
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1762361079,
"narHash": "sha256-lz718rr1BDpZBYk7+G8cE6wee3PiBUpn8aomG/vLLiY=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "ffcdcf99d65c61956d882df249a9be53e5902ea5",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"catppuccin": "catppuccin",
"home-manager": "home-manager",
"nixpkgs": "nixpkgs_2"
"nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable"
}
}
},

View File

@@ -3,8 +3,7 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
catppuccin.url = "github:catppuccin/nix";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
home-manager = {
url = "github:nix-community/home-manager/release-25.05";
@@ -13,32 +12,64 @@
};
outputs = inputs@{ self, nixpkgs, catppuccin, home-manager, ... }: {
nixosConfigurations = {
segfault-machine = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [
./hosts/segfault-machine/configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.backupFileExtension = "backup";
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.lukas.imports = [
./home/lukas/default.nix
];
home-manager.extraSpecialArgs = { inherit inputs; };
}
];
outputs = inputs@{ self, nixpkgs, home-manager, ... }:
let
system = "x86_64-linux";
lib = nixpkgs.lib;
pkgs-unstable = import inputs.nixpkgs-unstable {
system = system;
config.allowUnfree = true;
};
in
{
nixosConfigurations = {
segfault-machine = lib.nixosSystem {
inherit system; # inherited it from 'let' block
specialArgs = { inherit pkgs-unstable; };
modules = [
./hosts/segfault-machine/configuration.nix
home-manager.nixosModules.home-manager {
home-manager.backupFileExtension = "backup";
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.lukas.imports = [
./home/lukas/laptop/default.nix
];
home-manager.extraSpecialArgs = { inherit inputs; };
}
];
};
segfault-tower = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit pkgs-unstable; };
modules = [
./hosts/segfault-tower/configuration.nix
home-manager.nixosModules.home-manager {
home-manager.backupFileExtension = "backup";
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.lukas.imports = [
./home/lukas/tower/default.nix
];
home-manager.extraSpecialArgs = { inherit inputs; };
}
];
};
};
};
};
}

View File

@@ -1,20 +0,0 @@
{ inputs, ... }:
{
imports = [ inputs.catppuccin.homeModules.catppuccin ];
catppuccin = {
accent = "mauve";
flavor = "mocha";
enable = true;
cursors = {
enable = true;
flavor = "mocha";
accent = "mauve";
};
waybar.enable = false;
rofi.enable = false;
};
}

View File

@@ -2,6 +2,11 @@
programs.brave = {
enable = true;
commandLineArgs = [
"--force-dark-mode"
#"--enable-features=WebContentsForceDark"
];
extensions = [
# Catppuccin for GitHub File Explorer Icons
{ id = "lnjaiaapbakfhlbjenjkhffcdpoompki"; }

View File

@@ -1,7 +1,7 @@
{ pkgs, ... }:
let
grammars = pkgs.emacsPackages.treesit-grammars.with-all-grammars;
grammars = pkgs.emacs.pkgs.treesit-grammars.with-all-grammars;
in
{
programs.emacs = {

View File

@@ -1,12 +1,17 @@
let
userPubKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII1DsMfyMUK0snbTeVWMmdzLP9NIvPoQ4tjqyREUMHwZ mail@lukas.contact";
userPubKey1 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII1DsMfyMUK0snbTeVWMmdzLP9NIvPoQ4tjqyREUMHwZ mail@lukas.contact";
userPubKey2 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPmRbejTJaDOK7SHXz/geA7aDrcjFPR+G6YQLy55hjdR lukas@epple.contact";
in {
home.file.".ssh/allowed_signers".text = "* ${userPubKey}";
home.file.".ssh/allowed_signers".text = ''
* ${userPubKey1}
* ${userPubKey2}
'';
programs.git = {
enable = true;
userName = "Lukas";
userName= "Lukas";
userEmail = "mail@lukas.contact";
extraConfig = {
commit.gpgsign = true;
gpg.format = "ssh";

View File

@@ -7,7 +7,7 @@
syntaxHighlighting.enable = true;
autosuggestion.enable = true;
initContent = "source /etc/nixos/home/lukas/p10k.zsh";
initContent = "source /etc/nixos/home/lukas/common/p10k.zsh";
sessionVariables = {
POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD = "true";
};
@@ -28,13 +28,8 @@
la = "eza --icons -a"; # show all dot-files, short
lt = "eza -T --icons --git-ignore --level=4"; # pretty tree, two levels deep
gs = "git status --short --branch";
gl = "git log --oneline --graph --decorate";
cat ="bat --style=plain --pager=cat"; # pretty cat
less ="bat --style=plain --pager=less"; # pretty less
update = "sudo nixos-rebuild switch --flake /etc/nixos/#segfault-machine";
};
};

View File

@@ -1,5 +1,3 @@
{ pkgs, ... }:
{
xdg.enable = true;
xdg.mimeApps = {

View File

@@ -1,23 +0,0 @@
{
imports = [
./brave.nix
./catppuccin.nix
./direnv.nix
./emacs.nix
./git.nix
./packages.nix
./shell.nix
./alacritty.nix
./tmux.nix
./xgd.nix
./hyprland.nix
./waybar.nix
./rofi.nix
./libreoffice.nix
];
home.username = "lukas";
home.homeDirectory = "/home/lukas";
home.stateVersion = "25.05";
}

View File

@@ -0,0 +1,22 @@
{
imports = [
../common/brave.nix
../common/direnv.nix
../common/emacs.nix
../common/git.nix
../common/shell.nix
../common/alacritty.nix
../common/tmux.nix
../common/xgd.nix
../common/libreoffice.nix
./packages.nix
./hyprland.nix
./waybar.nix
./rofi.nix
];
home.username = "lukas";
home.homeDirectory = "/home/lukas";
home.stateVersion = "25.05";
}

View File

@@ -1,4 +1,13 @@
{ pkgs, ... }:
{
home.pointerCursor = {
name = "Vanilla-DMZ";
package = pkgs.vanilla-dmz;
size = 24;
gtk.enable = true;
x11.enable = true;
};
wayland.windowManager.hyprland = {
enable = true;
@@ -8,19 +17,32 @@
exec-once = [
"waybar"
"dunst"
"kwalletd6"
"nm-applet"
"blueman-applet"
"swww-daemon"
"swayidle -w timeout 300 'hyprlock' timeout 360 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' before-sleep 'hyprlock'"
"swww img $HOME/Bilder/Wallpapers/mountain.jpg"
"nextcloud"
];
env = [
"HYPRCURSOR_THEME,Vanilla-DMZ"
"HYPRCURSOR_SIZE,24"
"XCURSOR_THEME,Vanilla-DMZ"
"GDK_SCALE,2"
"XCURSOR_SIZE,32"
];
#windowrulev2 = [
# do not let scenbuilder take focus
# "nofocus, title:^(.*java.*)$"
#];
monitor = [
", highres, auto, 1"
];
@@ -34,6 +56,8 @@
force_zero_scaling = true;
};
# windowrule = "stayfocused,^(com.oracle.javafx.scenebuilder.app.SceneBuilderApp)$";
bind = [
@@ -46,6 +70,8 @@
# lock screen
"$mod, L, exec, hyprlock"
"$mod, S, togglefloating"
# emacs
"$mod, e, exec, emacs"

View File

@@ -16,6 +16,15 @@
pkgs.wget
pkgs.unzip
pkgs.feather
pkgs.electrum
pkgs.firefox
pkgs.zathura
pkgs.xfce.thunar
pkgs.ranger
pkgs.nerd-fonts.fira-code
pkgs.fira-code
pkgs.meslo-lgs-nf
@@ -24,12 +33,19 @@
pkgs.bat
pkgs.ripgrep
pkgs.seahorse
pkgs.binutils
pkgs.gcc
pkgs.scenebuilder
pkgs.nil
pkgs.quickemu
pkgs.zotero
pkgs.jabref
(pkgs.aspellWithDicts
(dicts: with dicts; [ de en en-computers ]))

View File

@@ -0,0 +1,19 @@
{
imports = [
./packages.nix
../common/brave.nix
../common/direnv.nix
../common/emacs.nix
../common/git.nix
../common/shell.nix
../common/alacritty.nix
../common/tmux.nix
../common/xgd.nix
../common/libreoffice.nix
];
home.username = "lukas";
home.homeDirectory = "/home/lukas";
home.stateVersion = "25.05";
}

View File

@@ -0,0 +1,54 @@
{ pkgs, ... }:
{
fonts.fontconfig.enable = true;
home.packages = [
pkgs.thunderbird
pkgs.nextcloud-client
pkgs.keepassxc
pkgs.telegram-desktop
pkgs.element-desktop
pkgs.tidal-hifi
pkgs.tree
pkgs.htop
pkgs.neovim
pkgs.wget
pkgs.unzip
pkgs.open-webui
pkgs.librechat
pkgs.feather
pkgs.firefox
pkgs.ranger
pkgs.zathura
pkgs.nerd-fonts.fira-code
pkgs.fira-code
pkgs.meslo-lgs-nf
pkgs.eza
pkgs.bat
pkgs.ripgrep
pkgs.seahorse
pkgs.binutils
pkgs.gcc
# pkgs.scenebuilder
pkgs.nil
pkgs.zotero
pkgs.jabref
(pkgs.aspellWithDicts
(dicts: with dicts; [ de en en-computers ]))
];
}

View File

@@ -1,4 +1,5 @@
{ pkgs, ... }: {
{ pkgs, ... }:
{
imports = [
./hardware.nix
../../users/lukas.nix
@@ -10,6 +11,9 @@
../../modules/system/audio.nix
../../modules/system/printing.nix
../../modules/system/docker.nix
../../modules/system/gpg.nix
../../modules/system/virtualbox.nix
../../modules/system/mullvad.nix
];
networking.hostName = "segfault-machine";

View File

@@ -13,6 +13,9 @@
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
boot.kernelParams = [ "amd_iommu=on" ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/5af0ed50-72c4-4bee-8c6e-7b0556cffbc7";
fsType = "ext4";
@@ -41,5 +44,7 @@
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
services.hardware.bolt.enable = true;
services.fwupd.enable = true;
}

View File

@@ -0,0 +1,46 @@
# 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).
{ pkgs, ... }:
{
imports = [
./hardware.nix
../../users/lukas.nix
../../modules/desktop/gnome.nix
../../modules/input/katana.nix
../../modules/input/qmk.nix
../../modules/networking/networkmanager.nix
../../modules/networking/bluetooth.nix
../../modules/system/locale.nix
../../modules/system/nvidia.nix
../../modules/system/audio.nix
../../modules/system/printing.nix
../../modules/system/docker.nix
../../modules/system/gpg.nix
../../modules/system/virtualbox.nix
../../modules/system/mullvad.nix
../../modules/services/ollama.nix
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.initrd.luks.devices."luks-b10eb0c6-67b8-40b6-bba4-83d38267abad".device = "/dev/disk/by-uuid/b10eb0c6-67b8-40b6-bba4-83d38267abad";
boot.resumeDevice = "/dev/mapper/luks-b10eb0c6-67b8-40b6-bba4-83d38267abad";
hardware.enableAllFirmware = true;
networking.hostName = "segfault-tower";
nixpkgs.config.allowUnfree = true;
# Version festlegen
system.stateVersion = "25.05";
nix.settings.experimental-features = [ "nix-command" "flakes" ];
}

View File

@@ -0,0 +1,38 @@
# 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")
];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/70a079c3-a222-473d-ba56-2f9bc60de4b5";
fsType = "ext4";
};
boot.initrd.luks.devices."luks-947b9aa6-e5dc-4e1e-83a7-7a77a7fe84f5".device = "/dev/disk/by-uuid/947b9aa6-e5dc-4e1e-83a7-7a77a7fe84f5";
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/E034-ADEC";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
swapDevices =
[
{ device = "/dev/disk/by-uuid/9afed355-7650-43ae-9fae-1d6c1135f6ee"; }
];
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View File

@@ -1,21 +1,19 @@
{ config, pkgs, lib, ... }:
{ pkgs, ... }:
{
# --- GNOME on Wayland --------------------------------------------------
services.xserver.enable = true;
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
services.xserver = {
displayManager.gdm.enable = true;
desktopManager.gnome.enable = true;
};
# Electron/Chromium apps → Wayland
environment.sessionVariables.NIXOS_OZONE_WL = "1";
# # --- dconf service & keyboard repeat ----------------------------------
# programs.dconf.enable = true; # ← brings the `dconf` option into scope!
# To disable installing GNOME's suite of applications
# and only be left with GNOME shell.
services.gnome.core-apps.enable = true;
services.gnome.core-developer-tools.enable = false;
services.gnome.games.enable = false;
environment.gnome.excludePackages = with pkgs; [ gnome-tour gnome-user-docs ];
# dconf.settings = {
# "org/gnome/desktop/peripherals/keyboard" = {
# delay = lib.gvariant.mkUint32 200; # ms before first repeat
# repeat-interval = lib.gvariant.mkUint32 25; # ms between repeats ≈40 cps
# };
# };
environment.systemPackages = [ pkgs.gnomeExtensions.appindicator ];
services.udev.packages = [ pkgs.gnome-settings-daemon ];
}

View File

@@ -1,4 +1,3 @@
{ inputs, pkgs, ... }:
{
# Enable the uinput module
boot.kernelModules = [ "uinput" ];
@@ -28,17 +27,6 @@
enable = true;
keyboards = {
internalKeyboard = {
devices = [
# Replace the paths below with the appropriate device paths for your setup.
# Use `ls /dev/input/by-path/` to find your keyboard devices.
"/dev/input/by-path/pci-0000:66:00.0-usb-0:2.3:1.0-event-kbd"
"/dev/input/by-path/pci-0000:66:00.0-usb-0:2.4:1.0-event-kbd"
"/dev/input/by-path/pci-0000:66:00.0-usb-0:2.4:1.2-event-kbd"
"/dev/input/by-path/pci-0000:66:00.0-usbv2-0:2.3:1.0-event-kbd"
"/dev/input/by-path/pci-0000:66:00.0-usbv2-0:2.4:1.0-event-kbd"
"/dev/input/by-path/pci-0000:66:00.0-usbv2-0:2.4:1.2-event-kbd"
"/dev/input/by-path/platform-i8042-serio-0-event-kbd"
];
extraDefCfg = "process-unmapped-keys yes";
config = ''
(defsrc

6
modules/input/qmk.nix Normal file
View File

@@ -0,0 +1,6 @@
{ pkgs, ... }:
{
hardware.keyboard.qmk.enable = true;
environment.systemPackages = with pkgs; [ via qmk ];
services.udev.packages = [ pkgs.via ];
}

View File

@@ -0,0 +1,45 @@
{config, pkgs-unstable, ... }:
{
services.ollama = {
enable = true;
package = pkgs-unstable.ollama;
acceleration = "cuda";
environmentVariables = {
OLLAMA_CONTEXT_LENGTH="32000";
};
};
systemd.services.ollama.serviceConfig = {
Environment = [ "OLLAMA_HOST=0.0.0.0:11434" ];
};
services.open-webui = {
package = pkgs-unstable.open-webui;
enable = true;
port = 8081;
environment = {
ANONYMIZED_TELEMETRY = "False";
DO_NOT_TRACK = "True";
SCARF_NO_ANALYTICS = "True";
OLLAMA_API_BASE_URL = "http://127.0.0.1:11434/api";
OLLAMA_BASE_URL = "http://127.0.0.1:11434";
WEBUI_AUTH = "False";
FRONTEND_BUILD_DIR = "${config.services.open-webui.stateDir}/build";
DATA_DIR = "${config.services.open-webui.stateDir}/data";
STATIC_DIR = "${config.services.open-webui.stateDir}/static";
};
};
services.searx = {
enable = true;
redisCreateLocally = true;
settings.server = {
bind_address = "::1";
port = 1111;
secret_key = "my ultra secret key";
};
settings.search.formats = ["html" "json"];
};
}

View File

@@ -1,3 +1,4 @@
{
virtualisation.docker.enable = true;
virtualisation.oci-containers.backend = "docker";
}

10
modules/system/gpg.nix Normal file
View File

@@ -0,0 +1,10 @@
{pkgs, ...}:
{
services.pcscd.enable = true;
programs.gnupg.agent = {
enable = true;
pinentryPackage = pkgs.pinentry-curses;
enableSSHSupport = true;
};
}

View File

@@ -1,6 +1,13 @@
{ config, pkgs, ... }:
{
{
console = {
earlySetup = true;
useXkbConfig = true;
};
services.xserver.xkb.layout = "de";
time.timeZone = "Europe/Berlin";
i18n.defaultLocale = "de_DE.UTF-8";
i18n.extraLocaleSettings = {

View File

@@ -0,0 +1,5 @@
{ pkgs, ... }:
{
services.mullvad-vpn.package = pkgs.mullvad-vpn;
services.mullvad-vpn.enable = true;
}

31
modules/system/nvidia.nix Normal file
View File

@@ -0,0 +1,31 @@
{config, pkgs, ...}:
{
nixpkgs.config.allowUnfree = true;
services.xserver.videoDrivers = ["nvidia"];
hardware.graphics = {
enable = true;
enable32Bit = true;
};
hardware.nvidia = {
modesetting.enable = true;
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
# Enable this if you have graphical corruption issues or application crashes after waking
# up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead
# of just the bare essentials.
powerManagement.enable = true;
# Fine-grained power management. Turns off GPU when not in use.
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
# (requires offloading)
powerManagement.finegrained = false;
open = false;
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
}

View File

@@ -0,0 +1,37 @@
{ config, pkgs, ... }: let
hibernateEnvironment = {
HIBERNATE_SECONDS = "3600";
HIBERNATE_LOCK = "/var/run/autohibernate.lock";
};
in {
systemd.services."awake-after-suspend-for-a-time" = {
description = "Sets up the suspend so that it'll wake for hibernation";
wantedBy = [ "suspend.target" ];
before = [ "systemd-suspend.service" ];
environment = hibernateEnvironment;
script = ''
curtime=$(date +%s)
echo "$curtime $1" >> /tmp/autohibernate.log
echo "$curtime" > $HIBERNATE_LOCK
${pkgs.util-linux}/bin/rtcwake -m no -s $HIBERNATE_SECONDS
'';
serviceConfig.Type = "simple";
};
systemd.services."hibernate-after-recovery" = {
description = "Hibernates after a suspend recovery due to timeout";
wantedBy = [ "suspend.target" ];
after = [ "systemd-suspend.service" ];
environment = hibernateEnvironment;
script = ''
curtime=$(date +%s)
sustime=$(cat $HIBERNATE_LOCK)
rm $HIBERNATE_LOCK
if [ $(($curtime - $sustime)) -ge $HIBERNATE_SECONDS ] ; then
systemctl hibernate
else
${pkgs.util-linux}/bin/rtcwake -m no -s 1
fi
'';
serviceConfig.Type = "simple";
};
}

View File

@@ -0,0 +1,14 @@
{
nixpkgs.config.allowUnfree = true;
virtualisation.virtualbox.host = {
enable = true;
enableKvm = true;
enableHardening = false;
addNetworkInterface = false;
};
users.extraGroups.vboxusers.members = [ "lukas" ];
virtualisation.virtualbox.host.enableExtensionPack = true;
}