nix-book/source/new-flake/bash-flake/flake-4.nix
Amy de Buitléir 0f5e7fb6bc temp
2025-10-12 21:48:22 +01:00

44 lines
1.1 KiB
Nix

{
description = "what does the cow say";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, nixpkgs }:
let
supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
forAllSupportedSystems = nixpkgs.lib.genAttrs supportedSystems;
nixpkgsFor = forAllSupportedSystems (system: import nixpkgs { inherit system; });
in {
devShells = forAllSupportedSystems (system:
let pkgs = nixpkgsFor.${system}; in {
default = pkgs.mkShell {
packages = [ pkgs.cowsay ];
};
});
packages = forAllSupportedSystems (system:
let pkgs = nixpkgsFor.${system}; in {
default = pkgs.stdenv.mkDerivation {
name = "cow-hello.sh";
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 ];
}; # mkDerivation
}); # packages
}; # outputs
}