mirror of
https://codeberg.org/mhwombat/nix-book.git
synced 2026-01-07 06:17:23 +08:00
46 lines
1.2 KiB
Nix
46 lines
1.2 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
hello-flake.url = "git+https://codeberg.org/mhwombat/hello-flake";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, flake-utils, hello-flake }:
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
pkgs = import nixpkgs { inherit system; };
|
|
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-flake
|
|
HELLO=$(type -p hello-flake)
|
|
sed "s_hello-flake_"$HELLO"_" --in-place $out/bin/hello-again
|
|
'';
|
|
|
|
buildInputs = [ hello-flake.packages.${system}.hello ];
|
|
};
|
|
default = hello;
|
|
};
|
|
|
|
apps = rec {
|
|
hello = flake-utils.lib.mkApp { drv = self.packages.${system}.hello; };
|
|
default = hello;
|
|
};
|
|
}
|
|
);
|
|
}
|