nix-book/source/recipes/remote-git/flake/flake.nix
Amy de Buitléir 90b9c96dc5 expanded
2025-09-02 16:56:18 +01:00

54 lines
1.3 KiB
Nix

{
# See https://github.com/mhwombat/nix-for-numbskulls/blob/main/flakes.md
# for a brief overview of what each section in a flake should or can contain.
description = "a sample flake";
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; };
in
{
devShells = rec {
default = pkgs.mkShell {
packages = [ hello-nix ];
};
};
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/hello-again
chmod +x $out/bin/hello-again
'';
};
default = hello;
};
apps = rec {
hello = flake-utils.lib.mkApp { drv = self.packages.${system}.hello; };
default = hello;
};
}
);
}