mirror of
https://codeberg.org/mhwombat/nix-book.git
synced 2026-01-07 22:37:23 +08:00
temp
This commit is contained in:
parent
d351582364
commit
c6d4fff7c6
5 changed files with 100 additions and 69 deletions
|
|
@ -21,12 +21,17 @@ it's usually more convenient to use `haskell-flake` as described in <<#haskell-f
|
|||
together with the _high-level workflow_ described in <<_development_workflows>>.
|
||||
====
|
||||
|
||||
[source,nix,linenums,highlight='11,16']
|
||||
[source,nix,linenums,highlight='5,8,12,17']
|
||||
.flake.nix
|
||||
....
|
||||
include::flake.nix[]
|
||||
....
|
||||
|
||||
Line 5 adds `pandoc-columns` as an input to this flake.
|
||||
Line 8 allows the output function to reference `pandoc-columns`.
|
||||
Line 12 makes a custom GHC that knows about `pandoc-columns`,
|
||||
and line 17 uses the custom GHC as a build input for this flake.
|
||||
|
||||
Here's a short Haskell program that uses it.
|
||||
|
||||
[source,haskell,linenums]
|
||||
|
|
|
|||
6
source/recipes/devshell/haskell-pkg/tempwork/Main.hs
Normal file
6
source/recipes/devshell/haskell-pkg/tempwork/Main.hs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import Text.Pandoc.Filters.Columns
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
putStrLn "Prove we have access to the pandoc-columns package"
|
||||
print $ defaultColSpec
|
||||
|
|
@ -1,5 +1,23 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1756770412,
|
||||
"narHash": "sha256-+uWLQZccFHwqpGqr2Yt5VsW/PbeJVTn9Dk6SHWhNRPw=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "4524271976b625a4a605beefd893f270620fd751",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
|
|
@ -18,59 +36,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"inputs": {
|
||||
"systems": "systems_2"
|
||||
},
|
||||
"haskell-flake": {
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"lastModified": 1756607542,
|
||||
"narHash": "sha256-+99fEAk0HwjYgIW2tEOs7ayBDxnU9NAM5E29ZxgyX40=",
|
||||
"owner": "srid",
|
||||
"repo": "haskell-flake",
|
||||
"rev": "73e3891fb135c679a1c30fae4b101e5b41b8ca61",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"owner": "srid",
|
||||
"repo": "haskell-flake",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hello-flake": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1757875192,
|
||||
"narHash": "sha256-JBkm6NAOYjR3Sc3BxJ2ijrTqW8Ga0NlN9GPUJ/NUsGM=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "2d9363f255c44a41be2e5291dd624e078e7f4139",
|
||||
"revCount": 25,
|
||||
"type": "git",
|
||||
"url": "https://codeberg.org/mhwombat/hello-flake"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://codeberg.org/mhwombat/hello-flake"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1757873102,
|
||||
"narHash": "sha256-kYhNxLlYyJcUouNRazBufVfBInMWMyF+44xG/xar2yE=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "88cef159e47c0dc56f151593e044453a39a6e547",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1757952092,
|
||||
"narHash": "sha256-BcfTLFCU7elUJ2dwyt0iTjxsz/XLh+8ZygDcFwy6xPE=",
|
||||
|
|
@ -85,29 +66,62 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"hello-flake": "hello-flake",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"lastModified": 1754788789,
|
||||
"narHash": "sha256-x2rJ+Ovzq0sCMpgfgGaaqgBSwY+LST+WbZ6TytnT9Rk=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"rev": "a73b9c743612e4244d865a2fdee11865283c04e6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_2": {
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1756911493,
|
||||
"narHash": "sha256-6n/n1GZQ/vi+LhFXMSyoseKdNfc2QQaSBXJdgamrbkE=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c6a788f552b7b7af703b1a29802a7233c0067908",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"pandoc-columns": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
"haskell-flake": "haskell-flake",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1757244346,
|
||||
"narHash": "sha256-Ewpv8f+CvF0du1egjRJoeOZhKsdoqPkb2ecrwTPI+os=",
|
||||
"path": "/home/amy/github/pandoc-columns",
|
||||
"type": "path"
|
||||
},
|
||||
"original": {
|
||||
"path": "/home/amy/github/pandoc-columns",
|
||||
"type": "path"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"pandoc-columns": "pandoc-columns"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
|
|
@ -2,18 +2,19 @@
|
|||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
hello-flake.url = "git+https://codeberg.org/mhwombat/hello-flake";
|
||||
pandoc-columns.url = "/home/amy/github/pandoc-columns";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, hello-flake }:
|
||||
outputs = { self, nixpkgs, flake-utils, pandoc-columns }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
customGhc = pkgs.haskellPackages.ghcWithPackages (p: with p; [ pandoc-columns ]);
|
||||
in
|
||||
{
|
||||
devShells = rec {
|
||||
default = pkgs.mkShell {
|
||||
buildInputs = [ hello-flake.packages.${system}.hello ];
|
||||
buildInputs = [ customGhc ];
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue