flakfiy some Justfile recipes and experiment with wayland based custom desktop

This commit is contained in:
steveej 2023-05-21 11:58:57 +02:00
parent 06a47c0d23
commit 476e10780b
18 changed files with 739 additions and 149 deletions

View file

@ -1,5 +1,6 @@
{
inputs',
packages',
pkgs,
}:
pkgs.stdenv.mkDerivation {
@ -27,6 +28,14 @@ pkgs.stdenv.mkDerivation {
git
ripgrep
lm_sensors
pass
prs
fuzzel
wofi
# broken as of 2023-04-27 because it doesn't load without a config
# packages'.aphorme_launcher
packages'.yofi
# packages'.ofi-pass
apacheHttpd

View file

@ -16,9 +16,12 @@ in {
# FIXME: fix homeshick when no WAN connection is available
# ../programs/homeshick.nix
# ../profiles/gnome-desktop.nix
../profiles/sway-desktop.nix
../profiles/experimental-desktop.ni
../programs/redshift.nix
../programs/espanso.nix
../programs/gnome-desktop.nix
../programs/gpg-agent.nix
../programs/radicale.nix
@ -30,14 +33,21 @@ in {
../programs/neovim.nix
../programs/pass.nix
../programs/vscode
../programs/holochain-launcher.nix
];
home.sessionVariables.HM_CONFIG = "graphical-fullblown";
home.sessionVariables.GOPATH = "$HOME/src/go";
home.sessionVariables.PATH = pkgs.lib.concatStringsSep ":" ["$HOME/.local/bin" "$PATH"];
# workaround: usually created by 'home.xsession.enabled=true' and i don't use with gnome
systemd.user.targets.tray = {
Unit = {
Description = "Home Manager System Tray";
Requires = ["graphical-session-pre.target"];
};
};
home.packages =
[]
++ (with pkgs; [
@ -91,12 +101,14 @@ in {
# Messaging/Communication
signal-desktop
pidgin
pkgsUnstable.session-desktop
# pidgin
hexchat
schildichat-desktop
aspellDicts.en
aspellDicts.de
skypeforlinux
pkgsUnstable.jitsi-meet-electron
# skypeforlinux
# pkgsUnstable.jitsi-meet-electron
thunderbird
evolution # gnome4.glib_networking
kotatogram-desktop
@ -168,6 +180,7 @@ in {
# Document Processing and Management
mendeley
evince
(pkgsUnstable.logseq.override (_: {electron = pkgs.electron_20;}))
# File Synchronzation

View file

@ -0,0 +1,28 @@
{
pkgs,
config,
lib,
nodeFlake,
packages',
...
}: let
pkgsUnstable = pkgs.callPackage nodeFlake.inputs.nixpkgs-unstable.outPath {};
in {
imports = [
../profiles/wayland-desktop.nix
];
home.packages = with pkgs; [
# experimental WMs
packages'.jay
packages'.magmawm
# swayidle
# swaylock
# # fonts
# noto-fonts
# font-awesome
# noto-fonts-emoji
];
}

View file

@ -5,6 +5,10 @@
...
}: let
in {
imports = [
../profiles/wayland-desktop.nix
];
services = {
gnome-keyring.enable = false;
blueman-applet.enable = true;
@ -20,20 +24,6 @@ in {
services.gpg-agent.pinentryFlavor = "gnome3";
# workaround: usually created by 'home.xsession.enabled=true' and i don't use with gnome
systemd.user.targets.tray = {
Unit = {
Description = "Home Manager System Tray";
Requires = ["graphical-session-pre.target"];
};
};
home.packages = [
pkgs.wmctrl
];
home.sessionVariables.MOZ_ENABLE_WAYLAND = "1";
dconf.settings = let
manualKeybindings = [
{
@ -76,12 +66,17 @@ in {
};
# disable the builtin <Super>[1-9] functionality
"org/gnome/shell/keybindings" = builtins.listToAttrs (builtins.genList
"org/gnome/shell/keybindings" = builtins.listToAttrs ((builtins.genList
(i: {
name = "switch-to-application-${toString (i + 1)}";
value = [];
})
numWorkspaces);
numWorkspaces) ++ [
{
name = "toggle-overview";
value = [];
}
]);
# remap it to switching to the workspaces
"org/gnome/desktop/wm/keybindings" = builtins.listToAttrs (builtins.genList

View file

@ -0,0 +1,84 @@
{
pkgs,
config,
lib,
...
}: let
inherit (import ../lib.nix {}) mkSimpleTrayService;
in {
imports = [
../profiles/wayland-desktop.nix
];
home.packages = with pkgs; [
swayidle
swaylock
# fonts
noto-fonts
font-awesome
noto-fonts-emoji
];
wayland.windowManager.sway = {
enable = true;
systemdIntegration = true;
config = let
modifier = "Mod4";
in {
inherit modifier;
keybindings = lib.mkOptionDefault {
"${modifier}+Ctrl+l" = "exec ${pkgs.swaylock}/bin/swaylock -fF";
"XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
"XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous";
"XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next";
};
terminal = "alacritty";
startup = [
# Launch Firefox on start
# {command = "firefox";}
# {command = "gnome-keyring --replace"}
];
fonts = {
names = [ "Noto Sans" "Font Awesome 5 Free" ];
style = "Heavy";
size = 10.0;
};
#fonts = {
# names = [ "DejaVu Sans Mono" "FontAwesome5Free" ];
# style = "Bold Semi-Condensed";
# size = 11.0;
#};
colors.focused = {
childBorder = "#ffa500";
# border = "#ffa500";
# TODO: refer to the defaults for these
border = "#4c7899";
background = "#285577";
text = "#ffffff";
indicator = "#2e9ef4";
};
window = {
border = 4;
};
};
};
services.swayidle = {
enable = true;
timeouts = [
{ timeout = 60 * 5; command = "${pkgs.swaylock}/bin/swaylock -fF"; }
];
};
}

View file

@ -0,0 +1,43 @@
{
pkgs,
config,
...
}: let
inherit (import ../lib.nix {}) mkSimpleTrayService;
in {
services.gpg-agent.pinentryFlavor = "gtk2";
fonts.fontconfig.enable = true;
home.packages = with pkgs; [
wlr-randr
wayout
wl-clipboard
wmctrl
# identifies key input syms
wev
# TODO: whwat's this for?
# wltype
pavucontrol
playerctl
pasystray
qt5.qtwayland
qt6.qtwayland
];
home.sessionVariables = {
XDG_SESSION_TYPE = "wayland";
NIXOS_OZONE_WL = "1";
MOZ_ENABLE_WAYLAND = "1";
};
home.pointerCursor = {
name = "Vanilla-DMZ";
package = pkgs.vanilla-dmz;
size = 32;
x11.enable = true;
gtk.enable = true;
};
}

View file

@ -1,3 +0,0 @@
{pkgs, ...}: {
home.packages = [pkgs.holochain-launcher];
}

View file

@ -5,5 +5,13 @@
programs.browserpass.enable = true;
home.packages = with pkgs; [pass rofi-pass gnupg];
home.packages = with pkgs; [
gnupg
pass
# broken on wayland
# rofi-pass
prs
];
}

View file

@ -32,28 +32,37 @@
old.propagatedBuildInputs
++ [radicale-storage-decsync];
});
radicale-config = pkgs.writeText "radicale-config" ''
[auth]
type = htpasswd
htpasswd_filename = ${
pkgs.writeText "radicale" ''
radicale:${passwords.users.radicale}
''
}
htpasswd_encryption = bcrypt
[storage]
type = radicale_storage_decsync
filesystem_folder = ${config.xdg.dataHome}/radicale
decsync_dir = ${config.xdg.dataHome}/decsync
'';
in {
systemd.user.services.radicale = {
Unit.Description = "Radicale with DecSync";
Service = {
ExecStart = "${radicale-decsync}/bin/radicale -C ${radicale-config}";
Restart = "on-failure";
mkRadicaleService = { suffix, port }: let
radicale-config = pkgs.writeText "radicale-config-${suffix}" ''
[server]
hosts = localhost:${builtins.toString(port)}
[auth]
type = htpasswd
htpasswd_filename = ${
pkgs.writeText "radicale" ''
radicale:${passwords.users.radicale}
''
}
htpasswd_encryption = bcrypt
[storage]
type = radicale_storage_decsync
filesystem_folder = ${config.xdg.dataHome}/radicale-${suffix}
decsync_dir = ${config.xdg.dataHome}/decsync-${suffix}
'';
in {
systemd.user.services."radicale-${suffix}" = {
Unit.Description = "Radicale with DecSync (${suffix})";
Service = {
ExecStart = "${radicale-decsync}/bin/radicale -C ${radicale-config}";
Restart = "on-failure";
};
Install.WantedBy = ["default.target"];
};
Install.WantedBy = ["default.target"];
};
}
in builtins.foldl' (sum: cur: lib.recursiveUpdate sum (mkRadicaleService cur)) {} [
{suffix = "personal"; port = 5232;}
{suffix = "family"; port = 5233;}
]

View file

@ -5,7 +5,7 @@
}: let
passwords = import ../../variables/passwords.crypt.nix;
in {
services.redshift = {
services.gammastep = {
enable = true;
inherit (passwords.location.stefan) longitude latitude;
temperature = {
@ -14,10 +14,9 @@ in {
};
tray = true;
settings = {
redshift = {
gammastep = {
brightness-day = 1.0;
brightness-night = 0.5;
adjustment-method = "randr";
};
};
};

View file

@ -1,4 +1,4 @@
{pkgs, ...}: {
{pkgs, lib, ...}: {
home-manager.users.steveej = _: {
imports = [
../../../home-manager/configuration/graphical-fullblown.nix
@ -11,13 +11,86 @@
];
};
services.teamviewer.enable = true;
# TODO: delegate graphical session to home-manager config (mostly)
# FIXME: move this to home-manager entirely
# programs.sway.enable = true;
# programs.sway.package = null;
services.xserver = {
enable = lib.mkForce false;
desktopManager = {
gnome.enable = lib.mkForce false;
xterm.enable = lib.mkForce false;
# FIXME: gnome should be moved to user session
# gnome.enable = true;
# xterm.enable = true;
};
displayManager = {
# gdm.enable = lib.mkForce false;
# FIXME: does the home-manager session have an explicit name?
# defaultSession = "xterm";
# autoLogin = {
# enable = true;
# user = "steveej";
# };
# session = [
# {
# manage = "desktop";
# name = "xsession";
# start = "";
# }
# ];
};
};
services.greetd =
let
# exec "${pkgs.greetd.gtkgreet}/bin/gtkgreet -l; swaymsg exit"
swayConfig = pkgs.writeText "greetd-sway-config" ''
# `-l` activates layer-shell mode. Notice that `swaymsg exit` will run after gtkgreet.
exec "dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK; ${pkgs.greetd.regreet}/bin/regreet; swaymsg exit"
bindsym Mod4+shift+e exec swaynag \
-t warning \
-m 'What do you want to do?' \
-b 'Poweroff' 'systemctl poweroff' \
-b 'Reboot' 'systemctl reboot'
'';
in {
enable = true;
settings = {
vt = 1;
default_session = {
command = "${pkgs.sway}/bin/sway --config ${swayConfig}";
};
};
};
environment.etc."greetd/environments".text = ''
sway
jay
'';
# required by swaywm
security.polkit.enable = true;
security.pam.services.swaylock = { };
services.teamviewer.enable = false;
system.stateVersion = "20.09";
# TODO: move this into home-manager
environment.systemPackages = with pkgs.gnomeExtensions; [
pop-shell
vitals
soft-brightness
# TODO: currently not compatible
# window-switcher-current-workspace-first

View file

@ -31,13 +31,22 @@ in {
];
networking.firewall.enable = true;
networking.firewall.allowedTCPPorts = [
services.openssh.openFirewall = false;
# TODO: upstream feature for inverse rule to work: `! --in-interface zt+`
networking.firewall.interfaces."eth+".allowedTCPPorts = [
22
# syncthing
22000
# iperf3
5201
];
networking.firewall.interfaces."eth+".allowedUDPPorts = [
# syncthing
22000 21027
];
networking.firewall.logRefusedConnections = false;
networking.usePredictableInterfaceNames = false;
@ -62,7 +71,7 @@ in {
podman = {
enable = true;
dockerCompat = true;
defaultNetwork.dnsname.enable = true;
# defaultNetwork.dnsname.enable = true;
};
};
@ -83,4 +92,11 @@ in {
time.timeZone = lib.mkForce passwords.timeZone.stefan;
hardware.ledger.enable = true;
services.zerotierone = {
enable = true;
joinNetworks = [
"93afae5963c547f1"
];
};
}

View file

@ -62,18 +62,14 @@
displayManager = {
gdm.enable = true;
autoLogin = {
enable = true;
user = "steveej";
};
gdm.wayland = true;
};
};
# gnome, most of it is disabled and ideally it could live entirely in the user's home config
programs.gpaste.enable = false;
programs.gnome-terminal.enable = false;
programs.gnome-documents.enable = false;
# programs.gnome-documents.enable = false;
programs.gnome-disks.enable = false;
services.gnome = {

36
nix/pkgs/jay.nix Normal file
View file

@ -0,0 +1,36 @@
{ lib
, src
, rustPlatform
, libinput
, libxkbcommon
, mesa
, pango
, udev
}:
rustPlatform.buildRustPackage rec {
pname = "jay";
version = src.rev;
inherit src;
cargoLock.lockFile = "${src}/Cargo.lock";
buildInputs = [
libxkbcommon
mesa
pango
udev
libinput
];
RUSTC_BOOTSTRAP = 1;
meta = with lib; {
description = "A Wayland compositor written in Rust";
homepage = "https://github.com/mahkoh/jay";
license = licenses.gpl3;
platforms = platforms.linux;
maintainers = with maintainers; [ dit7ya ];
};
}

50
nix/pkgs/magmawm.nix Normal file
View file

@ -0,0 +1,50 @@
{ lib
, src
, craneLib
, pkg-config
, wayland
, libseat
, libinput
, libxkbcommon
, mesa
, pango
, udev
, dbus
, libGL
}:
craneLib.buildPackage {inherit src;
pname = "magmawm";
version = src.rev;
nativeBuildInputs = [
pkg-config
];
buildInputs = [
wayland
udev
libxkbcommon
libinput
dbus
libseat
mesa
];
preFixup = ''
if [[ -e "$out/bin/magmawm" ]]; then
patchelf \
--add-needed "${libGL}/lib/libEGL.so.1" \
$out/bin/magmawm
fi
'';
meta = with lib; {
description = "A versatile and customizable Window Manager and Wayland Compositor";
homepage = "https://github.com/MagmaWM/MagmaWM";
license = licenses.gpl3;
platforms = platforms.linux;
maintainers = with maintainers; [ ];
};
}