summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2024-04-04 19:18:12 +0200
committerAlyssa Ross <hi@alyssa.is>2024-04-04 19:54:37 +0200
commit3c240f8ab8b44404d7b3c2db7ba4f56e4df1c1bd (patch)
treed7680d5195ec793ff5bf9a50535c5d4d4b99754c
parent4b90ff14ed760dd2155801000dde3595d9c54770 (diff)
downloadspectrum-3c240f8ab8b44404d7b3c2db7ba4f56e4df1c1bd.tar
spectrum-3c240f8ab8b44404d7b3c2db7ba4f56e4df1c1bd.tar.gz
spectrum-3c240f8ab8b44404d7b3c2db7ba4f56e4df1c1bd.tar.bz2
spectrum-3c240f8ab8b44404d7b3c2db7ba4f56e4df1c1bd.tar.lz
spectrum-3c240f8ab8b44404d7b3c2db7ba4f56e4df1c1bd.tar.xz
spectrum-3c240f8ab8b44404d7b3c2db7ba4f56e4df1c1bd.tar.zst
spectrum-3c240f8ab8b44404d7b3c2db7ba4f56e4df1c1bd.zip
lib/nixpkgs.default.nix: update to nixos-unstable
The foot patch is finally upstream!

Signed-off-by: Alyssa Ross <hi@alyssa.is>
-rw-r--r--lib/nixpkgs.default.nix4
-rw-r--r--pkgs/default.nix2
-rw-r--r--pkgs/foot/Add-support-for-opening-an-existing-PTY.patch228
-rw-r--r--pkgs/foot/default.nix10
-rw-r--r--pkgs/overlay.nix2
5 files changed, 3 insertions, 243 deletions
diff --git a/lib/nixpkgs.default.nix b/lib/nixpkgs.default.nix
index eb65e39..6599488 100644
--- a/lib/nixpkgs.default.nix
+++ b/lib/nixpkgs.default.nix
@@ -4,6 +4,6 @@
 # Generated by scripts/update-nixpkgs.sh.
 
 import (builtins.fetchTarball {
-  url = "https://github.com/NixOS/nixpkgs/archive/de0bf263cce70074a298ee4672ca3a503d66e39c.tar.gz";
-  sha256 = "1wh05qqihvmjnykxv8sncxcbim29d6wdx356w1zcwpmhm28rrrrj";
+  url = "https://github.com/NixOS/nixpkgs/archive/fd281bd6b7d3e32ddfa399853946f782553163b5.tar.gz";
+  sha256 = "1hy81yj2dcg6kfsm63xcqf8kvigxglim1rcg1xpmy2rb6a8vqvsj";
 })
diff --git a/pkgs/default.nix b/pkgs/default.nix
index ca072f5..1c8a8d2 100644
--- a/pkgs/default.nix
+++ b/pkgs/default.nix
@@ -42,7 +42,7 @@ let
 
     # Packages from the overlay, so it's possible to build them from
     # the CLI easily.
-    inherit (pkgs) cloud-hypervisor foot;
+    inherit (pkgs) cloud-hypervisor;
 
     pkgsStatic = makeScopeWithSplicing pkgs.pkgsStatic;
 
diff --git a/pkgs/foot/Add-support-for-opening-an-existing-PTY.patch b/pkgs/foot/Add-support-for-opening-an-existing-PTY.patch
deleted file mode 100644
index 56f9cf2..0000000
--- a/pkgs/foot/Add-support-for-opening-an-existing-PTY.patch
+++ /dev/null
@@ -1,228 +0,0 @@
-From 85cb6c3c705424ff3352d4771efa4c4d0dd09590 Mon Sep 17 00:00:00 2001
-From: Alyssa Ross <hi@alyssa.is>
-Date: Fri, 10 Dec 2021 17:40:59 +0000
-Subject: [PATCH] Add support for opening an existing PTY
-SPDX-FileCopyrightText: 2019 Daniel Eklöf
-SPDX-FileCopyrightText: 2021 Alyssa Ross <hi@alyssa.is>
-SPDX-License-Identifier: MIT
-
----
- main.c     | 13 ++++++++++-
- server.c   |  2 +-
- terminal.c | 68 ++++++++++++++++++++++++++++++++----------------------
- terminal.h |  5 ++--
- 4 files changed, 56 insertions(+), 32 deletions(-)
-
-diff --git a/main.c b/main.c
-index dffd2b2b..aa060747 100644
---- a/main.c
-+++ b/main.c
-@@ -3,6 +3,7 @@
- #include <string.h>
- #include <ctype.h>
- #include <stdbool.h>
-+#include <limits.h>
- #include <locale.h>
- #include <getopt.h>
- #include <signal.h>
-@@ -174,6 +175,10 @@ sanitize_signals(void)
-         sigaction(i, &dfl, NULL);
- }
- 
-+enum {
-+    PTY_OPTION = CHAR_MAX + 1,
-+};
-+
- int
- main(int argc, char *const *argv)
- {
-@@ -211,6 +216,7 @@ main(int argc, char *const *argv)
-         {"maximized",              no_argument,       NULL, 'm'},
-         {"fullscreen",             no_argument,       NULL, 'F'},
-         {"presentation-timings",   no_argument,       NULL, 'P'}, /* Undocumented */
-+        {"pty",                    required_argument, NULL, PTY_OPTION},
-         {"print-pid",              required_argument, NULL, 'p'},
-         {"log-level",              required_argument, NULL, 'd'},
-         {"log-colorize",           optional_argument, NULL, 'l'},
-@@ -223,6 +229,7 @@ main(int argc, char *const *argv)
-     bool check_config = false;
-     const char *conf_path = NULL;
-     const char *custom_cwd = NULL;
-+    const char *pty_path = NULL;
-     bool as_server = false;
-     const char *conf_server_socket_path = NULL;
-     bool presentation_timings = false;
-@@ -318,6 +325,10 @@ main(int argc, char *const *argv)
-                 conf_server_socket_path = optarg;
-             break;
- 
-+        case PTY_OPTION:
-+            pty_path = optarg;
-+            break;
-+
-         case 'P':
-             presentation_timings = true;
-             break;
-@@ -576,7 +587,7 @@ main(int argc, char *const *argv)
-         goto out;
- 
-     if (!as_server && (term = term_init(
--                           &conf, fdm, reaper, wayl, "foot", cwd, token,
-+                           &conf, fdm, reaper, wayl, "foot", cwd, token, pty_path,
-                            argc, argv, NULL,
-                            &term_shutdown_cb, &shutdown_ctx)) == NULL) {
-         goto out;
-diff --git a/server.c b/server.c
-index ca55b8f3..b1268574 100644
---- a/server.c
-+++ b/server.c
-@@ -332,7 +332,7 @@ fdm_client(struct fdm *fdm, int fd, int events, void *data)
-     instance->terminal = term_init(
-         conf != NULL ? conf : server->conf,
-         server->fdm, server->reaper, server->wayl, "footclient", cwd, token,
--        cdata.argc, argv, envp, &term_shutdown_handler, instance);
-+        NULL, cdata.argc, argv, envp, &term_shutdown_handler, instance);
- 
-     if (instance->terminal == NULL) {
-         LOG_ERR("failed to instantiate new terminal");
-diff --git a/terminal.c b/terminal.c
-index d4132c24..ad10bb7d 100644
---- a/terminal.c
-+++ b/terminal.c
-@@ -367,6 +367,7 @@ fdm_ptmx(struct fdm *fdm, int fd, int events, void *data)
-         del_utmp_record(term->conf, term->reaper, term->ptmx);
-         fdm_del(fdm, fd);
-         term->ptmx = -1;
-+        term_shutdown(term);
-     }
- 
-     return true;
-@@ -1056,11 +1057,14 @@ load_fonts_from_conf(struct terminal *term)
- static void fdm_client_terminated(
-     struct reaper *reaper, pid_t pid, int status, void *data);
- 
-+static const int PTY_OPEN_FLAGS = O_RDWR | O_NOCTTY;
-+
- struct terminal *
- term_init(const struct config *conf, struct fdm *fdm, struct reaper *reaper,
-           struct wayland *wayl, const char *foot_exe, const char *cwd,
--          const char *token, int argc, char *const *argv, char *const *envp,
--          void (*shutdown_cb)(void *data, int exit_code), void *shutdown_data)
-+          const char *token, const char *pty_path, int argc, char *const *argv,
-+          char *const *envp, void (*shutdown_cb)(void *data, int exit_code),
-+          void *shutdown_data)
- {
-     int ptmx = -1;
-     int flash_fd = -1;
-@@ -1075,7 +1079,8 @@ term_init(const struct config *conf, struct fdm *fdm, struct reaper *reaper,
-         return NULL;
-     }
- 
--    if ((ptmx = posix_openpt(O_RDWR | O_NOCTTY)) < 0) {
-+    ptmx = pty_path ? open(pty_path, PTY_OPEN_FLAGS) : posix_openpt(PTY_OPEN_FLAGS);
-+    if (ptmx < 0) {
-         LOG_ERRNO("failed to open PTY");
-         goto close_fds;
-     }
-@@ -1142,6 +1147,7 @@ term_init(const struct config *conf, struct fdm *fdm, struct reaper *reaper,
-         .fdm = fdm,
-         .reaper = reaper,
-         .conf = conf,
-+        .slave = -1,
-         .ptmx = ptmx,
-         .ptmx_buffers = tll_init(),
-         .ptmx_paste_buffers = tll_init(),
-@@ -1272,16 +1278,18 @@ term_init(const struct config *conf, struct fdm *fdm, struct reaper *reaper,
- 
-     add_utmp_record(conf, reaper, ptmx);
- 
--    /* Start the slave/client */
--    if ((term->slave = slave_spawn(
--             term->ptmx, argc, term->cwd, argv, envp, &conf->env_vars,
--             conf->term, conf->shell, conf->login_shell,
--             &conf->notifications)) == -1)
--    {
--        goto err;
--    }
-+    if (!pty_path) {
-+        /* Start the slave/client */
-+        if ((term->slave = slave_spawn(
-+                 term->ptmx, argc, term->cwd, argv, envp, &conf->env_vars,
-+                 conf->term, conf->shell, conf->login_shell,
-+                 &conf->notifications)) == -1)
-+        {
-+            goto err;
-+        }
- 
--    reaper_add(term->reaper, term->slave, &fdm_client_terminated, term);
-+        reaper_add(term->reaper, term->slave, &fdm_client_terminated, term);
-+    }
- 
-     /* Guess scale; we're not mapped yet, so we don't know on which
-      * output we'll be. Use scaling factor from first monitor */
-@@ -1541,26 +1549,30 @@ term_shutdown(struct terminal *term)
-         close(term->ptmx);
- 
-     if (!term->shutdown.client_has_terminated) {
--        LOG_DBG("initiating asynchronous terminate of slave; "
--                "sending SIGTERM to PID=%u", term->slave);
-+        if (term->slave <= 0) {
-+            term->shutdown.client_has_terminated = true;
-+        } else {
-+            LOG_DBG("initiating asynchronous terminate of slave; "
-+                    "sending SIGTERM to PID=%u", term->slave);
- 
--        kill(-term->slave, SIGTERM);
-+            kill(-term->slave, SIGTERM);
- 
--        const struct itimerspec timeout = {.it_value = {.tv_sec = 60}};
-+            const struct itimerspec timeout = {.it_value = {.tv_sec = 60}};
- 
--        int timeout_fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
--        if (timeout_fd < 0 ||
--            timerfd_settime(timeout_fd, 0, &timeout, NULL) < 0 ||
--            !fdm_add(term->fdm, timeout_fd, EPOLLIN, &fdm_terminate_timeout, term))
--        {
--            if (timeout_fd >= 0)
--                close(timeout_fd);
--            LOG_ERRNO("failed to create slave terminate timeout FD");
--            return false;
-+            int timeout_fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
-+            if (timeout_fd < 0 ||
-+                timerfd_settime(timeout_fd, 0, &timeout, NULL) < 0 ||
-+                !fdm_add(term->fdm, timeout_fd, EPOLLIN, &fdm_terminate_timeout, term))
-+            {
-+                if (timeout_fd >= 0)
-+                    close(timeout_fd);
-+                LOG_ERRNO("failed to create slave terminate timeout FD");
-+                return false;
-+            }
-+
-+            xassert(term->shutdown.terminate_timeout_fd < 0);
-+            term->shutdown.terminate_timeout_fd = timeout_fd;
-         }
--
--        xassert(term->shutdown.terminate_timeout_fd < 0);
--        term->shutdown.terminate_timeout_fd = timeout_fd;
-     }
- 
-     term->selection.auto_scroll.fd = -1;
-diff --git a/terminal.h b/terminal.h
-index 25019ecd..569fe8f4 100644
---- a/terminal.h
-+++ b/terminal.h
-@@ -722,8 +722,9 @@ struct config;
- struct terminal *term_init(
-     const struct config *conf, struct fdm *fdm, struct reaper *reaper,
-     struct wayland *wayl, const char *foot_exe, const char *cwd,
--    const char *token, int argc, char *const *argv, char *const *envp,
--    void (*shutdown_cb)(void *data, int exit_code), void *shutdown_data);
-+    const char *token, const char *pty_path, int argc, char *const *argv,
-+    char *const *envp, void (*shutdown_cb)(void *data, int exit_code),
-+    void *shutdown_data);
- 
- bool term_shutdown(struct terminal *term);
- int term_destroy(struct terminal *term);
--- 
-2.41.0
-
diff --git a/pkgs/foot/default.nix b/pkgs/foot/default.nix
deleted file mode 100644
index a44c61d..0000000
--- a/pkgs/foot/default.nix
+++ /dev/null
@@ -1,10 +0,0 @@
-# SPDX-FileCopyrightText: 2023 Alyssa Ross <hi@alyssa.is>
-# SPDX-License-Identifier: MIT
-
-import ../../lib/overlay-package.nix "foot" ({ final, super }:
-
-super.foot.overrideAttrs ({ patches ? [], ... }: {
-  patches = patches ++ [
-    ./Add-support-for-opening-an-existing-PTY.patch
-  ];
-}))
diff --git a/pkgs/overlay.nix b/pkgs/overlay.nix
index 2266744..55cb00c 100644
--- a/pkgs/overlay.nix
+++ b/pkgs/overlay.nix
@@ -3,6 +3,4 @@
 
 (final: super: {
   cloud-hypervisor = import ./cloud-hypervisor { inherit final super; };
-
-  foot = import ./foot { inherit final super; };
 })