Compare commits

...

42 Commits

Author SHA1 Message Date
b655dafce9 move sway to module 2024-03-06 23:02:59 +01:00
fac8cb3be4 87 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-04 13:57:07 +01:00
386d86872c 86 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-04 12:20:24 +01:00
f050c4ee4a 85 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-04 12:16:41 +01:00
f8b27b2473 84 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-04 12:13:52 +01:00
0ae81ca5f3 83 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-04 12:01:20 +01:00
07a32014cf 82 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-04 12:00:10 +01:00
13bdcf8399 81 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-04 11:58:58 +01:00
015881d858 80 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-04 11:55:16 +01:00
523827f429 79 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-04 11:50:11 +01:00
7a1bb2fc01 78 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-04 11:46:50 +01:00
cca986ee40 77 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-04 11:40:46 +01:00
78e8b63367 76 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-04 11:37:38 +01:00
4e461f0e91 75 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-04 11:36:21 +01:00
20aae22e52 74 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-04 11:30:14 +01:00
5ce1c1df4c 73 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-04 11:24:37 +01:00
b8b68d25e4 72 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-04 11:23:10 +01:00
9f41d33fb4 70 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-04 11:16:52 +01:00
c640a0abb0 69 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-03 23:59:50 +01:00
3a2cfc6ccc 68 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-03 23:58:34 +01:00
a77fe9a357 67 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-03 23:45:16 +01:00
c70ec06aab 66 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-03 23:38:43 +01:00
2d6fb7092d 65 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-03 23:28:43 +01:00
628f2208fd 64 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-03 23:26:30 +01:00
79f2f1b643 63 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-03 23:17:29 +01:00
3f0fae6f3d 62 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-03 23:11:14 +01:00
a4f5cbe681 61 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-03 23:10:37 +01:00
62e3a62969 60 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-03 23:01:48 +01:00
a11ad83220 59 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-03 22:59:30 +01:00
486e514aac 58 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-03 22:53:54 +01:00
367265e506 57 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-03 22:51:22 +01:00
2444924e09 56 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-03 22:36:17 +01:00
a704bce591 55 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-03 22:18:08 +01:00
b8f0c0a843 54 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-03 22:14:34 +01:00
0253ad9a9a 53 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-03 22:11:18 +01:00
7cfea52860 52 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-03 22:09:57 +01:00
ccf0f37da2 51 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-03 22:08:39 +01:00
e0b5446e95 50 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-03 22:07:03 +01:00
0f7e4e7b00 49 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-03 16:07:47 +01:00
08898ebfd7 48 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-03 12:46:45 +01:00
4fb4790eaa 47 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-03 12:45:44 +01:00
e61c22b365 46 current 1970-01-01 01:00:00 23.11.20240229.068d4db 6.1.79 * 2024-03-03 12:26:53 +01:00
8 changed files with 347 additions and 60 deletions

View File

@ -21,7 +21,7 @@
nixosConfigurations."MaxNixosLaptop" = nixpkgs.lib.nixosSystem { nixosConfigurations."MaxNixosLaptop" = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs;}; specialArgs = {inherit inputs;};
modules = [ modules = [
./configuration.nix ./hosts/MaxNixosLaptop/configuration.nix
inputs.home-manager.nixosModules.default inputs.home-manager.nixosModules.default
]; ];
}; };

View File

@ -10,7 +10,8 @@
imports = [ imports = [
# Include the results of the hardware scan. # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
./suspend-and-hibernate.nix # sway as window manager
../../modules/nixos/sway.nix
inputs.home-manager.nixosModules.default inputs.home-manager.nixosModules.default
]; ];
@ -49,18 +50,6 @@
LC_TIME = "de_DE.UTF-8"; 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 # Configure console keymap
console.keyMap = "de"; console.keyMap = "de";
@ -77,7 +66,7 @@
alsa.support32Bit = true; alsa.support32Bit = true;
pulse.enable = true; pulse.enable = true;
# If you want to use JACK applications, uncomment this # 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, # 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) # no need to redefine it in your config for now)
@ -127,6 +116,10 @@
ffmpeg ffmpeg
]; ];
fonts.fonts = with pkgs; [
nerdfonts
];
# Some programs need SUID wrappers, can be configured further or are # Some programs need SUID wrappers, can be configured further or are
# started in user sessions. # started in user sessions.
# programs.mtr.enable = true; # programs.mtr.enable = true;
@ -134,17 +127,50 @@
# enable = true; # enable = true;
# enableSSHSupport = true; # enableSSHSupport = true;
# }; # };
programs.ssh.startAgent = true;
programs.nix-ld.enable = 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.zsh.enable = true;
programs.steam.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: # List services that you want to enable:
# fingerprint unlock # fingerprint unlock
services.fprintd.enable = true; services.fprintd.enable = true;
services.greetd = {
enable = true;
settings = rec {
default_session = {
command = "${pkgs.sway}/bin/sway";
user = "max";
};
};
};
# Enable the OpenSSH daemon. # Enable the OpenSSH daemon.
# services.openssh.enable = true; # services.openssh.enable = true;

View File

@ -1,8 +1,14 @@
{ {
config, config,
pkgs, 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 # Home Manager needs a bit of information about you and the paths it should
# manage. # manage.
home.username = "max"; home.username = "max";
@ -25,14 +31,12 @@
zsh zsh
starship starship
zoxide zoxide
nerdfonts
lazygit lazygit
btop btop
bat bat
eza eza
unzip unzip
rustup rustup
keepassxc
nextcloud-client nextcloud-client
firefox firefox
thunderbird thunderbird
@ -51,6 +55,8 @@
betaflight-configurator betaflight-configurator
loudgain loudgain
youtube-dl youtube-dl
dconf
distrobox
]; ];
# Home Manager is pretty good at managing dotfiles. The primary way to manage # Home Manager is pretty good at managing dotfiles. The primary way to manage

View 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
View 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 = {};
}

View File

@ -7,7 +7,7 @@ set -e
pushd ~/dotfiles/nixos/ pushd ~/dotfiles/nixos/
# Edit your config # Edit your config
$EDITOR configuration.nix $EDITOR
# Autoformat your nix files # Autoformat your nix files
alejandra . #&>/dev/null alejandra . #&>/dev/null

View File

@ -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";
};
}