Hello, I’m trying to install local .deb files on flake.nix without adding .deb flies on git too.
My directory is:
example folder
|-flake.nix
|-debs
|\1.deb
|\2.deb
|\...
|-install-deb.nix
Now, I wrote flake.nix such as
inputs = {
extrapkg.url = "git+https://anotherpkgurl";
};
outputs = { self, extrapkg }:
let
pkgs = extrapkg.pkgs;
artiq = extrapkg.packages.x86_64-linux;
debs = builtins.path {
path = ./debs;
name = "debs";
};
deb-install = import ./install-deb.nix {
inherit (pkgs) stdenv dpkg lib;
debs_directory = debs;
};
}
in {
# Define the development shells
devShells.x86_64-linux.default = pkgs.mkShell {
buildInputs = [
(pkgs.python310.withPackages (ps: with ps; [ myPython ]))
deb-install
];
shellHook = ''
export CPLUS_INCLUDE_PATH=${deb-install}/include
export LIBRARY_PATH=${deb-install}/lib
export LD_LIBRARY_PATH=${deb-install}/lib:$LD_LIBRARY_PATH
'';
};
packages.x86_64-linux.deb-install = deb-install;
This is my install-deb.nix
{ stdenv, dpkg, lib, debs_directory }:
stdenv.mkDerivation rec {
pname = "examplename";
version = "4.2.0.46";
src = debs_directory;
nativeBuildInputs = [ dpkg ];
unpackPhase = ''
echo "SRC path is: $src"
echo "Listing .deb files..."
ls -l $src/*.deb || echo "No .deb files found"
for deb in $src/*.deb; do
echo "Unpacking $deb..."
dpkg-deb -x "$deb" .
done
'';
installPhase = ''
echo "Contents after dpkg unpack:"
ls -R .
mkdir -p $out
cp -r * $out
'';
meta = with lib; {
description = "examples (.deb unpacked)";
platforms = platforms.linux;
};
}
Now, when I tested using
nix build .#deb-install --impure --show-trace --print-build-logs --no-write-lock-file
It says
aqp-linux@aqp-linux-inspiron:~/aqpcontrol_test/aqpcontrol$ nix build .#deb-install --impure --show-trace --print-build-logs --no-write-lock-file
error:
… while calling the 'derivationStrict' builtin
at <nix/derivation-internal.nix>:34:12:
33|
34| strict = derivationStrict drvAttrs;
| ^
35|
… while evaluating derivation 'examplename-4.2.0.46'
whose name attribute is located at /nix/store/vj980b72z6zb0yg6v0a7nzc9rcww3jmn-source/pkgs/stdenv/generic/make-derivation.nix:480:13
… while evaluating attribute 'src' of derivation 'examplename-4.2.0.46'
at /nix/store/lnsgjnis0x04bx2mnjdmrm0wc5gz8ws8-source/spinnaker-sdk.nix:7:3:
6|
7| src = debs_directory;
| ^
8|
… while calling the 'path' builtin
at /nix/store/lnsgjnis0x04bx2mnjdmrm0wc5gz8ws8-source/flake.nix:14:24:
13| artiq = extrapkg.packages.x86_64-linux;
14| debs = builtins.path {
| ^
15| path = ./debs;
… while adding path '/nix/store/lnsgjnis0x04bx2mnjdmrm0wc5gz8ws8-source/debs'
error: path '/nix/store/lnsgjnis0x04bx2mnjdmrm0wc5gz8ws8-source/debs' does not exist
It seems like flake.nix can’t find right directory.
Is it possible to install some local library without putting on git?
Thanks