Update to work with latest NixOS
This commit is contained in:
parent
4db7f63b04
commit
e1b69b417b
3 changed files with 154 additions and 148 deletions
|
@ -2,11 +2,11 @@
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1684076341,
|
"lastModified": 1724104367,
|
||||||
"narHash": "sha256-60pNoKP2opEnGoPGrVo43Vt433El4+BcSl0TS36qJgQ=",
|
"narHash": "sha256-ZYT8DwJKW6UTUm1F0kSluOGNrpmCrwEWruhtmWDhiNM=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "1feac2b61756a5a4392a6cc5f5b510325312437d",
|
"rev": "dfd48cea67e78574522201471bccca03383e9987",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
48
flake.nix
48
flake.nix
|
@ -22,7 +22,7 @@
|
||||||
pkgs = import nixpkgs { inherit system; };
|
pkgs = import nixpkgs { inherit system; };
|
||||||
});
|
});
|
||||||
|
|
||||||
make_package = pkgs: pkgs.stdenv.mkDerivation {
|
make_package = pkgs: pkgs.stdenv.mkDerivation rec {
|
||||||
name = "q-sh";
|
name = "q-sh";
|
||||||
src = self;
|
src = self;
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
@ -32,27 +32,33 @@
|
||||||
echo "OUT " $out
|
echo "OUT " $out
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
dontStrip = true;
|
||||||
|
nativeBuildInputs = [pkgs.makeWrapper];
|
||||||
|
|
||||||
|
wrapperPath = pkgs.lib.makeBinPath ( with pkgs; [
|
||||||
|
fzf
|
||||||
|
findutils
|
||||||
|
gnused
|
||||||
|
gawk
|
||||||
|
bc
|
||||||
|
pass
|
||||||
|
coreutils
|
||||||
|
wl-clipboard
|
||||||
|
xdg-utils
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
postFixup = ''
|
postFixup = ''
|
||||||
q-fixup() {
|
substituteInPlace $out/bin/q \
|
||||||
TOOL="$1"
|
--replace 'ENV_q="''${0##*/}"' "ENV_q=$out/bin/q"
|
||||||
PATH="$2"
|
|
||||||
${pkgs.findutils}/bin/find $out -type f -name 'q*' -exec ${pkgs.gnused}/bin/sed -i "s#ENV_$TOOL=.*#ENV_$TOOL=$PATH#g" {} +
|
# Ensure all dependencies are in PATH
|
||||||
}
|
for fn in $out/bin/q*; do
|
||||||
q-fixup "fzf" "${pkgs.fzf}/bin/fzf"
|
echo "wrapping $fn"
|
||||||
q-fixup "find" "${pkgs.findutils}/bin/find"
|
wrapProgram $fn \
|
||||||
q-fixup "sed" "${pkgs.gnused}/bin/sed"
|
--prefix PATH : "${wrapperPath}"
|
||||||
q-fixup "awk" "${pkgs.gawk}/bin/awk"
|
done
|
||||||
q-fixup "bc" "${pkgs.bc}/bin/bc"
|
|
||||||
q-fixup "pass" "${pkgs.pass}/bin/pass"
|
|
||||||
q-fixup "cut" "${pkgs.coreutils}/bin/cut"
|
|
||||||
q-fixup "base64" "${pkgs.coreutils}/bin/base64"
|
|
||||||
q-fixup "cat" "${pkgs.coreutils}/bin/cat"
|
|
||||||
q-fixup "tac" "${pkgs.coreutils}/bin/tac"
|
|
||||||
q-fixup "sort" "${pkgs.coreutils}/bin/sort"
|
|
||||||
q-fixup "uniq" "${pkgs.coreutils}/bin/uniq"
|
|
||||||
q-fixup "wl_copy" "${pkgs.wl-clipboard}/bin/wl-copy"
|
|
||||||
q-fixup "xdg_open" "${pkgs.xdg-utils}/bin/xdg-open"
|
|
||||||
q-fixup "q" "$out/bin"
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|
2
q
2
q
|
@ -36,7 +36,7 @@ ENV_q=~/.config/q.sh
|
||||||
SELF=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)/$(basename -- "$0")")
|
SELF=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)/$(basename -- "$0")")
|
||||||
|
|
||||||
if [[ -z "$Q_SCRIPT_DIR" ]]; then
|
if [[ -z "$Q_SCRIPT_DIR" ]]; then
|
||||||
Q_SCRIPT_DIR="$ENV_q"
|
Q_SCRIPT_DIR="$(dirname -- $SELF)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
INDEX_FILE=~/.q.index
|
INDEX_FILE=~/.q.index
|
||||||
|
|
Loading…
Reference in a new issue