b12f restructure #1
|
@ -17,24 +17,26 @@ with lib;
|
|||
};
|
||||
|
||||
config = {
|
||||
# Enable plymouth for better experience of booting
|
||||
boot.plymouth.enable = true;
|
||||
boot = {
|
||||
# Enable plymouth for better experience of booting
|
||||
plymouth.enable = true;
|
||||
|
||||
# Mount / luks device in initrd
|
||||
# Allow fstrim to work on it.
|
||||
# The ! makes this enabled by default
|
||||
boot.initrd = mkIf (!cfg.iso-options.enable && cfg.disk-encryption-active) {
|
||||
luks.devices."cryptroot" = {
|
||||
allowDiscards = true;
|
||||
# Mount / luks device in initrd
|
||||
# Allow fstrim to work on it.
|
||||
# The ! makes this enabled by default
|
||||
initrd = mkIf (!cfg.iso-options.enable && cfg.disk-encryption-active) {
|
||||
luks.devices."cryptroot" = {
|
||||
allowDiscards = true;
|
||||
};
|
||||
};
|
||||
|
||||
loader.systemd-boot.enable = true;
|
||||
|
||||
# Use latest LTS linux kernel by default
|
||||
kernelPackages = pkgs.linuxPackages_5_15;
|
||||
|
||||
# Support ntfs drives
|
||||
supportedFilesystems = [ "ntfs" ];
|
||||
};
|
||||
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
|
||||
# Use latest LTS linux kernel by default
|
||||
boot.kernelPackages = pkgs.linuxPackages_5_15;
|
||||
|
||||
# Support ntfs drives
|
||||
boot.supportedFilesystems = [ "ntfs" ];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ in
|
|||
{
|
||||
imports = [
|
||||
./boot.nix
|
||||
./hibernation.nix
|
||||
./fonts.nix
|
||||
./i18n.nix
|
||||
./networking.nix
|
||||
|
|
38
modules/core/hibernation.nix
Normal file
38
modules/core/hibernation.nix
Normal file
|
@ -0,0 +1,38 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.pub-solar.core.hibernation;
|
||||
in
|
||||
{
|
||||
options.pub-solar.core.hibernation = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Whether the device can hibernate. This creates a swapfile at /swapfile.";
|
||||
};
|
||||
|
||||
resumeDevice = mkOption {
|
||||
type = types.str;
|
||||
default = "/swapfile";
|
||||
description = "The location of the hibernation resume swap file.";
|
||||
};
|
||||
|
||||
resumeOffset = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = null;
|
||||
description = "The swap file offset. Can be found by running `filefrag -v $swap_file_location`. See https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate#Hibernation_into_swap_file";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
boot = mkIf cfg.enable {
|
||||
resumeDevice = cfg.resumeDevice;
|
||||
kernelParams = [
|
||||
"resume=${cfg.resumeDevice}"
|
||||
] ++ (
|
||||
if (cfg.resumeOffset == null && cfg.enable) then builtins.abort "config.pub-solar.resumeOffset has to be set if config.pub-solar.enable is true."
|
||||
else [ "resume_offset=${cfg.resumeOffset}" ]
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
24
modules/paranoia/default.nix
Normal file
24
modules/paranoia/default.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
psCfg = config.pub-solar;
|
||||
cfg = config.pub-solar.paranoia;
|
||||
in
|
||||
{
|
||||
options.pub-solar.paranoia = {
|
||||
enable = mkOption {
|
||||
description = ''
|
||||
Only offer hibernation instead of screen locking and sleeping. This only makes sense
|
||||
if your hard drive is encrypted, and ensures that the contents of your drive are
|
||||
encrypted if you are not actively using the device.
|
||||
'';
|
||||
default = false;
|
||||
type = types.bool;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
pub-solar.core.hibernation.enable = true;
|
||||
};
|
||||
}
|
|
@ -37,22 +37,6 @@ bindsym $mod+Ctrl+r exec record-screen
|
|||
set $menu exec alacritty --class launcher -e env TERMINAL_COMMAND="alacritty -e" sway-launcher
|
||||
bindsym $mod+Space exec $menu
|
||||
|
||||
# Set shut down, restart and locking features
|
||||
set $mode_system (l)ock, (e)xit, (s)uspend, (h)ibernate, (r)eboot, (Shift+s)hutdown
|
||||
bindsym $mod+0 mode "$mode_system"
|
||||
mode "$mode_system" {
|
||||
bindsym l exec swaylock-bg, mode "default"
|
||||
bindsym e exec systemctl --user stop graphical-session.target, mode "default"
|
||||
bindsym s exec systemctl suspend, mode "default"
|
||||
bindsym h exec systemctl hibernate, mode "default"
|
||||
bindsym r exec systemctl reboot, mode "default"
|
||||
bindsym Shift+s exec systemctl poweroff, mode "default"
|
||||
|
||||
# exit system mode: "Enter" or "Escape"
|
||||
bindsym Return mode "default"
|
||||
bindsym Escape mode "default"
|
||||
}
|
||||
|
||||
set $mode_vncclient In VNCClient mode. Press $mod+Num_Lock or $mod+Shift+Escape to return.
|
||||
bindsym $mod+Num_Lock mode "$mode_vncclient"
|
||||
bindsym $mod+Shift+Escape mode "$mode_vncclient"
|
||||
|
|
21
modules/sway/config/config.d/mode_system.conf.nix
Normal file
21
modules/sway/config/config.d/mode_system.conf.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{ psCfg, ... }: ''
|
||||
# Set shut down, restart and locking features
|
||||
set $mode_system (e)xit, (h)ibernate, (r)eboot, (Shift+s)hutdown
|
||||
bindsym $mod+0 mode "$mode_system"
|
||||
mode "$mode_system" {
|
||||
bindsym e exec swaymsg exit, mode "default"
|
||||
'' + (if !psCfg.core.hibernation.enable then ''
|
||||
bindsym h exec systemctl hibernate, mode "default"
|
||||
'' else "")
|
||||
+ (if !psCfg.paranoia.enable then ''
|
||||
bindsym l exec swaylock-bg, mode "default"
|
||||
bindsym s exec systemctl suspend, mode "default"
|
||||
'' else "") + ''
|
||||
bindsym r exec systemctl reboot, mode "default"
|
||||
bindsym Shift+s exec systemctl poweroff, mode "default"
|
||||
|
||||
# exit system mode: "Enter" or "Escape"
|
||||
bindsym Return mode "default"
|
||||
bindsym Escape mode "default"
|
||||
}
|
||||
''
|
|
@ -2,7 +2,6 @@
|
|||
with lib;
|
||||
let
|
||||
psCfg = config.pub-solar;
|
||||
cfg = config.pub-solar.sway;
|
||||
in
|
||||
{
|
||||
options.pub-solar.sway = {
|
||||
|
@ -23,8 +22,8 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf (cfg.v4l2loopback.enable) {
|
||||
config = mkIf psCfg.sway.enable (mkMerge [
|
||||
(mkIf (psCfg.sway.v4l2loopback.enable) {
|
||||
boot.extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback ];
|
||||
boot.kernelModules = [ "v4l2loopback" ];
|
||||
boot.extraModprobeConfig = ''
|
||||
|
@ -79,7 +78,6 @@ in
|
|||
xsettingsd
|
||||
ydotool
|
||||
|
||||
swaylock-bg
|
||||
sway-launcher
|
||||
record-screen
|
||||
import-gtk-settings
|
||||
|
@ -90,12 +88,12 @@ in
|
|||
programs.waybar.enable = true;
|
||||
#programs.waybar.systemd.enable = true;
|
||||
|
||||
systemd.user.services.mako = import ./mako.service.nix pkgs;
|
||||
systemd.user.services.sway = import ./sway.service.nix pkgs;
|
||||
systemd.user.services.swayidle = import ./swayidle.service.nix pkgs;
|
||||
systemd.user.services.xsettingsd = import ./xsettingsd.service.nix pkgs;
|
||||
systemd.user.services.waybar = import ./waybar.service.nix pkgs;
|
||||
systemd.user.targets.sway-session = import ./sway-session.target.nix pkgs;
|
||||
systemd.user.services.mako = import ./mako.service.nix { inherit pkgs psCfg; };
|
||||
systemd.user.services.sway = import ./sway.service.nix { inherit pkgs psCfg; };
|
||||
systemd.user.services.swayidle = import ./swayidle.service.nix { inherit pkgs psCfg; };
|
||||
systemd.user.services.xsettingsd = import ./xsettingsd.service.nix { inherit pkgs psCfg; };
|
||||
systemd.user.services.waybar = import ./waybar.service.nix { inherit pkgs psCfg; };
|
||||
systemd.user.targets.sway-session = import ./sway-session.target.nix { inherit pkgs psCfg; };
|
||||
|
||||
systemd.user.services.wayvnc = mkIf cfg.vnc.enable (import ./wayvnc.service.nix pkgs);
|
||||
|
||||
|
@ -104,6 +102,7 @@ in
|
|||
xdg.configFile."sway/config.d/theme.conf".source = ./config/config.d/theme.conf;
|
||||
xdg.configFile."sway/config.d/gaps.conf".source = ./config/config.d/gaps.conf;
|
||||
xdg.configFile."sway/config.d/custom-keybindings.conf".source = ./config/config.d/custom-keybindings.conf;
|
||||
xdg.configFile."sway/config.d/mode_system.conf".text = import ./config/config.d/mode_system.conf.nix { inherit psCfg; };
|
||||
xdg.configFile."sway/config.d/applications.conf".source = ./config/config.d/applications.conf;
|
||||
xdg.configFile."sway/config.d/systemd.conf".source = ./config/config.d/systemd.conf;
|
||||
xdg.configFile."wayvnc/config".text = import ./config/wayvnc/config.nix { inherit psCfg; inherit pkgs; };
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pkgs:
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
Unit = {
|
||||
Description = "set color temperature of display according to time of day";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pkgs:
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
Unit = {
|
||||
Description = "Actions gestures on your touchpad using libinput";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pkgs:
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
Unit = {
|
||||
Description = "Lightweight Wayland notification daemon";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pkgs:
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
Unit = {
|
||||
Description = "sway compositor session";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pkgs:
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
Unit = {
|
||||
Description = "sway - SirCmpwn's Wayland window manager";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pkgs:
|
||||
{ pkgs, psCfg, ... }:
|
||||
{
|
||||
Unit = {
|
||||
Description = "Idle manager for Wayland";
|
||||
|
@ -9,13 +9,19 @@ pkgs:
|
|||
};
|
||||
Service = {
|
||||
Type = "simple";
|
||||
Environment = "PATH=/run/current-system/sw/bin:${pkgs.sway}/bin:${pkgs.swaylock}/bin:${pkgs.swaylock-bg}/bin";
|
||||
ExecStart = ''${pkgs.swayidle}/bin/swayidle -w \
|
||||
timeout 600 'swaylock-bg' \
|
||||
timeout 900 'swaymsg "output * dpms off"' \
|
||||
resume 'swaymsg "output * dpms on"' \
|
||||
before-sleep 'swaylock-bg'
|
||||
'';
|
||||
Environment = "PATH=/run/current-system/sw/bin:${pkgs.sway}/bin";
|
||||
ExecStart =
|
||||
if psCfg.paranoia.enable then ''
|
||||
${pkgs.swayidle}/bin/swayidle -w \
|
||||
timeout 120 'swaymsg "output * dpms off"' \
|
||||
timeout 150 'systemctl hibernate' \
|
||||
'' else ''
|
||||
${pkgs.swayidle}/bin/swayidle -w \
|
||||
timeout 600 'swaylock-bg' \
|
||||
timeout 900 'swaymsg "output * dpms off"' \
|
||||
resume 'swaymsg "output * dpms on"' \
|
||||
before-sleep 'swaylock-bg'
|
||||
'';
|
||||
};
|
||||
Install = {
|
||||
WantedBy = [ "sway-session.target" ];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pkgs:
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
Unit = {
|
||||
Description = "Highly customizable Wayland bar for Sway and Wlroots based compositors.";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pkgs:
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
Unit = {
|
||||
Description = "X Settings Daemon";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pkgs:
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
Unit = {
|
||||
Description = "ydotool - Generic command-line automation tool (no X!)";
|
||||
|
|
|
@ -13,7 +13,7 @@ with final; {
|
|||
s = writeShellScriptBin "s" (import ./s.nix final);
|
||||
sway-launcher = writeScriptBin "sway-launcher" (import ./sway-launcher.nix final);
|
||||
sway-service = writeShellScriptBin "sway-service" (import ./sway-service.nix final);
|
||||
swaylock-bg = writeScriptBin "swaylock-bg" (import ./swaylock-bg.nix final);
|
||||
swaylock-bg = writeShellScriptBin "swaylock-bg" (import ./swaylock-bg.nix final);
|
||||
toggle-kbd-layout = writeShellScriptBin "toggle-kbd-layout" (import ./toggle-kbd-layout.nix final);
|
||||
uhk-agent = import ./uhk-agent.nix final;
|
||||
wcwd = writeShellScriptBin "wcwd" (import ./wcwd.nix final);
|
||||
|
|
Loading…
Reference in a new issue