This commit is contained in:
Amy de Buitléir 2025-09-15 15:39:37 +01:00
parent 5dcadd370e
commit fc95b866c8
5 changed files with 56 additions and 28 deletions

View file

@ -5568,7 +5568,7 @@ Hello from your flake!</pre>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2025-09-15 15:31:24 IST
Last updated 2025-09-15 15:37:52 IST
</div>
</div>
</body>

View file

@ -0,0 +1,51 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
hello-nix = {
url = "git+https://codeberg.org/mhwombat/hello-nix";
flake = false;
};
};
outputs = { self, nixpkgs, flake-utils, hello-nix }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
helloNix = import hello-nix { inherit pkgs; };
in
{
packages = rec {
hello = pkgs.stdenv.mkDerivation rec {
name = "hello-again";
src = ./.;
unpackPhase = "true";
buildPhase = ":";
installPhase =
''
mkdir -p $out/bin
cp $src/hello-again $out/bin
chmod +x $out/bin/hello-again
# modify the hello-again script so it can find hello-nix
HELLO=$(type -p hello-nix)
sed "s_hello-nix_"$HELLO"_" --in-place $out/bin/hello-again
'';
buildInputs = [ helloNix ];
};
default = hello;
};
apps = rec {
hello = flake-utils.lib.mkApp { drv = self.packages.${system}.hello; };
default = hello;
};
}
);
}

View file

@ -0,0 +1,4 @@
#!/usr/bin/env sh
echo "I'm a flake, but I'm running a command defined in a non-flake package."
hello-nix

View file

@ -1,27 +0,0 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
hello-nix = {
url = "git+https://codeberg.org/mhwombat/hello-nix";
flake = false;
};
};
outputs = { self, nixpkgs, flake-utils, hello-nix }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
};
helloNix = import hello-nix { inherit pkgs; };
in
{
devShells = rec {
default = pkgs.mkShell {
packages = [ helloNix ];
};
};
}
);
}