commit 412340b95bc6334c118486c33242d5e5ccf63137
parent 4e9e8020d528400319a97f9c472004299369f133
Author: Jared Tobin <jared@jtobin.io>
Date: Sun, 25 Feb 2024 08:59:27 +0400
Update project flake.
Diffstat:
2 files changed, 36 insertions(+), 7 deletions(-)
diff --git a/flake.lock b/flake.lock
@@ -20,11 +20,11 @@
},
"nixpkgs": {
"locked": {
- "lastModified": 1708247094,
- "narHash": "sha256-H2VS7VwesetGDtIaaz4AMsRkPoSLEVzL/Ika8gnbUnE=",
+ "lastModified": 1708751719,
+ "narHash": "sha256-0uWOKSpXJXmXswOvDM5Vk3blB74apFB6rNGWV5IjoN0=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "045b51a3ae66f673ed44b5bbd1f4a341d96703bf",
+ "rev": "f63ce824cd2f036216eb5f637dfef31e1a03ee89",
"type": "github"
},
"original": {
diff --git a/flake.nix b/flake.nix
@@ -9,20 +9,48 @@
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
- pkgs = nixpkgs.legacyPackages.${system};
+ lib = "ppad-csecp256k1";
+ sys = "secp256k1-sys";
+
+ config = {
+ packageOverrides = super: let self = super.pkgs; in rec {
+ haskell = super.haskell // {
+ packageOverrides = self: super: {
+ ${sys} = super.callCabal2nix sys ./${sys} {};
+ ${lib} = super.callCabal2nix lib ./. {};
+ };
+ };
+ };
+ };
+
+ pkgs = import nixpkgs { inherit system; inherit config; };
hpkgs = pkgs.haskell.packages.ghc964;
+
+ cc = pkgs.stdenv.cc;
ghc = hpkgs.ghc;
cabal = hpkgs.cabal-install;
in
{
- devShells.default = pkgs.mkShell {
+ packages.${lib} = hpkgs.${lib};
+
+ defaultPackage = self.packages.${system}.${lib};
+
+ devShells.default = hpkgs.shellFor {
+ packages = p: [
+ p.${lib} p.${sys}
+ ];
+
buildInputs = [
cabal
+ cc
];
+ inputsFrom = builtins.attrValues self.packages.${system};
+
shellHook = ''
- PS1="[nix] \w$ "
- echo "entering shell, using"
+ PS1="[${lib}] \w$ "
+ echo "entering ${system} shell, using"
+ echo "cc: $(${cc}/bin/cc --version)"
echo "ghc: $(${ghc}/bin/ghc --version)"
echo "cabal: $(${cabal}/bin/cabal --version)"
'';
@@ -30,3 +58,4 @@
}
);
}
+