From 42cf9bd028adc357c951ad053df6f92b36115241 Mon Sep 17 00:00:00 2001 From: xecarlox94 Date: Tue, 20 May 2025 23:51:33 +0100 Subject: [PATCH] fixing nix env --- Bindings/Haskell/flake.lock | 96 +------------------------------------ Bindings/Haskell/flake.nix | 38 ++++++++------- flake.lock | 76 ++++++++++++++++++++++++++--- flake.nix | 32 ++++++++++--- 4 files changed, 117 insertions(+), 125 deletions(-) diff --git a/Bindings/Haskell/flake.lock b/Bindings/Haskell/flake.lock index b20190e..dfb4f3a 100644 --- a/Bindings/Haskell/flake.lock +++ b/Bindings/Haskell/flake.lock @@ -18,31 +18,6 @@ "type": "github" } }, - "gomod2nix": { - "inputs": { - "flake-utils": [ - "p2prc", - "flake-utils" - ], - "nixpkgs": [ - "p2prc", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1733668782, - "narHash": "sha256-tPsqU00FhgdFr0JiQUiBMgPVbl1jbPCY5gbFiJycL3I=", - "owner": "nix-community", - "repo": "gomod2nix", - "rev": "514283ec89c39ad0079ff2f3b1437404e4cba608", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "gomod2nix", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 0, @@ -55,44 +30,10 @@ "type": "indirect" } }, - "nixpkgs_2": { - "locked": { - "lastModified": 1735834308, - "narHash": "sha256-dklw3AXr3OGO4/XT1Tu3Xz9n/we8GctZZ75ZWVqAVhk=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "6df24922a1400241dae323af55f30e4318a6ca65", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "p2prc": { - "inputs": { - "flake-utils": "flake-utils", - "gomod2nix": "gomod2nix", - "nixpkgs": "nixpkgs_2" - }, - "locked": { - "lastModified": 0, - "narHash": "sha256-f4e4JcQzBS+R+8HqJbQVeecInm2ggInJuSSymj6gtQo=", - "path": "/nix/store/hmk8v0lxifsscll054qsdnzxqfql1998-source", - "type": "path" - }, - "original": { - "path": "/nix/store/hmk8v0lxifsscll054qsdnzxqfql1998-source", - "type": "path" - } - }, "root": { "inputs": { - "nixpkgs": "nixpkgs", - "p2prc": "p2prc", - "utils": "utils" + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" } }, "systems": { @@ -109,39 +50,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", diff --git a/Bindings/Haskell/flake.nix b/Bindings/Haskell/flake.nix index eababdb..dcf9e7e 100644 --- a/Bindings/Haskell/flake.nix +++ b/Bindings/Haskell/flake.nix @@ -2,23 +2,27 @@ description = "Nix flake for P2PRC Haskell library"; inputs = { - p2prc.url = "../../"; - utils.url = "github:numtide/flake-utils"; + flake-utils.url = "github:numtide/flake-utils"; }; - outputs = { self, nixpkgs, utils, p2prc }: utils.lib.eachDefaultSystem (system: - let - pkgs = nixpkgs.legacyPackages.${system}; - in - { - devShell = pkgs.mkShell { - buildInputs = with pkgs; [ - cabal-install - haskell.compiler.ghc96 - zlib.dev - p2prc.outputs.packages.${system}.default - ]; - }; - } - ); + outputs = + { nixpkgs, flake-utils, ... }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + hsPkgs = pkgs.haskell.packages.ghc98; + in + { + packages.default = hsPkgs.callCabal2nix "p2prc" ./. {}; + + devShell = pkgs.mkShell { + buildInputs = with pkgs; [ + cabal-install + haskell.compiler.ghc98 + zlib.dev + ]; + }; + } + ); } diff --git a/flake.lock b/flake.lock index 5f751c0..3a5d977 100644 --- a/flake.lock +++ b/flake.lock @@ -28,11 +28,11 @@ ] }, "locked": { - "lastModified": 1733668782, - "narHash": "sha256-tPsqU00FhgdFr0JiQUiBMgPVbl1jbPCY5gbFiJycL3I=", + "lastModified": 1745875161, + "narHash": "sha256-0YkWCS13jpoo3+sX/3kcgdxBNt1VZTmvF+FhZb4rFKI=", "owner": "nix-community", "repo": "gomod2nix", - "rev": "514283ec89c39ad0079ff2f3b1437404e4cba608", + "rev": "2cbd7fdd6eeab65c494cc426e18f4e4d2a5e35c0", "type": "github" }, "original": { @@ -43,11 +43,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1735834308, - "narHash": "sha256-dklw3AXr3OGO4/XT1Tu3Xz9n/we8GctZZ75ZWVqAVhk=", + "lastModified": 1747542820, + "narHash": "sha256-GaOZntlJ6gPPbbkTLjbd8BMWaDYafhuuYRNrxCGnPJw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6df24922a1400241dae323af55f30e4318a6ca65", + "rev": "292fa7d4f6519c074f0a50394dbbe69859bb6043", "type": "github" }, "original": { @@ -57,11 +57,40 @@ "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": { + "nixpkgs": "nixpkgs_2", + "utils": "utils" + }, + "locked": { + "lastModified": 1, + "narHash": "sha256-185ddVKbQVvVaJL6H8BPxDcH9m+Pmx42eRVJkB0foQM=", + "path": "./Bindings/Haskell", + "type": "path" + }, + "original": { + "path": "./Bindings/Haskell", + "type": "path" + } + }, "root": { "inputs": { "flake-utils": "flake-utils", "gomod2nix": "gomod2nix", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "p2prc-hs": "p2prc-hs" } }, "systems": { @@ -78,6 +107,39 @@ "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", diff --git a/flake.nix b/flake.nix index 068e4a5..b5bf97d 100644 --- a/flake.nix +++ b/flake.nix @@ -1,13 +1,25 @@ { description = "P2PRC nix flake"; - inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - inputs.flake-utils.url = "github:numtide/flake-utils"; - inputs.gomod2nix.url = "github:nix-community/gomod2nix"; - inputs.gomod2nix.inputs.nixpkgs.follows = "nixpkgs"; - inputs.gomod2nix.inputs.flake-utils.follows = "flake-utils"; + inputs = { - outputs = { self, nixpkgs, flake-utils, gomod2nix }: + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + + gomod2nix = { + url = "github:nix-community/gomod2nix"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.flake-utils.follows = "flake-utils"; + }; + + p2prc-hs = { + url = "path:./Bindings/Haskell"; + inputs.flake-utils.follows = "flake-utils"; + }; + + }; + + outputs = { self, nixpkgs, flake-utils, gomod2nix, p2prc-hs, ... }: (flake-utils.lib.eachDefaultSystem (system: let @@ -16,7 +28,10 @@ overlays = [ gomod2nix.overlays.default ]; }; - # pkgs = nixpkgs.legacyPackages.${system}; + # 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. @@ -26,6 +41,8 @@ packages.default = callPackage ./. { }; + # packages.p2prc-hs = p2prc-hs.packages.${system}.default; + devShells.default = pkgs.mkShell { buildInputs = with pkgs; [ go @@ -34,6 +51,7 @@ go-tools gomod2nix.packages.${system}.default sqlite-interactive + p2prc-hs.devShells.${system}.default ]; }; })