This commit is contained in:
Amy de Buitléir 2025-09-13 15:03:44 +01:00
parent 5dd1d42a13
commit dda3f7db65
3 changed files with 63 additions and 27 deletions

View file

@ -0,0 +1,63 @@
{
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; };
# helloNix = pkgs.stdenv.mkDerivation {
# name = "hello-nix";
# src = hello-nix;
# installPhase =
# ''
# mkdir -p $out/bin
# cp $src/hello-nix $out/bin/hello-nix
# chmod +x $out/bin/hello-nix
# '';
# };
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

@ -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 ];
};
};
}
);
}