extract sway system config

This commit is contained in:
Leonardo Eugênio 2022-10-18 21:45:20 -03:00
parent f17d07d18b
commit 64e43f4535
9 changed files with 157 additions and 156 deletions

View file

@ -1,35 +1,43 @@
inputs@{ system, ... }:
(final: prev: {
uservars = import ../user/variables.nix;
dhist = inputs.dhist.packages.${system}.dhist;
# alacritty = (old-pkgs.alacritty.overrideAttrs
# (old-alacritty: rec {
# src = inputs.alacritty-sixel;
# cargoDeps = old-alacritty.cargoDeps.overrideAttrs
# (old-pkgs.lib.const {
# inherit src;
# outputHash =
# "sha256-2hMntoGHqoQT/Oqz261Ljif5xEuV8SnPH0m52bXdd2s=";
# });
# }));
# ranger = (old-pkgs.ranger.overridePythonAttrs (old-ranger: rec {
# src = inputs.ranger-sixel;
# checkInputs = [ ];
# propagatedBuildInputs = with old-pkgs.python3Packages;
# old-ranger.propagatedBuildInputs ++ [ astroid pylint pytest ];
# }));
material-wifi-icons = final.stdenv.mkDerivation rec {
name = "material-wifi-icons";
src = inputs.material-wifi-icons;
installPhase = let dest = "$out/share/fonts/${name}";
in ''
mkdir -p ${dest}
cp material-wifi.ttf ${dest}
'';
};
papirus_red = (final.unstable.papirus-icon-theme.override { color = "red"; });
orchis_theme_compact =
(final.orchis-theme.override { tweaks = [ "compact" "solid" ]; });
nerdfonts_fira_hack =
(final.nerdfonts.override { fonts = [ "FiraCode" "Hack" ]; });
(inputs@{ system, ... }: {pkgs, ...}: {
nixpkgs.overlays = [
inputs.nur.overlay
(import ../scripts)
(import ./sway.nix)
(final: prev: {
unstable = inputs.nixpkgs-unstable.legacyPackages.${prev.system};
uservars = import ../user/variables.nix;
dhist = inputs.dhist.packages.${system}.dhist;
# alacritty = (old-pkgs.alacritty.overrideAttrs
# (old-alacritty: rec {
# src = inputs.alacritty-sixel;
# cargoDeps = old-alacritty.cargoDeps.overrideAttrs
# (old-pkgs.lib.const {
# inherit src;
# outputHash =
# "sha256-2hMntoGHqoQT/Oqz261Ljif5xEuV8SnPH0m52bXdd2s=";
# });
# }));
# ranger = (old-pkgs.ranger.overridePythonAttrs (old-ranger: rec {
# src = inputs.ranger-sixel;
# checkInputs = [ ];
# propagatedBuildInputs = with old-pkgs.python3Packages;
# old-ranger.propagatedBuildInputs ++ [ astroid pylint pytest ];
# }));
material-wifi-icons = final.stdenv.mkDerivation rec {
name = "material-wifi-icons";
src = inputs.material-wifi-icons;
installPhase = let dest = "$out/share/fonts/${name}";
in ''
mkdir -p ${dest}
cp material-wifi.ttf ${dest}
'';
};
papirus_red = (final.unstable.papirus-icon-theme.override { color = "red"; });
orchis_theme_compact =
(final.orchis-theme.override { tweaks = [ "compact" "solid" ]; });
nerdfonts_fira_hack =
(final.nerdfonts.override { fonts = [ "FiraCode" "Hack" ]; });
})
];
})

37
overlays/sway.nix Normal file
View 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'
'';
};
})