diff --git a/index.html b/index.html index cfeb023..f50a74a 100644 --- a/index.html +++ b/index.html @@ -4766,8 +4766,8 @@ However, you can use any of the flake reference styles defined in hello-flake.url = "git+https://codeberg.org/mhwombat/hello-flake"; }; - outputs = { self, nixpkgs, flake-utils, hello-flake }: - flake-utils.lib.eachDefaultSystem (system: + outputs = { self, nixpkgs, flake-utils, hello-flake }: + flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; }; in @@ -4784,6 +4784,11 @@ However, you can use any of the flake reference styles defined in +

Line 5 adds hello-flake as an input to this flake. +Line 8 allows the output function to reference hello-flake. +Line 16 adds hello-flake as a build input for this flake.

+ +

Let’s take a closer look at the buildInputs expression from line 16.

@@ -4803,7 +4808,7 @@ and the last part is the name of the package or app we want.
$ hello-flake     # Fails; dependency not available
-bash: line 31: hello-flake: command not found
+bash: line 35: hello-flake: command not found
 $ nix develop
 $ hello-flake     # Works in development environment
 Hello from your flake!
@@ -5633,7 +5638,7 @@ Hello from your flake!
diff --git a/source/recipes/devshell/haskell-pkg/main.adoc0 b/source/recipes/devshell/haskell-pkg/main.adoc0 index 5265e3e..ff8246d 100644 --- a/source/recipes/devshell/haskell-pkg/main.adoc0 +++ b/source/recipes/devshell/haskell-pkg/main.adoc0 @@ -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] diff --git a/source/recipes/devshell/haskell-pkg/tempwork/Main.hs b/source/recipes/devshell/haskell-pkg/tempwork/Main.hs new file mode 100644 index 0000000..96349a1 --- /dev/null +++ b/source/recipes/devshell/haskell-pkg/tempwork/Main.hs @@ -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 diff --git a/source/recipes/devshell/flake/tempwork/flake.lock b/source/recipes/devshell/haskell-pkg/tempwork/flake.lock similarity index 52% rename from source/recipes/devshell/flake/tempwork/flake.lock rename to source/recipes/devshell/haskell-pkg/tempwork/flake.lock index aabac4f..72e1817 100644 --- a/source/recipes/devshell/flake/tempwork/flake.lock +++ b/source/recipes/devshell/haskell-pkg/tempwork/flake.lock @@ -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=", diff --git a/source/recipes/devshell/flake/tempwork/flake.nix b/source/recipes/devshell/haskell-pkg/tempwork/flake.nix similarity index 57% rename from source/recipes/devshell/flake/tempwork/flake.nix rename to source/recipes/devshell/haskell-pkg/tempwork/flake.nix index 0db427b..35cc9c0 100644 --- a/source/recipes/devshell/flake/tempwork/flake.nix +++ b/source/recipes/devshell/haskell-pkg/tempwork/flake.nix @@ -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 ]; }; }; }