Compare commits
42 Commits
4b519ab7e1
...
b655dafce9
Author | SHA1 | Date | |
---|---|---|---|
b655dafce9 | |||
fac8cb3be4 | |||
386d86872c | |||
f050c4ee4a | |||
f8b27b2473 | |||
0ae81ca5f3 | |||
07a32014cf | |||
13bdcf8399 | |||
015881d858 | |||
523827f429 | |||
7a1bb2fc01 | |||
cca986ee40 | |||
78e8b63367 | |||
4e461f0e91 | |||
20aae22e52 | |||
5ce1c1df4c | |||
b8b68d25e4 | |||
9f41d33fb4 | |||
c640a0abb0 | |||
3a2cfc6ccc | |||
a77fe9a357 | |||
c70ec06aab | |||
2d6fb7092d | |||
628f2208fd | |||
79f2f1b643 | |||
3f0fae6f3d | |||
a4f5cbe681 | |||
62e3a62969 | |||
a11ad83220 | |||
486e514aac | |||
367265e506 | |||
2444924e09 | |||
a704bce591 | |||
b8f0c0a843 | |||
0253ad9a9a | |||
7cfea52860 | |||
ccf0f37da2 | |||
e0b5446e95 | |||
0f7e4e7b00 | |||
08898ebfd7 | |||
4fb4790eaa | |||
e61c22b365 |
@ -21,7 +21,7 @@
|
||||
nixosConfigurations."MaxNixosLaptop" = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = {inherit inputs;};
|
||||
modules = [
|
||||
./configuration.nix
|
||||
./hosts/MaxNixosLaptop/configuration.nix
|
||||
inputs.home-manager.nixosModules.default
|
||||
];
|
||||
};
|
||||
|
@ -10,7 +10,8 @@
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
./suspend-and-hibernate.nix
|
||||
# sway as window manager
|
||||
../../modules/nixos/sway.nix
|
||||
inputs.home-manager.nixosModules.default
|
||||
];
|
||||
|
||||
@ -49,18 +50,6 @@
|
||||
LC_TIME = "de_DE.UTF-8";
|
||||
};
|
||||
|
||||
# Enable the X11 windowing system.
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
displayManager.gdm = {
|
||||
enable = true;
|
||||
wayland = true;
|
||||
};
|
||||
desktopManager.gnome.enable = true;
|
||||
layout = "de";
|
||||
xkbVariant = "";
|
||||
};
|
||||
|
||||
# Configure console keymap
|
||||
console.keyMap = "de";
|
||||
|
||||
@ -77,7 +66,7 @@
|
||||
alsa.support32Bit = true;
|
||||
pulse.enable = true;
|
||||
# If you want to use JACK applications, uncomment this
|
||||
#jack.enable = true;
|
||||
jack.enable = true;
|
||||
|
||||
# use the example session manager (no others are packaged yet so this is enabled by default,
|
||||
# no need to redefine it in your config for now)
|
||||
@ -127,6 +116,10 @@
|
||||
ffmpeg
|
||||
];
|
||||
|
||||
fonts.fonts = with pkgs; [
|
||||
nerdfonts
|
||||
];
|
||||
|
||||
# Some programs need SUID wrappers, can be configured further or are
|
||||
# started in user sessions.
|
||||
# programs.mtr.enable = true;
|
||||
@ -134,17 +127,50 @@
|
||||
# enable = true;
|
||||
# enableSSHSupport = true;
|
||||
# };
|
||||
programs.ssh.startAgent = true;
|
||||
programs.nix-ld.enable = true;
|
||||
programs.nix-ld.libraries = with pkgs; [];
|
||||
programs.nix-ld.libraries = with pkgs; [
|
||||
glfw
|
||||
wayland-protocols
|
||||
libxkbcommon
|
||||
xorg.libX11
|
||||
xorg.libXinerama
|
||||
xorg.libXcursor
|
||||
xorg.libXrandr
|
||||
xorg.libXi
|
||||
xorg.libXext
|
||||
libGL
|
||||
libGLU
|
||||
];
|
||||
|
||||
programs.zsh.enable = true;
|
||||
programs.steam.enable = true;
|
||||
|
||||
security.polkit.enable = true;
|
||||
environment.sessionVariables.NIXOS_OZONE_WL = "1";
|
||||
|
||||
virtualisation = {
|
||||
podman = {
|
||||
enable = true;
|
||||
defaultNetwork.settings.dns_enabled = true;
|
||||
};
|
||||
};
|
||||
|
||||
# List services that you want to enable:
|
||||
|
||||
# fingerprint unlock
|
||||
services.fprintd.enable = true;
|
||||
|
||||
services.greetd = {
|
||||
enable = true;
|
||||
settings = rec {
|
||||
default_session = {
|
||||
command = "${pkgs.sway}/bin/sway";
|
||||
user = "max";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Enable the OpenSSH daemon.
|
||||
# services.openssh.enable = true;
|
||||
|
@ -1,8 +1,14 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
# sway as windowmanager
|
||||
../../modules/home-manager/sway.nix
|
||||
];
|
||||
|
||||
# Home Manager needs a bit of information about you and the paths it should
|
||||
# manage.
|
||||
home.username = "max";
|
||||
@ -25,14 +31,12 @@
|
||||
zsh
|
||||
starship
|
||||
zoxide
|
||||
nerdfonts
|
||||
lazygit
|
||||
btop
|
||||
bat
|
||||
eza
|
||||
unzip
|
||||
rustup
|
||||
keepassxc
|
||||
nextcloud-client
|
||||
firefox
|
||||
thunderbird
|
||||
@ -51,6 +55,8 @@
|
||||
betaflight-configurator
|
||||
loudgain
|
||||
youtube-dl
|
||||
dconf
|
||||
distrobox
|
||||
];
|
||||
|
||||
# Home Manager is pretty good at managing dotfiles. The primary way to manage
|
211
modules/home-manager/sway.nix
Normal file
211
modules/home-manager/sway.nix
Normal file
@ -0,0 +1,211 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
home.packages = with pkgs; [
|
||||
sway
|
||||
waybar # status bar
|
||||
swaylock # screen locking
|
||||
swayidle # automatic screen locking after system idle time
|
||||
kanshi # hotswap displays
|
||||
foot # terminal
|
||||
keepassxc # used for secrets instead of gnome-keyring
|
||||
];
|
||||
|
||||
wayland.windowManager.sway = {
|
||||
enable = true;
|
||||
systemd = {
|
||||
enable = true;
|
||||
xdgAutostart = true;
|
||||
};
|
||||
|
||||
wrapperFeatures = {
|
||||
gtk = true;
|
||||
};
|
||||
|
||||
config = {
|
||||
input = {
|
||||
"*" = {
|
||||
xkb_layout = "de";
|
||||
xkb_options = "caps:ctrl_modifier";
|
||||
xkb_numlock = "enable";
|
||||
};
|
||||
"type:touchpad" = {
|
||||
tap = "enable";
|
||||
natural_scroll = "enable";
|
||||
};
|
||||
};
|
||||
modifier = "Mod4";
|
||||
keybindings = let
|
||||
modifier = config.wayland.windowManager.sway.config.modifier;
|
||||
in
|
||||
lib.mkOptionDefault {
|
||||
# brightness
|
||||
"XF86MonBrightnessDown" = "exec ${pkgs.light}/bin/light -U 5";
|
||||
"XF86MonBrightnessUp" = "exec ${pkgs.light}/bin/light -A 5";
|
||||
# volume
|
||||
"XF86AudioRaiseVolume" = "exec '${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +1%'";
|
||||
"XF86AudioLowerVolume" = "exec '${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -1%'";
|
||||
"XF86AudioMute" = "exec '${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle'";
|
||||
|
||||
# custom pause mode similar to typical system shutdown menus
|
||||
"${modifier}+F12" = "mode pause-break";
|
||||
};
|
||||
# use foot as default terminal
|
||||
terminal = "foot";
|
||||
assigns = {
|
||||
"1" = [{app_id = "firefox";}];
|
||||
"2" = [{app_id = "foot";}];
|
||||
};
|
||||
bars = [];
|
||||
menu = "${pkgs.tofi}/bin/tofi-drun | ${pkgs.findutils}/bin/xargs swaymsg exec --";
|
||||
fonts = {
|
||||
names = ["FiraCode Nerd Font"];
|
||||
size = 11.0;
|
||||
};
|
||||
modes = {
|
||||
pause-break = {
|
||||
e = "exec --no-startup-id swaymsg exit, mode default";
|
||||
s = "exec --no-startup-id ${pkgs.dash}/bin/dash -c '${pkgs.swaylock}/bin/swaylock & systemctl suspend-then-hibernate', mode default";
|
||||
r = "exec --no-startup-id systemctl reboot";
|
||||
End = "exec --no-startup-id systemctl poweroff";
|
||||
Return = "mode default";
|
||||
Escape = "mode default";
|
||||
};
|
||||
};
|
||||
startup = [
|
||||
{command = "${pkgs.keepassxc}/bin/keepassxc";}
|
||||
{command = "${pkgs.waybar}/bin/waybar";}
|
||||
{command = "${pkgs.foot}/bin/foot";}
|
||||
{command = "${pkgs.firefox}/bin/firefox";}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
programs.waybar = {
|
||||
enable = true;
|
||||
settings = {
|
||||
mainBar = {
|
||||
layer = "top";
|
||||
position = "top";
|
||||
height = 26;
|
||||
modules-left = ["sway/workspaces" "sway/mode"];
|
||||
modules-right = ["sway/language" "clock" "battery"];
|
||||
|
||||
"sway/language" = {
|
||||
format = "{shortDescription}";
|
||||
tooltip = false;
|
||||
};
|
||||
|
||||
"clock" = {
|
||||
interval = 60;
|
||||
format = "{:%a %d.%m %I:%M}";
|
||||
};
|
||||
};
|
||||
};
|
||||
style = ''
|
||||
* {
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
window#waybar {
|
||||
background: #292828;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
#workspaces button {
|
||||
margin-right: 10px;
|
||||
color: #ffffff;
|
||||
}
|
||||
#workspaces button:hover, #workspaces button:active {
|
||||
background-color: #292828;
|
||||
color: #ffffff;
|
||||
}
|
||||
#workspaces button.focused {
|
||||
background-color: #383737;
|
||||
}
|
||||
|
||||
#language {
|
||||
margin-right: 7px;
|
||||
}
|
||||
|
||||
#battery {
|
||||
margin-left: 7px;
|
||||
margin-right: 3px;
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
services.kanshi = {
|
||||
enable = true;
|
||||
profiles = {
|
||||
laptop.outputs = [
|
||||
{
|
||||
criteria = "eDP-1";
|
||||
position = "0,0";
|
||||
}
|
||||
];
|
||||
dock_luhbots.outputs = [
|
||||
{
|
||||
criteria = "eDP-1";
|
||||
position = "0,1080";
|
||||
}
|
||||
{
|
||||
criteria = "Dell Inc. DELL U2422HE GRCPH83";
|
||||
position = "0,0";
|
||||
}
|
||||
{
|
||||
criteria = "NEC Corporation E243WMi 7X313185NB";
|
||||
transform = "90";
|
||||
position = "1920,0";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# Theming
|
||||
gtk = {
|
||||
enable = true;
|
||||
cursorTheme = {
|
||||
package = pkgs.capitaine-cursors;
|
||||
name = "capitaine-cursors-white";
|
||||
size = 24;
|
||||
};
|
||||
iconTheme = {
|
||||
package = pkgs.whitesur-icon-theme;
|
||||
name = "WhiteSur-dark";
|
||||
};
|
||||
theme = {
|
||||
package = pkgs.whitesur-gtk-theme;
|
||||
name = "WhiteSur-Dark";
|
||||
};
|
||||
gtk3.extraConfig = {
|
||||
gtk-dialogs-use-header = false;
|
||||
gtk-cursor-theme-size = 0;
|
||||
gtk-toolbar-style = "GTK_TOOLBAR_BOTH_HORIZ";
|
||||
gtk-toolbar-icon-style = "GTK_ICON_SIZE_LARGE_TOOLBAR";
|
||||
gtk-button-images = 0;
|
||||
gtk-menu-images = 0;
|
||||
gtk-enable-event-sounds = 0;
|
||||
gtk-enable-input-feedback-sounds = 1;
|
||||
gtk-xft-antialias = 1;
|
||||
gtk-xft-hinting = 1;
|
||||
gtk-xft-hintstyle = "hintslight";
|
||||
gtk-xft-rgba = "none";
|
||||
};
|
||||
};
|
||||
home.pointerCursor = {
|
||||
package = pkgs.capitaine-cursors;
|
||||
name = "capitaine-cursors-white";
|
||||
size = 24;
|
||||
x11.enable = true;
|
||||
x11.defaultCursor = "capitaine-cursors-white";
|
||||
};
|
||||
xsession.enable = true;
|
||||
}
|
85
modules/nixos/sway.nix
Normal file
85
modules/nixos/sway.nix
Normal file
@ -0,0 +1,85 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
# bash script to let dbus know about impotant env variables and
|
||||
# propagate them to relevent services run at the end of sway config
|
||||
dbus-sway-environment = pkgs.writeTextFile {
|
||||
name = "dubs-sway-environment";
|
||||
destination = "/bin/dbus-sway-environment";
|
||||
executable = true;
|
||||
text = ''
|
||||
dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway
|
||||
systemctl --user stop pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
|
||||
systemctl --user start pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
|
||||
'';
|
||||
};
|
||||
|
||||
# currently, there is some friction between sway and gtk:
|
||||
# https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland
|
||||
configure-gtk = pkgs.writeTextFile {
|
||||
name = "configure-gtk";
|
||||
destination = "/bin/configure-gtk";
|
||||
executable = true;
|
||||
text = let
|
||||
schema = pkgs.gsettings-desktop-schemas;
|
||||
datadir = "${schema}/share/gsettings-schemas/${schema.name}";
|
||||
in ''
|
||||
gnome_schema=org.gnome.desktop.interface
|
||||
gsettings set $gnome_schema gtk-theme 'Dracula'
|
||||
'';
|
||||
};
|
||||
in {
|
||||
environment.systemPackages = with pkgs; [
|
||||
dbus # make dbus-update-activation-environment available in the path
|
||||
dbus-sway-environment
|
||||
configure-gtk
|
||||
wayland
|
||||
xdg-utils # for opening default programs when clicking links
|
||||
glib # gsettings
|
||||
dracula-theme # gtk theme
|
||||
gnome3.adwaita-icon-theme # default gnome cursors
|
||||
swaylock
|
||||
swayidle
|
||||
grim # screenshot functionality
|
||||
slurp # screenshot functionality
|
||||
wl-clipboard # wl-copy and wl-paste for copy/paste from stdin/stdout
|
||||
mako # notification system developed by swaywm maintainer
|
||||
wdisplays # tool to configure displays
|
||||
];
|
||||
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
alsa.enable = true;
|
||||
pulse.enable = true;
|
||||
jack.enable = true;
|
||||
};
|
||||
|
||||
# xdg-desktop-portal works by exposing a series of D-Bus interfaces
|
||||
# known as portals under a well-known name
|
||||
# (org.freedesktop.portal.Desktop) and object path
|
||||
# (/org/freedesktop/portal/desktop).
|
||||
# The portal interfaces include APIs for file access, opening URIs,
|
||||
# printing and others.
|
||||
services.dbus.enable = true;
|
||||
xdg.portal = {
|
||||
enable = true;
|
||||
wlr.enable = true;
|
||||
# gtk portal needed to make gtk apps happy
|
||||
extraPortals = [pkgs.xdg-desktop-portal-gtk];
|
||||
};
|
||||
|
||||
programs.sway = {
|
||||
enable = true;
|
||||
wrapperFeatures.gtk = true;
|
||||
};
|
||||
|
||||
# make brightness keys work
|
||||
users.users.max.extraGroups = ["video"];
|
||||
programs.light.enable = true;
|
||||
|
||||
# make swaylock work
|
||||
security.pam.services.swaylock = {};
|
||||
}
|
@ -7,7 +7,7 @@ set -e
|
||||
pushd ~/dotfiles/nixos/
|
||||
|
||||
# Edit your config
|
||||
$EDITOR configuration.nix
|
||||
$EDITOR
|
||||
|
||||
# Autoformat your nix files
|
||||
alejandra . #&>/dev/null
|
||||
|
@ -1,41 +0,0 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
hibernateEnvironment = {
|
||||
HIBERNATE_SECONDS = "300";
|
||||
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.utillinux}/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.utillinux}/bin/rtcwake -m no -s 1
|
||||
fi
|
||||
'';
|
||||
serviceConfig.Type = "simple";
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user