nixos: add wip FAIL* package derivation to flake.nix

This commit is contained in:
2026-01-12 23:26:06 +01:00
parent c10739b8df
commit c491750494
2 changed files with 167 additions and 267 deletions

119
flake.lock generated
View File

@ -1,66 +1,5 @@
{ {
"nodes": { "nodes": {
"clj-nix": {
"inputs": {
"devshell": "devshell",
"nix-fetcher-data": "nix-fetcher-data",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1767127926,
"narHash": "sha256-x7ySkkTG3dPi6jMhkPVten3pQCIzllRzcFqJ/tRQSFY=",
"owner": "jlesquembre",
"repo": "clj-nix",
"rev": "86c0312e9abcc46e3b4168c1b8ac1daebad5ddb6",
"type": "github"
},
"original": {
"owner": "jlesquembre",
"repo": "clj-nix",
"type": "github"
}
},
"devshell": {
"inputs": {
"nixpkgs": [
"clj-nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1741473158,
"narHash": "sha256-kWNaq6wQUbUMlPgw8Y+9/9wP0F8SHkjy24/mN3UAppg=",
"owner": "numtide",
"repo": "devshell",
"rev": "7c9e793ebe66bcba8292989a68c0419b737a22a0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1719745305,
"narHash": "sha256-xwgjVUpqSviudEkpQnioeez1Uo2wzrsMaJKJClh+Bls=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "c3c5ecc05edc7dafba779c6c1a61cd08ac6583e9",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": { "flake-utils": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems"
@ -79,28 +18,6 @@
"type": "github" "type": "github"
} }
}, },
"nix-fetcher-data": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": [
"clj-nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1728229178,
"narHash": "sha256-p5Fx880uBYstIsbaDYN7sECJT11oHxZQKtHgMAVblWA=",
"owner": "jlesquembre",
"repo": "nix-fetcher-data",
"rev": "f3a73c34d28db49ef90fd7872a142bfe93120e55",
"type": "github"
},
"original": {
"owner": "jlesquembre",
"repo": "nix-fetcher-data",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1768032153, "lastModified": 1768032153,
@ -115,44 +32,10 @@
"type": "indirect" "type": "indirect"
} }
}, },
"nixpkgs-lib": {
"locked": {
"lastModified": 1717284937,
"narHash": "sha256-lIbdfCsf8LMFloheeE6N31+BMIeixqyQWbSr2vk79EQ=",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz"
}
},
"root": { "root": {
"inputs": { "inputs": {
"clj-nix": "clj-nix",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs"
"rust-overlay": "rust-overlay"
}
},
"rust-overlay": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1768100056,
"narHash": "sha256-2GWCrsoWIuEXrzdKR2DPnoDhA5SqW7CGNO+Absni054=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "71a69fd633552550de7cb05cc149e4a99ff6f3b6",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
} }
}, },
"systems": { "systems": {

315
flake.nix
View File

@ -1,32 +1,22 @@
rec { rec {
description = ""; description = "FAIL* - Fault Injection Leveraged";
inputs = { inputs = {
nixpkgs.url = "nixpkgs"; # Use nixpkgs from system registry nixpkgs.url = "nixpkgs"; # Use nixpkgs from system registry
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
clj-nix.url = "github:jlesquembre/clj-nix";
clj-nix.inputs.nixpkgs.follows = "nixpkgs";
}; };
outputs = { outputs = {
self, self,
nixpkgs, nixpkgs,
flake-utils, flake-utils,
rust-overlay,
clj-nix,
}: }:
# Create a shell (and possibly package) for each possible system, not only x86_64-linux # Create a shell (and possibly package) for each possible system, not only x86_64-linux
flake-utils.lib.eachDefaultSystem (system: let flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
config.allowUnfree = true; config.allowUnfree = true;
overlays = [ overlays = [];
rust-overlay.overlays.default
];
}; };
inherit (pkgs) lib stdenv; inherit (pkgs) lib stdenv;
@ -34,57 +24,28 @@ rec {
# Define custom dependencies # Define custom dependencies
# =========================================================================================== # ===========================================================================================
# Python package example
# typed-ffmpeg = pkgs.python313Packages.buildPythonPackage rec {
# pname = "typed_ffmpeg";
# version = "3.6";
#
# src = pkgs.python313Packages.fetchPypi {
# inherit pname version;
# hash = "sha256-YPspq/lqI/jx/9FCQntmQPw4lrPIsdxtHTUg0F0QbrM=";
# };
#
# pyproject = true;
# build-system = [
# pkgs.python313Packages.setuptools
# pkgs.python313Packages.setuptools-scm
# ];
# };
# python = pkgs.python313.withPackages (p:
# with p; [
# # numpy
# # matplotlib
# # typed-ffmpeg
# # pyside6
# ]);
# rust = pkgs.rust-bin.stable.latest.default.override {
# extensions = ["rust-src"]; # Include the Rust stdlib source (for IntelliJ)
# };
# 64 bit C/C++ compilers that don't collide (use the same libc) # 64 bit C/C++ compilers that don't collide (use the same libc)
# bintools = pkgs.wrapBintoolsWith { bintools = pkgs.wrapBintoolsWith {
# bintools = pkgs.bintools.bintools; # Unwrapped bintools bintools = pkgs.bintools.bintools; # Unwrapped bintools
# libc = pkgs.glibc; libc = pkgs.glibc;
# }; };
# gcc = pkgs.hiPrio (pkgs.wrapCCWith { gcc = lib.hiPrio (pkgs.wrapCCWith {
# cc = pkgs.gcc.cc; # Unwrapped gcc cc = pkgs.gcc.cc; # Unwrapped gcc
# libc = pkgs.glibc; libc = pkgs.glibc;
# bintools = bintools; bintools = bintools;
# }); });
# clang = pkgs.wrapCCWith { clang = pkgs.wrapCCWith {
# cc = pkgs.clang.cc; # Unwrapped clang cc = pkgs.clang.cc; # Unwrapped clang
# libc = pkgs.glibc; libc = pkgs.glibc;
# bintools = bintools; bintools = bintools;
# }; };
# Multilib C/C++ compilers that don't collide (use the same libc) # Multilib C/C++ compilers that don't collide (use the same libc)
# bintools_multilib = pkgs.wrapBintoolsWith { # bintools_multilib = pkgs.wrapBintoolsWith {
# bintools = pkgs.bintools.bintools; # Unwrapped bintools # bintools = pkgs.bintools.bintools; # Unwrapped bintools
# libc = pkgs.glibc_multi; # libc = pkgs.glibc_multi;
# }; # };
# gcc_multilib = pkgs.hiPrio (pkgs.wrapCCWith { # gcc_multilib = lib.hiPrio (pkgs.wrapCCWith {
# cc = pkgs.gcc.cc; # Unwrapped gcc # cc = pkgs.gcc.cc; # Unwrapped gcc
# libc = pkgs.glibc_multi; # libc = pkgs.glibc_multi;
# bintools = bintools_multilib; # bintools = bintools_multilib;
@ -95,6 +56,84 @@ rec {
# bintools = bintools_multilib; # bintools = bintools_multilib;
# }; # };
aspectcxx = stdenv.mkDerivation rec {
pname = "aspectcxx";
version = "1.2";
src = pkgs.fetchurl {
url = "http://www.aspectc.org/releases/${version}/ac-bin-linux-x86-64bit-${version}.tar.gz";
sha256 = "sha256-8wOrPYC99E3aV5/Js2EBI4V/OoD9y10fYZt8ikPtvt4="; # 1.2
# sha256 = "sha256-gmqoZFkPvs60b6yuMHNtYvuGJXGnbwAYEiyXxp/fmPI="; # 2.0
# sha256 = "sha256-+rEflemXNwn4XZZwSOqCsr6/KFGV8wxW6PeXzHHUK0o="; # 2.5
};
nativeBuildInputs = [
pkgs.autoPatchelfHook
];
unpackPhase = ''
tar xvzf $src
'';
installPhase = ''
mkdir -p $out/bin
cp aspectc++/ac++ $out/bin/
cp aspectc++/ag++ $out/bin/
'';
};
libpcl = stdenv.mkDerivation rec {
pname = "libpcl";
version = "1.12-2";
src = pkgs.fetchurl {
url = "https://launchpadlibrarian.net/521269537/libpcl1_1.12-2_amd64.deb";
sha256 = "sha256-GL3mjPAccAtRMAJPnDMCHiDf6xNvGi4oUWylOIqBjP0=";
};
nativeBuildInputs = with pkgs; [
dpkg
autoPatchelfHook
];
unpackPhase = ''
dpkg-deb -x $src .
'';
installPhase = ''
mkdir -p $out
cp -r usr/* $out/
'';
};
libpcl-dev = stdenv.mkDerivation rec {
pname = "libpcl-dev";
version = "1.12-2";
src = pkgs.fetchurl {
url = "https://launchpadlibrarian.net/521269536/libpcl1-dev_${version}_amd64.deb";
sha256 = "sha256-Z1wP0K8hfV1f9ypee9XIx6H0JOTidhtXDBe82mlRaOg=";
};
nativeBuildInputs = with pkgs; [
dpkg
autoPatchelfHook
];
unpackPhase = ''
dpkg-deb -x $src .
'';
installPhase = ''
mkdir -p $out
cp -r usr/* $out/
# Hacky bullshit
cp ${libpcl}/lib/x86_64-linux-gnu/libpcl.so.1.0.11 $out/lib/x86_64-linux-gnu/libpcl.so.1.0.11
rm $out/share/doc/libpcl1-dev/changelog.Debian.gz
'';
};
# =========================================================================================== # ===========================================================================================
# Specify dependencies # Specify dependencies
# https://nixos.org/manual/nixpkgs/stable/#ssec-stdenv-dependencies-overview # https://nixos.org/manual/nixpkgs/stable/#ssec-stdenv-dependencies-overview
@ -107,37 +146,16 @@ rec {
# - Interpreters needed by patchShebangs for build scripts (with the --build flag), which can be the case for e.g. perl # - Interpreters needed by patchShebangs for build scripts (with the --build flag), which can be the case for e.g. perl
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
# Languages: # Languages:
# python bintools
# rust gcc
# bintools
# gcc
# clang # clang
# bintools_multilib aspectcxx
# gcc_multilib
# clang_multilib
# clojure
# jdk
# C/C++: # C/C++:
# gdb
# valgrind
gnumake gnumake
# cmake cmake
# pkg-config pkg-config
doxygen
# Clojure:
# leiningen
# clj-nix.packages.${system}.deps-lock
# Java:
# gradle
# Python:
# hatch
# py-spy
# Qt:
# qt6.wrapQtAppsHook # For the shellHook
]; ];
# Add dependencies to buildInputs if they will end up copied or linked into the final output or otherwise used at runtime: # Add dependencies to buildInputs if they will end up copied or linked into the final output or otherwise used at runtime:
@ -145,50 +163,77 @@ rec {
# - Interpreters needed by patchShebangs for scripts which are installed, which can be the case for e.g. perl # - Interpreters needed by patchShebangs for scripts which are installed, which can be the case for e.g. perl
buildInputs = with pkgs; [ buildInputs = with pkgs; [
# C/C++: # C/C++:
# boost libpcl-dev
# sfml libiberty
libelf
libdwarf
boost
# Qt: llvmPackages_18.llvm
# qt6.qtbase mariadb-connector-c
# qt6.full fontconfig
zlib
capstone
protobuf
binutils
# No clue what I need from those
xorg.libX11
xorg.libXext
xorg.libXrender
xorg.libXrandr
xorg.libXinerama
xorg.libXcursor
xorg.libXi
xorg.libXfixes
]; ];
# =========================================================================================== # ===========================================================================================
# Define buildable + installable packages # Define buildable + installable packages
# =========================================================================================== # ===========================================================================================
# package = stdenv.mkDerivation { package = stdenv.mkDerivation {
# inherit nativeBuildInputs buildInputs; inherit nativeBuildInputs buildInputs;
# pname = ""; pname = "fail";
# version = "1.0.0"; version = "1.0.1";
# src = ./.; src = ./.;
#
# installPhase = '' enableParallelBuilding = true;
# mkdir -p $out/bin
# mv ./BINARY $out/bin cmakeFlags = [
# ''; # Our CMake is too new :( Try it anyway, can still downgrade later...
# }; "-DCMAKE_POLICY_VERSION_MINIMUM=3.5"
# package = clj-nix.lib.mkCljApp {
# inherit pkgs; # AspectC++
# modules = [ # "-DCMAKE_AGPP_FLAGS=--c_compiler${clang}/bin/clang++"
# # Option list: https://jlesquembre.github.io/clj-nix/options/ "-DCMAKE_AGPP_FLAGS=-D__NO_MATH_INLINES"
# { # "-DCMAKE_AGPP_FLAGS=--c_compiler${clang}/bin/clang++ -D__NO_MATH_INLINES -D__STRICT_ANSI__"
# name = "";
# version = "1.0.0"; # Tell CMake where the libs are
# main-ns = ""; "-DLibIberty_INCLUDE_DIRS=${pkgs.libiberty}/include"
# projectSrc = ./.; "-DLibIberty_LIBRARIES=${pkgs.libiberty}/lib/libiberty.a"
# withLeiningen = true;
# buildCommand = "lein uberjar"; # Requires "withLeiningen = true;" "-DLIBELF_INCLUDE_DIRS=${pkgs.libelf}/include"
# jdk = pkgs.jdk; # Default is pkgs.jdk_headless "-DLIBELF_LIBRARIES=${pkgs.libelf}/lib/libelf.a"
# # customJdk.enable = true;
# # nativeImage.enable = true; "-DLIBDWARF_INCLUDE_DIRS=${pkgs.libdwarf}/include"
# } "-DLIBDWARF_LIBRARIES=${pkgs.libdwarf}/lib/libdwarf.a"
# ];
# }; "-DCAPSTONE_INCLUDE_DIR=${pkgs.capstone}/include"
"-DCAPSTONE_LIBRARY=${pkgs.capstone}/lib/libcapstone.a"
"-DLIBPCL_LIBRARIES=${libpcl-dev}/lib/libpcl.a"
];
installPhase = ''
mkdir -p $out/bin
mv ./fail $out/bin/
'';
};
in rec { in rec {
# Provide package for "nix build" # Provide package for "nix build"
# defaultPackage = package; defaultPackage = package;
# defaultApp = flake-utils.lib.mkApp { defaultApp = flake-utils.lib.mkApp {
# drv = defaultPackage; drv = defaultPackage;
# }; };
# Provide environment for "nix develop" # Provide environment for "nix develop"
devShell = pkgs.mkShell { devShell = pkgs.mkShell {
@ -199,9 +244,6 @@ rec {
# Define environment variables # Define environment variables
# ========================================================================================= # =========================================================================================
# Rust stdlib source:
# RUST_SRC_PATH = "${rust}/lib/rustlib/src/rust/library";
# Custom dynamic libraries: # Custom dynamic libraries:
# LD_LIBRARY_PATH = builtins.concatStringsSep ":" [ # LD_LIBRARY_PATH = builtins.concatStringsSep ":" [
# # Rust Bevy GUI app: # # Rust Bevy GUI app:
@ -219,13 +261,7 @@ rec {
# ]; # ];
# Dynamic libraries from buildinputs: # Dynamic libraries from buildinputs:
# LD_LIBRARY_PATH = nixpkgs.lib.makeLibraryPath buildInputs; LD_LIBRARY_PATH = nixpkgs.lib.makeLibraryPath buildInputs;
# QT imports to use with "qmlls -E"
# QML_IMPORT_PATH = "${pkgs.qt6.full}/lib/qt-6/qml";
# Set PYTHONPATH
# PYTHONPATH = ".";
# Set matplotlib backend # Set matplotlib backend
# MPLBACKEND = "TkAgg"; # MPLBACKEND = "TkAgg";
@ -280,22 +316,11 @@ rec {
# Determine the project root, used e.g. in cmake scripts # Determine the project root, used e.g. in cmake scripts
set -g -x FLAKE_PROJECT_ROOT (git rev-parse --show-toplevel) set -g -x FLAKE_PROJECT_ROOT (git rev-parse --show-toplevel)
# Rust Bevy:
# abbr -a build-release-windows "CARGO_FEATURE_PURE=1 cargo xwin build --release --target x86_64-pc-windows-msvc"
# C/C++: # C/C++:
# abbr -a cmake-debug "${cmakeDebug}" # abbr -a cmake-debug "${cmakeDebug}"
# abbr -a cmake-release "${cmakeRelease}" # abbr -a cmake-release "${cmakeRelease}"
# abbr -a build-debug "${buildDebug}" # abbr -a build-debug "${buildDebug}"
# abbr -a build-release "${buildRelease}" # abbr -a build-release "${buildRelease}"
# Clojure:
# abbr -a clojure-deps "deps-lock --lein"
# Python:
# abbr -a run "python ./app/main.py"
# abbr -a profile "py-spy record -o profile.svg -- python ./app/main.py && firefox profile.svg"
# abbr -a ptop "py-spy top -- python ./app/main.py"
''; '';
in in
builtins.concatStringsSep "\n" [ builtins.concatStringsSep "\n" [
@ -303,14 +328,6 @@ rec {
'' ''
exec "$(type -p fish)" -C "source ${initProjectShell} && abbr -a menu '${pkgs.bat}/bin/bat "${initProjectShell}"'" exec "$(type -p fish)" -C "source ${initProjectShell} && abbr -a menu '${pkgs.bat}/bin/bat "${initProjectShell}"'"
'' ''
# Qt: Launch into wrapped fish shell
# https://nixos.org/manual/nixpkgs/stable/#sec-language-qt
# ''
# fishdir=$(mktemp -d)
# makeWrapper "$(type -p fish)" "$fishdir/fish" "''${qtWrapperArgs[@]}"
# exec "$fishdir/fish" -C "source ${initProjectShell} && abbr -a menu '${pkgs.bat}/bin/bat "${initProjectShell}"'"
# ''
]; ];
}; };
}); });