Refactor flake.nix to use stdenv.mkDerivation instead of buildPythonApplication, disable configure/build phases, add minimal installPhase to avoid triggering Makefile. See ChatGPT conversation: https://chatgpt.com/share/69332bc4-a128-800f-a69c-fdc24c4cc7fe
This commit is contained in:
21
flake.nix
21
flake.nix
@@ -46,14 +46,13 @@
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
# Packages: nix build .#pkgmgr / .#default
|
|
||||||
packages = forAllSystems (system:
|
packages = forAllSystems (system:
|
||||||
let
|
let
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
python = pkgs.python311;
|
python = pkgs.python311;
|
||||||
pypkgs = pkgs.python311Packages;
|
pypkgs = pkgs.python311Packages;
|
||||||
|
|
||||||
# Be robust: ansible-core if available, otherwise ansible.
|
# Optional: ansible mit in den Closure nehmen
|
||||||
ansiblePkg =
|
ansiblePkg =
|
||||||
if pkgs ? ansible-core then pkgs.ansible-core
|
if pkgs ? ansible-core then pkgs.ansible-core
|
||||||
else pkgs.ansible;
|
else pkgs.ansible;
|
||||||
@@ -65,10 +64,21 @@
|
|||||||
|
|
||||||
src = ./.;
|
src = ./.;
|
||||||
|
|
||||||
|
# Nix soll *kein* configure / build ausführen (also auch kein make)
|
||||||
|
dontConfigure = true;
|
||||||
|
dontBuild = true;
|
||||||
|
|
||||||
|
# Wenn du Python/Ansible im Runtime-Closure haben willst:
|
||||||
|
buildInputs = [
|
||||||
|
python
|
||||||
|
pypkgs.pyyaml
|
||||||
|
ansiblePkg
|
||||||
|
];
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/bin
|
mkdir -p "$out/bin"
|
||||||
cp main.py $out/bin/pkgmgr
|
cp main.py "$out/bin/pkgmgr"
|
||||||
chmod +x $out/bin/pkgmgr
|
chmod +x "$out/bin/pkgmgr"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -78,6 +88,7 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Apps: nix run .#pkgmgr / .#default
|
# Apps: nix run .#pkgmgr / .#default
|
||||||
apps = forAllSystems (system:
|
apps = forAllSystems (system:
|
||||||
let
|
let
|
||||||
|
|||||||
Reference in New Issue
Block a user