nix-book/source/new-flake/bash-flake/flake-4.nix
Amy de Buitléir 374030a540 initial commit
2025-10-12 16:00:44 +01:00

50 lines
1 KiB
Nix

{
description = "what does the cow say";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, nixpkgs }: {
devShells =
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in {
${system}.default =
pkgs.mkShell {
packages = [
pkgs.cowsay
];
}; # mkShell
}; # devShells
packages =
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in rec {
${system}.hello = pkgs.stdenv.mkDerivation {
name = "cow-hello";
src = ./.;
unpackPhase = "true";
buildPhase = ":";
installPhase =
''
mkdir -p $out/bin
cp $src/cow-hello.sh $out/bin
chmod +x $out/bin/cow-hello.sh
'';
buildInputs = [ pkgs.cowsay ];
};
${system}.default = hello;
}; # packages
};
}