From 326d8fbae79880f42fc48e26448c123cef92ac6a Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 13 Jun 2024 17:31:49 +0100 Subject: [PATCH] st derivation and startx in hm --- .../optional/desktop/common/default.nix | 1 + .../optional/desktop/startx/default.nix | 27 ++++++++++ home/semita.nix | 1 + home/users/sam/default.nix | 21 -------- pkgs/default.nix | 1 + pkgs/st/default.nix | 51 +++++++++++++++++++ 6 files changed, 81 insertions(+), 21 deletions(-) create mode 100644 home/common/optional/desktop/startx/default.nix create mode 100644 pkgs/st/default.nix diff --git a/home/common/optional/desktop/common/default.nix b/home/common/optional/desktop/common/default.nix index 10be23e..49c9fd1 100644 --- a/home/common/optional/desktop/common/default.nix +++ b/home/common/optional/desktop/common/default.nix @@ -12,6 +12,7 @@ # Global packages for desktop environments home.packages = [ pkgs.alacritty + pkgs.st pkgs.libnotify pkgs.zathura pkgs.xfce.thunar diff --git a/home/common/optional/desktop/startx/default.nix b/home/common/optional/desktop/startx/default.nix new file mode 100644 index 0000000..cef6462 --- /dev/null +++ b/home/common/optional/desktop/startx/default.nix @@ -0,0 +1,27 @@ +{ + imports = [ + ../common + ]; + + # TODO configure x11 to look in .config/x11 + #home.file."${config.xdg.configHome}/x11/xinitrc" = { + home.file.".xinitrc" = { + recursive = true; + text = '' + if test -z "$DBUS_SESSION_BUS_ADDRESS"; then + eval $(dbus-launch --exit-with-session --sh-syntax) + fi + systemctl --user import-environment DISPLAY XAUTHORITY + + if command -v dbus-update-activation-environment >/dev/null 2>&1; then + dbus-update-activation-environment DISPLAY XAUTHORITY + fi + + export XSESSION_PID="$$" + exec dwm + + ''; + }; + + +} diff --git a/home/semita.nix b/home/semita.nix index 2186de1..a6dc6e0 100644 --- a/home/semita.nix +++ b/home/semita.nix @@ -11,6 +11,7 @@ ./common/optional/git.nix ./common/optional/sops.nix ./common/optional/syncthing.nix + ./common/optional/desktop/startx ]; diff --git a/home/users/sam/default.nix b/home/users/sam/default.nix index d611c12..616fcb8 100644 --- a/home/users/sam/default.nix +++ b/home/users/sam/default.nix @@ -54,27 +54,6 @@ qt.style.name = "adwaita-dark"; qt.style.package = pkgs.adwaita-qt; - # TODO configure x11 to look in .config/x11 - #home.file."${config.xdg.configHome}/x11/xinitrc" = { - home.file.".xinitrc" = { - recursive = true; - text = '' - if test -z "$DBUS_SESSION_BUS_ADDRESS"; then - eval $(dbus-launch --exit-with-session --sh-syntax) - fi - systemctl --user import-environment DISPLAY XAUTHORITY - - if command -v dbus-update-activation-environment >/dev/null 2>&1; then - dbus-update-activation-environment DISPLAY XAUTHORITY - fi - - export XSESSION_PID="$$" - exec dwm - - ''; - }; - - home.sessionVariables = { EDITOR = "nvim"; TERMINAL = "alacritty"; diff --git a/pkgs/default.nix b/pkgs/default.nix index 591d772..693502b 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -2,4 +2,5 @@ # You can build them using 'nix build .#example' pkgs: { sddm-theme = pkgs.callPackage ./sddm-theme { }; + st = pkgs.callPackage ./st { }; } diff --git a/pkgs/st/default.nix b/pkgs/st/default.nix new file mode 100644 index 0000000..ad3ba63 --- /dev/null +++ b/pkgs/st/default.nix @@ -0,0 +1,51 @@ +{ pkgs ? import { } +, fetchFromGitea ? pkgs.fetchFromGitea +, stdenv ? pkgs.stdenv +, pkg-config ? pkgs.pkg-config +, fontconfig ? pkgs.fontconfig +, freetype ? pkgs.freetype +, libX11 ? pkgs.xorg.libX11 +, libXft ? pkgs.xorg.libXft +, ncurses ? pkgs.ncurses +, extraLibs ? [ ] +}: +pkgs.stdenv.mkDerivation { + pname = "st"; + name = "st"; + + src = fetchFromGitea { + domain = "git.bitlab21.com"; + owner = "sam"; + repo = "st"; + rev = "1cde288ca34ad05984a0251a7879005128be085c"; + sha256 = "sha256-4W9w/Efk+YCSP1VuUFr+jPXIyrlpktwxRPUOZHTAtx8="; + }; + + makeFlags = [ + "PKG_CONFIG=${stdenv.cc.targetPrefix}pkg-config" + ]; + + nativeBuildInputs = [ + pkg-config + ncurses + fontconfig + freetype + ]; + + buildInputs = [ + libX11 + libXft + ] ++ extraLibs; + + installFlags = [ "PREFIX=$(out)" ]; + + buildPhase = '' + make + ''; + + installPhase = '' + mkdir -p $out/usr/local/bin + mv st $out/usr/local/bin + ''; + +}