22 Apr 2024 |
matthewcroughan - nix.how | Actually, this code doesn't work in flakes. | 21:34:36 |
matthewcroughan - nix.how | https://github.com/nix-community/poetry2nix/blob/master/vendor/pyproject.nix/fetchers/default.nix#L112-L116 | 21:34:50 |
matthewcroughan - nix.how | pathParts = filter ({ prefix, path }: "NETRC" == prefix) nixPath; # deadnix: skip
netrc_file =
if (pathParts != [ ])
then (head pathParts).path
else "";
| 21:34:59 |
matthewcroughan - nix.how | netrc_file is always "" because nixPath is always [] in pure-eval | 21:35:17 |
| @niklauzg:matrix.org left the room. | 23:53:48 |
23 Apr 2024 |
| nim65s changed their display name from Guilhem to nim65s. | 07:52:33 |
truh | Does it need to be that strict in fixed output derivations? Private git repos work too. | 09:49:56 |
@malteneuss:matrix.org | In reply to @matthewcroughan:defenestrate.it
netrc_file is always "" because nixPath is always [] in pure-eval Thanks for the feedback. The Nix flake variant indeed was missing in my PR. I added a few paragraphs how to add env vars to the nix-daemon (i think this is the only working way for flakes). Could you take a look again?
btw, thanks for your awesome talks on Nix for Docker (the main reason my company is willing to try Nix) and for Riscv.
| 19:55:13 |
@malteneuss:matrix.org | In reply to @truh:matrix.org Does it need to be that strict in fixed output derivations? Private git repos work too. According to my current understanding the correct way is to not let code inside the sandbox fetch things with credentials (due to security concerns) but let nix do that outside of the sandbox. I think there are some special builtins.fetchers that can take care of that. I may take a look at this once our Python backend services run with poetry2nix and Docker. | 19:59:28 |
matthewcroughan - nix.how | In reply to @malteneuss:matrix.org
Thanks for the feedback. The Nix flake variant indeed was missing in my PR. I added a few paragraphs how to add env vars to the nix-daemon (i think this is the only working way for flakes). Could you take a look again?
btw, thanks for your awesome talks on Nix for Docker (the main reason my company is willing to try Nix) and for Riscv.
Thanks! | 21:59:21 |
matthewcroughan - nix.how | No, I believe there is no way to pass the NETRC file in, even following your documentation, because poetry2nix has the above bug in it that makes stuff only work via -I which isn't available in pure-eval. | 21:59:48 |
matthewcroughan - nix.how | I'm triple checking that here | 21:59:55 |
matthewcroughan - nix.how | Yeah, fixed it here anyway https://github.com/nix-community/poetry2nix/pull/1612 | 22:44:03 |
25 Apr 2024 |
| @delroth:delroth.net left the room. | 14:44:15 |
| cullenmcd joined the room. | 17:41:30 |
26 Apr 2024 |
matthewcroughan - nix.how | In reply to @k900:0upti.me Any poetry2nix overrides are applied on top of nixpkgs overrides Is it possible we could go over this again please? I'm really trying to understand it, and would like to understand this code you wrote a bit better https://github.com/nix-community/poetry2nix/blob/master/default.nix#L233-L285 | 13:11:23 |
matthewcroughan - nix.how | https://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/development/python-modules/apsw/default.nix#L39 | 13:11:36 |
matthewcroughan - nix.how | apsw is a derivation that exists in nixpkgs. When poetry2nix encounters apsw in the pyproject.toml, does it use any information from nixpkgs that is already there, or is it making a completely unique derivation that doesn't re-use anything from nixpkgs? | 13:12:07 |
matthewcroughan - nix.how | I'm about to submit a fix for apsw in the overrides.nix in poetry2nix, but want to understand it more first | 13:12:26 |
matthewcroughan - nix.how | When poetry2nix sees apsw uses the sources from pypi, which are wrong because they contain a setup.py which breaks the build, because it doesn't do the same thing as the setup.py from GitHub. | 13:13:00 |
matthewcroughan - nix.how | * When poetry2nix sees apsw uses the sources from pypi, which are wrong because they contain a setup.py which breaks the build, because it doesn't do the same thing as the setup.py from GitHub. | 13:13:09 |
matthewcroughan - nix.how | In addition sqlite is not in the buildInputs of the poetry2nix generated derivation, which implies nothing is added to poetry2nix by the pre-existing nixpkgs derivation | 13:14:04 |
matthewcroughan - nix.how | Here's a minimal flake.nix to reproduce it ``nix { description = "A minimal Python project with apsw dependency";
inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; poetry2nix.url = "github:nix-community/poetry2nix"; };
outputs = { self, nixpkgs, flake-utils, poetry2nix }: flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; overlays = [ poetry2nix.overlays.default ]; }; in { packages.default = pkgs.poetry2nix.mkPoetryApplication { projectDir = ./.; preferWheels = false; };
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
poetry
(pkgs.poetry2nix.mkPoetryEnv {
projectDir = ./.;
preferWheels = false;
overrides = pkgs.poetry2nix.defaultPoetryOverrides.extend
(self: super: {
apsw = super.apsw.overridePythonAttrs
(
old: {
src = pkgs.fetchFromGitHub {
owner = "rogerbinns";
repo = "apsw";
rev = "3.45.2.0";
hash = "sha256-tTi3/10W4OoGH6PQVhvPWc5o09on5BZrWoAvrfh4C/E=";
};
buildInputs = old.buildInputs ++ [ pkgs.sqlite ];
}
);
});
})
];
};
}
);
}
| 13:15:34 |
matthewcroughan - nix.how | * Here's a minimal flake.nix to reproduce it
{
description = "A minimal Python project with apsw dependency";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
poetry2nix.url = "github:nix-community/poetry2nix";
};
outputs = { self, nixpkgs, flake-utils, poetry2nix }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; overlays = [ poetry2nix.overlays.default ]; };
in
{
packages.default = pkgs.poetry2nix.mkPoetryApplication {
projectDir = ./.;
preferWheels = false;
};
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
poetry
(pkgs.poetry2nix.mkPoetryEnv {
projectDir = ./.;
preferWheels = false;
overrides = pkgs.poetry2nix.defaultPoetryOverrides.extend
(self: super: {
apsw = super.apsw.overridePythonAttrs
(
old: {
src = pkgs.fetchFromGitHub {
owner = "rogerbinns";
repo = "apsw";
rev = "3.45.2.0";
hash = "sha256-tTi3/10W4OoGH6PQVhvPWc5o09on5BZrWoAvrfh4C/E=";
};
buildInputs = old.buildInputs ++ [ pkgs.sqlite ];
}
);
});
})
];
};
}
);
}
| 13:15:56 |
matthewcroughan - nix.how | and a pyproject.toml
[tool.poetry]
name = "my-project"
version = "0.1.0"
description = "A minimal Python project with apsw dependency"
authors = ["Your Name <your@email.com>"]
[tool.poetry.dependencies]
python = "^3.8"
apsw = "*"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
~
| 13:16:11 |
matthewcroughan - nix.how | * and a pyproject.toml
[tool.poetry]
name = "my-project"
version = "0.1.0"
description = "A minimal Python project with apsw dependency"
authors = ["Your Name <your@email.com>"]
[tool.poetry.dependencies]
python = "^3.8"
apsw = "*"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
~
| 13:16:16 |
matthewcroughan - nix.how | https://github.com/nix-community/poetry2nix/pull/1614 anyway | 14:00:42 |
matthewcroughan - nix.how | maybe it's not the right way to fix it | 14:00:45 |
| @christian:kampka.net left the room. | 18:32:59 |
29 Apr 2024 |
gaivs | Have anyone here had success getting imgui to work with nix?
| 06:55:09 |