picoCTF/flake.nix

48 lines
1.1 KiB
Nix
Raw Normal View History

2023-08-23 21:17:59 +00:00
{
description = "picoGym Practice Challenges";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
};
outputs = {
self,
nixpkgs,
}: let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
2023-08-24 16:40:32 +00:00
exercises = builtins.attrNames (builtins.readDir ./exercises);
forAllExercises = nixpkgs.lib.genAttrs exercises;
2023-08-23 21:17:59 +00:00
in {
formatter.${system} = pkgs.alejandra;
2023-08-24 16:40:32 +00:00
packages.${system} = forAllExercises (
exercise:
pkgs.writers.writePython3Bin "picoCTF_${exercise}" {
2023-08-24 17:02:49 +00:00
#libraries = with pkgs.python3.pkgs; [requests];
2023-08-24 16:40:32 +00:00
} "${builtins.readFile ./exercises/${exercise}/main.py}"
);
apps.${system} = forAllExercises (
exercise: {
type = "app";
program = "${self.packages.${system}.${exercise}}/bin/picoCTF_${exercise}";
}
);
devShells.${system} =
forAllExercises (
exercise:
pkgs.mkShellNoCC {
packages = with pkgs; [python3];
}
)
// {
default = pkgs.mkShellNoCC {
packages = with pkgs; [python3];
};
};
2023-08-23 21:17:59 +00:00
};
}