dustbowl: make swayidle a systemd service + run nixpkgs-fmt

This commit is contained in:
joachimschmidt557 2022-07-17 14:07:16 +02:00
parent 989e4f9555
commit 9757bf7ff6
No known key found for this signature in database
GPG key ID: E0B575BE2884ACC5
9 changed files with 41 additions and 31 deletions

View file

@ -34,10 +34,12 @@
nixosConfigurations = { nixosConfigurations = {
dustbowl = nixpkgs.lib.nixosSystem { dustbowl = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ (import ./nixos/dustbowl.nix { modules = [
(import ./nixos/dustbowl.nix {
emacs-overlay = emacs-overlay; emacs-overlay = emacs-overlay;
nixpkgs = nixpkgs; nixpkgs = nixpkgs;
}) ]; })
];
}; };
}; };

View file

@ -1,4 +1,3 @@
# WARN: this file will get overwritten by $ cachix use <name> # WARN: this file will get overwritten by $ cachix use <name>
{ pkgs, lib, ... }: { pkgs, lib, ... }:
@ -7,7 +6,8 @@ let
toImport = name: value: folder + ("/" + name); toImport = name: value: folder + ("/" + name);
filterCaches = key: value: value == "regular" && lib.hasSuffix ".nix" key; filterCaches = key: value: value == "regular" && lib.hasSuffix ".nix" key;
imports = lib.mapAttrsToList toImport (lib.filterAttrs filterCaches (builtins.readDir folder)); imports = lib.mapAttrsToList toImport (lib.filterAttrs filterCaches (builtins.readDir folder));
in { in
{
inherit imports; inherit imports;
nix.settings.trusted-substituters = [ "https://cache.nixos.org/" ]; nix.settings.trusted-substituters = [ "https://cache.nixos.org/" ];
} }

View file

@ -1,4 +1,3 @@
{ {
nix.settings = { nix.settings = {
trusted-substituters = [ trusted-substituters = [

View file

@ -1,4 +1,3 @@
{ {
nix.settings = { nix.settings = {
trusted-substituters = [ trusted-substituters = [

View file

@ -1,4 +1,3 @@
{ {
nix.settings = { nix.settings = {
trusted-substituters = [ trusted-substituters = [

View file

@ -1,4 +1,3 @@
{ {
nix.settings = { nix.settings = {
trusted-substituters = [ trusted-substituters = [

View file

@ -1,4 +1,3 @@
{ {
nix.settings = { nix.settings = {
trusted-substituters = [ trusted-substituters = [

View file

@ -7,7 +7,8 @@
{ {
imports = imports =
[ # Include the results of the hardware scan. [
# Include the results of the hardware scan.
/etc/nixos/hardware-configuration.nix /etc/nixos/hardware-configuration.nix
/etc/nixos/private.nix /etc/nixos/private.nix
./cachix.nix ./cachix.nix
@ -47,6 +48,12 @@
}; };
}; };
# Enable systemd watchdog
systemd.watchdog = {
runtimeTime = "30s";
rebootTime = "10m";
};
boot.extraModulePackages = [ boot.extraModulePackages = [
config.boot.kernelPackages.v4l2loopback.out config.boot.kernelPackages.v4l2loopback.out
]; ];
@ -257,6 +264,24 @@
}; };
}; };
systemd.user.services.swayidle = {
description = "swayidle idle manager for Wayland";
wantedBy = [ "graphical-session.target" ];
partOf = [ "graphical-session.target" ];
path = with pkgs; [ bash sway swaylock ];
serviceConfig = {
ExecStart = ''
${pkgs.swayidle}/bin/swayidle -w \
timeout 300 'swaylock -f -c 000000' \
timeout 600 'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on"' \
before-sleep 'swaylock -f -c 000000'
'';
RestartSec = 3;
Restart = "always";
};
};
# Enable sound. # Enable sound.
sound.enable = true; sound.enable = true;
@ -319,7 +344,9 @@
# Fonts # Fonts
fonts.fonts = with pkgs; [ fonts.fonts = with pkgs; [
fira-code fira-code
noto-fonts noto-fonts-emoji noto-fonts-extra noto-fonts
noto-fonts-emoji
noto-fonts-extra
]; ];
fonts.fontconfig = { fonts.fontconfig = {
enable = true; enable = true;

View file

@ -22,20 +22,6 @@ set $term env XCURSOR_THEME=Adwaita footclient
# on the original workspace that the command was run on. # on the original workspace that the command was run on.
# set $menu dmenu_path | dmenu | xargs swaymsg exec -- # set $menu dmenu_path | dmenu | xargs swaymsg exec --
### Idle configuration
#
# Example configuration:
#
exec swayidle -w \
timeout 300 'swaylock -f -c 000000' \
timeout 600 'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on"' \
before-sleep 'swaylock -f -c 000000'
# This will lock your screen after 300 seconds of inactivity, then turn off
# your displays after another 300 seconds, and turn your screens back on when
# resumed. It will also lock your screen before your computer goes to sleep.
### Start foot server ### Start foot server
exec foot --server exec foot --server