fix nixpkgs command with latest nix version

This commit is contained in:
Jörg Thalheim
2024-10-22 12:38:01 +02:00
parent 78bf5b9147
commit eb0643f920
2 changed files with 29 additions and 19 deletions

View File

@@ -16,6 +16,7 @@
runCommand,
setuptools,
stdenv,
nixVersions,
# custom args
clan-core-path,
@@ -67,24 +68,33 @@ let
'';
# Create a custom nixpkgs for use within the project
nixpkgs' = runCommand "nixpkgs" { nativeBuildInputs = [ nix ]; } ''
mkdir $out
cat > $out/flake.nix << EOF
{
description = "dependencies for the clan-cli";
inputs = {
nixpkgs.url = "path://${nixpkgs}";
};
nixpkgs' =
runCommand "nixpkgs"
{
nativeBuildInputs = [
# old nix version doesn't support --flake flag
(if lib.versionAtLeast nix.version "2.24" then nix else nixVersions.latest)
];
}
''
mkdir $out
cat > $out/flake.nix << EOF
{
description = "dependencies for the clan-cli";
outputs = _inputs: { };
}
EOF
ln -sf ${nixpkgs} $out/path
nix flake update $out \
--store ./. \
--extra-experimental-features 'nix-command flakes'
'';
inputs = {
nixpkgs.url = "path://${nixpkgs}";
};
outputs = _inputs: { };
}
EOF
ln -sf ${nixpkgs} $out/path
HOME=$TMPDIR nix flake update --flake $out \
--store ./. \
--extra-experimental-features 'nix-command flakes'
'';
in
python3.pkgs.buildPythonApplication {
name = "clan-cli";