mach-nix icon indicating copy to clipboard operation
mach-nix copied to clipboard

Specifying unique derivation name for python applications

Open picogeyer opened this issue 3 years ago • 0 comments

I'm using mach-nix to bundle 2 python applications with a common library.

let mylib = mach-nix.buildPythonPackage {
    requirements = builtins.readFile ./requirements.txt;
    pname = "my_lib";
    src = ./.
};
in

# App1
mach-nix.mkPython {
  requirements = builtins.readFile ./requirements.txt;
  packagesExtra = [
                  my_lib
                  ./.
                  ];
}

# App2 in a different directory
mach-nix.mkPython {
  requirements = builtins.readFile ./requirements.txt;
  packagesExtra = [
                  my_lib
                  ./.
                  ];
}

The above is just the general idea so might not be perfectly well formed code. The issue I'm having is that I don't see a parameter to give each of the application derivations a unique name. I see the following for my apps:

nix-build -A app1
...

nix show-derivation /path/to/app1/derivation.drv | grep name
"name": "python3-3.8.9-env"

nix-build -A app2
...

nix show-derivation /path/to/app2/derivation.drv | grep name
"name": "python3-3.8.9-env"

With the above I won't be able to install both apps side by side using nix-env -i Is there a way to customize the name of the derivation? I didn't see anything by looking at the documentation or the examples.

picogeyer avatar Nov 10 '21 18:11 picogeyer