Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 75 additions & 37 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,45 +9,83 @@
outputs = { self, nixpkgs, flake-utils}:
flake-utils.lib.eachDefaultSystem (
system:
let
let
pkgs = nixpkgs.legacyPackages.${system};
in

runtimeDeps = [
pkgs.curl
pkgs.jq
pkgs.ripgrep
pkgs.fd
pkgs.qsv

pkgs.coreutils
pkgs.gnused
pkgs.gawk
pkgs.findutils
pkgs.gnugrep

pkgs.bc
pkgs.ffmpeg
pkgs.imagemagick
pkgs.gnutar
pkgs.gzip
pkgs.bzip2
pkgs.xz
pkgs.p7zip
pkgs.unzip

pkgs.rsync

pkgs.bash
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 pkgs.bash silently added to devShells.default

Since devShells.default is built from runtimeDeps ++ [ pkgs.bash-completion ] (line 84), pkgs.bash is now part of devShells.default.buildInputs. This changes the devShell's PATH compared to the previous behaviour (where Nix's bash was not in the shell's packages). On macOS in particular, having Nix's bash prepended to PATH ahead of the system bash can subtly change shell behaviour for developers who rely on the system bash.

Consider separating pkgs.bash into the packages.default-specific list rather than the shared runtimeDeps, or at least call this out in the PR description.

Prompt To Fix With AI
This is a comment left during a code review.
Path: flake.nix
Line: 40

Comment:
**`pkgs.bash` silently added to `devShells.default`**

Since `devShells.default` is built from `runtimeDeps ++ [ pkgs.bash-completion ]` (line 84), `pkgs.bash` is now part of `devShells.default.buildInputs`. This changes the devShell's PATH compared to the previous behaviour (where Nix's bash was not in the shell's packages). On macOS in particular, having Nix's bash prepended to PATH ahead of the system bash can subtly change shell behaviour for developers who rely on the system bash.

Consider separating `pkgs.bash` into the `packages.default`-specific list rather than the shared `runtimeDeps`, or at least call this out in the PR description.

How can I resolve this? If you propose a fix, please make it concise.


pkgs.openssl
pkgs.yq-go
pkgs.git

pkgs.libwebp
pkgs.gifsicle
pkgs.rename
];
in
{
packages.default = pkgs.stdenv.mkDerivation {
pname = "u7";
version = "0.1.0";
src = pkgs.lib.cleanSource ./.;
dontBuild = true;

installPhase = let
runtimePath = pkgs.lib.makeBinPath runtimeDeps;
in ''
mkdir -p $out/share/u7 $out/bin
cp utility.sh $out/share/u7/utility.sh

cat > $out/bin/u7 <<EOF
#!${pkgs.bash}/bin/bash
export PATH="${runtimePath}:\$PATH"
source "$out/share/u7/utility.sh"
u7 "\$@"
EOF
chmod +x $out/bin/u7

cat > $out/bin/u7-init <<EOF
#!${pkgs.bash}/bin/bash
echo "$out/share/u7/utility.sh"
EOF
chmod +x $out/bin/u7-init
'';

meta = with pkgs.lib; {
description = "u7 – intuitive CLI for humans and AI";
mainProgram = "u7";
license = licenses.mit;
platforms = platforms.all;
};
};

devShells.default = pkgs.mkShell {
buildInputs = [
pkgs.curl
pkgs.jq
pkgs.ripgrep
pkgs.fd
pkgs.qsv

pkgs.coreutils
pkgs.gnused
pkgs.gawk
pkgs.findutils
pkgs.gnugrep

pkgs.bc
pkgs.ffmpeg
pkgs.imagemagick
pkgs.gnutar
pkgs.gzip
pkgs.bzip2
pkgs.xz
pkgs.p7zip
pkgs.unzip

pkgs.rsync

pkgs.openssl
pkgs.yq-go
pkgs.git
pkgs.bash-completion

pkgs.libwebp
pkgs.gifsicle
pkgs.rename
];
buildInputs = runtimeDeps ++ [ pkgs.bash-completion ];

shellHook = ''
source ${pkgs.bash-completion}/etc/profile.d/bash_completion.sh
Expand All @@ -58,4 +96,4 @@
};
}
);
}
}
Loading