clearing js BLOAT using bash

This commit is contained in:
Ivan Dimitrov 2023-11-04 13:48:07 +02:00
parent 7ebb38820b
commit 53fe971b12
4 changed files with 24 additions and 10 deletions

View File

@ -18,7 +18,12 @@
, hosts
, ...
}:
let system = "x86_64-linux"; in
let
system = "x86_64-linux";
my-overlay = self: super: {
scripts = (super.buildEnv { name = "scripts"; paths = [ ./scripts ]; });
};
in
{
nixosConfigurations = {
laptop = nixpkgs.lib.nixosSystem {
@ -31,12 +36,12 @@
};
homeConfigurations = {
ivand = home-manager.lib.homeManagerConfiguration {
extraSpecialArgs = { rootPath = ./.; };
modules = [
./home/laptop
];
pkgs = import nixpkgs {
inherit system;
overlays = [ my-overlay ];
};
};
};

View File

@ -31,12 +31,10 @@
};
services = {
bingwp = {
Unit = {
Type = "oneshot";
};
Service = {
Environment = [ "PATH=${pkgs.nodejs_20}/bin" ];
ExecStart = [ "${pkgs.bash}/bin/bash -c '${pkgs.bun}/bin/bunx bingwp'" ];
Type = "oneshot";
Environment = [ "PATH=${pkgs.curl}/bin:${pkgs.wget}/bin:${pkgs.xdg-user-dirs}/bin:${pkgs.jq}/bin:${pkgs.busybox}/bin:${pkgs.bash}/bin" ];
ExecStart = [ "${pkgs.scripts}/bin/bingwp" ];
};
};
};

View File

@ -1,7 +1,6 @@
{ pkgs, rootPath, ... }: {
{ pkgs, ... }: {
home.packages = with pkgs; [
#scripts
(pkgs.buildEnv { name = "my-scripts"; paths = [ (rootPath + /scripts) ]; })
scripts
# wayland/sway stuff
bemenu
wl-clipboard

12
scripts/bin/bingwp Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
img_url=$(curl "https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=en-US" | jq ".images[0].url" | sed "s/\"//g" | awk '{printf "https://bing.com%s", $1 }')
pic_dir="$(xdg-user-dir "PICTURES")"
img_file="$pic_dir/bg.png"
backup_dir="$pic_dir/oldbg"
mkdir -p "$backup_dir"
mkdir -p "$pic_dir"
mv "$img_file" "$backup_dir/$(date +%Y-%m-%d).png"
wget -O "$img_file" "$img_url"