Skip to content
Snippets Groups Projects
flake.nix 2.04 KiB
Newer Older
{
  inputs = {
    nixpkgs.url = "github:/NixOS/nixpkgs/nixpkgs-unstable";
  };

  outputs = { self, nixpkgs }:
    let pkgs = nixpkgs.legacyPackages.x86_64-linux;
    in
    {
      devShell.x86_64-linux =
        pkgs.mkShell {
          buildInputs = with pkgs; [
            (python311.withPackages
              (ps: with ps; [
                # We need to make sure that all Python the programs are installed
                # with the same version of Python to avoid overriding PYTHONPATH
                jupyter
                python-openstackclient
                python-magnumclient
                python-octaviaclient
                httpie
              ]))
            pwgen
            jq
          ];
          shellHook = ''
            source openrc
          '';
        };

      dockerContainers.inf110-workspace =
        pkgs.dockerTools.buildLayeredImage {
          name = "inf110-workspace-base";
          tag = "latest";
          # Update to the latest version of the image with the output of:
          # $ nix run nixpkgs#nix-prefetch-docker -- --image-name codercom/code-server --image-tag latest --arch amd64 --os linux
          fromImage = pkgs.dockerTools.pullImage {
            imageName = "codercom/code-server";
            imageDigest = "sha256:f32cfa5e7cc768f60969f1d2183fc4c7aa093b80b93c365535e83f79ccf004f2";
            sha256 = "0aa297aqrhfi0c3wybd9wld95axsn84g0caprzqrihdfxzh9bw91";
            finalImageName = "codercom/code-server";
            finalImageTag = "latest";
          };
          config = {
            User = "coder";
            Env = [
              "LANG=en_US.UTF-8"
              "HOME=/home/coder"
            ];
          };
          contents = with pkgs; buildEnv {
            name = "copyToRoot";
            paths = [
              bashInteractive
              coq_8_19
              coqPackages_8_19.coq-lsp
              dockerTools.binSh
              (python3.withPackages (ps: with ps; [ jupyter-client ipykernel ]))
            ];
            pathsToLink = [ "/bin" ];
          };
        };
    };
}