preparing overlays for build system

This commit is contained in:
2025-05-24 16:53:01 +01:00
parent 257d91a432
commit c262e612e1
3 changed files with 50 additions and 41 deletions

16
flake.lock generated
View File

@@ -57,24 +57,14 @@
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 0,
"narHash": "sha256-m/lh6hYMIWDYHCAsn81CDAiXoT3gmxXI9J987W5tZrE=",
"path": "/nix/store/wj2qla569hnxwqfc26imv5hqbxc1rc27-source",
"type": "path"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"p2prc-hs": {
"inputs": {
"flake-utils": [
"flake-utils"
],
"nixpkgs": "nixpkgs_2"
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1,

View File

@@ -14,43 +14,61 @@
p2prc-hs = {
url = "path:./Bindings/Haskell";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
};
outputs = { self, nixpkgs, flake-utils, gomod2nix, p2prc-hs, ... }:
(flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ gomod2nix.overlays.default ];
};
outputs =
{
nixpkgs,
flake-utils,
gomod2nix,
p2prc-hs,
...
}:
let
# 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;
in
{
getOverlay = overlayName: import ./nix/overlays/${overlayName};
packages.default = callPackage ./. { };
mainOverlay = getOverlay "main.nix";
packages.p2prc-hs = pkgs.haskellPackages.callPackage ./Bindings/Haskell/project.nix {};
in
{
overlays.default = mainOverlay;
} //
(flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ gomod2nix.overlays.default mainOverlay ];
};
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
go
gopls
gotools
go-tools
gomod2nix.packages.${system}.default
sqlite-interactive
];
};
# 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;
in
{
devShells.p2prc-hs = p2prc-hs.devShell.${system};
packages.default = callPackage ./. { };
})
);
packages.p2prc-hs = pkgs.haskellPackages.callPackage ./Bindings/Haskell/project.nix { };
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
go
gopls
gotools
go-tools
gomod2nix.packages.${system}.default
sqlite-interactive
];
};
devShells.p2prc-hs = p2prc-hs.devShell.${system};
}
));
}

1
nix/overlays/main.nix Normal file
View File

@@ -0,0 +1 @@
final: prev: {}