fixing nix development and build environments

This commit is contained in:
2025-05-21 23:11:56 +01:00
parent 42cf9bd028
commit 257d91a432
6 changed files with 28 additions and 45 deletions

View File

@@ -11,13 +11,13 @@
system:
let
pkgs = nixpkgs.legacyPackages.${system};
hsPkgs = pkgs.haskell.packages.ghc98;
in
{
packages.default = hsPkgs.callCabal2nix "p2prc" ./. {};
packages.default = pkgs.haskellPackages.callPackage ./project.nix {};
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
cabal2nix
cabal-install
haskell.compiler.ghc98
zlib.dev

View File

@@ -0,0 +1,17 @@
{ mkDerivation, aeson, base, bytestring, directory, lib, process
, text
}:
mkDerivation {
pname = "p2prc";
version = "0.1.0.0";
src = ./.;
isLibrary = true;
isExecutable = true;
libraryHaskellDepends = [
aeson base bytestring directory process text
];
executableHaskellDepends = [ base ];
description = "P2PRC haskell library";
license = "unknown";
mainProgram = "p2prc";
}

41
flake.lock generated
View File

@@ -71,12 +71,14 @@
},
"p2prc-hs": {
"inputs": {
"nixpkgs": "nixpkgs_2",
"utils": "utils"
"flake-utils": [
"flake-utils"
],
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1,
"narHash": "sha256-185ddVKbQVvVaJL6H8BPxDcH9m+Pmx42eRVJkB0foQM=",
"narHash": "sha256-6V4bXwaigsd4mcWfyAzYJ2Cuhj8RDuD/N/Y8d2Z8XZM=",
"path": "./Bindings/Haskell",
"type": "path"
},
@@ -107,39 +109,6 @@
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",

View File

@@ -28,11 +28,6 @@
overlays = [ gomod2nix.overlays.default ];
};
# p2prc-hs = import (self + "/Bindings/Haskell/flake.nix") {
# inherit pkgs;
# inherit system;
# };
# The current default sdk for macOS fails to compile go projects, so we use a newer one for now.
# This has no effect on other platforms.
callPackage = pkgs.darwin.apple_sdk_11_0.callPackage or pkgs.callPackage;
@@ -41,7 +36,7 @@
packages.default = callPackage ./. { };
# packages.p2prc-hs = p2prc-hs.packages.${system}.default;
packages.p2prc-hs = pkgs.haskellPackages.callPackage ./Bindings/Haskell/project.nix {};
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
@@ -51,9 +46,11 @@
go-tools
gomod2nix.packages.${system}.default
sqlite-interactive
p2prc-hs.devShells.${system}.default
];
};
devShells.p2prc-hs = p2prc-hs.devShell.${system};
})
);
}