From cc1f30abbfc8c35931e60f68aa12dfa2805da6a4 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Mon, 24 Mar 2025 16:21:31 -0500 Subject: [PATCH 01/39] PoC: Replace haskell.nix with stacklock2nix Co-authored-by: Fabricio Mera Co-authored-by: David Becerra --- flake.lock | 695 ++--------------------------------------------------- flake.nix | 79 ++---- 2 files changed, 35 insertions(+), 739 deletions(-) diff --git a/flake.lock b/flake.lock index 7f51fc82..cbb03d7e 100644 --- a/flake.lock +++ b/flake.lock @@ -1,703 +1,38 @@ { "nodes": { - "HTTP": { - "flake": false, - "locked": { - "lastModified": 1451647621, - "narHash": "sha256-oHIyw3x0iKBexEo49YeUDV1k74ZtyYKGR2gNJXXRxts=", - "owner": "phadej", - "repo": "HTTP", - "rev": "9bc0996d412fef1787449d841277ef663ad9a915", - "type": "github" - }, - "original": { - "owner": "phadej", - "repo": "HTTP", - "type": "github" - } - }, - "cabal-32": { - "flake": false, - "locked": { - "lastModified": 1603716527, - "narHash": "sha256-X0TFfdD4KZpwl0Zr6x+PLxUt/VyKQfX7ylXHdmZIL+w=", - "owner": "haskell", - "repo": "cabal", - "rev": "48bf10787e27364730dd37a42b603cee8d6af7ee", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "3.2", - "repo": "cabal", - "type": "github" - } - }, - "cabal-34": { - "flake": false, - "locked": { - "lastModified": 1645834128, - "narHash": "sha256-wG3d+dOt14z8+ydz4SL7pwGfe7SiimxcD/LOuPCV6xM=", - "owner": "haskell", - "repo": "cabal", - "rev": "5ff598c67f53f7c4f48e31d722ba37172230c462", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "3.4", - "repo": "cabal", - "type": "github" - } - }, - "cabal-36": { - "flake": false, - "locked": { - "lastModified": 1669081697, - "narHash": "sha256-I5or+V7LZvMxfbYgZATU4awzkicBwwok4mVoje+sGmU=", - "owner": "haskell", - "repo": "cabal", - "rev": "8fd619e33d34924a94e691c5fea2c42f0fc7f144", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "3.6", - "repo": "cabal", - "type": "github" - } - }, - "cardano-shell": { - "flake": false, - "locked": { - "lastModified": 1608537748, - "narHash": "sha256-PulY1GfiMgKVnBci3ex4ptk2UNYMXqGjJOxcPy2KYT4=", - "owner": "input-output-hk", - "repo": "cardano-shell", - "rev": "9392c75087cb9a3d453998f4230930dea3a95725", - "type": "github" - }, - "original": { - "owner": "input-output-hk", - "repo": "cardano-shell", - "type": "github" - } - }, - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1672831974, - "narHash": "sha256-z9k3MfslLjWQfnjBtEtJZdq3H7kyi2kQtUThfTgdRk0=", - "owner": "input-output-hk", - "repo": "flake-compat", - "rev": "45f2638735f8cdc40fe302742b79f248d23eb368", - "type": "github" - }, - "original": { - "owner": "input-output-hk", - "ref": "hkm/gitlab-fix", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1726560853, - "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "ghc-8.6.5-iohk": { - "flake": false, - "locked": { - "lastModified": 1600920045, - "narHash": "sha256-DO6kxJz248djebZLpSzTGD6s8WRpNI9BTwUeOf5RwY8=", - "owner": "input-output-hk", - "repo": "ghc", - "rev": "95713a6ecce4551240da7c96b6176f980af75cae", - "type": "github" - }, - "original": { - "owner": "input-output-hk", - "ref": "release/8.6.5-iohk", - "repo": "ghc", - "type": "github" - } - }, - "hackage": { - "flake": false, - "locked": { - "lastModified": 1727656118, - "narHash": "sha256-RwerqkdfQIP2IsVbRmuYbb+eogm6S9Bk1CO49shkGVs=", - "owner": "input-output-hk", - "repo": "hackage.nix", - "rev": "b9ffc606875b2ccf24a08a1dc84419a6a9eb5d9b", - "type": "github" - }, - "original": { - "owner": "input-output-hk", - "repo": "hackage.nix", - "type": "github" - } - }, - "haskellNix": { - "inputs": { - "HTTP": "HTTP", - "cabal-32": "cabal-32", - "cabal-34": "cabal-34", - "cabal-36": "cabal-36", - "cardano-shell": "cardano-shell", - "flake-compat": "flake-compat", - "ghc-8.6.5-iohk": "ghc-8.6.5-iohk", - "hackage": "hackage", - "hls-1.10": "hls-1.10", - "hls-2.0": "hls-2.0", - "hls-2.2": "hls-2.2", - "hls-2.3": "hls-2.3", - "hls-2.4": "hls-2.4", - "hls-2.5": "hls-2.5", - "hls-2.6": "hls-2.6", - "hls-2.7": "hls-2.7", - "hls-2.8": "hls-2.8", - "hls-2.9": "hls-2.9", - "hpc-coveralls": "hpc-coveralls", - "hydra": "hydra", - "iserv-proxy": "iserv-proxy", - "nixpkgs": [ - "haskellNix", - "nixpkgs-unstable" - ], - "nixpkgs-2003": "nixpkgs-2003", - "nixpkgs-2105": "nixpkgs-2105", - "nixpkgs-2111": "nixpkgs-2111", - "nixpkgs-2205": "nixpkgs-2205", - "nixpkgs-2211": "nixpkgs-2211", - "nixpkgs-2305": "nixpkgs-2305", - "nixpkgs-2311": "nixpkgs-2311", - "nixpkgs-2405": "nixpkgs-2405", - "nixpkgs-unstable": "nixpkgs-unstable", - "old-ghc-nix": "old-ghc-nix", - "stackage": "stackage" - }, - "locked": { - "lastModified": 1727657466, - "narHash": "sha256-aOHI5E0PcihXlwQQgcSiLsIrk4sYg4SI+zxpFO34lC8=", - "owner": "input-output-hk", - "repo": "haskell.nix", - "rev": "a4fc7302dec23f5ae2064b90b19090067be1550e", - "type": "github" - }, - "original": { - "owner": "input-output-hk", - "repo": "haskell.nix", - "type": "github" - } - }, - "hls-1.10": { - "flake": false, - "locked": { - "lastModified": 1680000865, - "narHash": "sha256-rc7iiUAcrHxwRM/s0ErEsSPxOR3u8t7DvFeWlMycWgo=", - "owner": "haskell", - "repo": "haskell-language-server", - "rev": "b08691db779f7a35ff322b71e72a12f6e3376fd9", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "1.10.0.0", - "repo": "haskell-language-server", - "type": "github" - } - }, - "hls-2.0": { - "flake": false, - "locked": { - "lastModified": 1687698105, - "narHash": "sha256-OHXlgRzs/kuJH8q7Sxh507H+0Rb8b7VOiPAjcY9sM1k=", - "owner": "haskell", - "repo": "haskell-language-server", - "rev": "783905f211ac63edf982dd1889c671653327e441", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "2.0.0.1", - "repo": "haskell-language-server", - "type": "github" - } - }, - "hls-2.2": { - "flake": false, - "locked": { - "lastModified": 1693064058, - "narHash": "sha256-8DGIyz5GjuCFmohY6Fa79hHA/p1iIqubfJUTGQElbNk=", - "owner": "haskell", - "repo": "haskell-language-server", - "rev": "b30f4b6cf5822f3112c35d14a0cba51f3fe23b85", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "2.2.0.0", - "repo": "haskell-language-server", - "type": "github" - } - }, - "hls-2.3": { - "flake": false, - "locked": { - "lastModified": 1695910642, - "narHash": "sha256-tR58doOs3DncFehHwCLczJgntyG/zlsSd7DgDgMPOkI=", - "owner": "haskell", - "repo": "haskell-language-server", - "rev": "458ccdb55c9ea22cd5d13ec3051aaefb295321be", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "2.3.0.0", - "repo": "haskell-language-server", - "type": "github" - } - }, - "hls-2.4": { - "flake": false, - "locked": { - "lastModified": 1699862708, - "narHash": "sha256-YHXSkdz53zd0fYGIYOgLt6HrA0eaRJi9mXVqDgmvrjk=", - "owner": "haskell", - "repo": "haskell-language-server", - "rev": "54507ef7e85fa8e9d0eb9a669832a3287ffccd57", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "2.4.0.1", - "repo": "haskell-language-server", - "type": "github" - } - }, - "hls-2.5": { - "flake": false, - "locked": { - "lastModified": 1701080174, - "narHash": "sha256-fyiR9TaHGJIIR0UmcCb73Xv9TJq3ht2ioxQ2mT7kVdc=", - "owner": "haskell", - "repo": "haskell-language-server", - "rev": "27f8c3d3892e38edaef5bea3870161815c4d014c", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "2.5.0.0", - "repo": "haskell-language-server", - "type": "github" - } - }, - "hls-2.6": { - "flake": false, - "locked": { - "lastModified": 1705325287, - "narHash": "sha256-+P87oLdlPyMw8Mgoul7HMWdEvWP/fNlo8jyNtwME8E8=", - "owner": "haskell", - "repo": "haskell-language-server", - "rev": "6e0b342fa0327e628610f2711f8c3e4eaaa08b1e", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "2.6.0.0", - "repo": "haskell-language-server", - "type": "github" - } - }, - "hls-2.7": { - "flake": false, - "locked": { - "lastModified": 1708965829, - "narHash": "sha256-LfJ+TBcBFq/XKoiNI7pc4VoHg4WmuzsFxYJ3Fu+Jf+M=", - "owner": "haskell", - "repo": "haskell-language-server", - "rev": "50322b0a4aefb27adc5ec42f5055aaa8f8e38001", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "2.7.0.0", - "repo": "haskell-language-server", - "type": "github" - } - }, - "hls-2.8": { - "flake": false, - "locked": { - "lastModified": 1715153580, - "narHash": "sha256-Vi/iUt2pWyUJlo9VrYgTcbRviWE0cFO6rmGi9rmALw0=", - "owner": "haskell", - "repo": "haskell-language-server", - "rev": "dd1be1beb16700de59e0d6801957290bcf956a0a", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "2.8.0.0", - "repo": "haskell-language-server", - "type": "github" - } - }, - "hls-2.9": { - "flake": false, - "locked": { - "lastModified": 1720003792, - "narHash": "sha256-qnDx8Pk0UxtoPr7BimEsAZh9g2WuTuMB/kGqnmdryKs=", - "owner": "haskell", - "repo": "haskell-language-server", - "rev": "0c1817cb2babef0765e4e72dd297c013e8e3d12b", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "2.9.0.1", - "repo": "haskell-language-server", - "type": "github" - } - }, - "hpc-coveralls": { - "flake": false, - "locked": { - "lastModified": 1607498076, - "narHash": "sha256-8uqsEtivphgZWYeUo5RDUhp6bO9j2vaaProQxHBltQk=", - "owner": "sevanspowell", - "repo": "hpc-coveralls", - "rev": "14df0f7d229f4cd2e79f8eabb1a740097fdfa430", - "type": "github" - }, - "original": { - "owner": "sevanspowell", - "repo": "hpc-coveralls", - "type": "github" - } - }, - "hydra": { - "inputs": { - "nix": "nix", - "nixpkgs": [ - "haskellNix", - "hydra", - "nix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1671755331, - "narHash": "sha256-hXsgJj0Cy0ZiCiYdW2OdBz5WmFyOMKuw4zyxKpgUKm4=", - "owner": "NixOS", - "repo": "hydra", - "rev": "f48f00ee6d5727ae3e488cbf9ce157460853fea8", - "type": "github" - }, - "original": { - "id": "hydra", - "type": "indirect" - } - }, - "iserv-proxy": { - "flake": false, - "locked": { - "lastModified": 1717479972, - "narHash": "sha256-7vE3RQycHI1YT9LHJ1/fUaeln2vIpYm6Mmn8FTpYeVo=", - "owner": "stable-haskell", - "repo": "iserv-proxy", - "rev": "2ed34002247213fc435d0062350b91bab920626e", - "type": "github" - }, - "original": { - "owner": "stable-haskell", - "ref": "iserv-syms", - "repo": "iserv-proxy", - "type": "github" - } - }, - "lowdown-src": { - "flake": false, - "locked": { - "lastModified": 1633514407, - "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=", - "owner": "kristapsdz", - "repo": "lowdown", - "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8", - "type": "github" - }, - "original": { - "owner": "kristapsdz", - "repo": "lowdown", - "type": "github" - } - }, - "nix": { - "inputs": { - "lowdown-src": "lowdown-src", - "nixpkgs": "nixpkgs", - "nixpkgs-regression": "nixpkgs-regression" - }, - "locked": { - "lastModified": 1661606874, - "narHash": "sha256-9+rpYzI+SmxJn+EbYxjGv68Ucp22bdFUSy/4LkHkkDQ=", - "owner": "NixOS", - "repo": "nix", - "rev": "11e45768b34fdafdcf019ddbd337afa16127ff0f", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "2.11.0", - "repo": "nix", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1657693803, - "narHash": "sha256-G++2CJ9u0E7NNTAi9n5G8TdDmGJXcIjkJ3NF8cetQB8=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "365e1b3a859281cf11b94f87231adeabbdd878a2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-22.05-small", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-2003": { - "locked": { - "lastModified": 1620055814, - "narHash": "sha256-8LEHoYSJiL901bTMVatq+rf8y7QtWuZhwwpKE2fyaRY=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "1db42b7fe3878f3f5f7a4f2dc210772fd080e205", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-20.03-darwin", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-2105": { - "locked": { - "lastModified": 1659914493, - "narHash": "sha256-lkA5X3VNMKirvA+SUzvEhfA7XquWLci+CGi505YFAIs=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "022caabb5f2265ad4006c1fa5b1ebe69fb0c3faf", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-21.05-darwin", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-2111": { - "locked": { - "lastModified": 1659446231, - "narHash": "sha256-hekabNdTdgR/iLsgce5TGWmfIDZ86qjPhxDg/8TlzhE=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "eabc38219184cc3e04a974fe31857d8e0eac098d", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-21.11-darwin", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-2205": { - "locked": { - "lastModified": 1685573264, - "narHash": "sha256-Zffu01pONhs/pqH07cjlF10NnMDLok8ix5Uk4rhOnZQ=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "380be19fbd2d9079f677978361792cb25e8a3635", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-22.05-darwin", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-2211": { - "locked": { - "lastModified": 1688392541, - "narHash": "sha256-lHrKvEkCPTUO+7tPfjIcb7Trk6k31rz18vkyqmkeJfY=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-22.11-darwin", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-2305": { - "locked": { - "lastModified": 1705033721, - "narHash": "sha256-K5eJHmL1/kev6WuqyqqbS1cdNnSidIZ3jeqJ7GbrYnQ=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "a1982c92d8980a0114372973cbdfe0a307f1bdea", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-23.05-darwin", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-2311": { - "locked": { - "lastModified": 1719957072, - "narHash": "sha256-gvFhEf5nszouwLAkT9nWsDzocUTqLWHuL++dvNjMp9I=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "7144d6241f02d171d25fba3edeaf15e0f2592105", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-23.11-darwin", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-2405": { - "locked": { - "lastModified": 1720122915, - "narHash": "sha256-Nby8WWxj0elBu1xuRaUcRjPi/rU3xVbkAt2kj4QwX2U=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "835cf2d3f37989c5db6585a28de967a667a75fb1", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-24.05-darwin", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-regression": { - "locked": { - "lastModified": 1643052045, - "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - } - }, - "nixpkgs-unstable": { - "locked": { - "lastModified": 1720181791, - "narHash": "sha256-i4vJL12/AdyuQuviMMd1Hk2tsGt02hDNhA0Zj1m16N8=", - "owner": "NixOS", + "lastModified": 1742850322, + "narHash": "sha256-iinn8lHhcpWHL7ccJFH/SUIPb4+YdvTUhFkdzHLt7n0=", + "owner": "nixos", "repo": "nixpkgs", - "rev": "4284c2b73c8bce4b46a6adf23e16d9e2ec8da4bb", + "rev": "b7a97f713793d62f2090a703fca9b7a21cdd8314", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", + "owner": "nixos", "repo": "nixpkgs", "type": "github" } }, - "old-ghc-nix": { - "flake": false, - "locked": { - "lastModified": 1631092763, - "narHash": "sha256-sIKgO+z7tj4lw3u6oBZxqIhDrzSkvpHtv0Kki+lh9Fg=", - "owner": "angerman", - "repo": "old-ghc-nix", - "rev": "af48a7a7353e418119b6dfe3cd1463a657f342b8", - "type": "github" - }, - "original": { - "owner": "angerman", - "ref": "master", - "repo": "old-ghc-nix", - "type": "github" - } - }, "root": { "inputs": { - "flake-utils": "flake-utils", - "haskellNix": "haskellNix", - "nixpkgs": [ - "haskellNix", - "nixpkgs-unstable" - ] - } - }, - "stackage": { - "flake": false, - "locked": { - "lastModified": 1727655087, - "narHash": "sha256-t+mvlQp15og02vGhehBR5Amv3r+eTMJ7IE3BdpqmPVo=", - "owner": "input-output-hk", - "repo": "stackage.nix", - "rev": "08a17b45866f3de7bbd083677ea28b56c74cd1f3", - "type": "github" - }, - "original": { - "owner": "input-output-hk", - "repo": "stackage.nix", - "type": "github" + "nixpkgs": "nixpkgs", + "stacklock2nix": "stacklock2nix" } }, - "systems": { + "stacklock2nix": { "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "lastModified": 1742355519, + "narHash": "sha256-X5niEE/oc58LORprUdwWo/sHH0Gs776WeTbylfzrxwg=", + "owner": "cdepillabout", + "repo": "stacklock2nix", + "rev": "65fb3f8537b063b9036a8033a905795fa0b1952c", "type": "github" }, "original": { - "owner": "nix-systems", - "repo": "default", + "owner": "cdepillabout", + "repo": "stacklock2nix", "type": "github" } } diff --git a/flake.nix b/flake.nix index a7f3c640..53ee196b 100644 --- a/flake.nix +++ b/flake.nix @@ -1,68 +1,29 @@ { inputs = { - flake-utils.url = "github:numtide/flake-utils"; - haskellNix.url = "github:input-output-hk/haskell.nix"; - nixpkgs.follows = "haskellNix/nixpkgs-unstable"; + nixpkgs.url = "github:nixos/nixpkgs"; + stacklock2nix.url = "github:cdepillabout/stacklock2nix"; }; - nixConfig = { - allow-import-from-derivation = "true"; - extra-substituters = [ - "https://cache.iog.io" - "https://cache.zw3rk.com" - ]; - extra-trusted-public-keys = [ - "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" - "loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk=" - ]; - }; - - outputs = inputs@{ self, flake-utils, haskellNix, nixpkgs }: - # https://input-output-hk.github.io/haskell.nix/tutorials/getting-started-flakes.html - flake-utils.lib.eachDefaultSystem (system: - let + outputs = + { + nixpkgs, + stacklock2nix, + }: + let + pkgs = import nixpkgs { + system = "x86_64-linux"; overlays = [ - haskellNix.overlay + stacklock2nix.overlay (final: prev: { - hapistrano = final.haskell-nix.cabalProject' { - src = final.haskell-nix.haskellLib.cleanGit { - name = "hapistrano"; - src = ./.; - }; - # This is used by `nix develop .` to open a shell for use with - # `cabal`, `hlint` and `haskell-language-server` - shell.tools = { - cabal = {}; - hlint = {}; - haskell-language-server = {}; - }; - compiler-nix-name = "ghc966"; + hapistrano-stacklock = final.stacklock2nix { + stackYaml = ./stack.yaml; + baseHaskellPkgSet = final.haskell.packages.ghc984; }; }) - ]; - pkgs = import nixpkgs { inherit system overlays; inherit (haskellNix) config; }; - flake = pkgs.hapistrano.flake { }; - in rec { - apps = { - test = { - type = "app"; - program = "${packages.test}/bin/test"; - }; - }; - packages = { - default = flake.packages."hapistrano:exe:hap"; - test = flake.packages."hapistrano:test:test".overrideAttrs (_: { - postFixup = '' - wrapProgram $out/bin/test \ - --set PATH ${pkgs.lib.makeBinPath [ - pkgs.bash - pkgs.coreutils - pkgs.findutils - pkgs.git - pkgs.zsh - ]} - ''; - }); - }; - }); + ]; + }; + in + { + packages.x86_64-linux = pkgs; + }; } From f1c858599a263005ef83bb629e9b33b02d70af70 Mon Sep 17 00:00:00 2001 From: Fabricio Mera <55803899+fm7-1@users.noreply.github.com> Date: Mon, 24 Mar 2025 16:35:02 -0500 Subject: [PATCH 02/39] Build hapistrano in Linux --- flake.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 53ee196b..c5cde5dd 100644 --- a/flake.nix +++ b/flake.nix @@ -8,6 +8,7 @@ { nixpkgs, stacklock2nix, + ... }: let pkgs = import nixpkgs { @@ -19,11 +20,12 @@ stackYaml = ./stack.yaml; baseHaskellPkgSet = final.haskell.packages.ghc984; }; + hapistrano = final.hapistrano-stacklock.pkgSet.hapistrano; }) ]; }; in { - packages.x86_64-linux = pkgs; + packages.x86_64-linux.default = pkgs.hapistrano; }; } From c0976257cf437c45cdb2b691b8dcde7ac328c0b6 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Mon, 24 Mar 2025 17:15:59 -0500 Subject: [PATCH 03/39] Upgrade stack.yaml --- .envrc | 6 +++- .gitignore | 10 +++++++ devenv.lock | 73 +++++++++++++++++++------------------------------ devenv.nix | 8 ++++++ devenv.yaml | 15 ++++++++++ stack.yaml | 2 +- stack.yaml.lock | 8 +++--- 7 files changed, 71 insertions(+), 51 deletions(-) create mode 100644 devenv.nix create mode 100644 devenv.yaml diff --git a/.envrc b/.envrc index 3550a30f..30da14fd 100644 --- a/.envrc +++ b/.envrc @@ -1 +1,5 @@ -use flake +export DIRENV_WARN_TIMEOUT=20s + +eval "$(devenv direnvrc)" + +use devenv diff --git a/.gitignore b/.gitignore index b1e6960f..c935ce93 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,13 @@ devenv.local.nix # pre-commit .pre-commit-config.yaml + +# Devenv +.devenv* +devenv.local.nix + +# direnv +.direnv + +# pre-commit +.pre-commit-config.yaml diff --git a/devenv.lock b/devenv.lock index 7e7c5c50..083f5fb4 100644 --- a/devenv.lock +++ b/devenv.lock @@ -20,11 +20,10 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1696426674, + "lastModified": 1733328505, "owner": "edolstra", "repo": "flake-compat", - "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", - "treeHash": "2addb7b71a20a25ea74feeaf5c2f6a6b30898ecb", + "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", "type": "github" }, "original": { @@ -33,10 +32,31 @@ "type": "github" } }, + "git-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1742649964, + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "dcf5072734cb576d2b0c59b2ac44f5050b5eac82", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, "gitignore": { "inputs": { "nixpkgs": [ - "pre-commit-hooks", + "git-hooks", "nixpkgs" ] }, @@ -45,7 +65,6 @@ "owner": "hercules-ci", "repo": "gitignore.nix", "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", - "treeHash": "ca14199cabdfe1a06a7b1654c76ed49100a689f9", "type": "github" }, "original": { @@ -70,50 +89,14 @@ "type": "github" } }, - "nixpkgs-stable": { - "locked": { - "lastModified": 1718811006, - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "03d771e513ce90147b65fe922d87d3a0356fc125", - "treeHash": "ab837eb82b2b0afbb6568f2b27f214324699af3d", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-23.11", - "repo": "nixpkgs", - "type": "github" - } - }, - "pre-commit-hooks": { - "inputs": { - "flake-compat": "flake-compat", - "gitignore": "gitignore", - "nixpkgs": [ - "nixpkgs" - ], - "nixpkgs-stable": "nixpkgs-stable" - }, - "locked": { - "lastModified": 1718879355, - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "8cd35b9496d21a6c55164d8547d9d5280162b07a", - "treeHash": "246f2197feb48979ccc58af4cab0cfd0f5738645", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "type": "github" - } - }, "root": { "inputs": { "devenv": "devenv", + "git-hooks": "git-hooks", "nixpkgs": "nixpkgs", - "pre-commit-hooks": "pre-commit-hooks" + "pre-commit-hooks": [ + "git-hooks" + ] } } }, diff --git a/devenv.nix b/devenv.nix new file mode 100644 index 00000000..386a4b0b --- /dev/null +++ b/devenv.nix @@ -0,0 +1,8 @@ +{ pkgs, lib, config, inputs, ... }: + +{ + + packages = [ + pkgs.stack + ]; +} diff --git a/devenv.yaml b/devenv.yaml new file mode 100644 index 00000000..116a2adb --- /dev/null +++ b/devenv.yaml @@ -0,0 +1,15 @@ +# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json +inputs: + nixpkgs: + url: github:cachix/devenv-nixpkgs/rolling + +# If you're using non-OSS software, you can set allowUnfree to true. +# allowUnfree: true + +# If you're willing to use a package that's vulnerable +# permittedInsecurePackages: +# - "openssl-1.1.1w" + +# If you have more than one devenv you can merge them +#imports: +# - ./backend diff --git a/stack.yaml b/stack.yaml index ffc3795e..8860696a 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,4 +1,4 @@ -resolver: lts-17.10 +resolver: lts-23.15 packages: - . allow-newer: true diff --git a/stack.yaml.lock b/stack.yaml.lock index 8d057378..dc2195be 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -6,7 +6,7 @@ packages: [] snapshots: - completed: - size: 567241 - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/17/10.yaml - sha256: 321b3b9f0c7f76994b39e0dabafdc76478274b4ff74cc5e43d410897a335ad3b - original: lts-17.10 + sha256: 3020db98a5e35009543057d6e6b96890d285890fc97688933e1798da92c8bbde + size: 683815 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/23/15.yaml + original: lts-23.15 From fe6482c7e04c9ca2180cd66026a446a5d888a908 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Mon, 24 Mar 2025 19:02:51 -0500 Subject: [PATCH 04/39] Add missing all-cabal-hashes --- flake.nix | 10 ++++++++-- stack.yaml | 2 -- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index c5cde5dd..8d694211 100644 --- a/flake.nix +++ b/flake.nix @@ -12,13 +12,19 @@ }: let pkgs = import nixpkgs { - system = "x86_64-linux"; + system = "aarch64-darwin"; overlays = [ stacklock2nix.overlay (final: prev: { hapistrano-stacklock = final.stacklock2nix { stackYaml = ./stack.yaml; baseHaskellPkgSet = final.haskell.packages.ghc984; + all-cabal-hashes = final.fetchFromGitHub { + owner = "commercialhaskell"; + repo = "all-cabal-hashes"; + rev = "299918adb3205b2dfe960bcdc79a9b1b300b11e6"; + sha256 = "sha256-Z0UJ78I3O8kWduNOqz7jASnR5XB8mwBDP0fVvjJoqOg="; + }; }; hapistrano = final.hapistrano-stacklock.pkgSet.hapistrano; }) @@ -26,6 +32,6 @@ }; in { - packages.x86_64-linux.default = pkgs.hapistrano; + packages.aarch64-darwin.default = pkgs.hapistrano; }; } diff --git a/stack.yaml b/stack.yaml index 8860696a..1f2051d4 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,4 +1,2 @@ resolver: lts-23.15 -packages: - - . allow-newer: true From 2cb83946c94e25aecd74d2a100b8f6d684744a31 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Mon, 24 Mar 2025 23:27:01 -0500 Subject: [PATCH 05/39] Fix package boundaries warnings --- hapistrano.cabal | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hapistrano.cabal b/hapistrano.cabal index 8b49ce37..dac1b01e 100644 --- a/hapistrano.cabal +++ b/hapistrano.cabal @@ -52,13 +52,13 @@ library , System.Hapistrano.Commands.Internal , System.Hapistrano.Maintenance build-depends: aeson >= 2.0 && < 3.0 - , ansi-terminal >= 0.9 && < 0.12 + , ansi-terminal >= 1.0 && < 2.0 , base >= 4.9 && < 5.0 , directory >= 1.2.5 && < 1.4 , filepath >= 1.2 && < 1.5 , gitrev >= 1.2 && < 1.4 , mtl >= 2.0 && < 3.0 - , megaparsec >= 9.0.0 && < 9.6.1 + , megaparsec >= 9.6 && < 10.0 , stm >= 2.0 && < 2.6 , path >= 0.5 && < 1.0 , path-io >= 1.2 && < 1.9 @@ -84,7 +84,7 @@ executable hap , formatting >= 6.2 && < 8.0 , gitrev >= 1.2 && < 1.4 , hapistrano - , optparse-applicative >= 0.11 && < 0.17 + , optparse-applicative >= 0.18 && < 0.19 , stm >= 2.4 && < 2.6 , yaml >= 0.11.7 && < 0.12 if flag(dev) From 949f07f780aca0eaa74b03bac7fae02ece65f691 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Tue, 25 Mar 2025 00:27:29 -0500 Subject: [PATCH 06/39] Disable tests for hapistrano package --- flake.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/flake.nix b/flake.nix index 8d694211..f71ccdfd 100644 --- a/flake.nix +++ b/flake.nix @@ -25,7 +25,17 @@ rev = "299918adb3205b2dfe960bcdc79a9b1b300b11e6"; sha256 = "sha256-Z0UJ78I3O8kWduNOqz7jASnR5XB8mwBDP0fVvjJoqOg="; }; + additionalHaskellPkgSetOverrides = hfinal: hprev: { + hapistrano = final.haskell.lib.dontCheck hprev.hapistrano; + }; }; + # hapistrano = final.haskell.lib.compose.overrideCabal (drv: { + # testToolDepends = [ + # pkgs.coreutils + # pkgs.zsh + # ]; + # }) final.hapistrano-stacklock.pkgSet.hapistrano; + # hapistrano = final.haskell.lib.dontCheck final.hapistrano-stacklock.pkgSet.hapistrano; hapistrano = final.hapistrano-stacklock.pkgSet.hapistrano; }) ]; From 0054b4492d9c994c691379c553a4b8a3727780b1 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Tue, 25 Mar 2025 00:42:09 -0500 Subject: [PATCH 07/39] Override testToolDepends for hapistrano --- flake.nix | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/flake.nix b/flake.nix index f71ccdfd..40b4b28c 100644 --- a/flake.nix +++ b/flake.nix @@ -26,16 +26,14 @@ sha256 = "sha256-Z0UJ78I3O8kWduNOqz7jASnR5XB8mwBDP0fVvjJoqOg="; }; additionalHaskellPkgSetOverrides = hfinal: hprev: { - hapistrano = final.haskell.lib.dontCheck hprev.hapistrano; + hapistrano = final.haskell.lib.compose.overrideCabal (drv: { + testToolDepends = drv.testToolDepends ++ [ + pkgs.git + pkgs.zsh + ]; + }) hprev.hapistrano; }; }; - # hapistrano = final.haskell.lib.compose.overrideCabal (drv: { - # testToolDepends = [ - # pkgs.coreutils - # pkgs.zsh - # ]; - # }) final.hapistrano-stacklock.pkgSet.hapistrano; - # hapistrano = final.haskell.lib.dontCheck final.hapistrano-stacklock.pkgSet.hapistrano; hapistrano = final.hapistrano-stacklock.pkgSet.hapistrano; }) ]; From 8b064d2830681d4d11341f64118ac417a30a5f42 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Tue, 25 Mar 2025 00:56:45 -0500 Subject: [PATCH 08/39] Support all nix default systems --- flake.lock | 34 +++++++++++++++++++++++++++ flake.nix | 67 +++++++++++++++++++++++++++++------------------------- 2 files changed, 70 insertions(+), 31 deletions(-) diff --git a/flake.lock b/flake.lock index cbb03d7e..ac6275ab 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,23 @@ { "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" + } + }, "nixpkgs": { "locked": { "lastModified": 1742850322, @@ -17,6 +35,7 @@ }, "root": { "inputs": { + "flake-utils": "flake-utils", "nixpkgs": "nixpkgs", "stacklock2nix": "stacklock2nix" } @@ -35,6 +54,21 @@ "repo": "stacklock2nix", "type": "github" } + }, + "systems": { + "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", diff --git a/flake.nix b/flake.nix index 40b4b28c..a48c71d7 100644 --- a/flake.nix +++ b/flake.nix @@ -1,45 +1,50 @@ { inputs = { + flake-utils.url = "github:numtide/flake-utils"; nixpkgs.url = "github:nixos/nixpkgs"; stacklock2nix.url = "github:cdepillabout/stacklock2nix"; }; outputs = { + flake-utils, nixpkgs, stacklock2nix, ... }: - let - pkgs = import nixpkgs { - system = "aarch64-darwin"; - overlays = [ - stacklock2nix.overlay - (final: prev: { - hapistrano-stacklock = final.stacklock2nix { - stackYaml = ./stack.yaml; - baseHaskellPkgSet = final.haskell.packages.ghc984; - all-cabal-hashes = final.fetchFromGitHub { - owner = "commercialhaskell"; - repo = "all-cabal-hashes"; - rev = "299918adb3205b2dfe960bcdc79a9b1b300b11e6"; - sha256 = "sha256-Z0UJ78I3O8kWduNOqz7jASnR5XB8mwBDP0fVvjJoqOg="; + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ + stacklock2nix.overlay + (final: prev: { + hapistrano-stacklock = final.stacklock2nix { + stackYaml = ./stack.yaml; + baseHaskellPkgSet = final.haskell.packages.ghc984; + all-cabal-hashes = final.fetchFromGitHub { + owner = "commercialhaskell"; + repo = "all-cabal-hashes"; + rev = "299918adb3205b2dfe960bcdc79a9b1b300b11e6"; + sha256 = "sha256-Z0UJ78I3O8kWduNOqz7jASnR5XB8mwBDP0fVvjJoqOg="; + }; + additionalHaskellPkgSetOverrides = hfinal: hprev: { + hapistrano = final.haskell.lib.compose.overrideCabal (drv: { + testToolDepends = drv.testToolDepends ++ [ + pkgs.git + pkgs.zsh + ]; + }) hprev.hapistrano; + }; }; - additionalHaskellPkgSetOverrides = hfinal: hprev: { - hapistrano = final.haskell.lib.compose.overrideCabal (drv: { - testToolDepends = drv.testToolDepends ++ [ - pkgs.git - pkgs.zsh - ]; - }) hprev.hapistrano; - }; - }; - hapistrano = final.hapistrano-stacklock.pkgSet.hapistrano; - }) - ]; - }; - in - { - packages.aarch64-darwin.default = pkgs.hapistrano; - }; + hapistrano = final.hapistrano-stacklock.pkgSet.hapistrano; + }) + ]; + }; + in + { + packages.default = pkgs.hapistrano; + } + ); } From 3db50948006917f9a1db82b88ddf9cff60dea29d Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Tue, 25 Mar 2025 01:00:38 -0500 Subject: [PATCH 09/39] Add overlay --- flake.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index a48c71d7..41087f2e 100644 --- a/flake.nix +++ b/flake.nix @@ -7,6 +7,7 @@ outputs = { + self, flake-utils, nixpkgs, stacklock2nix, @@ -46,5 +47,10 @@ { packages.default = pkgs.hapistrano; } - ); + ) + // { + overlays.default = final: prev: { + hapistrano = self.packages.${prev.system}.default; + }; + }; } From ae95d76c766ed5410fdf3faa4a52f8a41b70044e Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Tue, 25 Mar 2025 01:18:31 -0500 Subject: [PATCH 10/39] Add devenv example --- examples/devenv/.envrc | 5 + examples/devenv/.gitignore | 9 ++ examples/devenv/devenv.lock | 183 ++++++++++++++++++++++++++++++++++++ examples/devenv/devenv.nix | 7 ++ examples/devenv/devenv.yaml | 8 ++ 5 files changed, 212 insertions(+) create mode 100644 examples/devenv/.envrc create mode 100644 examples/devenv/.gitignore create mode 100644 examples/devenv/devenv.lock create mode 100644 examples/devenv/devenv.nix create mode 100644 examples/devenv/devenv.yaml diff --git a/examples/devenv/.envrc b/examples/devenv/.envrc new file mode 100644 index 00000000..30da14fd --- /dev/null +++ b/examples/devenv/.envrc @@ -0,0 +1,5 @@ +export DIRENV_WARN_TIMEOUT=20s + +eval "$(devenv direnvrc)" + +use devenv diff --git a/examples/devenv/.gitignore b/examples/devenv/.gitignore new file mode 100644 index 00000000..4d058db7 --- /dev/null +++ b/examples/devenv/.gitignore @@ -0,0 +1,9 @@ +# Devenv +.devenv* +devenv.local.nix + +# direnv +.direnv + +# pre-commit +.pre-commit-config.yaml diff --git a/examples/devenv/devenv.lock b/examples/devenv/devenv.lock new file mode 100644 index 00000000..8ff774e4 --- /dev/null +++ b/examples/devenv/devenv.lock @@ -0,0 +1,183 @@ +{ + "nodes": { + "devenv": { + "locked": { + "dir": "src/modules", + "lastModified": 1742659231, + "owner": "cachix", + "repo": "devenv", + "rev": "c651cb04013be972767aaecb3e9a98fc930d080e", + "type": "github" + }, + "original": { + "dir": "src/modules", + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1733328505, + "owner": "edolstra", + "repo": "flake-compat", + "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "git-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1742649964, + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "dcf5072734cb576d2b0c59b2ac44f5050b5eac82", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "hapistrano": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "stacklock2nix": "stacklock2nix" + }, + "locked": { + "lastModified": 1742882438, + "owner": "stackbuilders", + "repo": "hapistrano", + "rev": "3db50948006917f9a1db82b88ddf9cff60dea29d", + "type": "github" + }, + "original": { + "owner": "stackbuilders", + "ref": "setup_stacklock2nix", + "repo": "hapistrano", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1742882999, + "owner": "nixos", + "repo": "nixpkgs", + "rev": "ad32e7593119b6cf6788d5606fadf0ad6fce4f0a", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1733477122, + "owner": "cachix", + "repo": "devenv-nixpkgs", + "rev": "7bd9e84d0452f6d2e63b6e6da29fe73fac951857", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "rolling", + "repo": "devenv-nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "devenv": "devenv", + "git-hooks": "git-hooks", + "hapistrano": "hapistrano", + "nixpkgs": "nixpkgs_2", + "pre-commit-hooks": [ + "git-hooks" + ] + } + }, + "stacklock2nix": { + "locked": { + "lastModified": 1742355519, + "owner": "cdepillabout", + "repo": "stacklock2nix", + "rev": "65fb3f8537b063b9036a8033a905795fa0b1952c", + "type": "github" + }, + "original": { + "owner": "cdepillabout", + "repo": "stacklock2nix", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/examples/devenv/devenv.nix b/examples/devenv/devenv.nix new file mode 100644 index 00000000..536e2cf6 --- /dev/null +++ b/examples/devenv/devenv.nix @@ -0,0 +1,7 @@ +{ pkgs, ... }: + +{ + packages = [ + pkgs.hapistrano + ]; +} diff --git a/examples/devenv/devenv.yaml b/examples/devenv/devenv.yaml new file mode 100644 index 00000000..94a61aa8 --- /dev/null +++ b/examples/devenv/devenv.yaml @@ -0,0 +1,8 @@ +# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json +inputs: + nixpkgs: + url: github:cachix/devenv-nixpkgs/rolling + hapistrano: + url: github:stackbuilders/hapistrano/setup_stacklock2nix + overlays: + - default From ea1888f46e32642b28d0326d33ee41bf3347960e Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Tue, 25 Mar 2025 01:54:18 -0500 Subject: [PATCH 11/39] Remove flake-utils --- flake.lock | 5 ++-- flake.nix | 83 +++++++++++++++++++++++++++++++----------------------- 2 files changed, 49 insertions(+), 39 deletions(-) diff --git a/flake.lock b/flake.lock index ac6275ab..9b25d06c 100644 --- a/flake.lock +++ b/flake.lock @@ -13,9 +13,8 @@ "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" + "id": "flake-utils", + "type": "indirect" } }, "nixpkgs": { diff --git a/flake.nix b/flake.nix index 41087f2e..dc7b0184 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,5 @@ { inputs = { - flake-utils.url = "github:numtide/flake-utils"; nixpkgs.url = "github:nixos/nixpkgs"; stacklock2nix.url = "github:cdepillabout/stacklock2nix"; }; @@ -13,42 +12,54 @@ stacklock2nix, ... }: - flake-utils.lib.eachDefaultSystem ( - system: - let - pkgs = import nixpkgs { - inherit system; - overlays = [ - stacklock2nix.overlay - (final: prev: { - hapistrano-stacklock = final.stacklock2nix { - stackYaml = ./stack.yaml; - baseHaskellPkgSet = final.haskell.packages.ghc984; - all-cabal-hashes = final.fetchFromGitHub { - owner = "commercialhaskell"; - repo = "all-cabal-hashes"; - rev = "299918adb3205b2dfe960bcdc79a9b1b300b11e6"; - sha256 = "sha256-Z0UJ78I3O8kWduNOqz7jASnR5XB8mwBDP0fVvjJoqOg="; - }; - additionalHaskellPkgSetOverrides = hfinal: hprev: { - hapistrano = final.haskell.lib.compose.overrideCabal (drv: { - testToolDepends = drv.testToolDepends ++ [ - pkgs.git - pkgs.zsh - ]; - }) hprev.hapistrano; - }; + let + forAllSystems = + f: + nixpkgs.lib.genAttrs + [ + "aarch64-darwin" + "aarch64-linux" + "x86_64-darwin" + "x86_64-linux" + ] + ( + system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ + stacklock2nix.overlay + (final: prev: { + hapistrano-stacklock = final.stacklock2nix { + stackYaml = ./stack.yaml; + baseHaskellPkgSet = final.haskell.packages.ghc984; + all-cabal-hashes = final.fetchFromGitHub { + owner = "commercialhaskell"; + repo = "all-cabal-hashes"; + rev = "299918adb3205b2dfe960bcdc79a9b1b300b11e6"; + sha256 = "sha256-Z0UJ78I3O8kWduNOqz7jASnR5XB8mwBDP0fVvjJoqOg="; + }; + additionalHaskellPkgSetOverrides = hfinal: hprev: { + hapistrano = final.haskell.lib.compose.overrideCabal (drv: { + testToolDepends = drv.testToolDepends ++ [ + pkgs.git + pkgs.zsh + ]; + }) hprev.hapistrano; + }; + }; + hapistrano = final.hapistrano-stacklock.pkgSet.hapistrano; + }) + ]; }; - hapistrano = final.hapistrano-stacklock.pkgSet.hapistrano; - }) - ]; - }; - in - { - packages.default = pkgs.hapistrano; - } - ) - // { + in + f pkgs + ); + in + { + packages = forAllSystems (pkgs: { + default = pkgs.hapistrano; + }); overlays.default = final: prev: { hapistrano = self.packages.${prev.system}.default; }; From 27116bedfd77738a989156125502018caa0ce4a2 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Tue, 25 Mar 2025 02:04:22 -0500 Subject: [PATCH 12/39] Refactor forAllSystems --- flake.lock | 33 ---------------------- flake.nix | 82 +++++++++++++++++++++++++----------------------------- 2 files changed, 38 insertions(+), 77 deletions(-) diff --git a/flake.lock b/flake.lock index 9b25d06c..cbb03d7e 100644 --- a/flake.lock +++ b/flake.lock @@ -1,22 +1,5 @@ { "nodes": { - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "id": "flake-utils", - "type": "indirect" - } - }, "nixpkgs": { "locked": { "lastModified": 1742850322, @@ -34,7 +17,6 @@ }, "root": { "inputs": { - "flake-utils": "flake-utils", "nixpkgs": "nixpkgs", "stacklock2nix": "stacklock2nix" } @@ -53,21 +35,6 @@ "repo": "stacklock2nix", "type": "github" } - }, - "systems": { - "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", diff --git a/flake.nix b/flake.nix index dc7b0184..648d9387 100644 --- a/flake.nix +++ b/flake.nix @@ -7,58 +7,52 @@ outputs = { self, - flake-utils, nixpkgs, stacklock2nix, ... }: let - forAllSystems = - f: - nixpkgs.lib.genAttrs - [ - "aarch64-darwin" - "aarch64-linux" - "x86_64-darwin" - "x86_64-linux" - ] - ( - system: - let - pkgs = import nixpkgs { - inherit system; - overlays = [ - stacklock2nix.overlay - (final: prev: { - hapistrano-stacklock = final.stacklock2nix { - stackYaml = ./stack.yaml; - baseHaskellPkgSet = final.haskell.packages.ghc984; - all-cabal-hashes = final.fetchFromGitHub { - owner = "commercialhaskell"; - repo = "all-cabal-hashes"; - rev = "299918adb3205b2dfe960bcdc79a9b1b300b11e6"; - sha256 = "sha256-Z0UJ78I3O8kWduNOqz7jASnR5XB8mwBDP0fVvjJoqOg="; - }; - additionalHaskellPkgSetOverrides = hfinal: hprev: { - hapistrano = final.haskell.lib.compose.overrideCabal (drv: { - testToolDepends = drv.testToolDepends ++ [ - pkgs.git - pkgs.zsh - ]; - }) hprev.hapistrano; - }; - }; - hapistrano = final.hapistrano-stacklock.pkgSet.hapistrano; - }) - ]; + supportedSystems = [ + "aarch64-darwin" + "aarch64-linux" + "x86_64-darwin" + "x86_64-linux" + ]; + forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system); + nixpkgsFor = forAllSystems ( + system: + import nixpkgs { + inherit system; + overlays = [ + stacklock2nix.overlay + (final: prev: { + hapistrano-stacklock = final.stacklock2nix { + stackYaml = ./stack.yaml; + baseHaskellPkgSet = final.haskell.packages.ghc984; + all-cabal-hashes = final.fetchFromGitHub { + owner = "commercialhaskell"; + repo = "all-cabal-hashes"; + rev = "299918adb3205b2dfe960bcdc79a9b1b300b11e6"; + sha256 = "sha256-Z0UJ78I3O8kWduNOqz7jASnR5XB8mwBDP0fVvjJoqOg="; + }; + additionalHaskellPkgSetOverrides = hfinal: hprev: { + hapistrano = final.haskell.lib.compose.overrideCabal (drv: { + testToolDepends = drv.testToolDepends ++ [ + final.git + final.zsh + ]; + }) hprev.hapistrano; + }; }; - in - f pkgs - ); + hapistrano = final.hapistrano-stacklock.pkgSet.hapistrano; + }) + ]; + } + ); in { - packages = forAllSystems (pkgs: { - default = pkgs.hapistrano; + packages = forAllSystems (system: { + default = nixpkgsFor.${system}.hapistrano; }); overlays.default = final: prev: { hapistrano = self.packages.${prev.system}.default; From ac44f4d7ef61467c08cbe0307d0729f0701b8bdb Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Tue, 25 Mar 2025 09:46:00 -0500 Subject: [PATCH 13/39] Conditional sha256 based on platform --- flake.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 648d9387..c6f9fec4 100644 --- a/flake.nix +++ b/flake.nix @@ -33,7 +33,11 @@ owner = "commercialhaskell"; repo = "all-cabal-hashes"; rev = "299918adb3205b2dfe960bcdc79a9b1b300b11e6"; - sha256 = "sha256-Z0UJ78I3O8kWduNOqz7jASnR5XB8mwBDP0fVvjJoqOg="; + sha256 = + if final.stdenv.isLinux then + "sha256-9nkHnZusYNDntpH9LrLTamY9BimRWfeX2m99lAuMCMI=" + else + "sha256-Z0UJ78I3O8kWduNOqz7jASnR5XB8mwBDP0fVvjJoqOg="; }; additionalHaskellPkgSetOverrides = hfinal: hprev: { hapistrano = final.haskell.lib.compose.overrideCabal (drv: { From e92b4320fa333b5bfae5d5dee19c75e8be4607ed Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Tue, 25 Mar 2025 10:08:42 -0500 Subject: [PATCH 14/39] Extract overlay to a separate file --- .gitignore | 1 - flake.nix | 26 +------------------------- nix/overlay.nix | 25 +++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 26 deletions(-) create mode 100644 nix/overlay.nix diff --git a/.gitignore b/.gitignore index c935ce93..4f3c3f12 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,6 @@ cabal.sandbox.config .stack-work/ dist-newstyle result -nix/ .ghc.environment.* .tmuxinator.yml # Devenv diff --git a/flake.nix b/flake.nix index c6f9fec4..8d26097c 100644 --- a/flake.nix +++ b/flake.nix @@ -25,31 +25,7 @@ inherit system; overlays = [ stacklock2nix.overlay - (final: prev: { - hapistrano-stacklock = final.stacklock2nix { - stackYaml = ./stack.yaml; - baseHaskellPkgSet = final.haskell.packages.ghc984; - all-cabal-hashes = final.fetchFromGitHub { - owner = "commercialhaskell"; - repo = "all-cabal-hashes"; - rev = "299918adb3205b2dfe960bcdc79a9b1b300b11e6"; - sha256 = - if final.stdenv.isLinux then - "sha256-9nkHnZusYNDntpH9LrLTamY9BimRWfeX2m99lAuMCMI=" - else - "sha256-Z0UJ78I3O8kWduNOqz7jASnR5XB8mwBDP0fVvjJoqOg="; - }; - additionalHaskellPkgSetOverrides = hfinal: hprev: { - hapistrano = final.haskell.lib.compose.overrideCabal (drv: { - testToolDepends = drv.testToolDepends ++ [ - final.git - final.zsh - ]; - }) hprev.hapistrano; - }; - }; - hapistrano = final.hapistrano-stacklock.pkgSet.hapistrano; - }) + (import ./nix/overlay.nix) ]; } ); diff --git a/nix/overlay.nix b/nix/overlay.nix new file mode 100644 index 00000000..8ddee532 --- /dev/null +++ b/nix/overlay.nix @@ -0,0 +1,25 @@ +final: prev: { + hapistrano-stacklock = final.stacklock2nix { + stackYaml = ../stack.yaml; + baseHaskellPkgSet = final.haskell.packages.ghc984; + all-cabal-hashes = final.fetchFromGitHub { + owner = "commercialhaskell"; + repo = "all-cabal-hashes"; + rev = "299918adb3205b2dfe960bcdc79a9b1b300b11e6"; + sha256 = + if final.stdenv.isLinux then + "sha256-9nkHnZusYNDntpH9LrLTamY9BimRWfeX2m99lAuMCMI=" + else + "sha256-Z0UJ78I3O8kWduNOqz7jASnR5XB8mwBDP0fVvjJoqOg="; + }; + additionalHaskellPkgSetOverrides = hfinal: hprev: { + hapistrano = final.haskell.lib.compose.overrideCabal (drv: { + testToolDepends = drv.testToolDepends ++ [ + final.git + final.zsh + ]; + }) hprev.hapistrano; + }; + }; + hapistrano = final.hapistrano-stacklock.pkgSet.hapistrano; +} From b399411809c08d56ac18e58ba877f8db878f2eac Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Tue, 25 Mar 2025 10:11:50 -0500 Subject: [PATCH 15/39] Building on the CI --- .github/workflows/build.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b7db85f0..4abadff8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,12 +9,26 @@ on: types: - opened - synchronize + concurrency: group: build-${{ github.ref }} cancel-in-progress: true jobs: + nix-build: + strategy: + matrix: + runner: + - macos-latest + - ubuntu-latest + runs-on: ${{ matrix.runner }} + steps: + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v31 + - run: nix build + haskell: + if: false strategy: matrix: os: @@ -36,6 +50,7 @@ jobs: run: nix run .#test docker: + if: false uses: ./.github/workflows/reusable-docker.yml with: push: false From c4312c6e11cf1c6e288b118b983c117100cff654 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Tue, 25 Mar 2025 11:06:39 -0500 Subject: [PATCH 16/39] Setup binary cache --- .github/workflows/build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4abadff8..dcc49eb8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,6 +25,10 @@ jobs: steps: - uses: actions/checkout@v4 - uses: cachix/install-nix-action@v31 + - uses: cachix/cachix-action@v16 + with: + name: stackbuilders + authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} - run: nix build haskell: From f9e89048914bd50216a160c971167879f079fa0c Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Tue, 25 Mar 2025 14:30:27 -0500 Subject: [PATCH 17/39] Remove `allow-newer` flag from `stack.yaml` --- stack.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/stack.yaml b/stack.yaml index 1f2051d4..24d78544 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,2 +1 @@ resolver: lts-23.15 -allow-newer: true From a326ae16f4d58ac436eb905af70bae85562f3639 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Thu, 27 Mar 2025 02:14:35 -0500 Subject: [PATCH 18/39] Add non-Nix build --- .github/workflows/build.yml | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dcc49eb8..f1aef835 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ concurrency: cancel-in-progress: true jobs: - nix-build: + build: strategy: matrix: runner: @@ -25,33 +25,23 @@ jobs: steps: - uses: actions/checkout@v4 - uses: cachix/install-nix-action@v31 - - uses: cachix/cachix-action@v16 - with: - name: stackbuilders - authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} - - run: nix build + - run: devenv shell -- stack build - haskell: - if: false + nix-build: strategy: matrix: - os: - - macos-13 # x86_64-darwin - - macos-latest # aarch64-darwin - - ubuntu-latest # x86_64-linux - fail-fast: true - runs-on: ${{ matrix.os }} - timeout-minutes: 30 + runner: + - macos-latest + - ubuntu-latest + runs-on: ${{ matrix.runner }} steps: - uses: actions/checkout@v4 - - uses: DeterminateSystems/nix-installer-action@v12 + - uses: cachix/install-nix-action@v31 + - uses: cachix/cachix-action@v16 with: - extra-conf: accept-flake-config = true - - uses: DeterminateSystems/magic-nix-cache-action@v7 - - name: Compile code ${{ matrix.ghc }} - run: nix build .#test - - name: Run tests ${{ matrix.ghc }} - run: nix run .#test + name: stackbuilders + authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} + - run: nix build docker: if: false From 2ab375ba9353fae5616f24c22ebbc032d01f4e2a Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Thu, 27 Mar 2025 02:17:11 -0500 Subject: [PATCH 19/39] Install devenv --- .github/workflows/build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f1aef835..411185e0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,6 +25,10 @@ jobs: steps: - uses: actions/checkout@v4 - uses: cachix/install-nix-action@v31 + - uses: cachix/cachix-action@v16 + with: + name: devenv + - run: nix profile install nixpkgs#devenv - run: devenv shell -- stack build nix-build: From cf2e995cd7349c985dc82bcaf2505851a9815e42 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Thu, 27 Mar 2025 02:17:28 -0500 Subject: [PATCH 20/39] Shorten feedback loop for build job --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 411185e0..463e7d19 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: strategy: matrix: runner: - - macos-latest + # - macos-latest - ubuntu-latest runs-on: ${{ matrix.runner }} steps: @@ -32,6 +32,7 @@ jobs: - run: devenv shell -- stack build nix-build: + if: false strategy: matrix: runner: From faf199ab5b761dcb1cc9e7a9cd9875eaeebad514 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Thu, 27 Mar 2025 02:37:46 -0500 Subject: [PATCH 21/39] Install GHC via Nix --- devenv.lock | 16 ++++++++++++++++ devenv.nix | 14 +++++++++++--- devenv.yaml | 13 ++----------- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/devenv.lock b/devenv.lock index 083f5fb4..cd602124 100644 --- a/devenv.lock +++ b/devenv.lock @@ -89,11 +89,27 @@ "type": "github" } }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1742923925, + "owner": "nixos", + "repo": "nixpkgs", + "rev": "25d1b84f5c90632a623c48d83a2faf156451e6b1", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "devenv": "devenv", "git-hooks": "git-hooks", "nixpkgs": "nixpkgs", + "nixpkgs-unstable": "nixpkgs-unstable", "pre-commit-hooks": [ "git-hooks" ] diff --git a/devenv.nix b/devenv.nix index 386a4b0b..66be297d 100644 --- a/devenv.nix +++ b/devenv.nix @@ -1,8 +1,16 @@ -{ pkgs, lib, config, inputs, ... }: +{ pkgs, inputs, ... }: +let + pkgs-unstable = import inputs.nixpkgs-unstable { + system = pkgs.stdenv.system; + }; +in { - packages = [ - pkgs.stack + pkgs-unstable.haskell.compiler.ghc984 ]; + + scripts.stack.exec = '' + ${pkgs.stack}/bin/stack --system-ghc "$@" + ''; } diff --git a/devenv.yaml b/devenv.yaml index 116a2adb..94a0e21d 100644 --- a/devenv.yaml +++ b/devenv.yaml @@ -2,14 +2,5 @@ inputs: nixpkgs: url: github:cachix/devenv-nixpkgs/rolling - -# If you're using non-OSS software, you can set allowUnfree to true. -# allowUnfree: true - -# If you're willing to use a package that's vulnerable -# permittedInsecurePackages: -# - "openssl-1.1.1w" - -# If you have more than one devenv you can merge them -#imports: -# - ./backend + nixpkgs-unstable: + url: github:nixos/nixpkgs/nixpkgs-unstable From f1238ea94b840623364cb6bd38e6c0857f030b13 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Thu, 27 Mar 2025 02:43:14 -0500 Subject: [PATCH 22/39] Try macos-latest runner --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 463e7d19..c0711b1f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,8 +19,8 @@ jobs: strategy: matrix: runner: - # - macos-latest - - ubuntu-latest + - macos-latest + # - ubuntu-latest runs-on: ${{ matrix.runner }} steps: - uses: actions/checkout@v4 From 9fbc6376c648c17bbe6ff4a0455a4a68ae0f7b25 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Thu, 27 Mar 2025 03:01:49 -0500 Subject: [PATCH 23/39] Cache dependencies --- .github/workflows/build.yml | 8 ++++++-- devenv.lock | 16 ---------------- devenv.nix | 13 ++----------- devenv.yaml | 2 -- 4 files changed, 8 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c0711b1f..bd67e23f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,8 +28,12 @@ jobs: - uses: cachix/cachix-action@v16 with: name: devenv - - run: nix profile install nixpkgs#devenv - - run: devenv shell -- stack build + - run: nix profile install nixpkgs#devenv + - uses: actions/cache@v4 + with: + path: ~/.stack + key: ${{ runner.os }}-stack-global-${{ hashFiles('stack.yaml') }}-${{ hashFiles('hapistrano.cabal') }} + - run: devenv shell -- stack build --only-dependencies --test nix-build: if: false diff --git a/devenv.lock b/devenv.lock index cd602124..083f5fb4 100644 --- a/devenv.lock +++ b/devenv.lock @@ -89,27 +89,11 @@ "type": "github" } }, - "nixpkgs-unstable": { - "locked": { - "lastModified": 1742923925, - "owner": "nixos", - "repo": "nixpkgs", - "rev": "25d1b84f5c90632a623c48d83a2faf156451e6b1", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "root": { "inputs": { "devenv": "devenv", "git-hooks": "git-hooks", "nixpkgs": "nixpkgs", - "nixpkgs-unstable": "nixpkgs-unstable", "pre-commit-hooks": [ "git-hooks" ] diff --git a/devenv.nix b/devenv.nix index 66be297d..6aebb208 100644 --- a/devenv.nix +++ b/devenv.nix @@ -1,16 +1,7 @@ -{ pkgs, inputs, ... }: +{ pkgs, ... }: -let - pkgs-unstable = import inputs.nixpkgs-unstable { - system = pkgs.stdenv.system; - }; -in { packages = [ - pkgs-unstable.haskell.compiler.ghc984 + pkgs.stack ]; - - scripts.stack.exec = '' - ${pkgs.stack}/bin/stack --system-ghc "$@" - ''; } diff --git a/devenv.yaml b/devenv.yaml index 94a0e21d..68616a49 100644 --- a/devenv.yaml +++ b/devenv.yaml @@ -2,5 +2,3 @@ inputs: nixpkgs: url: github:cachix/devenv-nixpkgs/rolling - nixpkgs-unstable: - url: github:nixos/nixpkgs/nixpkgs-unstable From 0811fac3c1f1424c8c1b5731ef742145cafafafe Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Thu, 27 Mar 2025 09:33:29 -0500 Subject: [PATCH 24/39] Compile and run tests --- .github/workflows/build.yml | 6 ++++++ devenv.nix | 2 ++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bd67e23f..8207fd12 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,6 +34,12 @@ jobs: path: ~/.stack key: ${{ runner.os }}-stack-global-${{ hashFiles('stack.yaml') }}-${{ hashFiles('hapistrano.cabal') }} - run: devenv shell -- stack build --only-dependencies --test + - uses: actions/cache@v4 + with: + path: .stack-work + key: ${{ runner.os }}-stack-work-${{ hashFiles('stack.yaml') }}-${{ hashFiles('hapistrano.cabal') }}-${{ hashFiles('**/*.hs') }} + - run: devenv shell -- stack build --test --no-run-tests + - run: devenv shell -- stack test nix-build: if: false diff --git a/devenv.nix b/devenv.nix index 6aebb208..91a04b43 100644 --- a/devenv.nix +++ b/devenv.nix @@ -2,6 +2,8 @@ { packages = [ + pkgs.git pkgs.stack + pkgs.zsh ]; } From e095cb0486e2c9f98daedbfac6f03b7a8a6e4bab Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Thu, 27 Mar 2025 09:38:34 -0500 Subject: [PATCH 25/39] Enable ubuntu-latest runner --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8207fd12..caac8057 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,7 @@ jobs: matrix: runner: - macos-latest - # - ubuntu-latest + - ubuntu-latest runs-on: ${{ matrix.runner }} steps: - uses: actions/checkout@v4 From 7ecb77fc695afeb08ec8e8f67427cbd52ede21e3 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Thu, 27 Mar 2025 09:46:17 -0500 Subject: [PATCH 26/39] Install gmp for Linux --- .github/workflows/build.yml | 16 +++++++++++++--- devenv.nix | 16 ++++++++++------ 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index caac8057..b7392cff 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,13 +33,23 @@ jobs: with: path: ~/.stack key: ${{ runner.os }}-stack-global-${{ hashFiles('stack.yaml') }}-${{ hashFiles('hapistrano.cabal') }} - - run: devenv shell -- stack build --only-dependencies --test + restore-keys: | + ${{ runner.os }}-stack-global-${{ hashFiles('stack.yaml') }}- + ${{ runner.os }}-stack-global- + - name: Install dependencies + run: devenv shell -- stack build --only-dependencies --test - uses: actions/cache@v4 with: path: .stack-work key: ${{ runner.os }}-stack-work-${{ hashFiles('stack.yaml') }}-${{ hashFiles('hapistrano.cabal') }}-${{ hashFiles('**/*.hs') }} - - run: devenv shell -- stack build --test --no-run-tests - - run: devenv shell -- stack test + restore-keys: | + ${{ runner.os }}-stack-work-${{ hashFiles('stack.yaml') }}-${{ hashFiles('hapistrano.cabal') }}- + ${{ runner.os }}-stack-work-${{ hashFiles('stack.yaml') }}- + ${{ runner.os }}-stack-work- + - name: Compile code + run: devenv shell -- stack build --test --no-run-tests + - name: Run tests + run: devenv shell -- stack test nix-build: if: false diff --git a/devenv.nix b/devenv.nix index 91a04b43..6797bd8a 100644 --- a/devenv.nix +++ b/devenv.nix @@ -1,9 +1,13 @@ -{ pkgs, ... }: +{ pkgs, lib, ... }: { - packages = [ - pkgs.git - pkgs.stack - pkgs.zsh - ]; + packages = + [ + pkgs.git + pkgs.stack + pkgs.zsh + ] + ++ lib.optionals pkgs.stdenv.isLinux [ + pkgs.gmp + ]; } From cf528f8029c160804a0bc337bf48e5127263853f Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Thu, 27 Mar 2025 10:04:22 -0500 Subject: [PATCH 27/39] Set locale --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b7392cff..f7ccb022 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,6 +22,9 @@ jobs: - macos-latest - ubuntu-latest runs-on: ${{ matrix.runner }} + env: + LANG: en_US.UTF-8 + LC_ALL: en_US.UTF-8 steps: - uses: actions/checkout@v4 - uses: cachix/install-nix-action@v31 From abc8f348309e621222cd445090de7ca7dcab2afb Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Thu, 27 Mar 2025 10:16:43 -0500 Subject: [PATCH 28/39] Add missing descriptions to jobs' steps --- .github/workflows/build.yml | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f7ccb022..503ca722 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,13 +26,18 @@ jobs: LANG: en_US.UTF-8 LC_ALL: en_US.UTF-8 steps: - - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v31 - - uses: cachix/cachix-action@v16 + - name: Checkout code + uses: actions/checkout@v4 + - name: Install Nix + uses: cachix/install-nix-action@v31 + - name: Setup Cachix + uses: cachix/cachix-action@v16 with: name: devenv - - run: nix profile install nixpkgs#devenv - - uses: actions/cache@v4 + - name: Install devenv + run: nix profile install nixpkgs#devenv + - name: Setup cache for `~/.stack` + uses: actions/cache@v4 with: path: ~/.stack key: ${{ runner.os }}-stack-global-${{ hashFiles('stack.yaml') }}-${{ hashFiles('hapistrano.cabal') }} @@ -41,7 +46,8 @@ jobs: ${{ runner.os }}-stack-global- - name: Install dependencies run: devenv shell -- stack build --only-dependencies --test - - uses: actions/cache@v4 + - name: Setup cache for `.stack-work` + uses: actions/cache@v4 with: path: .stack-work key: ${{ runner.os }}-stack-work-${{ hashFiles('stack.yaml') }}-${{ hashFiles('hapistrano.cabal') }}-${{ hashFiles('**/*.hs') }} @@ -55,7 +61,6 @@ jobs: run: devenv shell -- stack test nix-build: - if: false strategy: matrix: runner: @@ -63,13 +68,17 @@ jobs: - ubuntu-latest runs-on: ${{ matrix.runner }} steps: - - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v31 - - uses: cachix/cachix-action@v16 + - name: Checkout code + uses: actions/checkout@v4 + - name: Install Nix + uses: cachix/install-nix-action@v31 + - name: Setup Cachix + uses: cachix/cachix-action@v16 with: name: stackbuilders authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} - - run: nix build + - name: Build `default` package + run: nix build docker: if: false From d1f71d33c24b3c586c277728ffcfd797b346aafa Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Thu, 27 Mar 2025 10:17:57 -0500 Subject: [PATCH 29/39] Remove `devenv` example --- examples/devenv/.envrc | 5 - examples/devenv/.gitignore | 9 -- examples/devenv/devenv.lock | 183 ------------------------------------ examples/devenv/devenv.nix | 7 -- examples/devenv/devenv.yaml | 8 -- 5 files changed, 212 deletions(-) delete mode 100644 examples/devenv/.envrc delete mode 100644 examples/devenv/.gitignore delete mode 100644 examples/devenv/devenv.lock delete mode 100644 examples/devenv/devenv.nix delete mode 100644 examples/devenv/devenv.yaml diff --git a/examples/devenv/.envrc b/examples/devenv/.envrc deleted file mode 100644 index 30da14fd..00000000 --- a/examples/devenv/.envrc +++ /dev/null @@ -1,5 +0,0 @@ -export DIRENV_WARN_TIMEOUT=20s - -eval "$(devenv direnvrc)" - -use devenv diff --git a/examples/devenv/.gitignore b/examples/devenv/.gitignore deleted file mode 100644 index 4d058db7..00000000 --- a/examples/devenv/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -# Devenv -.devenv* -devenv.local.nix - -# direnv -.direnv - -# pre-commit -.pre-commit-config.yaml diff --git a/examples/devenv/devenv.lock b/examples/devenv/devenv.lock deleted file mode 100644 index 8ff774e4..00000000 --- a/examples/devenv/devenv.lock +++ /dev/null @@ -1,183 +0,0 @@ -{ - "nodes": { - "devenv": { - "locked": { - "dir": "src/modules", - "lastModified": 1742659231, - "owner": "cachix", - "repo": "devenv", - "rev": "c651cb04013be972767aaecb3e9a98fc930d080e", - "type": "github" - }, - "original": { - "dir": "src/modules", - "owner": "cachix", - "repo": "devenv", - "type": "github" - } - }, - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1733328505, - "owner": "edolstra", - "repo": "flake-compat", - "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1731533236, - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "git-hooks": { - "inputs": { - "flake-compat": "flake-compat", - "gitignore": "gitignore", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1742649964, - "owner": "cachix", - "repo": "git-hooks.nix", - "rev": "dcf5072734cb576d2b0c59b2ac44f5050b5eac82", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "git-hooks.nix", - "type": "github" - } - }, - "gitignore": { - "inputs": { - "nixpkgs": [ - "git-hooks", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1709087332, - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", - "type": "github" - } - }, - "hapistrano": { - "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs", - "stacklock2nix": "stacklock2nix" - }, - "locked": { - "lastModified": 1742882438, - "owner": "stackbuilders", - "repo": "hapistrano", - "rev": "3db50948006917f9a1db82b88ddf9cff60dea29d", - "type": "github" - }, - "original": { - "owner": "stackbuilders", - "ref": "setup_stacklock2nix", - "repo": "hapistrano", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1742882999, - "owner": "nixos", - "repo": "nixpkgs", - "rev": "ad32e7593119b6cf6788d5606fadf0ad6fce4f0a", - "type": "github" - }, - "original": { - "owner": "nixos", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_2": { - "locked": { - "lastModified": 1733477122, - "owner": "cachix", - "repo": "devenv-nixpkgs", - "rev": "7bd9e84d0452f6d2e63b6e6da29fe73fac951857", - "type": "github" - }, - "original": { - "owner": "cachix", - "ref": "rolling", - "repo": "devenv-nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "devenv": "devenv", - "git-hooks": "git-hooks", - "hapistrano": "hapistrano", - "nixpkgs": "nixpkgs_2", - "pre-commit-hooks": [ - "git-hooks" - ] - } - }, - "stacklock2nix": { - "locked": { - "lastModified": 1742355519, - "owner": "cdepillabout", - "repo": "stacklock2nix", - "rev": "65fb3f8537b063b9036a8033a905795fa0b1952c", - "type": "github" - }, - "original": { - "owner": "cdepillabout", - "repo": "stacklock2nix", - "type": "github" - } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/examples/devenv/devenv.nix b/examples/devenv/devenv.nix deleted file mode 100644 index 536e2cf6..00000000 --- a/examples/devenv/devenv.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ pkgs, ... }: - -{ - packages = [ - pkgs.hapistrano - ]; -} diff --git a/examples/devenv/devenv.yaml b/examples/devenv/devenv.yaml deleted file mode 100644 index 94a61aa8..00000000 --- a/examples/devenv/devenv.yaml +++ /dev/null @@ -1,8 +0,0 @@ -# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json -inputs: - nixpkgs: - url: github:cachix/devenv-nixpkgs/rolling - hapistrano: - url: github:stackbuilders/hapistrano/setup_stacklock2nix - overlays: - - default From 4651882c25150daef4deda17158f8f41f202fdf9 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Thu, 27 Mar 2025 10:33:52 -0500 Subject: [PATCH 30/39] Add comments about keeping GHC version in sync --- nix/overlay.nix | 2 ++ stack.yaml | 3 +++ 2 files changed, 5 insertions(+) diff --git a/nix/overlay.nix b/nix/overlay.nix index 8ddee532..f45459bf 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -1,6 +1,8 @@ final: prev: { hapistrano-stacklock = final.stacklock2nix { stackYaml = ../stack.yaml; + # The version of the compiler declared here must match the GHC version + # provided by the stack resolver. baseHaskellPkgSet = final.haskell.packages.ghc984; all-cabal-hashes = final.fetchFromGitHub { owner = "commercialhaskell"; diff --git a/stack.yaml b/stack.yaml index 24d78544..a97be0f1 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1 +1,4 @@ +# After upgrading the resolver, make sure that the GHC version specified in the +# `./nix/overlay.nix` file under the `baseHaskellPkgSet` field matches the +# compiler version provided by the resolver. resolver: lts-23.15 From b0f77f1fe3a800691567e7ee18f2852d601eef54 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Thu, 27 Mar 2025 10:34:53 -0500 Subject: [PATCH 31/39] Enable docker job / Remove bin folder --- .github/workflows/build.yml | 1 - bin/ghc810 | 2 -- bin/ghc90 | 2 -- 3 files changed, 5 deletions(-) delete mode 100755 bin/ghc810 delete mode 100755 bin/ghc90 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 503ca722..90d3a5a5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -81,7 +81,6 @@ jobs: run: nix build docker: - if: false uses: ./.github/workflows/reusable-docker.yml with: push: false diff --git a/bin/ghc810 b/bin/ghc810 deleted file mode 100755 index 53018177..00000000 --- a/bin/ghc810 +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -nix develop .#ghc810 --accept-flake-config "$@" diff --git a/bin/ghc90 b/bin/ghc90 deleted file mode 100755 index 4545407b..00000000 --- a/bin/ghc90 +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -nix develop .#ghc90 --accept-flake-config "$@" From c2276d8d8f21bf826bfa5d400252edf7a7f6d3ba Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Thu, 27 Mar 2025 10:57:48 -0500 Subject: [PATCH 32/39] Update NIX documentation via claude --- docs/NIX.md | 56 ++++++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/docs/NIX.md b/docs/NIX.md index d0c85bf0..3b1b9c20 100644 --- a/docs/NIX.md +++ b/docs/NIX.md @@ -3,46 +3,50 @@ ## Requirements - Install [Nix](https://nixos.org/download.html) -- Enable Flakes [permanently](https://nixos.wiki/wiki/Flakes#Permanent) +- Enable [Flakes](https://nixos.wiki/wiki/Flakes#Permanent) permanently +- Install [devenv](https://devenv.sh/getting-started/): -**For macOS users** +## Project Structure -Add the following lines to configuration file located at `/etc/nix/nix.conf`: +The project uses: +- Nix Flakes for reproducible builds and development environments +- `stacklock2nix` for deriving Nix packages from stack.yaml.lock +- `devenv` for creating consistent development environments -``` -trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= -substituters = https://cache.iog.io https://cache.nixos.org -``` +### Flake.nix -Restart the `nix-daemon` service: +The flake.nix file has the following inputs: +- `nixpkgs`: Standard Nix packages repository +- `stacklock2nix`: A tool for generating Nix packages from stack.yaml.lock files -``` -sudo launchctl stop org.nixos.nix-daemon -sudo launchctl start org.nixos.nix-daemon -``` +The flake outputs: +- `packages.default`: The Hapistrano package for each supported system +- `overlays.default`: An overlay for integrating Hapistrano into other Nix + systems -If the following messages appear running the scripts detailed in the section -below, it means that Nix is not picking up the substituters we described -earlier and is unable to use them as a derivation cache: +## Development Environments -``` -warning: ignoring untrusted substituter 'https://cache.iog.io' -``` -in which case -it is recommended to go over the steps detailed in this section again, or look for alternative ways to add extra substituters in [nix.conf](https://nix.dev/manual/nix/2.18/command-ref/conf-file). - -## Enabling the development environment +The project includes a `devenv.nix` configuration that provides a consistent +development environment with all necessary dependencies. -To enable the development environment exposed by the project's [Nix flake](../flake.nix), you can start a development shell by running the following command from within the project's root: +To use devenv: ``` -nix develop +devenv shell ``` -Alternatively, if you are using [nix-direnv](https://github.com/nix-community/nix-direnv) (recommended), you can run: +The devenv configuration includes: +- Essential tools like git, stack, and zsh +- System-specific dependencies (e.g., gmp for Linux systems) + +### Using nix-direnv + +If you are using [nix-direnv](https://github.com/nix-community/nix-direnv), run: ``` direnv allow ``` -that will enable the development shell according to the contents of [.envrc](../.envrc). It is advisable not to run `direnv allow` blindly and always check the contents of [.envrc](../.envrc) files first to ensure nothing malicious is executed. +This will enable the development shell according to the contents of +[.envrc](../.envrc). Always check the contents of [.envrc](../.envrc) files +before running `direnv allow` to ensure nothing malicious is executed. From 179ebdd75d5ebca3cd182b478a87fa654e565116 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Thu, 27 Mar 2025 11:19:00 -0500 Subject: [PATCH 33/39] Update lock files --- devenv.lock | 10 ++++------ flake.lock | 6 +++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/devenv.lock b/devenv.lock index 083f5fb4..992960ce 100644 --- a/devenv.lock +++ b/devenv.lock @@ -3,11 +3,10 @@ "devenv": { "locked": { "dir": "src/modules", - "lastModified": 1719003735, + "lastModified": 1743025451, "owner": "cachix", "repo": "devenv", - "rev": "ffbb18da9000524978d3e537f5e02f48535d2aed", - "treeHash": "60ca1cd5b478a61ecc2ec0e454be4ff7b7c3241b", + "rev": "686aaf88c9c095fc49dadc620d1a814830c78206", "type": "github" }, "original": { @@ -75,11 +74,10 @@ }, "nixpkgs": { "locked": { - "lastModified": 1716977621, + "lastModified": 1733477122, "owner": "cachix", "repo": "devenv-nixpkgs", - "rev": "4267e705586473d3e5c8d50299e71503f16a6fb6", - "treeHash": "6d9f1f7ca0faf1bc2eeb397c78a49623260d3412", + "rev": "7bd9e84d0452f6d2e63b6e6da29fe73fac951857", "type": "github" }, "original": { diff --git a/flake.lock b/flake.lock index cbb03d7e..314a93c8 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1742850322, - "narHash": "sha256-iinn8lHhcpWHL7ccJFH/SUIPb4+YdvTUhFkdzHLt7n0=", + "lastModified": 1743091875, + "narHash": "sha256-S1S8uNCRkp+/3D8nO16THLgRoFCJTWbrJu8d6lQG7o0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "b7a97f713793d62f2090a703fca9b7a21cdd8314", + "rev": "25125c6e6b12df85d808dbfac34d6e4dd1efd589", "type": "github" }, "original": { From 5b39e5c13ea486dacfc45cd35c9b67d04a812e9d Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Thu, 27 Mar 2025 11:22:47 -0500 Subject: [PATCH 34/39] Revert "Update lock files" This reverts commit 179ebdd75d5ebca3cd182b478a87fa654e565116. --- devenv.lock | 10 ++++++---- flake.lock | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/devenv.lock b/devenv.lock index 992960ce..083f5fb4 100644 --- a/devenv.lock +++ b/devenv.lock @@ -3,10 +3,11 @@ "devenv": { "locked": { "dir": "src/modules", - "lastModified": 1743025451, + "lastModified": 1719003735, "owner": "cachix", "repo": "devenv", - "rev": "686aaf88c9c095fc49dadc620d1a814830c78206", + "rev": "ffbb18da9000524978d3e537f5e02f48535d2aed", + "treeHash": "60ca1cd5b478a61ecc2ec0e454be4ff7b7c3241b", "type": "github" }, "original": { @@ -74,10 +75,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1733477122, + "lastModified": 1716977621, "owner": "cachix", "repo": "devenv-nixpkgs", - "rev": "7bd9e84d0452f6d2e63b6e6da29fe73fac951857", + "rev": "4267e705586473d3e5c8d50299e71503f16a6fb6", + "treeHash": "6d9f1f7ca0faf1bc2eeb397c78a49623260d3412", "type": "github" }, "original": { diff --git a/flake.lock b/flake.lock index 314a93c8..cbb03d7e 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1743091875, - "narHash": "sha256-S1S8uNCRkp+/3D8nO16THLgRoFCJTWbrJu8d6lQG7o0=", + "lastModified": 1742850322, + "narHash": "sha256-iinn8lHhcpWHL7ccJFH/SUIPb4+YdvTUhFkdzHLt7n0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "25125c6e6b12df85d808dbfac34d6e4dd1efd589", + "rev": "b7a97f713793d62f2090a703fca9b7a21cdd8314", "type": "github" }, "original": { From 0fb41a1178d96b57ad8ffd80432b85c8d6030759 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Thu, 27 Mar 2025 12:40:04 -0500 Subject: [PATCH 35/39] Remove duplicated entries from `.gitignore` --- .gitignore | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.gitignore b/.gitignore index 4f3c3f12..542f8599 100644 --- a/.gitignore +++ b/.gitignore @@ -31,13 +31,3 @@ devenv.local.nix # pre-commit .pre-commit-config.yaml - -# Devenv -.devenv* -devenv.local.nix - -# direnv -.direnv - -# pre-commit -.pre-commit-config.yaml From abcc21d85fe1c2bdc3977f5bdcad64745c74da53 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Thu, 27 Mar 2025 22:11:35 -0500 Subject: [PATCH 36/39] Add aarch64-linux and x86_64-darwin runners --- .github/workflows/build.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 90d3a5a5..1366320c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -64,8 +64,10 @@ jobs: strategy: matrix: runner: - - macos-latest - - ubuntu-latest + - macos-13 # x86_64-darwin + - macos-latest # aarch64-darwin + - ubuntu-24.04-arm # aarch64-linux" + - ubuntu-latest # x86_64-linux runs-on: ${{ matrix.runner }} steps: - name: Checkout code From 3fb96c85994f16bb611d464383710044bda0525b Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Fri, 28 Mar 2025 09:23:50 -0500 Subject: [PATCH 37/39] Remove macos-13 and ubuntu-24.04-arm runners to reduce storage usage on Cachix --- .github/workflows/build.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1366320c..90d3a5a5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -64,10 +64,8 @@ jobs: strategy: matrix: runner: - - macos-13 # x86_64-darwin - - macos-latest # aarch64-darwin - - ubuntu-24.04-arm # aarch64-linux" - - ubuntu-latest # x86_64-linux + - macos-latest + - ubuntu-latest runs-on: ${{ matrix.runner }} steps: - name: Checkout code From 9a9521ab54dc82021de9f33eaef2f0a03a2bbb50 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Fri, 28 Mar 2025 09:50:51 -0500 Subject: [PATCH 38/39] Print warning for untested systems --- flake.nix | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index 8d26097c..55bcea8b 100644 --- a/flake.nix +++ b/flake.nix @@ -18,6 +18,10 @@ "x86_64-darwin" "x86_64-linux" ]; + unstestedSystems = [ + "aarch64-linux" + "x86_64-darwin" + ]; forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system); nixpkgsFor = forAllSystems ( system: @@ -31,9 +35,18 @@ ); in { - packages = forAllSystems (system: { - default = nixpkgsFor.${system}.hapistrano; - }); + packages = forAllSystems ( + system: + let + pkgs = nixpkgsFor.${system}; + in + { + default = + pkgs.lib.warnIf (builtins.any (x: x == system) unstestedSystems) + "'${system}' is not tested as part of the CI workflow; please report any issues you encounter while dealing with it." + pkgs.hapistrano; + } + ); overlays.default = final: prev: { hapistrano = self.packages.${prev.system}.default; }; From f48c3e804edbcbe505674aef593bc8b7b081eb6b Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Fri, 28 Mar 2025 10:10:15 -0500 Subject: [PATCH 39/39] Revert changes made to package constraints lower bound to avoid breaking changes --- hapistrano.cabal | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hapistrano.cabal b/hapistrano.cabal index dac1b01e..1af276b5 100644 --- a/hapistrano.cabal +++ b/hapistrano.cabal @@ -1,6 +1,6 @@ cabal-version: 1.18 name: hapistrano -version: 0.4.9.0 +version: 0.4.10.0 synopsis: A deployment library for Haskell applications description: . @@ -28,7 +28,7 @@ category: System homepage: https://github.com/stackbuilders/hapistrano bug-reports: https://github.com/stackbuilders/hapistrano/issues build-type: Simple -tested-with: GHC==9.6.6 +tested-with: GHC==9.8.4 extra-doc-files: CHANGELOG.md , README.md @@ -52,13 +52,13 @@ library , System.Hapistrano.Commands.Internal , System.Hapistrano.Maintenance build-depends: aeson >= 2.0 && < 3.0 - , ansi-terminal >= 1.0 && < 2.0 + , ansi-terminal >= 0.9 && < 2.0 , base >= 4.9 && < 5.0 , directory >= 1.2.5 && < 1.4 , filepath >= 1.2 && < 1.5 , gitrev >= 1.2 && < 1.4 , mtl >= 2.0 && < 3.0 - , megaparsec >= 9.6 && < 10.0 + , megaparsec >= 9.0 && < 10.0 , stm >= 2.0 && < 2.6 , path >= 0.5 && < 1.0 , path-io >= 1.2 && < 1.9 @@ -84,7 +84,7 @@ executable hap , formatting >= 6.2 && < 8.0 , gitrev >= 1.2 && < 1.4 , hapistrano - , optparse-applicative >= 0.18 && < 0.19 + , optparse-applicative >= 0.11 && < 0.19 , stm >= 2.4 && < 2.6 , yaml >= 0.11.7 && < 0.12 if flag(dev)