Hello,
We want to install a home-made python package xyz
into the nix development environment using the flake.nix file, so when I run `ǹix develop``, it creates a shell with the right python, artiq, and our custom package. This is installed using pip and setup.py file at the moment.
We are migrating away from conda, and at the moment, the experiment files import modules from xyz directly. I prefer to not change the experiment files.
How can I do this? Here is my file system structure, and the contents of flake.nix file:
./
|---- flake.nix
|---- flake.lock
|---- local_packages/
| |---- xyz/
| | |---- setup.py
| | |---- build stuff
|---- repository/
| |---- experiment files
flake.nix
{
inputs = {
artiq.url = "git+https://github.com/m-labs/artiq.git?ref=release-8";
artiq-comtools.follows = "artiq/artiq-comtools";
artiq-extrapkg = {
url = "git+https://git.m-labs.hk/M-Labs/artiq-extrapkg.git?ref=release-8";
inputs.artiq.follows = "artiq";
};
nixpkgs.follows = "artiq/nixpkgs";
};
outputs = { self, artiq, artiq-comtools, artiq-extrapkg, nixpkgs }:
let
pkgs = import nixpkgs { system = "x86_64-linux"; };
# Combine attribute sets for convenience
artiq-full = artiq.packages.x86_64-linux // artiq-comtools.packages.x86_64-linux // artiq-extrapkg.packages.x86_64-linux;
in
{
# Default shell for `nix develop`
devShells.x86_64-linux.default = pkgs.mkShell {
buildInputs = [
# Python packages
(pkgs.python312.withPackages (ps: [
ps.redis
ps.numpy
ps.scipy
ps.matplotlib
ps.pyserial
ps.colorlog
# From the artiq flake
artiq-full.artiq
# Additional packages
artiq-full.artiq-comtools
#ps.paramiko # needed for flashing boards remotely (artiq_flash -H)
]))
# Non-Python packages
#artiq-full.openocd-bscanspi # needed for flashing boards, also provides proxy bitstreams
pkgs.git
];
};
# Enables use of `nix fmt`
formatter.x86_64-linux = pkgs.nixpkgs-fmt;
};
# Settings to enable substitution from the M-Labs servers (avoiding local builds)
nixConfig = {
extra-trusted-public-keys = [
"nixbld.m-labs.hk-1:5aSRVA5b320xbNvu30tqxVPXpld73bhtOeH6uAjRyHc="
];
extra-substituters = [ "https://nixbld.m-labs.hk" ];
};
}
How should I modify the flake file to do this?
Any help is appreciated!! (:
Clear skies,
Santhosh