From 64bdd20095c6506d4de86c8ad48bbfbcffabeeac Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Sun, 19 May 2024 11:26:03 +0800 Subject: [PATCH 1/9] refactor(disko): clean up labels --- nixos/server/hosts/crix/disko.nix | 181 +++++++++++---------- nixos/workstation/hosts/msix/disko.nix | 3 +- nixos/workstation/hosts/rescanix/disko.nix | 3 +- 3 files changed, 95 insertions(+), 92 deletions(-) diff --git a/nixos/server/hosts/crix/disko.nix b/nixos/server/hosts/crix/disko.nix index 69b1f080..a0b5a843 100644 --- a/nixos/server/hosts/crix/disko.nix +++ b/nixos/server/hosts/crix/disko.nix @@ -1,109 +1,110 @@ {config, ...}: { - disko.devices = { - disk.primary = { - type = "disk"; - device = "/dev/vda"; - content = { - type = "gpt"; - partitions = { - ESP = { - size = "512M"; - type = "EF00"; - label = "BOOT"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - }; + disko.devices.disk.primary = { + type = "disk"; + device = "/dev/vda"; + + content = { + type = "gpt"; + + partitions = { + ESP = { + size = "512M"; + type = "EF00"; + label = "boot"; + + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; }; + }; - root = { - size = "100%"; - label = "root"; + root = { + size = "100%"; + label = "root"; - content = { - type = "zfs"; - pool = config.host.name; - }; + content = { + type = "zfs"; + pool = config.host.name; }; }; }; }; + }; - zpool.${config.host.name} = { - type = "zpool"; + disko.devices.zpool.${config.host.name} = { + type = "zpool"; - options = { - ashift = "12"; - compatibility = "openzfs-2.2-linux"; - }; + options = { + ashift = "12"; + compatibility = "openzfs-2.2-linux"; + }; - rootFsOptions = { - "com.sun:auto-snapshot" = "true"; - acltype = "posix"; - compression = "zstd"; - dnodesize = "auto"; - encryption = "aes-256-gcm"; - keyformat = "passphrase"; - keylocation = "prompt"; - mountpoint = "none"; - normalization = "formD"; - xattr = "sa"; - }; + rootFsOptions = { + "com.sun:auto-snapshot" = "true"; + acltype = "posix"; + compression = "zstd"; + dnodesize = "auto"; + encryption = "aes-256-gcm"; + keyformat = "passphrase"; + keylocation = "prompt"; + mountpoint = "none"; + normalization = "formD"; + xattr = "sa"; + }; - datasets = { - root = { - mountpoint = "/"; - type = "zfs_fs"; - options.mountpoint = "legacy"; - }; - "root/home" = { - mountpoint = "/home"; - type = "zfs_fs"; - options = { - mountpoint = "legacy"; - refreservation = "1G"; - }; - }; - "root/var" = { - mountpoint = "/var"; - type = "zfs_fs"; - options.mountpoint = "legacy"; + datasets = { + root = { + mountpoint = "/"; + type = "zfs_fs"; + options.mountpoint = "legacy"; + }; + "root/home" = { + mountpoint = "/home"; + type = "zfs_fs"; + options = { + mountpoint = "legacy"; + refreservation = "1G"; }; - "root/var/coredump" = { - mountpoint = "/var/lib/systemd/coredump"; - type = "zfs_fs"; - options = { - atime = "off"; - compression = "zle"; - mountpoint = "legacy"; - recordsize = "1M"; - }; + }; + "root/var" = { + mountpoint = "/var"; + type = "zfs_fs"; + options.mountpoint = "legacy"; + }; + "root/var/coredump" = { + mountpoint = "/var/lib/systemd/coredump"; + type = "zfs_fs"; + options = { + atime = "off"; + compression = "zle"; + mountpoint = "legacy"; + recordsize = "1M"; }; - "root/var/log" = { - mountpoint = "/var/log"; - type = "zfs_fs"; - options = { - atime = "off"; - mountpoint = "legacy"; - }; + }; + "root/var/log" = { + mountpoint = "/var/log"; + type = "zfs_fs"; + options = { + atime = "off"; + mountpoint = "legacy"; }; - "root/nix" = { - mountpoint = "/nix"; - type = "zfs_fs"; - options = { - atime = "off"; - mountpoint = "legacy"; - }; + }; + "root/nix" = { + mountpoint = "/nix"; + type = "zfs_fs"; + options = { + atime = "off"; + mountpoint = "legacy"; }; - "root/nix/store" = { - mountpoint = "/nix/store"; - type = "zfs_fs"; - options = { - "com.sun:auto-snapshot" = "false"; - mountpoint = "legacy"; - recordsize = "256K"; - }; + }; + "root/nix/store" = { + mountpoint = "/nix/store"; + type = "zfs_fs"; + options = { + "com.sun:auto-snapshot" = "false"; + mountpoint = "legacy"; + recordsize = "256K"; }; }; }; diff --git a/nixos/workstation/hosts/msix/disko.nix b/nixos/workstation/hosts/msix/disko.nix index abed6a65..03d467f9 100644 --- a/nixos/workstation/hosts/msix/disko.nix +++ b/nixos/workstation/hosts/msix/disko.nix @@ -10,7 +10,8 @@ ESP = { size = "1G"; type = "EF00"; - label = "BOOT"; + label = "boot"; + content = { type = "filesystem"; format = "vfat"; diff --git a/nixos/workstation/hosts/rescanix/disko.nix b/nixos/workstation/hosts/rescanix/disko.nix index 74c4be8b..805e58b1 100644 --- a/nixos/workstation/hosts/rescanix/disko.nix +++ b/nixos/workstation/hosts/rescanix/disko.nix @@ -10,7 +10,8 @@ ESP = { size = "512M"; type = "EF00"; - label = "BOOT"; + label = "boot"; + content = { type = "filesystem"; format = "vfat"; From d1dedab4a425d43062428b0059a01ddc675555a7 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Sun, 19 May 2024 13:10:59 +0800 Subject: [PATCH 2/9] refactor(packages/btrfs-progs): clean up error messages in dump-csum patch --- packages/btrfs-progs/dump-csum.patch | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/btrfs-progs/dump-csum.patch b/packages/btrfs-progs/dump-csum.patch index df1eabe4..871c1212 100644 --- a/packages/btrfs-progs/dump-csum.patch +++ b/packages/btrfs-progs/dump-csum.patch @@ -49,10 +49,10 @@ index c19e664a..8d491c8f 100644 DECLARE_COMMAND(send); diff --git a/cmds/inspect-dump-csum.c b/cmds/inspect-dump-csum.c new file mode 100644 -index 00000000..8e607e51 +index 00000000..4597ebf6 --- /dev/null +++ b/cmds/inspect-dump-csum.c -@@ -0,0 +1,243 @@ +@@ -0,0 +1,244 @@ +/* + * Copyright (C) 2019 SUSE. All rights reserved. + * @@ -223,7 +223,7 @@ index 00000000..8e607e51 +} + +static const char * const cmd_inspect_dump_csum_usage[] = { -+ "btrfs inspect-internal dump-csum ", ++ "btrfs inspect-internal dump-csum ", + "Dump checksums for a given file", + "", + OPTLINE("-d|--debug", "Be more verbose"), @@ -269,13 +269,13 @@ index 00000000..8e607e51 + + fd = open(filename, O_RDONLY); + if (fd < 0) { -+ error("cannot open file %s: %m", filename); ++ error("couldn't open file %s: %m", filename); + return -errno; + } + + devfd = open(device, O_RDONLY); + if (devfd < 0) { -+ error("cannot open device %s: %m", device); ++ error("couldn't open device %s: %m", device); + ret = -errno; + goto out_close; + } @@ -284,13 +284,14 @@ index 00000000..8e607e51 + + if (btrfs_super_magic(&sb) != BTRFS_MAGIC) { + ret = -EINVAL; -+ error("bad magic on superblock on %s", device); ++ error("bad superblock magic on %s", device); + goto out_close; + } + + ret = btrfs_get_extent_csum(fd, &sb); + if (ret) -+ error("checsum lookup for file %s failed", filename); ++ error("checksum lookup for file %s failed", filename); ++ +out_close: + close(fd); + return ret; From 2d1d413a7563b73fedd01534468f560eeb4e38ed Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Sun, 19 May 2024 19:16:37 +0800 Subject: [PATCH 3/9] feat(packages/strace): add colors patch https://github.com/xfgusta/strace-with-colors --- packages/list.nix | 4 + packages/strace/colors.patch | 914 +++++++++++++++++++++++++++++++++++ packages/strace/default.nix | 11 + 3 files changed, 929 insertions(+) create mode 100644 packages/strace/colors.patch create mode 100644 packages/strace/default.nix diff --git a/packages/list.nix b/packages/list.nix index 8c6fa134..0c03b6be 100644 --- a/packages/list.nix +++ b/packages/list.nix @@ -113,6 +113,10 @@ name = "slurp"; source = ./slurp; } + { + name = "strace"; + source = ./strace; + } { name = "tbw"; source = ./tbw; diff --git a/packages/strace/colors.patch b/packages/strace/colors.patch new file mode 100644 index 00000000..7b682b9e --- /dev/null +++ b/packages/strace/colors.patch @@ -0,0 +1,914 @@ +diff --git a/src/color.h b/src/color.h +new file mode 100644 +index 000000000..e84b06672 +--- /dev/null ++++ b/src/color.h +@@ -0,0 +1,12 @@ ++#ifndef COLOR_H ++#define COLOR_H ++ ++#define C_RESET "\033[0m" ++#define C_RED "\033[31m" ++#define C_GREEN "\033[32m" ++#define C_YELLOW "\033[33m" ++#define C_BLUE "\033[34m" ++#define C_MAGENTA "\033[35m" ++#define C_CYAN "\033[36m" ++ ++#endif +diff --git a/src/futex.c b/src/futex.c +index ac2c7ffd8..6c094b0a6 100644 +--- a/src/futex.c ++++ b/src/futex.c +@@ -25,6 +25,7 @@ + #include "xlat/futexops.h" + #include "xlat/futexwakeops.h" + #include "xlat/futexwakecmps.h" ++#include "color.h" + + static int + do_futex(struct tcb *const tcp, const print_obj_by_addr_fn print_ts) +diff --git a/src/ioctl.c b/src/ioctl.c +index fc6cef933..55ad6966e 100644 +--- a/src/ioctl.c ++++ b/src/ioctl.c +@@ -12,6 +12,7 @@ + #include "defs.h" + #include + #include "xlat/ioctl_dirs.h" ++#include "color.h" + + #if defined(SPARC) || defined(SPARC64) + /* +@@ -480,10 +481,10 @@ SYS_FUNC(ioctl) + if (iop) { + if (ret) + tprint_alternative_value(); +- tprints_string(iop->symbol); ++ tprintf_string(C_YELLOW "%s" C_RESET, iop->symbol); + while ((iop = ioctl_next_match(iop))) { + tprint_alternative_value(); +- tprints_string(iop->symbol); ++ tprintf_string(C_YELLOW "%s" C_RESET, iop->symbol); + } + } else if (!ret) { + ioctl_print_code(tcp->u_arg[1]); +diff --git a/src/ipc.c b/src/ipc.c +index c9ccf2687..26cb80b4c 100644 +--- a/src/ipc.c ++++ b/src/ipc.c +@@ -8,6 +8,7 @@ + + #include "defs.h" + #include "xlat/ipccalls.h" ++#include "color.h" + + SYS_FUNC(ipc) + { +diff --git a/src/ipc_shm.c b/src/ipc_shm.c +index e9999c5f2..946851391 100644 +--- a/src/ipc_shm.c ++++ b/src/ipc_shm.c +@@ -26,6 +26,7 @@ + + #include "xlat/shm_resource_flags.h" + #include "xlat/shm_flags.h" ++#include "color.h" + + SYS_FUNC(shmget) + { +diff --git a/src/mem.c b/src/mem.c +index a959bf708..9f09a1258 100644 +--- a/src/mem.c ++++ b/src/mem.c +@@ -14,6 +14,7 @@ + #include "defs.h" + #include + #include ++#include "color.h" + + unsigned long + get_pagesize(void) +@@ -90,7 +91,7 @@ print_mmap_flags(kernel_ulong_t flags) + * print_xlat_u is not used here because the whole thing + * is potentially inside a comment already. + */ +- tprints_string("MAP_HUGE_SHIFT"); ++ tprints_string(C_YELLOW "MAP_HUGE_SHIFT" C_RESET); + tprint_shift_end(); + } + +diff --git a/src/memfd_create.c b/src/memfd_create.c +index a4509a27d..6fbed3f1f 100644 +--- a/src/memfd_create.c ++++ b/src/memfd_create.c +@@ -9,6 +9,7 @@ + #include "defs.h" + #include + #include "xlat/memfd_create_flags.h" ++#include "color.h" + + #ifndef MFD_NAME_MAX_LEN + # define MFD_NAME_MAX_LEN (255 - (sizeof("memfd:") - 1)) +@@ -52,7 +53,7 @@ SYS_FUNC(memfd_create) + * print_xlat_u is not used here because the whole thing + * is potentially inside a comment already. + */ +- tprints_string("MFD_HUGE_SHIFT"); ++ tprints_string(C_YELLOW "MFD_HUGE_SHIFT" C_RESET); + tprint_shift_end(); + } + +diff --git a/src/mmsghdr.c b/src/mmsghdr.c +index ce793f4b5..668f506fb 100644 +--- a/src/mmsghdr.c ++++ b/src/mmsghdr.c +@@ -13,6 +13,7 @@ + #include "msghdr.h" + #include "xstring.h" + #include ++#include "color.h" + + static bool + fetch_struct_mmsghdr_for_print(struct tcb *const tcp, +@@ -138,7 +139,7 @@ dumpiov_in_mmsghdr(struct tcb *const tcp, kernel_ulong_t addr) + fetched = fetch_struct_mmsghdr(tcp, addr, &mmsg); + if (!fetched) + break; +- tprintf_string(" = %" PRI_klu " buffers in vector %u\n", ++ tprintf_string(" = " C_CYAN "%" PRI_klu C_RESET " buffers in vector " C_CYAN "%u" C_RESET "\n", + (kernel_ulong_t) mmsg.msg_hdr.msg_iovlen, i); + dumpiov_upto(tcp, mmsg.msg_hdr.msg_iovlen, + ptr_to_kulong(mmsg.msg_hdr.msg_iov), +diff --git a/src/netlink.c b/src/netlink.c +index e75e90440..e36031fc0 100644 +--- a/src/netlink.c ++++ b/src/netlink.c +@@ -52,6 +52,7 @@ + #include "xlat/nl_sock_diag_types.h" + #include "xlat/nl_xfrm_types.h" + #include "xlat/nlmsgerr_attrs.h" ++#include "color.h" + + /* + * Fetch a struct nlmsghdr from the given address. +diff --git a/src/netlink_netlink_diag.c b/src/netlink_netlink_diag.c +index e0d689421..70829659e 100644 +--- a/src/netlink_netlink_diag.c ++++ b/src/netlink_netlink_diag.c +@@ -19,6 +19,7 @@ + #include "xlat/netlink_diag_show.h" + #include "xlat/netlink_socket_flags.h" + #include "xlat/netlink_states.h" ++#include "color.h" + + DECL_NETLINK_DIAG_DECODER(decode_netlink_diag_req) + { +diff --git a/src/numa.c b/src/numa.c +index 3e7fb2984..b2f74992f 100644 +--- a/src/numa.c ++++ b/src/numa.c +@@ -8,6 +8,7 @@ + */ + + #include "defs.h" ++#include "color.h" + + static bool + print_node(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data) +@@ -96,7 +97,7 @@ print_mode(struct tcb *const tcp, const kernel_ulong_t mode_arg) + tprint_comment_begin(); + + tprint_flags_begin(); +- tprints_string(mode_str); ++ tprintf_string(C_YELLOW "%s" C_RESET, mode_str); + tprint_flags_or(); + printflags_ex(flags, NULL, XLAT_STYLE_ABBREV, mpol_mode_flags, NULL); + tprint_flags_end(); +diff --git a/src/perf.c b/src/perf.c +index 1a39cd0c7..4fe1bff1d 100644 +--- a/src/perf.c ++++ b/src/perf.c +@@ -25,6 +25,7 @@ + #include "xlat/perf_hw_id.h" + #include "xlat/perf_sw_ids.h" + #include "xlat/perf_type_id.h" ++#include "color.h" + + struct pea_desc { + struct perf_event_attr *attr; +diff --git a/src/print_fields.h b/src/print_fields.h +index 60ecf56af..b51683460 100644 +--- a/src/print_fields.h ++++ b/src/print_fields.h +@@ -10,6 +10,7 @@ + # define STRACE_PRINT_FIELDS_H + + # include "static_assert.h" ++#include "color.h" + + # ifdef IN_STRACE + +@@ -140,13 +141,13 @@ tprint_bitset_end(void) + static inline void + tprint_comment_begin(void) + { +- STRACE_PRINTS(" /* "); ++ STRACE_PRINTS(C_MAGENTA " /* "); + } + + static inline void + tprint_comment_end(void) + { +- STRACE_PRINTS(" */"); ++ STRACE_PRINTS(" */" C_RESET); + } + + static inline void +@@ -256,7 +257,7 @@ tprint_space(void) + static inline void + tprint_null(void) + { +- STRACE_PRINTS("NULL"); ++ STRACE_PRINTS(C_CYAN "NULL" C_RESET); + } + + static inline void +@@ -268,13 +269,13 @@ tprint_newline(void) + static inline void + tprints_field_name(const char *name) + { +- STRACE_PRINTF("%s=", name); ++ STRACE_PRINTF(C_BLUE "%s" C_RESET "=", name); + } + + static inline void + tprints_arg_name_begin(const char *name) + { +- STRACE_PRINTF("%s=", name); ++ STRACE_PRINTF(C_BLUE "%s" C_RESET "=", name); + } + + static inline void +@@ -285,7 +286,7 @@ tprint_arg_name_end(void) + static inline void + tprints_arg_begin(const char *name) + { +- STRACE_PRINTF("%s(", name); ++ STRACE_PRINTF(C_RED "%s" C_RESET "(", name); + } + + static inline void +@@ -319,19 +320,19 @@ tprint_sysret_end(void) + } + + # define PRINT_VAL_D(val_) \ +- STRACE_PRINTF("%lld", sign_extend_unsigned_to_ll(val_)) ++ STRACE_PRINTF(C_CYAN "%lld" C_RESET, sign_extend_unsigned_to_ll(val_)) + + # define PRINT_VAL_U(val_) \ +- STRACE_PRINTF("%llu", zero_extend_signed_to_ull(val_)) ++ STRACE_PRINTF(C_CYAN "%llu" C_RESET, zero_extend_signed_to_ull(val_)) + + # define PRINT_VAL_X(val_) \ +- STRACE_PRINTF("%#llx", zero_extend_signed_to_ull(val_)) ++ STRACE_PRINTF(C_CYAN "%#llx" C_RESET, zero_extend_signed_to_ull(val_)) + + # define PRINT_VAL_03O(val_) \ +- STRACE_PRINTF("%#03llo", zero_extend_signed_to_ull(val_)) ++ STRACE_PRINTF(C_CYAN "%#03llo" C_RESET, zero_extend_signed_to_ull(val_)) + + # define PRINT_VAL_0X(val_) \ +- STRACE_PRINTF("%#0*llx", (int) sizeof(val_) * 2, \ ++ STRACE_PRINTF(C_CYAN "%#0*llx" C_RESET, (int) sizeof(val_) * 2, \ + zero_extend_signed_to_ull(val_)) + + # define PRINT_VAL_ID(val_) \ +diff --git a/src/print_instruction_pointer.c b/src/print_instruction_pointer.c +index d2cc7628b..80692d6cf 100644 +--- a/src/print_instruction_pointer.c ++++ b/src/print_instruction_pointer.c +@@ -15,8 +15,8 @@ print_instruction_pointer(struct tcb *tcp) + tprint_attribute_begin(); + if (get_instruction_pointer(tcp, &ip)) { + tprintf_string(current_wordsize == 4 +- ? "%08" PRI_klx +- : "%016" PRI_klx, ip); ++ ? C_CYAN "%08" PRI_klx C_RESET ++ : C_CYAN "%016" PRI_klx C_RESET, ip); + } else { + tprints_string(current_wordsize == 4 + ? "????????" +diff --git a/src/print_syscall_number.c b/src/print_syscall_number.c +index 82a1eaa66..ec046e43f 100644 +--- a/src/print_syscall_number.c ++++ b/src/print_syscall_number.c +@@ -6,13 +6,14 @@ + */ + + #include "defs.h" ++#include "color.h" + + void + print_syscall_number(struct tcb *tcp) + { + tprint_attribute_begin(); + if (tcp->true_scno != (kernel_ulong_t) -1) +- tprintf_string("%4" PRI_klu, tcp->true_scno); ++ tprintf_string(C_CYAN "%4" PRI_klu C_RESET, tcp->true_scno); + else + tprint_unavailable(); + tprint_attribute_end(); +diff --git a/src/printmode.c b/src/printmode.c +index baab46449..a718627cf 100644 +--- a/src/printmode.c ++++ b/src/printmode.c +@@ -16,6 +16,7 @@ + #include + + #include "xlat/modetypes.h" ++#include "color.h" + + void + print_symbolic_mode_t(const unsigned int mode) +@@ -31,13 +32,21 @@ print_symbolic_mode_t(const unsigned int mode) + if (!ifmt || xlat_verbose(xlat_verbosity) == XLAT_STYLE_RAW) + return; + +- (xlat_verbose(xlat_verbosity) == XLAT_STYLE_ABBREV +- ? tprintf_string : tprintf_comment)("%s%s%s%s%s%#03o", ++ if(xlat_verbose(xlat_verbosity) == XLAT_STYLE_ABBREV) { ++ tprintf_string(C_YELLOW "%s" C_RESET "%s%s%s%s" C_CYAN "%#03o" C_RESET, ++ ifmt, ifmt[0] ? "|" : "", ++ (mode & S_ISUID) ? C_YELLOW "S_ISUID" C_RESET "|" : "", ++ (mode & S_ISGID) ? C_YELLOW "S_ISGID" C_RESET "|" : "", ++ (mode & S_ISVTX) ? C_YELLOW "S_ISVTX" C_RESET "|" : "", ++ mode & ~(S_IFMT|S_ISUID|S_ISGID|S_ISVTX)); ++ } else { ++ tprintf_comment("%s%s%s%s%s%#03o", + ifmt, ifmt[0] ? "|" : "", + (mode & S_ISUID) ? "S_ISUID|" : "", + (mode & S_ISGID) ? "S_ISGID|" : "", + (mode & S_ISVTX) ? "S_ISVTX|" : "", + mode & ~(S_IFMT|S_ISUID|S_ISGID|S_ISVTX)); ++ } + } + + void +diff --git a/src/ptrace.c b/src/ptrace.c +index 663a5f314..be9b7d61b 100644 +--- a/src/ptrace.c ++++ b/src/ptrace.c +@@ -31,6 +31,7 @@ + #include "xlat/compat_ptrace_cmds.h" + #include "xlat/ptrace_setoptions_flags.h" + #include "xlat/ptrace_peeksiginfo_flags.h" ++#include "color.h" + + #define uoff(member) offsetof(struct user, member) + #define XLAT_UOFF(member) { uoff(member), "offsetof(struct user, " #member ")" } +diff --git a/src/s390.c b/src/s390.c +index ca71730c4..7b0dd6bea 100644 +--- a/src/s390.c ++++ b/src/s390.c +@@ -16,6 +16,7 @@ + # include "xlat/s390_guarded_storage_commands.h" + # include "xlat/s390_runtime_instr_commands.h" + # include "xlat/s390_sthyi_function_codes.h" ++#include "color.h" + + /* + * Since, for some reason, kernel doesn't expose all these nice constants and +@@ -510,7 +511,7 @@ print_sthyi_machine(struct tcb *tcp, struct sthyi_machine *hdr, uint16_t size, + + CHECK_SIZE_EX(hdr, last_decoded, size, "machine structure"); + +- tprints_string("/* machine */ "); ++ tprints_string(C_MAGENTA "/* machine */ " C_RESET); + tprint_struct_begin(); + if (!abbrev(tcp)) { + if (hdr->infmflg1) { /* Reserved */ +@@ -620,7 +621,7 @@ print_sthyi_partition(struct tcb *tcp, struct sthyi_partition *hdr, + + *mt = !!(hdr->infpflg1 & 0x80); + +- tprints_string("/* partition */ "); ++ tprints_string(C_MAGENTA "/* partition */ " C_RESET); + tprint_struct_begin(); + PRINT_FIELD_0X(*hdr, infpflg1); + if (!abbrev(tcp) && hdr->infpflg1) +@@ -791,7 +792,7 @@ print_funcs(const uint8_t funcs[8]) + tprint_comment_begin(); + cont = true; + } +- tprintf_string("%u: %s", i, func_descs[i]); ++ tprintf_string(C_CYAN "%u" C_RESET ": %s", i, func_descs[i]); + } + + if (cont) +@@ -806,7 +807,7 @@ print_sthyi_hypervisor(struct tcb *tcp, struct sthyi_hypervisor *hdr, + + CHECK_SIZE_EX(hdr, last_decoded, size, "hypervisor %d structure", num); + +- tprintf_string("/* hypervisor %d */ ", num); ++ tprintf_string(C_MAGENTA "/* hypervisor %d */ " C_RESET, num); + tprint_struct_begin(); + PRINT_FIELD_0X(*hdr, infyflg1); + if (!abbrev(tcp) && hdr->infyflg1) +@@ -922,7 +923,7 @@ print_sthyi_guest(struct tcb *tcp, struct sthyi_guest *hdr, uint16_t size, + { + CHECK_SIZE(hdr, size, "guest %d structure", num); + +- tprintf_string("/* guest %d */ ", num); ++ tprintf_string(C_MAGENTA "/* guest %d */ " C_RESET, num); + tprint_struct_begin(); + PRINT_FIELD_0X(*hdr, infgflg1); + if (!abbrev(tcp) && hdr->infgflg1) +@@ -1132,7 +1133,7 @@ print_sthyi_buf(struct tcb *tcp, kernel_ulong_t ptr) + tprint_struct_begin(); + + /* Header */ +- tprints_string("/* header */ "); ++ tprints_string(C_MAGENTA "/* header */ " C_RESET); + tprint_struct_begin(); + PRINT_FIELD_0X(*hdr, infhflg1); + +@@ -1349,7 +1350,7 @@ guard_storage_print_gsepl(struct tcb *tcp, uint64_t addr) + /* Since it is 64-bit even on 31-bit s390... */ + if (sizeof(addr) > current_klongsize && + addr >= (1ULL << (current_klongsize * 8))) { +- tprintf_string("%#" PRIx64, addr); ++ tprintf_string(C_CYAN "%#" PRIx64 C_RESET, addr); + + return; + } +diff --git a/src/signal.c b/src/signal.c +index 98f84d500..c1879aaaa 100644 +--- a/src/signal.c ++++ b/src/signal.c +@@ -15,6 +15,7 @@ + #include "defs.h" + #include "nsig.h" + #include "xstring.h" ++#include "color.h" + + /* The libc headers do not define this constant since it should only be + used by the implementation. So we define it here. */ +@@ -241,8 +242,12 @@ printsignal(int nr) + PRINT_VAL_D(nr); + if (!str || xlat_verbose(xlat_verbosity) == XLAT_STYLE_RAW) + return; +- (xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE +- ? tprints_comment : tprints_string)(str); ++ ++ if(xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE) { ++ tprints_comment(str); ++ } else { ++ tprintf_string(C_YELLOW "%s" C_RESET, str); ++ } + } + + static void +@@ -810,8 +815,11 @@ SYS_FUNC(rt_sigtimedwait_time64) + + SYS_FUNC(restart_syscall) + { +- tprintf_string("<... resuming interrupted %s ...>", +- tcp->s_prev_ent ? tcp->s_prev_ent->sys_name : "system call"); ++ if(tcp->s_prev_ent) { ++ tprintf_string("<... resuming interrupted " C_RED "%s" C_RESET " ...>", tcp->s_prev_ent->sys_name); ++ } else { ++ tprints_string("<... resuming interrupted system call ...>"); ++ } + + return RVAL_DECODED; + } +diff --git a/src/sockaddr.c b/src/sockaddr.c +index ee1ce8828..7b7b77d39 100644 +--- a/src/sockaddr.c ++++ b/src/sockaddr.c +@@ -39,6 +39,7 @@ + #include "xlat/bluetooth_l2_cid.h" + #include "xlat/bluetooth_l2_psm.h" + #include "xlat/hci_channels.h" ++#include "color.h" + + #include "xlat/rxrpc_services.h" + +@@ -181,7 +182,7 @@ print_inet_addr(const int af, + if (var_name && + (xlat_verbose(xlat_verbosity) == XLAT_STYLE_ABBREV)) { + tprint_arg_next(); +- tprintf_string("&%s", var_name); ++ tprintf_string(C_BLUE "&%s" C_RESET, var_name); + } + tprint_arg_end(); + +@@ -628,7 +629,7 @@ print_bluetooth_l2_psm(uint16_t psm) + tprint_plus(); + PRINT_VAL_U(psm_he - L2CAP_PSM_DYN_START); + } else { +- tprints_string("L2CAP_PSM_???"); ++ tprints_string(C_YELLOW "L2CAP_PSM_???" C_RESET); + } + + if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE || !psm_str) +@@ -663,7 +664,7 @@ print_bluetooth_l2_cid(uint16_t cid) + tprint_plus(); + PRINT_VAL_U(cid_he - L2CAP_CID_DYN_START); + } else { +- tprints_string("L2CAP_CID_???"); ++ tprints_string(C_YELLOW "L2CAP_CID_???" C_RESET); + } + + if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE || !cid_str) +diff --git a/src/strace.c b/src/strace.c +index 85d69485f..0c43e0d6d 100644 +--- a/src/strace.c ++++ b/src/strace.c +@@ -43,6 +43,8 @@ + #include "wait.h" + #include "secontext.h" + ++#include "color.h" ++ + /* In some libc, these aren't declared. Do it ourself: */ + extern char **environ; + extern int optind; +@@ -95,6 +97,12 @@ static int rflag_scale = 1000; + static int rflag_width = 6; + static bool print_pid_pfx; + ++/* -1 = auto ++ * 0 = never ++ * 1 = always ++ */ ++int no_color_flag = -1; ++ + static unsigned int version_verbosity; + + /* -I n */ +@@ -350,6 +358,8 @@ Filtering:\n\ + print only syscalls that returned with an error code\n\ + \n\ + Output format:\n\ ++ --color[=WHEN]\n\ ++ colorize the output; WHEN can be 'always', 'auto' (default), or 'never'\n\ + -a COLUMN, --columns=COLUMN\n\ + alignment COLUMN for printing syscall results (default %d)\n\ + -e abbrev=SET, --abbrev=SET\n\ +@@ -716,7 +726,23 @@ static void + tvprintf(const char *const fmt, va_list args) + { + if (current_tcp) { +- int n = vfprintf(current_tcp->outf, fmt, args); ++ int n; ++ if(no_color_flag) { ++ char new_fmt[strlen(fmt) + 1]; ++ int i = 0; ++ for(const char *c = fmt; *c; c++) { ++ if(*c == '\033') { ++ for(c++; *c && *c != 'm'; c++); ++ continue; ++ } ++ ++ new_fmt[i++] = *c; ++ } ++ new_fmt[i] = '\0'; ++ n = vfprintf(current_tcp->outf, new_fmt, args); ++ } else ++ n = vfprintf(current_tcp->outf, fmt, args); ++ + if (n < 0) { + /* very unlikely due to vfprintf buffering */ + outf_perror(current_tcp); +@@ -742,7 +768,22 @@ void + tprints_string(const char *str) + { + if (current_tcp) { +- int n = fputs_unlocked(str, current_tcp->outf); ++ int n; ++ if(no_color_flag) { ++ char new_str[strlen(str) + 1]; ++ int i = 0; ++ for(const char *c = str; *c; c++) { ++ if(*c == '\033') { ++ for(c++; *c && *c != 'm'; c++); ++ continue; ++ } ++ new_str[i++] = *c; ++ } ++ new_str[i] = '\0'; ++ n = fputs_unlocked(new_str, current_tcp->outf); ++ } else ++ n = fputs_unlocked(str, current_tcp->outf); ++ + if (n >= 0) { + current_tcp->curcol += strlen(str); + return; +@@ -885,7 +926,7 @@ printleader(struct tcb *tcp) + else + xsprintf(str, "%lld", (long long) local); + if (tflag_width) +- tprintf_string("%s.%0*ld ", str, tflag_width, ++ tprintf_string("%s." C_CYAN "%0*ld" C_RESET " ", str, tflag_width, + (long) ts.tv_nsec / tflag_scale); + else + tprintf_string("%s ", str); +@@ -903,10 +944,10 @@ printleader(struct tcb *tcp) + ts_sub(&dts, &ts, &ots); + ots = ts; + +- tprintf_string("%s%6ld", ++ tprintf_string("%s" C_CYAN "%6ld" C_RESET, + tflag_format ? "(+" : "", (long) dts.tv_sec); + if (rflag_width) { +- tprintf_string(".%0*ld", rflag_width, ++ tprintf_string("." C_CYAN "%0*ld" C_RESET, rflag_width, + (long) dts.tv_nsec / rflag_scale); + } + tprints_string(tflag_format ? ") " : " "); +@@ -2263,6 +2304,7 @@ init(int argc, char *argv[]) + + enum { + GETOPT_SECCOMP = 0x100, ++ GETOPT_COLOR, + GETOPT_DAEMONIZE, + GETOPT_HEX_STR, + GETOPT_FOLLOWFORKS, +@@ -2291,6 +2333,7 @@ init(int argc, char *argv[]) + GETOPT_QUAL_SECONTEXT, + }; + static const struct option longopts[] = { ++ { "color", optional_argument, 0, GETOPT_COLOR }, + { "columns", required_argument, 0, 'a' }, + { "output-append-mode", no_argument, 0, 'A' }, + { "detach-on", required_argument, 0, 'b' }, +@@ -2401,6 +2444,23 @@ init(int argc, char *argv[]) + case 'D': + daemonized_tracer++; + break; ++ case GETOPT_COLOR: ++ if(optarg) { ++ if(!strcmp(optarg , "always")) ++ no_color_flag = 0; ++ else if(!strcmp(optarg, "never")) ++ no_color_flag = 1; ++ else if(!strcmp(optarg, "auto")) ++ no_color_flag = -1; ++ else ++ error_msg_and_die("invalid argument \"%s\" for \"--color\"\n" ++ "Valid arguments are:\n" ++ " - \"always\"\n" ++ " - \"never\"\n" ++ " - \"auto\"", ++ optarg); ++ } ++ break; + case GETOPT_DAEMONIZE: + daemonized_tracer_long = + find_arg_val(optarg, daemonize_str, +@@ -2935,6 +2995,14 @@ init(int argc, char *argv[]) + qflag_short == 2 ? qqflag_qual : qqqflag_qual); + } + ++ // --color=auto (default) ++ if(no_color_flag == -1) ++ no_color_flag = !isatty(STDOUT_FILENO); ++ ++ // if we set NO_COLOR or use --output ++ if((getenv("NO_COLOR")) || outfname) ++ no_color_flag = 1; ++ + /* + * startup_child() must be called before the signal handlers get + * installed below as they are inherited into the spawned process. +diff --git a/src/swapon.c b/src/swapon.c +index aaa409a66..03446d282 100644 +--- a/src/swapon.c ++++ b/src/swapon.c +@@ -10,6 +10,7 @@ + #include + + #include "xlat/swap_flags.h" ++#include "color.h" + + SYS_FUNC(swapon) + { +diff --git a/src/syscall.c b/src/syscall.c +index c636ba37c..db39380b1 100644 +--- a/src/syscall.c ++++ b/src/syscall.c +@@ -25,6 +25,7 @@ + #include "retval.h" + #include + #include ++#include "color.h" + + /* for struct iovec */ + #include +@@ -421,7 +422,7 @@ print_err(int64_t err, bool negated) + const char *str = err_name(negated ? -err : err); + + if (!str || xlat_verbose(xlat_verbosity) != XLAT_STYLE_ABBREV) +- tprintf_string(negated ? "%" PRId64 : "%" PRIu64, err); ++ tprintf_string(negated ? C_CYAN "%" PRId64 C_RESET : C_CYAN "%" PRIu64 C_RESET, err); + if (!str || xlat_verbose(xlat_verbosity) == XLAT_STYLE_RAW) + return; + (xlat_verbose(xlat_verbosity) == XLAT_STYLE_ABBREV +@@ -443,7 +444,7 @@ print_err_ret(kernel_ulong_t ret, unsigned long u_error) + tprints_sysret_string("strerror", strerror(u_error)); + } else { + tprints_sysret_next("strerror"); +- tprintf_string("(errno %lu)", u_error); ++ tprintf_string("(errno " C_CYAN "%lu" C_RESET ")", u_error); + } + } + +@@ -760,7 +761,7 @@ print_syscall_resume(struct tcb *tcp) + || (tcp->flags & TCB_REPRINT)) { + tcp->flags &= ~TCB_REPRINT; + printleader(tcp); +- tprintf_string("<... %s resumed>", tcp_sysent(tcp)->sys_name); ++ tprintf_string("<... " C_RED "%s" C_RESET " resumed>", tcp_sysent(tcp)->sys_name); + } + printing_tcp = tcp; + } +@@ -1012,7 +1013,7 @@ syscall_exiting_trace(struct tcb *tcp, struct timespec *ts, int res) + ts_sub(ts, ts, &tcp->etime); + PRINT_VAL_D(ts->tv_sec); + if (Tflag_width) { +- tprintf_string(".%0*ld", Tflag_width, ++ tprintf_string("." C_CYAN "%0*ld" C_RESET, Tflag_width, + (long) ts->tv_nsec / Tflag_scale); + } + tprint_associated_info_end(); +diff --git a/src/sysctl.c b/src/sysctl.c +index 8624e018e..bd48df718 100644 +--- a/src/sysctl.c ++++ b/src/sysctl.c +@@ -11,6 +11,7 @@ + #include + typedef struct __sysctl_args struct_sysctl_args; + #include MPERS_DEFS ++#include "color.h" + + SYS_FUNC(sysctl) + { +diff --git a/src/term.c b/src/term.c +index f392af3fd..2b2e0c786 100644 +--- a/src/term.c ++++ b/src/term.c +@@ -41,6 +41,7 @@ + #endif + + #include "xlat/term_cmds_overlapping.h" ++#include "color.h" + + static void + decode_oflag(uint64_t val) +diff --git a/src/util.c b/src/util.c +index 343cf8850..efea2b16a 100644 +--- a/src/util.c ++++ b/src/util.c +@@ -32,6 +32,7 @@ + #include "string_to_uint.h" + #include "xlat.h" + #include "xstring.h" ++#include "color.h" + + const struct xlat_data * + find_xlat_val_ex(const struct xlat_data * const items, const char * const s, +@@ -696,7 +697,7 @@ printdev(struct tcb *tcp, int fd, const char *path, const struct finfo *finfo) + QUOTE_OMIT_LEADING_TRAILING_QUOTES, + "<>"); + tprint_associated_info_begin(); +- tprintf_string("%s %u:%u", ++ tprintf_string(C_BLUE "%s" C_RESET " " C_CYAN "%u" C_RESET ":" C_CYAN "%u" C_RESET, + (finfo->type == FINFO_DEV_BLK)? "block" : "char", + finfo->dev.major, finfo->dev.minor); + tprint_associated_info_end(); +@@ -1163,7 +1164,7 @@ print_quoted_string_ex(const char *str, unsigned int size, + } + + rc = string_quote(str, outstr, size, style, escape_chars); +- tprints_string(outstr); ++ tprintf_string(C_GREEN "%s" C_RESET, outstr); + + if (((style & (QUOTE_0_TERMINATED | QUOTE_EXPECT_TRAILING_0)) + == (QUOTE_0_TERMINATED | QUOTE_EXPECT_TRAILING_0)) && rc) { +@@ -1316,7 +1317,7 @@ printstr_ex(struct tcb *const tcp, const kernel_ulong_t addr, + && ((style & (QUOTE_0_TERMINATED | QUOTE_EXPECT_TRAILING_0)) + || len > max_strlen); + +- tprints_string(outstr); ++ tprintf_string(C_GREEN "%s" C_RESET, outstr); + if (ellipsis) + tprint_more_data_follows(); + +@@ -1357,7 +1358,7 @@ print_nonzero_bytes(struct tcb *const tcp, + ret = false; + } else { + prefix_fun(); +- tprintf_string("/* bytes %u..%u */ ", start_offs, total_len - 1); ++ tprintf_string(C_MAGENTA "/* bytes %u..%u */ " C_RESET, start_offs, total_len - 1); + + print_quoted_string(str, size, style); + +@@ -1415,8 +1416,7 @@ dumpiov_upto(struct tcb *const tcp, const int len, const kernel_ulong_t addr, + data_size -= iov_len; + /* include the buffer number to make it easy to + * match up the trace with the source */ +- tprintf_string(" * %" PRI_klu " bytes in buffer %d\n", +- iov_len, i); ++ tprintf_string(" * " C_CYAN "%" PRI_klu C_RESET " bytes in buffer " C_CYAN "%d" C_RESET "\n", iov_len, i); + dumpstr(tcp, iov_iov_base(i), iov_len); + } + } +@@ -1556,7 +1556,7 @@ dumpstr(struct tcb *const tcp, const kernel_ulong_t addr, + src++; + } while (++i & DUMPSTR_BYTES_MASK); + +- tprintf_string(" | %0*" PRI_klx " %s |\n", ++ tprintf_string(" | " C_CYAN "%0*" PRI_klx C_RESET " %s |\n", + offs_chars, i - DUMPSTR_WIDTH_BYTES, outbuf); + } + } +diff --git a/src/wait.c b/src/wait.c +index 1f04e836e..950c8f526 100644 +--- a/src/wait.c ++++ b/src/wait.c +@@ -20,6 +20,7 @@ + + #include "xlat/wait4_options.h" + #include "xlat/ptrace_events.h" ++#include "color.h" + + static int + printstatus(int status) +@@ -37,7 +38,7 @@ printstatus(int status) + int sig = WSTOPSIG(status); + tprintf_string("{WIFSTOPPED(s) && WSTOPSIG(s) == %s%s}", + sprintsigname(sig & 0x7f), +- sig & 0x80 ? " | 0x80" : ""); ++ sig & 0x80 ? " |" C_CYAN "0x80" C_RESET : ""); + status &= ~W_STOPCODE(sig); + } else if (WIFSIGNALED(status)) { + tprintf_string("{WIFSIGNALED(s) && WTERMSIG(s) == %s%s}", +@@ -45,7 +46,7 @@ printstatus(int status) + WCOREDUMP(status) ? " && WCOREDUMP(s)" : ""); + status &= ~(W_EXITCODE(0, WTERMSIG(status)) | WCOREFLAG); + } else if (WIFEXITED(status)) { +- tprintf_string("{WIFEXITED(s) && WEXITSTATUS(s) == %d}", ++ tprintf_string("{WIFEXITED(s) && WEXITSTATUS(s) == " C_CYAN "%d" C_RESET "}", + WEXITSTATUS(status)); + exited = 1; + status &= ~W_EXITCODE(WEXITSTATUS(status), 0); +diff --git a/src/xlat.c b/src/xlat.c +index 5135ab440..6d6c72290 100644 +--- a/src/xlat.c ++++ b/src/xlat.c +@@ -12,6 +12,7 @@ + #include "defs.h" + #include "xstring.h" + #include ++#include "color.h" + + static enum xlat_style + get_xlat_style(enum xlat_style style) +@@ -47,7 +48,7 @@ sprint_xlat_val(uint64_t val, enum xlat_style style) + static void + print_xlat_val(uint64_t val, enum xlat_style style) + { +- tprints_string(sprint_xlat_val(val, style)); ++ tprintf_string(C_CYAN "%s" C_RESET, sprint_xlat_val(val, style)); + } + + static int +@@ -231,7 +232,7 @@ printxvals_ex(const uint64_t val, const char *dflt, enum xlat_style style, + print_xlat_val(val, style); + tprints_comment(str); + } else { +- tprints_string(str); ++ tprintf_string(C_YELLOW "%s" C_RESET, str); + } + + goto printxvals_ex_end; +@@ -441,7 +442,7 @@ printflags_ex(uint64_t flags, const char *dflt, enum xlat_style style, + tprint_flags_or(); + else if (need_comment) + tprint_comment_begin(); +- tprints_string(xlat->data[idx].str); ++ tprintf_string(C_YELLOW "%s" C_RESET, xlat->data[idx].str); + flags &= ~v; + } + if (!flags) +@@ -486,7 +487,7 @@ print_xlat_ex(const uint64_t val, const char *str, uint32_t style) + print_xlat_val(val, style); + tprints_comment(str); + } else { +- tprints_string(str); ++ tprintf_string(C_YELLOW "%s" C_RESET, str); + } + break; + } diff --git a/packages/strace/default.nix b/packages/strace/default.nix new file mode 100644 index 00000000..0fd6e222 --- /dev/null +++ b/packages/strace/default.nix @@ -0,0 +1,11 @@ +{ + host, + self, + strace, + ... +}: +with self.lib.derivations; + c.optimizeAllExceptLto host (autotools.optimizeLto + (strace.overrideAttrs (old: { + patches = (old.patches or []) ++ [./colors.patch]; + }))) From b97313f61ec5c450001345f26e968c6d05e4d6a4 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Sun, 19 May 2024 19:52:03 +0800 Subject: [PATCH 4/9] feat(library/derivations): add autotools helpers --- library/derivations/autotools.nix | 10 ++++++++++ library/derivations/default.nix | 2 ++ 2 files changed, 12 insertions(+) create mode 100644 library/derivations/autotools.nix diff --git a/library/derivations/autotools.nix b/library/derivations/autotools.nix new file mode 100644 index 00000000..8295ee62 --- /dev/null +++ b/library/derivations/autotools.nix @@ -0,0 +1,10 @@ +rec { + mkFlags = old: flags: { + configureFlags = (old.cmakeFlags or []) ++ flags; + }; + + optimizeLto = derivation: + derivation.overrideAttrs (old: (mkFlags old [ + "--enable-lto" + ])); +} diff --git a/library/derivations/default.nix b/library/derivations/default.nix index 63c34c42..32db8b24 100644 --- a/library/derivations/default.nix +++ b/library/derivations/default.nix @@ -1,6 +1,8 @@ args: { architectures = import ./architectures.nix args; + autotools = import ./autotools.nix; + c = import ./c.nix args; cmake = import ./cmake.nix; From a81499abf1879610e81ada24df1323e0df5822e3 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Sun, 19 May 2024 20:08:20 +0800 Subject: [PATCH 5/9] refactor(workstation/kernel): lower background dirty ratio --- nixos/workstation/modules/kernel/common.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/nixos/workstation/modules/kernel/common.nix b/nixos/workstation/modules/kernel/common.nix index 507ec8a5..e0c8dfea 100644 --- a/nixos/workstation/modules/kernel/common.nix +++ b/nixos/workstation/modules/kernel/common.nix @@ -7,7 +7,6 @@ in { kernel.sysctl = { "kernel.sysrq" = mkDefault 1; - "vm.dirty_background_ratio" = 15; "vm.dirty_ratio" = 25; }; }; From 293cadefa44a9676952c720b90a53e73539a22d0 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Sun, 19 May 2024 22:51:09 +0800 Subject: [PATCH 6/9] refactor(fish/functions/glfzf): set shell to dish --- home/programs/terminal/fish/functions.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/home/programs/terminal/fish/functions.nix b/home/programs/terminal/fish/functions.nix index 969f2840..d2cb4871 100644 --- a/home/programs/terminal/fish/functions.nix +++ b/home/programs/terminal/fish/functions.nix @@ -87,6 +87,7 @@ end function glfzf -d "use fzf to preview git commits" + set SHELL fish git log --graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr" $argv | \ fzf --ansi --no-sort --reverse --tiebreak=index --scroll-off=5 --preview-window=right:60% \ --preview 'function preview; set commit (echo $argv | grep -o "[a-f0-9]\{7\}"); git show -m --color=always $commit | delta --width=(tput cols); end; preview {}' \ From e77cd4c57dc1b84b5bf190c947484b0250097adb Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 20 May 2024 12:51:30 +0800 Subject: [PATCH 7/9] feat(packages/btrfs-progs): enable experimental build --- packages/btrfs-progs/default.nix | 8 +++++++- ...{receive-selinux.patch => remove-receive-errors.patch} | 0 2 files changed, 7 insertions(+), 1 deletion(-) rename packages/btrfs-progs/{receive-selinux.patch => remove-receive-errors.patch} (100%) diff --git a/packages/btrfs-progs/default.nix b/packages/btrfs-progs/default.nix index 93094e11..0068c538 100644 --- a/packages/btrfs-progs/default.nix +++ b/packages/btrfs-progs/default.nix @@ -4,6 +4,12 @@ btrfs-progs.overrideAttrs (old: { (old.patches or []) ++ [ ./dump-csum.patch - ./receive-selinux.patch + ./remove-receive-errors.patch + ]; + + configureFlags = + (old.configureFlags or []) + ++ [ + "--enable-experimental" ]; }) diff --git a/packages/btrfs-progs/receive-selinux.patch b/packages/btrfs-progs/remove-receive-errors.patch similarity index 100% rename from packages/btrfs-progs/receive-selinux.patch rename to packages/btrfs-progs/remove-receive-errors.patch From 8702f651ac36e618b448a889173415a5831648d5 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 20 May 2024 13:12:31 +0800 Subject: [PATCH 8/9] chore(secrets): rekey for rescanix --- secrets/secrets.nix | 2 +- secrets/wireless-networks.age | Bin 751 -> 751 bytes secrets/zed_workstation.age | 13 ++++++------- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/secrets/secrets.nix b/secrets/secrets.nix index d68d4df4..dbd0baf2 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -3,7 +3,7 @@ let crix = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL8EVE+n6AqS8NWfZRjqLSI3HY+2YEWEsDo9oPSMt5C+"; msix = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHwJ6RJApteQw7nKq/dAyUC5gMf+q34bFivpBoE5eOeF"; pix = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINHoKZCpEfJ+rBCndkSlH3qEMypvSuJRdieSwPVMCKZB"; - rescanix = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFFrZMlFFrKX3yZF70eEHX4RlX8ovcf/g8bPQolOAywK"; + rescanix = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIswvEJXB3eQVkLGCFj33Pi0sO0jrS8P0WbntH5DBBGf"; }; users = { msix = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIEi1hNox3FVQ43qxMBNFTUw0guBctlp5DWsD3bD89J2"; diff --git a/secrets/wireless-networks.age b/secrets/wireless-networks.age index 7e306dbb143479e623465bda0c771967300d6ab3..d3880d5bedde5d7a42360dc5d4221fa09958d232 100644 GIT binary patch delta 699 zcmZ9{T}TrF007`H)K~~vppcO3Au6`9?e=pUX0)H%-F|P|ZQfi$oxAOBo44DKce_nt zQ86T;{G~FoUdo_)P@{+-3<-^XBt@(jOUX*qBrzeZsOR3lmv6mvy|hbOkN_AIw2_Gx z7vwd&?D+%%XRM!h6nJh3F72_x5;O2@IkmX ztHi)oI*`|K$xJKm5y_5=GZ|VICIO8`sTWf%f;Ny9XYGI?FZUXnNiLyELO{Sm;Dp_4 zLJ`(!fnw@N(yCSZ(`hfQbc*a@Cf-bG>`^GrBvk(-im1?pBOl^)0*?z|0yd$vLXRSP zL-+UU0v5#tCe;|HX&7uJnHUwfQiw4l;aP~tAx@o!#L%N6#6^w8}(B}yz ztN=j>p*^mE(#=I^f|Ve-kSHccfv`THWv!ZA&K$Pc(2PaS@G6%NjTqc|Uvr4!{WM@v z=pm6zCKChls2gbZ_=sROVwF41Zb*UJLV}4vvnE{*OzLph#$t>!hh{|Mv%;}!{dFY; z*?!-&bl~OsdmMJJOfGho;8)K+lik3Y__S@(3#bT<$`bNKq=!7cL5 zn5`rUPV6=O@eN%e6Z$~HX_~59&U#0#t^RbptZu+=|Q|I;p dxzQt^IyMf}K3qgrUR}P~SKc)FSl~6cte6U!PuX=9m=~o>!VvUX*4Kp66%i9v0>ro*HPt6&94~7!j76Xi#dA z8LS^3l$M`p6yR9lRTSvtWtLjtS>_s$6q%P?Y~%^FPFGhUG1s%eGN-&S#m_jx)g&b| zrNG47DL>CL(KE`})Z8mCG9t+!tTa#C+^d*NV#dm{$ya(*>!a9qZGR|#CH`560S{N_ zqieGxUtBg94X~8-TrE?$dW+p0hXq!}B9pS-re(VqJl`NzQC+|KtNX<+3p3w{C9Ch9 zlxbbF_oe6W-_iB%(@Hrz7#J?xnt3g|-Fn$+|9GhbOa4vCidA ssh-ed25519 glx6Xw hwQ5iioYPM0z8D65dbH4375df+X0UmXzwmbfBGdVYzI -B/sPh/tu/FiCNocwz+9AdNvc7cKvsABoR5k0pW7xkUg --> ssh-ed25519 L7dDgQ dULlYvkwtUWcQqhtwhPYqBrHkbJ/Ns36Ztb8zpvwLS8 -+ptNJVKd55wu3lfVgHqLjjpB81dQ25l/6SqoEK0oHHI ---- 1/qQTZ/kmlcBckCNnTeZ87CS8AhxjimRL+ZhYiTl7WE -c`tn]E pR,WdQ -o027f19W@Ngߕ. ssh-ed25519 glx6Xw 2qAicYuDVzcaFmH10+w+IkWzpLCarpxmuHKp8AH1wF4 +R4Y82s94sZ0V9KAAFI/17Gs3U5jGHKJ4GstbUk/btb0 +-> ssh-ed25519 S4MiMA BktEOHp8fBJxtmsqXP7o3VYfXpWqyxXOqGgQWDzNWx4 +KLOTNs1f0nldsXp1AL3UcVCE+tW1Kkxc+eAL8+8F4Gc +--- V0RJ5bsvhznbutEGEa3eQ9TXuH9TumjQ970istZtiwY +dsp6 |AfΏ BK7B.`<{2#S"=DŽ \ No newline at end of file From 1a28608ce97ba40dd9b80057a6837952395c08db Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 20 May 2024 13:42:39 +0800 Subject: [PATCH 9/9] feat(rescanix): add tor browser --- home/hosts/rescanix.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/home/hosts/rescanix.nix b/home/hosts/rescanix.nix index b50f0f96..96298ff1 100644 --- a/home/hosts/rescanix.nix +++ b/home/hosts/rescanix.nix @@ -114,6 +114,7 @@ tbw testdisk timg + tor-browser unigine-heaven upx usbutils