extract sway system config
This commit is contained in:
parent
f17d07d18b
commit
64e43f4535
11
flake.nix
11
flake.nix
|
@ -31,12 +31,10 @@
|
||||||
inherit system;
|
inherit system;
|
||||||
config = { allowUnfree = true; };
|
config = { allowUnfree = true; };
|
||||||
};
|
};
|
||||||
overlay-unstable = final: prev: {
|
|
||||||
unstable = nixpkgs-unstable.legacyPackages.${prev.system};
|
|
||||||
};
|
|
||||||
lib = nixpkgs.lib;
|
lib = nixpkgs.lib;
|
||||||
common_modules = [
|
common_modules = [
|
||||||
./system/configuration.nix
|
./system/configuration.nix
|
||||||
|
./system/sway.nix
|
||||||
./system/gitlab-runner.nix
|
./system/gitlab-runner.nix
|
||||||
# nur.nixosModules.nur
|
# nur.nixosModules.nur
|
||||||
inputs.hyprland.nixosModules.default
|
inputs.hyprland.nixosModules.default
|
||||||
|
@ -44,14 +42,7 @@
|
||||||
programs.hyprland.enable = true;
|
programs.hyprland.enable = true;
|
||||||
# programs.hyprland.package = null;
|
# programs.hyprland.package = null;
|
||||||
}
|
}
|
||||||
(mod-inputs@{ config, pkgs, ... }: {
|
|
||||||
nixpkgs.overlays = [
|
|
||||||
overlay-unstable
|
|
||||||
nur.overlay
|
|
||||||
(import ./scripts mod-inputs)
|
|
||||||
(import ./overlays (inputs // {inherit system;}))
|
(import ./overlays (inputs // {inherit system;}))
|
||||||
];
|
|
||||||
})
|
|
||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
{
|
{
|
||||||
home-manager.useGlobalPkgs = true;
|
home-manager.useGlobalPkgs = true;
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
inputs@{ system, ... }:
|
(inputs@{ system, ... }: {pkgs, ...}: {
|
||||||
|
nixpkgs.overlays = [
|
||||||
|
inputs.nur.overlay
|
||||||
|
(import ../scripts)
|
||||||
|
(import ./sway.nix)
|
||||||
(final: prev: {
|
(final: prev: {
|
||||||
|
unstable = inputs.nixpkgs-unstable.legacyPackages.${prev.system};
|
||||||
|
|
||||||
uservars = import ../user/variables.nix;
|
uservars = import ../user/variables.nix;
|
||||||
dhist = inputs.dhist.packages.${system}.dhist;
|
dhist = inputs.dhist.packages.${system}.dhist;
|
||||||
# alacritty = (old-pkgs.alacritty.overrideAttrs
|
# alacritty = (old-pkgs.alacritty.overrideAttrs
|
||||||
|
@ -33,3 +39,5 @@ inputs@{ system, ... }:
|
||||||
nerdfonts_fira_hack =
|
nerdfonts_fira_hack =
|
||||||
(final.nerdfonts.override { fonts = [ "FiraCode" "Hack" ]; });
|
(final.nerdfonts.override { fonts = [ "FiraCode" "Hack" ]; });
|
||||||
})
|
})
|
||||||
|
];
|
||||||
|
})
|
||||||
|
|
37
overlays/sway.nix
Normal file
37
overlays/sway.nix
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
(final: pkgs: {
|
||||||
|
# bash script to let dbus know about important env variables and
|
||||||
|
# propogate them to relevent services run at the end of sway config
|
||||||
|
# see
|
||||||
|
# https://github.com/emersion/xdg-desktop-portal-wlr/wiki/"It-doesn't-work"-Troubleshooting-Checklist
|
||||||
|
# note: this is pretty much the same as /etc/sway/config.d/nixos.conf but also restarts
|
||||||
|
# some user services to make sure they have the correct environment variables
|
||||||
|
dbus-sway-environment = pkgs.writeTextFile {
|
||||||
|
name = "dbus-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
|
||||||
|
# the suggested way to set gtk settings is with gsettings
|
||||||
|
# for gsettings to work, we need to tell it where the schemas are
|
||||||
|
# using the XDG_DATA_DIR environment variable
|
||||||
|
# run at the end of sway config
|
||||||
|
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 ''
|
||||||
|
export XDG_DATA_DIRS=${datadir}:$XDG_DATA_DIRS
|
||||||
|
gnome_schema=org.gnome.desktop.interface
|
||||||
|
# gsettings set $gnome_schema gtk-theme 'Dracula'
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
})
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ pkgs, ... }:
|
||||||
pkgs.writeShellScriptBin "_gpg-unlock" ''
|
pkgs.writeShellScriptBin "_gpg-unlock" ''
|
||||||
${pkgs.gnupg}/bin/gpg-connect-agent reloadagent /bye
|
${pkgs.gnupg}/bin/gpg-connect-agent reloadagent /bye
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
{ config, lib, ... }:
|
(final: prev:
|
||||||
(pkgs: _:
|
with prev;
|
||||||
with pkgs;
|
|
||||||
let
|
let
|
||||||
import_script = (_: path: import (path) { inherit config pkgs lib; });
|
import_script = (_: path: import (path) { inherit pkgs lib; });
|
||||||
create_script = (name: text: runtimeInputs:
|
create_script = (name: text: runtimeInputs:
|
||||||
let
|
let
|
||||||
script_body = pkgs.writeTextFile {
|
script_body = pkgs.writeTextFile {
|
||||||
|
@ -21,13 +20,13 @@
|
||||||
lib.mapAttrs (name: deps: create_script name ./${name} deps);
|
lib.mapAttrs (name: deps: create_script name ./${name} deps);
|
||||||
in create_scripts {
|
in create_scripts {
|
||||||
br = [ ];
|
br = [ ];
|
||||||
bmenu = [ bemenu dhist fish j4-dmenu-desktop jq sway ];
|
bmenu = [ bemenu final.dhist fish j4-dmenu-desktop jq sway ];
|
||||||
_diffr = [ diffr ];
|
_diffr = [ diffr ];
|
||||||
kak-pager = [ fish _diffr ];
|
kak-pager = [ fish final._diffr ];
|
||||||
terminal = [ alacritty ];
|
terminal = [ alacritty ];
|
||||||
wpass = [ bmenu fd pass sd wl-clipboard wtype ];
|
wpass = [ final.bmenu fd pass sd wl-clipboard wtype ];
|
||||||
screenshotsh =
|
screenshotsh =
|
||||||
[ capitaine-cursors grim jq sway wl-clipboard xdg-user-dirs ];
|
[ capitaine-cursors grim slurp jq sway wl-clipboard xdg-user-dirs ];
|
||||||
volumesh = [ pulseaudio libnotify ];
|
volumesh = [ pulseaudio libnotify ];
|
||||||
} // lib.mapAttrs import_script {
|
} // lib.mapAttrs import_script {
|
||||||
wdmenu = ./wdmenu.nix;
|
wdmenu = ./wdmenu.nix;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ pkgs, ... }:
|
||||||
let
|
let
|
||||||
inherit (pkgs.uservars) dmenu;
|
inherit (pkgs.uservars) dmenu;
|
||||||
available_menus = {
|
available_menus = {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ pkgs, ... }:
|
||||||
let
|
let
|
||||||
inherit (pkgs.uservars) dmenu;
|
inherit (pkgs.uservars) dmenu;
|
||||||
available_menus = {
|
available_menus = {
|
||||||
|
|
|
@ -1,44 +1,7 @@
|
||||||
# Edit this configuration file to define what should be installed on
|
# Edit this configuration file to define what should be installed on
|
||||||
# your system. Help is available in the configuration.nix(5) man page
|
# your system. Help is available in the configuration.nix(5) man page
|
||||||
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }: {
|
||||||
let
|
|
||||||
# bash script to let dbus know about important env variables and
|
|
||||||
# propogate them to relevent services run at the end of sway config
|
|
||||||
# see
|
|
||||||
# https://github.com/emersion/xdg-desktop-portal-wlr/wiki/"It-doesn't-work"-Troubleshooting-Checklist
|
|
||||||
# note: this is pretty much the same as /etc/sway/config.d/nixos.conf but also restarts
|
|
||||||
# some user services to make sure they have the correct environment variables
|
|
||||||
dbus-sway-environment = pkgs.writeTextFile {
|
|
||||||
name = "dbus-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
|
|
||||||
# the suggested way to set gtk settings is with gsettings
|
|
||||||
# for gsettings to work, we need to tell it where the schemas are
|
|
||||||
# using the XDG_DATA_DIR environment variable
|
|
||||||
# run at the end of sway config
|
|
||||||
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 ''
|
|
||||||
export XDG_DATA_DIRS=${datadir}:$XDG_DATA_DIRS
|
|
||||||
gnome_schema=org.gnome.desktop.interface
|
|
||||||
# gsettings set $gnome_schema gtk-theme 'Dracula'
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
in {
|
|
||||||
# Bootloader.
|
# Bootloader.
|
||||||
boot.loader.systemd-boot.enable = true;
|
boot.loader.systemd-boot.enable = true;
|
||||||
boot.loader.efi.canTouchEfiVariables = true;
|
boot.loader.efi.canTouchEfiVariables = true;
|
||||||
|
@ -67,42 +30,6 @@ in {
|
||||||
# services.xserver.displayManager.gdm.enable = true;
|
# services.xserver.displayManager.gdm.enable = true;
|
||||||
# services.xserver.desktopManager.gnome.enable = true;
|
# services.xserver.desktopManager.gnome.enable = true;
|
||||||
# services.xserver.displayManager.autologin.user = "lelgenio";
|
# services.xserver.displayManager.autologin.user = "lelgenio";
|
||||||
services.greetd = let
|
|
||||||
greetd_main_script = pkgs.writeShellScriptBin "main" ''
|
|
||||||
${dbus-sway-environment}/bin/dbus-sway-environment
|
|
||||||
${configure-gtk}/bin/configure-gtk
|
|
||||||
export XDG_CURRENT_DESKTOP=sway GTK_THEME=Orchis-Red-Dark-Compact
|
|
||||||
${pkgs.greetd.gtkgreet}/bin/gtkgreet -l -c sway
|
|
||||||
swaymsg exit
|
|
||||||
'';
|
|
||||||
swayConfig = pkgs.writeText "greetd-sway-config" ''
|
|
||||||
# `-l` activates layer-shell mode. Notice that `swaymsg exit` will run after gtkgreet.
|
|
||||||
exec "${greetd_main_script}/bin/main"
|
|
||||||
bindsym Mod4+shift+e exec swaynag \
|
|
||||||
-t warning \
|
|
||||||
-m 'What do you want to do?' \
|
|
||||||
-b 'Poweroff' 'systemctl poweroff' \
|
|
||||||
-b 'Reboot' 'systemctl reboot'
|
|
||||||
input "*" {
|
|
||||||
repeat_delay 200
|
|
||||||
repeat_rate 30
|
|
||||||
xkb_layout us(colemak)
|
|
||||||
xkb_numlock enabled
|
|
||||||
xkb_options lv3:lsgt_switch,grp:shifts_toggle
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
in {
|
|
||||||
enable = true;
|
|
||||||
settings = {
|
|
||||||
initial_session = {
|
|
||||||
command = "${pkgs.sway}/bin/sway";
|
|
||||||
user = "lelgenio";
|
|
||||||
};
|
|
||||||
default_session = {
|
|
||||||
command = "${pkgs.sway}/bin/sway --config ${swayConfig}";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
# Configure keymap in X11
|
# Configure keymap in X11
|
||||||
services.xserver = {
|
services.xserver = {
|
||||||
layout = "us";
|
layout = "us";
|
||||||
|
@ -111,16 +38,9 @@ in {
|
||||||
console.keyMap = "colemak";
|
console.keyMap = "colemak";
|
||||||
# Enable CUPS to print documents.
|
# Enable CUPS to print documents.
|
||||||
# services.printing.enable = true;
|
# services.printing.enable = true;
|
||||||
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 ];
|
|
||||||
# gtkUsePortal = false;
|
|
||||||
};
|
|
||||||
services.flatpak.enable = true;
|
services.flatpak.enable = true;
|
||||||
virtualisation.docker.enable = true;
|
virtualisation.docker.enable = true;
|
||||||
|
|
||||||
security.rtkit.enable = true;
|
security.rtkit.enable = true;
|
||||||
services.sshd.enable = true;
|
services.sshd.enable = true;
|
||||||
|
|
||||||
|
@ -137,6 +57,7 @@ in {
|
||||||
|
|
||||||
# Enable touchpad support (enabled default in most desktopManager).
|
# Enable touchpad support (enabled default in most desktopManager).
|
||||||
services.xserver.libinput.enable = true;
|
services.xserver.libinput.enable = true;
|
||||||
|
|
||||||
# Define a user account. Don't forget to set a password with ‘passwd’.
|
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||||
users.users.lelgenio = {
|
users.users.lelgenio = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
|
@ -171,23 +92,12 @@ in {
|
||||||
tdesktop
|
tdesktop
|
||||||
# recomended by nixwiki
|
# recomended by nixwiki
|
||||||
alacritty # gpu accelerated terminal
|
alacritty # gpu accelerated terminal
|
||||||
sway
|
|
||||||
dbus-sway-environment
|
|
||||||
pkgs.xdg-desktop-portal
|
|
||||||
pkgs.xdg-desktop-portal-wlr
|
|
||||||
configure-gtk
|
|
||||||
wayland
|
|
||||||
glib # gsettings
|
glib # gsettings
|
||||||
usbutils
|
usbutils
|
||||||
# dracula-theme # gtk theme
|
# dracula-theme # gtk theme
|
||||||
gnome3.adwaita-icon-theme # default gnome cursors
|
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
|
|
||||||
bemenu # wayland clone of dmenu
|
|
||||||
mako # notification system developed by swaywm maintainer
|
|
||||||
orchis_theme_compact
|
orchis_theme_compact
|
||||||
pulseaudio
|
pulseaudio
|
||||||
|
|
||||||
|
@ -208,11 +118,7 @@ in {
|
||||||
sqlx-cli
|
sqlx-cli
|
||||||
nodePackages.sass
|
nodePackages.sass
|
||||||
];
|
];
|
||||||
# enable sway window manager
|
|
||||||
programs.sway = {
|
|
||||||
enable = true;
|
|
||||||
wrapperFeatures.gtk = true;
|
|
||||||
};
|
|
||||||
services.geoclue2.enable = true;
|
services.geoclue2.enable = true;
|
||||||
# programs.qt5ct.enable = true;
|
# programs.qt5ct.enable = true;
|
||||||
programs.steam.enable = true;
|
programs.steam.enable = true;
|
||||||
|
|
60
system/sway.nix
Normal file
60
system/sway.nix
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
{ pkgs, ... }: {
|
||||||
|
# enable sway window manager
|
||||||
|
programs.sway = {
|
||||||
|
enable = true;
|
||||||
|
wrapperFeatures.gtk = true;
|
||||||
|
};
|
||||||
|
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 ];
|
||||||
|
# gtkUsePortal = false;
|
||||||
|
};
|
||||||
|
services.greetd = let
|
||||||
|
greetd_main_script = pkgs.writeShellScriptBin "main" ''
|
||||||
|
${pkgs.dbus-sway-environment}/bin/dbus-sway-environment
|
||||||
|
${pkgs.configure-gtk}/bin/configure-gtk
|
||||||
|
export XDG_CURRENT_DESKTOP=sway GTK_THEME=Orchis-Red-Dark-Compact
|
||||||
|
${pkgs.greetd.gtkgreet}/bin/gtkgreet -l -c sway
|
||||||
|
swaymsg exit
|
||||||
|
'';
|
||||||
|
swayConfig = pkgs.writeText "greetd-sway-config" ''
|
||||||
|
# `-l` activates layer-shell mode. Notice that `swaymsg exit` will run after gtkgreet.
|
||||||
|
exec "${greetd_main_script}/bin/main"
|
||||||
|
bindsym Mod4+shift+e exec swaynag \
|
||||||
|
-t warning \
|
||||||
|
-m 'What do you want to do?' \
|
||||||
|
-b 'Poweroff' 'systemctl poweroff' \
|
||||||
|
-b 'Reboot' 'systemctl reboot'
|
||||||
|
input "*" {
|
||||||
|
repeat_delay 200
|
||||||
|
repeat_rate 30
|
||||||
|
xkb_layout us(colemak)
|
||||||
|
xkb_numlock enabled
|
||||||
|
xkb_options lv3:lsgt_switch,grp:shifts_toggle
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
in {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
initial_session = {
|
||||||
|
command = "${pkgs.sway}/bin/sway";
|
||||||
|
user = "lelgenio";
|
||||||
|
};
|
||||||
|
default_session = {
|
||||||
|
command = "${pkgs.sway}/bin/sway --config ${swayConfig}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
sway
|
||||||
|
swaylock
|
||||||
|
swayidle
|
||||||
|
|
||||||
|
wayland
|
||||||
|
pkgs.xdg-desktop-portal
|
||||||
|
pkgs.xdg-desktop-portal-wlr
|
||||||
|
];
|
||||||
|
}
|
Loading…
Reference in a new issue