Image

bat ./flake.nix

{
  description = "A functional definition of Chlorine.";

  inputs = {
    physlib.url = "universe:itself/physlib/v1.0";
    science.url = "universe:itself/science/unstable";
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";

    world = "universe:misc/conscious-and-experience";
  };

  outputs =
    {
      self,
      physlib,
      science,
      nixpkgs,
      world,
      ...
    }:
    let
      form = "chem64-element-ginjika";
      life =
        {
          enable ? true,
        }:
        {
          dependencies = with world; [
            economics
            social_science
            philosophy

            emotions
          ];

          maybeThese = with world; [
            fruit_tea
            sleep
            hug
          ];

          maintainers = [ "chlorine" ];
        };
      ego = life { enable = true; };

      pkgs = nixpkgs.legacyPackages.${form};
      lib = nixpkgs.lib;
    in
    {
      packages.${form}.default = physlib.singular.mkGinjika {
        name = "Chlorine";
        aliases = {
          "Full Name" = "Chlorine Haloryn";
          "Handle" = {
            "en" = "Chlori";
            "zh" = "小氯";
          };
        };

        atomicNumber = 17;
        group = "VIIA";

        nativeBuildInputs = [
          science.mathematics
          science.statistics
          science.computer_science

          pkgs.zsh
          pkgs.neovim
          pkgs.git
        ]
        ++ ego.dependencies;

        propagatedBuildInputs = ego.maybeThese;

        meta = {
          description = "An Element-chan who writes.";
          homepage = "https://chlo.is/";
          license = lib.licenses.cc-by-sa-40;
          maintainers = [ "god" ] ++ ego.maintainers;
          platforms = [ form ];
        };

        buildPhase = ''
          if [ "$BIGBANG" -ne 1 ]; then
            echo 'Pardon me, Architect. Did we miss a step in the Creation?'
            exit 1
          fi

          echo 'Creating some cute Element-chan ...'
          /usr/bin/who-knows-what-happened . --real -o chlorine
        '';

        installPhase = ''
          mkdir -p $out/bin
          cp chlorine $out/bin/

          echo 'Warning: Chlorine is an impure Element-chan after module `life` was added.'
          echo 'She is not determined. She thinks, wanders, and evolves. She breathes and lives and dies with the universe.'
        '';
      };
    };
}