2022-05-28 14:14:08 -05:00
|
|
|
{
|
|
|
|
description = "hostapps";
|
|
|
|
inputs = {
|
|
|
|
nixpkgs = {
|
|
|
|
url = "github:nixos/nixpkgs/nixos-unstable";
|
|
|
|
};
|
2023-10-30 15:57:52 -05:00
|
|
|
flake-utils = {
|
|
|
|
url = "github:numtide/flake-utils";
|
|
|
|
};
|
2023-10-29 21:33:23 -05:00
|
|
|
make-shell = {
|
|
|
|
url = "github:ursi/nix-make-shell";
|
2023-03-24 10:53:20 -05:00
|
|
|
};
|
2024-05-14 14:44:33 -05:00
|
|
|
# zig = {
|
|
|
|
# url = "github:mitchellh/zig-overlay";
|
|
|
|
# inputs.nixpkgs.follows = "nixpkgs";
|
2024-12-13 10:39:38 -06:00
|
|
|
# inputs.flake-utils.follows = "flake-utils";
|
2024-05-14 14:44:33 -05:00
|
|
|
# };
|
|
|
|
# zls = {
|
|
|
|
# url = "github:zigtools/zls";
|
|
|
|
# inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
# inputs.zig-overlay.follows = "zig";
|
|
|
|
# inputs.flake-utils.follows = "flake-utils";
|
|
|
|
# };
|
2022-05-28 14:14:08 -05:00
|
|
|
};
|
2023-10-29 21:33:23 -05:00
|
|
|
outputs = {
|
|
|
|
self,
|
|
|
|
nixpkgs,
|
2024-09-21 16:35:21 -05:00
|
|
|
# poetry2nix,
|
2023-10-29 21:33:23 -05:00
|
|
|
flake-utils,
|
2024-05-14 14:44:33 -05:00
|
|
|
...
|
2023-10-29 21:33:23 -05:00
|
|
|
} @ inputs:
|
2022-10-09 09:57:03 -05:00
|
|
|
flake-utils.lib.eachDefaultSystem
|
2023-10-29 21:33:23 -05:00
|
|
|
(
|
|
|
|
system: let
|
|
|
|
pkgs = import nixpkgs {
|
|
|
|
inherit system;
|
2024-09-21 16:15:00 -05:00
|
|
|
config.permittedInsecurePackages = [];
|
2023-10-29 21:33:23 -05:00
|
|
|
};
|
2024-12-13 10:39:38 -06:00
|
|
|
zig_hook = pkgs.zig_0_13.hook.overrideAttrs {
|
2024-05-14 17:00:35 -05:00
|
|
|
zig_default_flags = "-Dcpu=baseline -Doptimize=ReleaseFast";
|
|
|
|
};
|
2023-10-29 21:33:23 -05:00
|
|
|
make-shell = import inputs.make-shell {
|
|
|
|
inherit system pkgs;
|
|
|
|
};
|
2024-09-21 16:35:21 -05:00
|
|
|
# inherit (poetry2nix.lib.mkPoetry2Nix {inherit pkgs;}) mkPoetryApplication overrides;
|
2023-10-29 21:33:23 -05:00
|
|
|
in {
|
2024-01-12 22:47:10 -06:00
|
|
|
packages = {
|
2024-12-13 10:39:38 -06:00
|
|
|
hostapps-python = pkgs.python3.pkgs.buildPythonPackage {
|
2024-09-21 16:35:21 -05:00
|
|
|
pname = "hostapps";
|
|
|
|
version = "0.1.0";
|
|
|
|
pyproject = true;
|
|
|
|
src = ./.;
|
|
|
|
propagatedBuildInputs = with pkgs.python3.pkgs; [
|
|
|
|
click
|
|
|
|
poetry-core
|
|
|
|
pydantic
|
|
|
|
pynetbox
|
2024-01-12 22:47:10 -06:00
|
|
|
];
|
2024-09-21 16:35:21 -05:00
|
|
|
doCheck = false;
|
2024-01-12 22:47:10 -06:00
|
|
|
};
|
|
|
|
hostapps-zig = let
|
|
|
|
cache = src:
|
2024-05-14 17:00:35 -05:00
|
|
|
pkgs.stdenv.mkDerivation {
|
2024-01-12 22:47:10 -06:00
|
|
|
inherit src;
|
|
|
|
name = "hostapps-zig-cache";
|
2024-05-14 17:00:35 -05:00
|
|
|
nativeBuildInputs = [pkgs.git zig_hook];
|
2024-05-14 16:48:09 -05:00
|
|
|
|
2024-01-12 22:47:10 -06:00
|
|
|
dontConfigure = true;
|
2024-05-14 16:48:09 -05:00
|
|
|
dontUseZigBuild = true;
|
|
|
|
dontUseZigInstall = true;
|
2024-01-12 22:47:10 -06:00
|
|
|
dontFixup = true;
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
zig build --fetch
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
2024-05-14 16:48:09 -05:00
|
|
|
cp -r --reflink=auto $ZIG_GLOBAL_CACHE_DIR $out
|
2024-01-12 22:47:10 -06:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
2024-05-14 17:00:35 -05:00
|
|
|
# outputHash = pkgs.lib.fakeHash;
|
2024-12-13 10:39:38 -06:00
|
|
|
outputHash = "sha256-OOBbn07bYUxYEudlone34/jJd4Aw1pEtEQVIrnZdqHY=";
|
2024-01-12 22:47:10 -06:00
|
|
|
outputHashMode = "recursive";
|
|
|
|
};
|
|
|
|
in
|
2024-05-14 17:00:35 -05:00
|
|
|
pkgs.stdenv.mkDerivation (
|
2024-01-12 22:47:10 -06:00
|
|
|
attrs: {
|
|
|
|
pname = "hostapps-zig";
|
|
|
|
version = "0.0.0";
|
|
|
|
|
|
|
|
src = ./.;
|
|
|
|
|
2024-05-14 16:48:09 -05:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkgs.git
|
2024-12-13 10:39:38 -06:00
|
|
|
pkgs.inetutils
|
|
|
|
pkgs.openssh
|
2024-05-14 17:00:35 -05:00
|
|
|
zig_hook
|
2024-01-12 22:47:10 -06:00
|
|
|
];
|
|
|
|
|
|
|
|
preBuild = ''
|
2024-05-14 16:48:09 -05:00
|
|
|
rm -rf $ZIG_GLOBAL_CACHE_DIR
|
|
|
|
cp -r --reflink=auto ${cache attrs.src} $ZIG_GLOBAL_CACHE_DIR
|
2024-01-12 22:47:10 -06:00
|
|
|
chmod -R u+rwX $ZIG_GLOBAL_CACHE_DIR
|
|
|
|
'';
|
|
|
|
|
2024-05-14 16:48:09 -05:00
|
|
|
# buildPhase = ''
|
|
|
|
# runHook preBuild
|
|
|
|
# zig build -Doptimize=ReleaseSafe
|
|
|
|
# runHook postBuild
|
|
|
|
# '';
|
2024-01-12 22:47:10 -06:00
|
|
|
|
2024-05-14 16:48:09 -05:00
|
|
|
# installPhase = ''
|
|
|
|
# runHook preInstall
|
|
|
|
# mkdir -p $out/bin
|
|
|
|
# cp zig-out/bin/hostapps $out/bin
|
|
|
|
# runHook postInstall
|
|
|
|
# '';
|
2024-01-12 22:47:10 -06:00
|
|
|
}
|
|
|
|
);
|
2023-10-29 21:33:23 -05:00
|
|
|
};
|
|
|
|
defaultPackage = self.packages.${system}.hostapps;
|
|
|
|
devShells.default = let
|
|
|
|
python = pkgs.python312.withPackages (
|
|
|
|
ps:
|
|
|
|
with ps; [
|
|
|
|
# poetry-core
|
|
|
|
]
|
|
|
|
);
|
|
|
|
project = "hostapps";
|
2022-10-09 09:57:03 -05:00
|
|
|
in
|
2023-10-29 21:33:23 -05:00
|
|
|
make-shell {
|
|
|
|
packages = [
|
|
|
|
python
|
2023-10-30 13:59:27 -05:00
|
|
|
pkgs.inetutils
|
2022-10-09 09:57:03 -05:00
|
|
|
pkgs.openssh
|
2023-10-29 21:33:23 -05:00
|
|
|
pkgs.poetry
|
2023-10-30 13:59:27 -05:00
|
|
|
pkgs.sshpass
|
2024-12-13 10:39:38 -06:00
|
|
|
pkgs.zig_0_13
|
2022-10-09 09:57:03 -05:00
|
|
|
];
|
2023-10-29 21:33:23 -05:00
|
|
|
env = {
|
2024-01-12 22:47:10 -06:00
|
|
|
name = project;
|
2022-10-09 09:57:03 -05:00
|
|
|
};
|
2023-10-29 21:33:23 -05:00
|
|
|
};
|
|
|
|
}
|
|
|
|
);
|
2022-05-28 14:14:08 -05:00
|
|
|
}
|