From 9d92ecb202eeb2ac403f774c62ff5ee6c09fffbd Mon Sep 17 00:00:00 2001 From: xecarlox94 Date: Tue, 27 May 2025 23:22:47 +0100 Subject: [PATCH] working on template for haskell --- nix/templates/haskell/flake.lock | 143 +++++++++++++++++++++++++++++++ nix/templates/haskell/flake.nix | 72 ++++++++++++++++ 2 files changed, 215 insertions(+) create mode 100644 nix/templates/haskell/flake.lock create mode 100644 nix/templates/haskell/flake.nix diff --git a/nix/templates/haskell/flake.lock b/nix/templates/haskell/flake.lock new file mode 100644 index 0000000..e3d6a69 --- /dev/null +++ b/nix/templates/haskell/flake.lock @@ -0,0 +1,143 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "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" + } + }, + "flake-utils_2": { + "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" + } + }, + "gomod2nix": { + "inputs": { + "flake-utils": [ + "p2prc-flake", + "flake-utils" + ], + "nixpkgs": [ + "p2prc-flake", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1745875161, + "narHash": "sha256-0YkWCS13jpoo3+sX/3kcgdxBNt1VZTmvF+FhZb4rFKI=", + "owner": "nix-community", + "repo": "gomod2nix", + "rev": "2cbd7fdd6eeab65c494cc426e18f4e4d2a5e35c0", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "gomod2nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1748190013, + "narHash": "sha256-R5HJFflOfsP5FBtk+zE8FpL8uqE7n62jqOsADvVshhE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "62b852f6c6742134ade1abdd2a21685fd617a291", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "p2prc-flake": { + "inputs": { + "flake-utils": "flake-utils_2", + "gomod2nix": "gomod2nix", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1748291200, + "narHash": "sha256-VUJo8sgFHLPouEpZs+QM/dI6S2ZJE6F0cj4SLWg1cBg=", + "owner": "xecarlox94", + "repo": "p2p-rendering-computation", + "rev": "5fa625160ee6627de61ca13991de3250c504be54", + "type": "github" + }, + "original": { + "owner": "xecarlox94", + "ref": "nix", + "repo": "p2p-rendering-computation", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "p2prc-flake": "p2prc-flake" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "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" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/nix/templates/haskell/flake.nix b/nix/templates/haskell/flake.nix new file mode 100644 index 0000000..a4d2b21 --- /dev/null +++ b/nix/templates/haskell/flake.nix @@ -0,0 +1,72 @@ +{ + description = "Start of Haskell P2PRC flake"; + + inputs = + { + nixpkgs = { + url = "github:NixOS/nixpkgs/nixos-unstable"; + }; + + p2prc-flake = { + url = "github:xecarlox94/p2p-rendering-computation?ref=nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + flake-utils = { + url = "github:numtide/flake-utils"; + }; + + }; + + outputs = { nixpkgs, p2prc-flake, flake-utils, ... }: + (flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ + p2prc-flake.overlays.${system}.default + p2prc-flake.overlays.${system}.bindings + ]; + }; + + + # TODO: Add this to a p2prc-nix lib + initProject = pkgs.writeShellApplication { + name = "initProject"; + runtimeInputs = with pkgs; [ + cabal2nix + cabal-install + ]; + text = '' + if [ -f *.cabal ]; then echo "The file exists"; fi + cabal init + echo "RUNNING" + cabal2nix . > ./project.nix; + ''; + }; + + in { + package = { + # default = pkgs.haskellPackages.callPackage ./project.nix { }; + init = initProject; + }; + + # devShell.default = pkgs.mkShell { + # packages = with pkgs; [ + # # cabal2nix + # # cabal-install + # ]; + # + # buildInputs = [ + # # p2prc-flake.packages.${system}.default + # initProject + # ]; + # + # shellHook = '' + # echo "creating a new development shell" + # ''; + # }; + } + )); + +}