WIP: minify script
This commit is contained in:
parent
a6094b387d
commit
f75622c263
|
@ -29,6 +29,10 @@ in
|
|||
package = pkgs.deploy;
|
||||
help = "build and deploy nix configurations";
|
||||
}
|
||||
{
|
||||
package = pkgs.minify;
|
||||
help = "build and deploy nix configurations";
|
||||
}
|
||||
{
|
||||
package = pkgs.agenix-rekey;
|
||||
help = "Edit and rekey repository secrets";
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
zsh-histdb-skim = super.callPackage ./zsh-histdb-skim.nix {};
|
||||
zsh-histdb = super.callPackage ./zsh-histdb.nix {};
|
||||
deploy = super.callPackage ./deploy.nix {};
|
||||
minify = super.callPackage ./minify {};
|
||||
neovim-clean = super.neovim-unwrapped.overrideAttrs (_neovimFinal: neovimPrev: {
|
||||
nativeBuildInputs = (neovimPrev.nativeBuildInputs or []) ++ [super.makeWrapper];
|
||||
postInstall =
|
||||
|
|
37
pkgs/minify/default.nix
Normal file
37
pkgs/minify/default.nix
Normal file
|
@ -0,0 +1,37 @@
|
|||
{writeShellApplication}:
|
||||
writeShellApplication {
|
||||
name = "minify";
|
||||
text = ''
|
||||
set -euo pipefail
|
||||
function die { echo "error: $*" >&2; exit 1;}
|
||||
function print_help() {
|
||||
echo ' Usage: minify <flake> [OPTION]'
|
||||
}
|
||||
|
||||
OPTIONS=()
|
||||
POSITIONAL_ARGS=()
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
"help"|"--help"|"-h")
|
||||
show_help
|
||||
exit 1
|
||||
;;
|
||||
-*)
|
||||
OPTIONS+=("$1")
|
||||
;;
|
||||
*)
|
||||
POSITIONAL_ARGS+=("$1")
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
[[ ! ''${#POSITIONAL_ARGS[@]} -lt 1 ]] \
|
||||
|| die "Missing argument: <flake>"
|
||||
[[ ! ''${#POSITIONAL_ARGS[@]} -gt 2 ]] \
|
||||
|| die "Too many arguments"
|
||||
|
||||
path=$(realpath "''${POSITIONAL_ARGS[0]}")
|
||||
nix eval --impure --argstr path "$path" --file ${./minify.nix} "erg"
|
||||
'';
|
||||
}
|
5
pkgs/minify/minify.nix
Normal file
5
pkgs/minify/minify.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{path}: let
|
||||
flake = builtins.getFlake path;
|
||||
in {
|
||||
erg = builtins.mapAttrs (name: value: builtins.mapAttrs (name: value: name) value.inputs) flake.inputs;
|
||||
}
|
Loading…
Reference in a new issue