dotfiles/common/users/homeModules/scripts/default.nix

71 lines
1.9 KiB
Nix
Raw Normal View History

2024-11-26 17:01:58 -05:00
{pkgs, lib, inputs, ...}:
let
# cpkg = import ../../../../customPackages { inherit pkgs inputs; };
2024-11-26 17:01:58 -05:00
# https://discourse.nixos.org/t/how-to-create-a-script-with-dependencies/7970/6
mkScript = { name, version ? "0.0.1", file, env ? [ ] }:
pkgs.writeTextFile {
name = "${name}-${version}";
executable = true;
destination = "/bin/${name}";
text = ''
for i in ${lib.concatStringsSep " " env}; do
export PATH="$i/bin:$PATH"
done
2024-11-26 17:14:29 -05:00
exec ${pkgs.bash}/bin/bash ${file} $@
2024-11-26 17:01:58 -05:00
'';
};
in
{
imports = [
../../../../customPackages
];
2024-11-26 17:01:58 -05:00
home = {
2024-12-18 18:54:34 -05:00
packages = [
2024-11-26 17:01:58 -05:00
# env for clipboard command will be required by their respective environemnts
(mkScript {
name = "paste";
file = ./paste.sh;
})
(mkScript {
name = "copy";
file = ./copy.sh;
})
(mkScript {
name = "http2ssh";
file = ./http2ssh.sh;
2024-12-18 18:54:34 -05:00
env = [pkgs.git];
2024-11-26 17:01:58 -05:00
})
(mkScript {
name = "git_fetchAll";
file = ./git_fetchAll.sh;
2024-12-18 18:54:34 -05:00
env = [pkgs.git];
2024-11-26 17:01:58 -05:00
})
(mkScript {
name = "install_eslint";
file = ./install_eslint.sh;
})
(mkScript {
name = "math";
file = ./math.sh;
2024-12-18 18:54:34 -05:00
env = [pkgs.python3];
2024-11-26 17:01:58 -05:00
})
(mkScript {
name = "hashi18n";
file = ./hashi18n.sh;
})
2024-12-18 18:54:34 -05:00
(mkScript {
name = "flakeify";
file = ./flakeify.sh;
2024-12-18 19:03:07 -05:00
env = [pkgs.direnv];
2024-12-18 18:54:34 -05:00
})
2024-11-26 17:01:58 -05:00
];
file = {
scripts = {
source = "${pkgs.cpkg.scripts}";
2024-11-26 17:01:58 -05:00
target = ".scripts";
};
};
};
}