Configuration for my NixOS based systems and Home Manager
1{ pkgs, lib, ... }:
2let # bash script to let dbus know about important env variables and
3 # propagate them to relevent services run at the end of sway config
4 # see
5 # https://github.com/emersion/xdg-desktop-portal-wlr/wiki/"It-doesn't-work"-Troubleshooting-Checklist
6 # note: this is pretty much the same as /etc/sway/config.d/nixos.conf but also restarts
7 # some user services to make sure they have the correct environment variables
8 dbus-sway-environment = pkgs.writeTextFile {
9 name = "dbus-sway-environment";
10 destination = "/bin/dbus-sway-environment";
11 executable = true;
12
13 text = ''
14 dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway
15 systemctl --user stop pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
16 systemctl --user start pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
17 '';
18 };
19
20 # currently, there is some friction between sway and gtk:
21 # https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland
22 # the suggested way to set gtk settings is with gsettings
23 # for gsettings to work, we need to tell it where the schemas are
24 # using the XDG_DATA_DIR environment variable
25 # run at the end of sway config
26 configure-gtk = pkgs.writeTextFile {
27 name = "configure-gtk";
28 destination = "/bin/configure-gtk";
29 executable = true;
30 text = let
31 # TODO: figure out why these bindings exist or where they're used
32 schema = pkgs.gsettings-desktop-schemas;
33 datadir = "${schema}/share/gsettings-schemas/${schema.name}";
34 in ''
356 gnome_schema=org.gnome.desktop.interface
36 gsettings set $gnome_schema gtk-theme 'Dracula'
37 '';
38 };
39in
40{
41
42 # List packages installed in system profile. To search, run:
43 # $ nix search wget
44 environment.systemPackages = with pkgs; [
45 neovim
46 appimage-run
47 wget
48 kitty
49 w3m
50 fishPlugins.fzf-fish
51 fzf
52 qemu
53 OVMF
54
55 # Sway stuff
56 wdisplays
57 mako
58 bemenu
59 wl-clipboard
60 slurp
61 grim
62 swayidle
63 swaylock
64 gnome3.adwaita-icon-theme
65 dracula-theme
66 glib
67 xdg-utils
68 wayland
69 configure-gtk
70 dbus-sway-environment
71 dbus
72 ];
73
74 # Fix dynamically linked libraries for unpackaged binaries
75 programs.nix-ld = {
76 enable = true;
77 libraries = with pkgs; [
78 # Add missing dynamic libraries for unpackaged programs HERE
79 # NOT in environment.systemPackages
80 zlib
81 ];
82 };
83
84
85 # Logseq uses an ancient version of Electron, so we enable that
86 nixpkgs.config.permittedInsecurePackages = [ "electron-25.9.0" ];
87
88 # Whitelist some unfree packages
89 nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
90 "discord"
91 "spotify"
92 "obsidian"
93 "tailscale"
94 "google-chrome"
95 ];
96}