diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index c6272ed..5174715 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: command: - - NIXPKGS_ALLOW_INSECURE=1 NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 nix flake check --accept-flake-config + - NIXPKGS_ALLOW_INSECURE=1 nix flake check --accept-flake-config --impure - nix run .#alejandra-custom -- -c . -e ./npins uses: ./.github/workflows/nix.yml with: diff --git a/flake.lock b/flake.lock index 0819156..049012b 100644 Binary files a/flake.lock and b/flake.lock differ diff --git a/flake.nix b/flake.nix index 002d9dc..013d46c 100644 --- a/flake.nix +++ b/flake.nix @@ -16,7 +16,7 @@ ... } @ inputs: flake-parts.lib.mkFlake {inherit inputs self;} { - systems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; + systems = import inputs.systems; imports = [flake-parts.flakeModules.easyOverlay]; perSystem = { @@ -94,12 +94,7 @@ devShells = { default = pkgs.mkShellNoCC { name = "nyxexprs"; - packages = [ - pkgs.npins - - # Also put the default formatter in the devshell - config.formatter - ]; + packages = [pkgs.npins]; }; }; @@ -130,7 +125,8 @@ }; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + systems.url = "github:nix-systems/default-linux"; flake-parts = { url = "github:hercules-ci/flake-parts"; inputs.nixpkgs-lib.follows = "nixpkgs"; @@ -142,16 +138,6 @@ }; # Rest of my packages will be constructed from previous flakes - ndg = { - url = "github:feel-co/ndg"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - nh = { - url = "github:nix-community/nh"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - watt = { url = "github:NotAShelf/watt"; inputs.nixpkgs.follows = "nixpkgs"; @@ -167,6 +153,11 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + ndg = { + url = "github:feel-co/ndg"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + licenseit = { url = "github:notashelf/licenseit"; inputs.nixpkgs.follows = "nixpkgs"; @@ -187,6 +178,11 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + nh = { + url = "github:nix-community/nh"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + gh-notify = { url = "github:notashelf/gh-notify"; inputs.nixpkgs.follows = "nixpkgs"; @@ -202,15 +198,13 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - tuigreet = { - url = "github:notashelf/tuigreet"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - # 3rd party flakes that I want to extract packages from wiremix = { url = "github:tsowell/wiremix"; - inputs.nixpkgs.follows = "nixpkgs"; + inputs = { + nixpkgs.follows = "nixpkgs"; + systems.follows = "systems"; + }; }; nil = { diff --git a/pkgs/btop/package.nix b/pkgs/btop/package.nix deleted file mode 100644 index a21f87e..0000000 --- a/pkgs/btop/package.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ - lib, - btop, -}: -btop.overrideAttrs { - patches = [ - ./patches/normalize_processes.patch - ]; - - meta = { - description = "Monitor of resources, with a patch to normalize process names on Nix"; - mainProgram = "btop"; - maintainers = [lib.maintainers.NotAShelf]; - }; -} diff --git a/pkgs/btop/patches/normalize_processes.patch b/pkgs/btop/patches/normalize_processes.patch deleted file mode 100644 index a83c1a0..0000000 --- a/pkgs/btop/patches/normalize_processes.patch +++ /dev/null @@ -1,100 +0,0 @@ -From f35abef6dd17c2704f3d84e1bee0acaac9d035e1 Mon Sep 17 00:00:00 2001 -From: NotAShelf -Date: Tue, 25 Nov 2025 17:29:51 +0300 -Subject: [PATCH] Add Nix store path normalization for process monitor - ---- - src/linux/btop_collect.cpp | 62 +++++++++++++++++++++++++++++++++++++- - 1 file changed, 61 insertions(+), 1 deletion(-) - -diff --git a/src/linux/btop_collect.cpp b/src/linux/btop_collect.cpp -index eebaa50..b895320 100644 ---- a/src/linux/btop_collect.cpp -+++ b/src/linux/btop_collect.cpp -@@ -94,6 +94,54 @@ long long get_monotonicTimeUSec() - return time.tv_sec * 1000000 + time.tv_nsec / 1000; - } - -+//? Nix store path normalization -+string normalize_nix_path(const string& path) { -+ // Check if path starts with /nix/store/ -+ if (path.rfind("/nix/store/", 0) != 0) { -+ return path; -+ } -+ -+ // Find the end of the hash (31 characters after /nix/store/) -+ const size_t hash_start = 12; // length of "/nix/store/" -+ if (path.length() <= hash_start + 31) { -+ return path; -+ } -+ -+ // Look for the end of the hash (first dash after 31 chars) -+ size_t hash_end = path.find('-', hash_start); -+ if (hash_end == string::npos || hash_end != hash_start + 31) { -+ return path; -+ } -+ -+ // Extract the name part after the hash -+ string name_part = path.substr(hash_end + 1); -+ -+ // Check if the binary is in /libexec or /bin -+ size_t bin_pos = name_part.find("/bin/"); -+ size_t libexec_pos = name_part.find("/libexec/"); -+ if (bin_pos != string::npos || libexec_pos != string::npos) { -+ // Strip the directory and return just the binary name -+ size_t slash_pos = (bin_pos != string::npos) ? bin_pos + 1 : libexec_pos + 1; -+ size_t next_slash = name_part.find('/', slash_pos); -+ if (next_slash != string::npos) { -+ return name_part.substr(next_slash + 1); -+ } -+ } -+ -+ // Handle wrapped programs: .program-wrapped -> program-wrapped -+ if (name_part.rfind(".", 0) == 0 && name_part.find("-wrapped") != string::npos) { -+ return name_part.substr(1); // Remove the leading dot -+ } -+ -+ // Handle wrapped programs in directories: name/.program-wrapped -> program-wrapped -+ size_t wrapped_pos = name_part.find("/."); -+ if (wrapped_pos != string::npos && name_part.find("-wrapped", wrapped_pos) != string::npos) { -+ return name_part.substr(wrapped_pos + 2); // Remove "/." -+ } -+ -+ return name_part; -+} -+ - } - - namespace Cpu { -@@ -3012,6 +3060,8 @@ namespace Proc { - if (not pread.good()) continue; - getline(pread, new_proc.name); - pread.close(); -+ //? Apply Nix store path normalization -+ new_proc.name = normalize_nix_path(new_proc.name); - //? Check for whitespace characters in name and set offset to get correct fields from stat file - new_proc.name_offset = rng::count(new_proc.name, ' '); - -@@ -3026,7 +3076,17 @@ namespace Proc { - } - } - pread.close(); -- if (not new_proc.cmd.empty()) new_proc.cmd.pop_back(); -+ if (not new_proc.cmd.empty()) { -+ new_proc.cmd.pop_back(); -+ //? Apply Nix store path normalization to first argument (program path) -+ size_t space_pos = new_proc.cmd.find(' '); -+ if (space_pos != string::npos) { -+ string first_arg = new_proc.cmd.substr(0, space_pos); -+ new_proc.cmd = normalize_nix_path(first_arg) + new_proc.cmd.substr(space_pos); -+ } else { -+ new_proc.cmd = normalize_nix_path(new_proc.cmd); -+ } -+ } - - pread.open(d.path() / "status"); - if (not pread.good()) continue; --- -2.51.0 - -