about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--flake.lock56
-rw-r--r--flake.nix20
-rw-r--r--flake/default.nix4
-rw-r--r--flake/nixosConfigurations/default.nix16
-rw-r--r--modules/home/conf/yambar/default.nix6
-rw-r--r--modules/system/home-manager/default.nix12
-rw-r--r--pkgs/by-name/ya/yambar-cpu/.gitignore1
-rw-r--r--pkgs/by-name/ya/yambar-cpu/Cargo.lock191
-rw-r--r--pkgs/by-name/ya/yambar-cpu/Cargo.toml9
-rw-r--r--pkgs/by-name/ya/yambar-cpu/flake.lock123
-rw-r--r--pkgs/by-name/ya/yambar-cpu/flake.nix35
-rw-r--r--pkgs/by-name/ya/yambar-cpu/package.nix10
-rw-r--r--pkgs/by-name/ya/yambar-cpu/src/main.rs22
-rwxr-xr-xpkgs/by-name/ya/yambar-cpu/update.sh7
-rw-r--r--pkgs/by-name/ya/yambar-memory/.gitignore1
-rw-r--r--pkgs/by-name/ya/yambar-memory/Cargo.lock191
-rw-r--r--pkgs/by-name/ya/yambar-memory/Cargo.toml9
-rw-r--r--pkgs/by-name/ya/yambar-memory/flake.lock123
-rw-r--r--pkgs/by-name/ya/yambar-memory/flake.nix35
-rw-r--r--pkgs/by-name/ya/yambar-memory/package.nix10
-rw-r--r--pkgs/by-name/ya/yambar-memory/src/main.rs30
-rwxr-xr-xpkgs/by-name/ya/yambar-memory/update.sh7
22 files changed, 817 insertions, 101 deletions
diff --git a/flake.lock b/flake.lock
index 06b47366..4f27dfa4 100644
--- a/flake.lock
+++ b/flake.lock
@@ -718,9 +718,7 @@
         "systems": "systems",
         "templates": "templates",
         "treefmt-nix": "treefmt-nix",
-        "user_js": "user_js",
-        "yambar_cpu": "yambar_cpu",
-        "yambar_memory": "yambar_memory"
+        "user_js": "user_js"
       }
     },
     "rust-overlay": {
@@ -889,58 +887,6 @@
         "repo": "user.js",
         "type": "github"
       }
-    },
-    "yambar_cpu": {
-      "inputs": {
-        "crane": [
-          "crane"
-        ],
-        "flake-utils": [
-          "flake-utils"
-        ],
-        "nixpkgs": [
-          "nixpkgs"
-        ]
-      },
-      "locked": {
-        "lastModified": 1678635450,
-        "narHash": "sha256-AER+dXb9YoFdTLtNRG8PSIFCPo5qiZBSrLHmLkbnanM=",
-        "ref": "refs/heads/prime",
-        "rev": "9668588173cbdffa325247a35de93f31e4511f9a",
-        "revCount": 5,
-        "type": "git",
-        "url": "https://codeberg.org/soispha/yambar_cpu.git"
-      },
-      "original": {
-        "type": "git",
-        "url": "https://codeberg.org/soispha/yambar_cpu.git"
-      }
-    },
-    "yambar_memory": {
-      "inputs": {
-        "crane": [
-          "crane"
-        ],
-        "flake-utils": [
-          "flake-utils"
-        ],
-        "nixpkgs": [
-          "nixpkgs"
-        ]
-      },
-      "locked": {
-        "lastModified": 1678015290,
-        "narHash": "sha256-oEZzslefttctJHPhHLVOBPqRh59p51CTmgaKQC+MXn8=",
-        "ref": "refs/heads/prime",
-        "rev": "9b273d73f151e7f47cde5ed3feba38797b43619b",
-        "revCount": 3,
-        "type": "git",
-        "url": "https://codeberg.org/soispha/yambar_memory.git"
-      },
-      "original": {
-        "type": "git",
-        "url": "https://codeberg.org/soispha/yambar_memory.git"
-      }
     }
   },
   "root": "root",
diff --git a/flake.nix b/flake.nix
index b6349603..39544f41 100644
--- a/flake.nix
+++ b/flake.nix
@@ -206,22 +206,6 @@
         flake-compat.follows = "flake-compat";
       };
     };
-    yambar_cpu = {
-      url = "git+https://codeberg.org/soispha/yambar_cpu.git";
-      inputs = {
-        nixpkgs.follows = "nixpkgs";
-        crane.follows = "crane";
-        flake-utils.follows = "flake-utils";
-      };
-    };
-    yambar_memory = {
-      url = "git+https://codeberg.org/soispha/yambar_memory.git";
-      inputs = {
-        nixpkgs.follows = "nixpkgs";
-        crane.follows = "crane";
-        flake-utils.follows = "flake-utils";
-      };
-    };
 
     # external resources
     user_js = {
@@ -260,8 +244,6 @@
     # my binaries
     shell_library,
     river_init_lesser,
-    yambar_memory,
-    yambar_cpu,
     ...
   }: let
     system = "x86_64-linux";
@@ -311,8 +293,6 @@
         
         shell_library
         river_init_lesser
-        yambar_memory
-        yambar_cpu
         ;
     };
   in
diff --git a/flake/default.nix b/flake/default.nix
index b54b5470..3bd0e6ba 100644
--- a/flake/default.nix
+++ b/flake/default.nix
@@ -25,8 +25,6 @@
   # my binaries
   shell_library,
   river_init_lesser,
-  yambar_memory,
-  yambar_cpu,
 }: let
   treefmtEval = import ./treefmt.nix {inherit treefmt-nix pkgs;};
 
@@ -57,8 +55,6 @@
       # bins
       
       river_init_lesser
-      yambar_cpu
-      yambar_memory
       # external
       
       user_js
diff --git a/flake/nixosConfigurations/default.nix b/flake/nixosConfigurations/default.nix
index 3895593f..92e1a41e 100644
--- a/flake/nixosConfigurations/default.nix
+++ b/flake/nixosConfigurations/default.nix
@@ -21,8 +21,6 @@
   nix-index-database,
   # bins
   river_init_lesser,
-  yambar_cpu,
-  yambar_memory,
   # external
   user_js,
 }: let
@@ -48,28 +46,26 @@
       shell_library
       sysLib
       # extra information
-
+      
       system
       # modules
-
+      
       impermanence
       nix-index-database
       nixVim
       # nix registry
-
+      
       nixpkgs_as_input
       self
       templates
       # bins
-
+      
       # TODO: Integrate these into `pkgs/by-name` <2024-05-22>
-
+      
       river_init_lesser
       serverphone
-      yambar_cpu
-      yambar_memory
       # external deps
-
+      
       user_js
       ;
   };
diff --git a/modules/home/conf/yambar/default.nix b/modules/home/conf/yambar/default.nix
index 021dfbdd..125030af 100644
--- a/modules/home/conf/yambar/default.nix
+++ b/modules/home/conf/yambar/default.nix
@@ -3,8 +3,6 @@
   sysLib,
   system,
   pkgs,
-  yambar_cpu,
-  yambar_memory,
   ...
 }: let
   makeScript = {
@@ -40,9 +38,9 @@ in {
       name = "sound-volume";
     };
 
-    cpu_script = yambar_cpu.app.${system}.default.program;
+    cpu_script = pkgs.yambar-cpu;
 
-    memory_script = yambar_memory.app.${system}.default.program;
+    memory_script = pkgs.yambar-memory;
 
     disk_script = makeScript {
       dependencies = builtins.attrValues {inherit (pkgs) gawk btrfs-progs coreutils;};
diff --git a/modules/system/home-manager/default.nix b/modules/system/home-manager/default.nix
index 1b973d6c..23ba1a25 100644
--- a/modules/system/home-manager/default.nix
+++ b/modules/system/home-manager/default.nix
@@ -10,8 +10,6 @@
   # TODO: Integrate these <2024-05-22>
   river_init_lesser,
   shell_library,
-  yambar_cpu,
-  yambar_memory,
   # external deps
   user_js,
   # modules
@@ -36,19 +34,17 @@ in {
           nixpkgs_open_prs
           sysLib
           # extra information
-
+          
           system
           # bins
-
-          yambar_cpu
-          yambar_memory
+          
           river_init_lesser
           shell_library
           # external deps
-
+          
           user_js
           # modules
-
+          
           impermanence
           nixVim
           nix-index-database
diff --git a/pkgs/by-name/ya/yambar-cpu/.gitignore b/pkgs/by-name/ya/yambar-cpu/.gitignore
new file mode 100644
index 00000000..ea8c4bf7
--- /dev/null
+++ b/pkgs/by-name/ya/yambar-cpu/.gitignore
@@ -0,0 +1 @@
+/target
diff --git a/pkgs/by-name/ya/yambar-cpu/Cargo.lock b/pkgs/by-name/ya/yambar-cpu/Cargo.lock
new file mode 100644
index 00000000..c9f2e156
--- /dev/null
+++ b/pkgs/by-name/ya/yambar-cpu/Cargo.lock
@@ -0,0 +1,191 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "autocfg"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
+
+[[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+
+[[package]]
+name = "core-foundation-sys"
+version = "0.8.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
+
+[[package]]
+name = "cpu_usage"
+version = "0.1.0"
+dependencies = [
+ "sysinfo",
+]
+
+[[package]]
+name = "crossbeam-channel"
+version = "0.5.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cf2b3e8478797446514c91ef04bafcb59faba183e621ad488df88983cc14128c"
+dependencies = [
+ "cfg-if",
+ "crossbeam-utils",
+]
+
+[[package]]
+name = "crossbeam-deque"
+version = "0.8.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef"
+dependencies = [
+ "cfg-if",
+ "crossbeam-epoch",
+ "crossbeam-utils",
+]
+
+[[package]]
+name = "crossbeam-epoch"
+version = "0.9.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695"
+dependencies = [
+ "autocfg",
+ "cfg-if",
+ "crossbeam-utils",
+ "memoffset",
+ "scopeguard",
+]
+
+[[package]]
+name = "crossbeam-utils"
+version = "0.8.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b"
+dependencies = [
+ "cfg-if",
+]
+
+[[package]]
+name = "either"
+version = "1.8.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
+
+[[package]]
+name = "hermit-abi"
+version = "0.2.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "libc"
+version = "0.2.139"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
+
+[[package]]
+name = "memoffset"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1"
+dependencies = [
+ "autocfg",
+]
+
+[[package]]
+name = "ntapi"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bc51db7b362b205941f71232e56c625156eb9a929f8cf74a428fd5bc094a4afc"
+dependencies = [
+ "winapi",
+]
+
+[[package]]
+name = "num_cpus"
+version = "1.15.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b"
+dependencies = [
+ "hermit-abi",
+ "libc",
+]
+
+[[package]]
+name = "once_cell"
+version = "1.17.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
+
+[[package]]
+name = "rayon"
+version = "1.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6db3a213adf02b3bcfd2d3846bb41cb22857d131789e01df434fb7e7bc0759b7"
+dependencies = [
+ "either",
+ "rayon-core",
+]
+
+[[package]]
+name = "rayon-core"
+version = "1.10.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "356a0625f1954f730c0201cdab48611198dc6ce21f4acff55089b5a78e6e835b"
+dependencies = [
+ "crossbeam-channel",
+ "crossbeam-deque",
+ "crossbeam-utils",
+ "num_cpus",
+]
+
+[[package]]
+name = "scopeguard"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
+
+[[package]]
+name = "sysinfo"
+version = "0.28.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "38a81bbc26c485910df47772df6bbcdb417036132caa9e51e29d2e39c4636d4e"
+dependencies = [
+ "cfg-if",
+ "core-foundation-sys",
+ "libc",
+ "ntapi",
+ "once_cell",
+ "rayon",
+ "winapi",
+]
+
+[[package]]
+name = "winapi"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
+dependencies = [
+ "winapi-i686-pc-windows-gnu",
+ "winapi-x86_64-pc-windows-gnu",
+]
+
+[[package]]
+name = "winapi-i686-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
+
+[[package]]
+name = "winapi-x86_64-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
diff --git a/pkgs/by-name/ya/yambar-cpu/Cargo.toml b/pkgs/by-name/ya/yambar-cpu/Cargo.toml
new file mode 100644
index 00000000..5a2bc6f9
--- /dev/null
+++ b/pkgs/by-name/ya/yambar-cpu/Cargo.toml
@@ -0,0 +1,9 @@
+[package]
+name = "cpu_usage"
+version = "0.1.0"
+edition = "2021"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
+sysinfo = "0.28.1"
diff --git a/pkgs/by-name/ya/yambar-cpu/flake.lock b/pkgs/by-name/ya/yambar-cpu/flake.lock
new file mode 100644
index 00000000..63ad6a9b
--- /dev/null
+++ b/pkgs/by-name/ya/yambar-cpu/flake.lock
@@ -0,0 +1,123 @@
+{
+  "nodes": {
+    "crane": {
+      "inputs": {
+        "flake-compat": "flake-compat",
+        "flake-utils": "flake-utils",
+        "nixpkgs": [
+          "nixpkgs"
+        ],
+        "rust-overlay": "rust-overlay"
+      },
+      "locked": {
+        "lastModified": 1677892403,
+        "narHash": "sha256-/Wi0L1spSWLFj+UQxN3j0mPYMoc7ZoAujpUF/juFVII=",
+        "owner": "ipetkov",
+        "repo": "crane",
+        "rev": "105e27adb70a9890986b6d543a67761cbc1964a2",
+        "type": "github"
+      },
+      "original": {
+        "owner": "ipetkov",
+        "repo": "crane",
+        "type": "github"
+      }
+    },
+    "flake-compat": {
+      "flake": false,
+      "locked": {
+        "lastModified": 1673956053,
+        "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
+        "owner": "edolstra",
+        "repo": "flake-compat",
+        "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
+        "type": "github"
+      },
+      "original": {
+        "owner": "edolstra",
+        "repo": "flake-compat",
+        "type": "github"
+      }
+    },
+    "flake-utils": {
+      "locked": {
+        "lastModified": 1676283394,
+        "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
+    "flake-utils_2": {
+      "locked": {
+        "lastModified": 1676283394,
+        "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
+    "nixpkgs": {
+      "locked": {
+        "lastModified": 1677852945,
+        "narHash": "sha256-liiVJjkBTuBTAkRW3hrI8MbPD2ImYzwUpa7kvteiKhM=",
+        "owner": "NixOS",
+        "repo": "nixpkgs",
+        "rev": "f5ffd5787786dde3a8bf648c7a1b5f78c4e01abb",
+        "type": "github"
+      },
+      "original": {
+        "owner": "NixOS",
+        "ref": "nixpkgs-unstable",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "root": {
+      "inputs": {
+        "crane": "crane",
+        "flake-utils": "flake-utils_2",
+        "nixpkgs": "nixpkgs"
+      }
+    },
+    "rust-overlay": {
+      "inputs": {
+        "flake-utils": [
+          "crane",
+          "flake-utils"
+        ],
+        "nixpkgs": [
+          "crane",
+          "nixpkgs"
+        ]
+      },
+      "locked": {
+        "lastModified": 1677812689,
+        "narHash": "sha256-EakqhgRnjVeYJv5+BJx/NZ7/eFTMBxc4AhICUNquhUg=",
+        "owner": "oxalica",
+        "repo": "rust-overlay",
+        "rev": "e53e8853aa7b0688bc270e9e6a681d22e01cf299",
+        "type": "github"
+      },
+      "original": {
+        "owner": "oxalica",
+        "repo": "rust-overlay",
+        "type": "github"
+      }
+    }
+  },
+  "root": "root",
+  "version": 7
+}
diff --git a/pkgs/by-name/ya/yambar-cpu/flake.nix b/pkgs/by-name/ya/yambar-cpu/flake.nix
new file mode 100644
index 00000000..0d63e121
--- /dev/null
+++ b/pkgs/by-name/ya/yambar-cpu/flake.nix
@@ -0,0 +1,35 @@
+{
+  description = "A smart way to check your cpu usage";
+
+  inputs = {
+    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+    crane.url = "github:ipetkov/crane";
+    crane.inputs.nixpkgs.follows = "nixpkgs";
+    flake-utils.url = "github:numtide/flake-utils";
+  };
+
+  outputs = {
+    self,
+    nixpkgs,
+    crane,
+    flake-utils,
+    ...
+  }:
+    flake-utils.lib.eachDefaultSystem (system: let
+      craneLib = crane.lib.${system};
+      craneBuild = craneLib.buildPackage {
+        src = craneLib.cleanCargoSource ./.;
+
+        doCheck = true;
+      };
+    in {
+      packages.default = craneBuild;
+      legacyPackages.default = craneBuild;
+      app.default = {
+        type = "app";
+        program = "${self.packages.${system}.default}/bin/cpu_usage";
+      };
+    });
+}
+# vim: ts=2
+
diff --git a/pkgs/by-name/ya/yambar-cpu/package.nix b/pkgs/by-name/ya/yambar-cpu/package.nix
new file mode 100644
index 00000000..d054a970
--- /dev/null
+++ b/pkgs/by-name/ya/yambar-cpu/package.nix
@@ -0,0 +1,10 @@
+{rustPlatform}:
+rustPlatform.buildRustPackage {
+  pname = "yambar_cpu";
+  version = "0.1.0";
+
+  src = ./.;
+  cargoLock = {
+    lockFile = ./Cargo.lock;
+  };
+}
diff --git a/pkgs/by-name/ya/yambar-cpu/src/main.rs b/pkgs/by-name/ya/yambar-cpu/src/main.rs
new file mode 100644
index 00000000..9314b81e
--- /dev/null
+++ b/pkgs/by-name/ya/yambar-cpu/src/main.rs
@@ -0,0 +1,22 @@
+use std::{thread, time::Duration};
+
+use sysinfo::{CpuExt, System, SystemExt};
+
+fn main() {
+    let mut sys = System::new();
+
+    // Number of CPUs:
+    loop {
+        sys.refresh_cpu();
+        let cpu_usage: f32 = sys.cpus().iter().map(|cpu| cpu.cpu_usage()).sum();
+        println!(
+            "cpu|range:0-100|{:.0}",
+            cpu_usage / sys.cpus().iter().count() as f32
+        );
+        println!();
+
+        // Sleeping to give the system time to run for long
+        // enough to have useful information.
+        thread::sleep(Duration::from_secs(3));
+    }
+}
diff --git a/pkgs/by-name/ya/yambar-cpu/update.sh b/pkgs/by-name/ya/yambar-cpu/update.sh
new file mode 100755
index 00000000..4de6e712
--- /dev/null
+++ b/pkgs/by-name/ya/yambar-cpu/update.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env sh
+
+[ "$1" = "upgrade" ] && cargo upgrade
+
+cargo update
+
+# vim: ft=sh
diff --git a/pkgs/by-name/ya/yambar-memory/.gitignore b/pkgs/by-name/ya/yambar-memory/.gitignore
new file mode 100644
index 00000000..ea8c4bf7
--- /dev/null
+++ b/pkgs/by-name/ya/yambar-memory/.gitignore
@@ -0,0 +1 @@
+/target
diff --git a/pkgs/by-name/ya/yambar-memory/Cargo.lock b/pkgs/by-name/ya/yambar-memory/Cargo.lock
new file mode 100644
index 00000000..9fb53b05
--- /dev/null
+++ b/pkgs/by-name/ya/yambar-memory/Cargo.lock
@@ -0,0 +1,191 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "autocfg"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
+
+[[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+
+[[package]]
+name = "core-foundation-sys"
+version = "0.8.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
+
+[[package]]
+name = "crossbeam-channel"
+version = "0.5.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cf2b3e8478797446514c91ef04bafcb59faba183e621ad488df88983cc14128c"
+dependencies = [
+ "cfg-if",
+ "crossbeam-utils",
+]
+
+[[package]]
+name = "crossbeam-deque"
+version = "0.8.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef"
+dependencies = [
+ "cfg-if",
+ "crossbeam-epoch",
+ "crossbeam-utils",
+]
+
+[[package]]
+name = "crossbeam-epoch"
+version = "0.9.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695"
+dependencies = [
+ "autocfg",
+ "cfg-if",
+ "crossbeam-utils",
+ "memoffset",
+ "scopeguard",
+]
+
+[[package]]
+name = "crossbeam-utils"
+version = "0.8.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b"
+dependencies = [
+ "cfg-if",
+]
+
+[[package]]
+name = "either"
+version = "1.8.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
+
+[[package]]
+name = "hermit-abi"
+version = "0.2.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "libc"
+version = "0.2.139"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
+
+[[package]]
+name = "memoffset"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1"
+dependencies = [
+ "autocfg",
+]
+
+[[package]]
+name = "memory"
+version = "0.1.0"
+dependencies = [
+ "sysinfo",
+]
+
+[[package]]
+name = "ntapi"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bc51db7b362b205941f71232e56c625156eb9a929f8cf74a428fd5bc094a4afc"
+dependencies = [
+ "winapi",
+]
+
+[[package]]
+name = "num_cpus"
+version = "1.15.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b"
+dependencies = [
+ "hermit-abi",
+ "libc",
+]
+
+[[package]]
+name = "once_cell"
+version = "1.17.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
+
+[[package]]
+name = "rayon"
+version = "1.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6db3a213adf02b3bcfd2d3846bb41cb22857d131789e01df434fb7e7bc0759b7"
+dependencies = [
+ "either",
+ "rayon-core",
+]
+
+[[package]]
+name = "rayon-core"
+version = "1.10.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "356a0625f1954f730c0201cdab48611198dc6ce21f4acff55089b5a78e6e835b"
+dependencies = [
+ "crossbeam-channel",
+ "crossbeam-deque",
+ "crossbeam-utils",
+ "num_cpus",
+]
+
+[[package]]
+name = "scopeguard"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
+
+[[package]]
+name = "sysinfo"
+version = "0.28.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "38a81bbc26c485910df47772df6bbcdb417036132caa9e51e29d2e39c4636d4e"
+dependencies = [
+ "cfg-if",
+ "core-foundation-sys",
+ "libc",
+ "ntapi",
+ "once_cell",
+ "rayon",
+ "winapi",
+]
+
+[[package]]
+name = "winapi"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
+dependencies = [
+ "winapi-i686-pc-windows-gnu",
+ "winapi-x86_64-pc-windows-gnu",
+]
+
+[[package]]
+name = "winapi-i686-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
+
+[[package]]
+name = "winapi-x86_64-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
diff --git a/pkgs/by-name/ya/yambar-memory/Cargo.toml b/pkgs/by-name/ya/yambar-memory/Cargo.toml
new file mode 100644
index 00000000..27ab3c31
--- /dev/null
+++ b/pkgs/by-name/ya/yambar-memory/Cargo.toml
@@ -0,0 +1,9 @@
+[package]
+name = "memory"
+version = "0.1.0"
+edition = "2021"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
+sysinfo = "0.28.1"
diff --git a/pkgs/by-name/ya/yambar-memory/flake.lock b/pkgs/by-name/ya/yambar-memory/flake.lock
new file mode 100644
index 00000000..1b495c04
--- /dev/null
+++ b/pkgs/by-name/ya/yambar-memory/flake.lock
@@ -0,0 +1,123 @@
+{
+  "nodes": {
+    "crane": {
+      "inputs": {
+        "flake-compat": "flake-compat",
+        "flake-utils": "flake-utils",
+        "nixpkgs": [
+          "nixpkgs"
+        ],
+        "rust-overlay": "rust-overlay"
+      },
+      "locked": {
+        "lastModified": 1677642623,
+        "narHash": "sha256-GlRa6/HWg8mIxPM29ZuTP2dP8y9sQ6BdbrjzCO8JgAo=",
+        "owner": "ipetkov",
+        "repo": "crane",
+        "rev": "f3f763e4d9f156ec0c37f39b0f77e2d62213b296",
+        "type": "github"
+      },
+      "original": {
+        "owner": "ipetkov",
+        "repo": "crane",
+        "type": "github"
+      }
+    },
+    "flake-compat": {
+      "flake": false,
+      "locked": {
+        "lastModified": 1673956053,
+        "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
+        "owner": "edolstra",
+        "repo": "flake-compat",
+        "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
+        "type": "github"
+      },
+      "original": {
+        "owner": "edolstra",
+        "repo": "flake-compat",
+        "type": "github"
+      }
+    },
+    "flake-utils": {
+      "locked": {
+        "lastModified": 1676283394,
+        "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
+    "flake-utils_2": {
+      "locked": {
+        "lastModified": 1676283394,
+        "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
+    "nixpkgs": {
+      "locked": {
+        "lastModified": 1677816901,
+        "narHash": "sha256-oqe8Q9LlWNGfVfUDkKfpWAk+I9RRDBvMSyYVIOZCfPM=",
+        "owner": "NixOS",
+        "repo": "nixpkgs",
+        "rev": "0749042bfaa2f4efa70ac829c5387133cfc0a337",
+        "type": "github"
+      },
+      "original": {
+        "owner": "NixOS",
+        "ref": "nixpkgs-unstable",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "root": {
+      "inputs": {
+        "crane": "crane",
+        "flake-utils": "flake-utils_2",
+        "nixpkgs": "nixpkgs"
+      }
+    },
+    "rust-overlay": {
+      "inputs": {
+        "flake-utils": [
+          "crane",
+          "flake-utils"
+        ],
+        "nixpkgs": [
+          "crane",
+          "nixpkgs"
+        ]
+      },
+      "locked": {
+        "lastModified": 1676437770,
+        "narHash": "sha256-mhJye91Bn0jJIE7NnEywGty/U5qdELfsT8S+FBjTdG4=",
+        "owner": "oxalica",
+        "repo": "rust-overlay",
+        "rev": "a619538647bd03e3ee1d7b947f7c11ff289b376e",
+        "type": "github"
+      },
+      "original": {
+        "owner": "oxalica",
+        "repo": "rust-overlay",
+        "type": "github"
+      }
+    }
+  },
+  "root": "root",
+  "version": 7
+}
diff --git a/pkgs/by-name/ya/yambar-memory/flake.nix b/pkgs/by-name/ya/yambar-memory/flake.nix
new file mode 100644
index 00000000..186195cc
--- /dev/null
+++ b/pkgs/by-name/ya/yambar-memory/flake.nix
@@ -0,0 +1,35 @@
+{
+  description = "A smart way to check your cpu usage";
+
+  inputs = {
+    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+    crane.url = "github:ipetkov/crane";
+    crane.inputs.nixpkgs.follows = "nixpkgs";
+    flake-utils.url = "github:numtide/flake-utils";
+  };
+
+  outputs = {
+    self,
+    nixpkgs,
+    crane,
+    flake-utils,
+    ...
+  }:
+    flake-utils.lib.eachDefaultSystem (system: let
+      craneLib = crane.lib.${system};
+      craneBuild = craneLib.buildPackage {
+        src = craneLib.cleanCargoSource ./.;
+
+        doCheck = true;
+      };
+    in {
+      packages.default = craneBuild;
+      legacyPackages.default = craneBuild;
+      app.default = {
+        type = "app";
+        program = "${self.packages.${system}.default}/bin/memory";
+      };
+    });
+}
+# vim: ts=2
+
diff --git a/pkgs/by-name/ya/yambar-memory/package.nix b/pkgs/by-name/ya/yambar-memory/package.nix
new file mode 100644
index 00000000..a144dc4c
--- /dev/null
+++ b/pkgs/by-name/ya/yambar-memory/package.nix
@@ -0,0 +1,10 @@
+{rustPlatform}:
+rustPlatform.buildRustPackage {
+  pname = "yambar_memory";
+  version = "0.1.0";
+
+  src = ./.;
+  cargoLock = {
+    lockFile = ./Cargo.lock;
+  };
+}
diff --git a/pkgs/by-name/ya/yambar-memory/src/main.rs b/pkgs/by-name/ya/yambar-memory/src/main.rs
new file mode 100644
index 00000000..ea9e6f39
--- /dev/null
+++ b/pkgs/by-name/ya/yambar-memory/src/main.rs
@@ -0,0 +1,30 @@
+use std::{thread, time::Duration};
+
+use sysinfo::{System, SystemExt};
+
+fn main() {
+    let mut sys = System::new();
+
+    // Number of CPUs:
+    loop {
+        sys.refresh_memory();
+
+        let memory_percentage: f64 =
+            100 as f64 * (sys.used_memory() as f64 / sys.total_memory() as f64);
+
+        println!("memperc|string|{:.0}", memory_percentage);
+        if sys.total_swap() > 0 {
+            let swap_percentage: f64 =
+                100 as f64 * (sys.used_swap() as f64 / sys.total_swap() as f64);
+            println!("swapperc|string|{:.0}", swap_percentage);
+            println!("swapstate|bool|true");
+        } else {
+            println!("swapstate|bool|false");
+        }
+        println!("");
+
+        // Sleeping to give the system time to run for long
+        // enough to have useful information.
+        thread::sleep(Duration::from_secs(3));
+    }
+}
diff --git a/pkgs/by-name/ya/yambar-memory/update.sh b/pkgs/by-name/ya/yambar-memory/update.sh
new file mode 100755
index 00000000..4de6e712
--- /dev/null
+++ b/pkgs/by-name/ya/yambar-memory/update.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env sh
+
+[ "$1" = "upgrade" ] && cargo upgrade
+
+cargo update
+
+# vim: ft=sh