Last active
November 15, 2023 12:14
-
-
Save Hogeyama/101b9877bf47abc9f1347370b2687ad5 to your computer and use it in GitHub Desktop.
flake.nix置き場
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| description = "template"; | |
| inputs = { | |
| nixpkgs.url = "nixpkgs-pinned"; | |
| flake-utils.url = "github:numtide/flake-utils/master"; | |
| }; | |
| outputs = { self, nixpkgs, flake-utils, ... }: | |
| let | |
| compilerVersion = "924"; | |
| supportedSystems = [ "x86_64-linux" ]; | |
| my-package = { pkgs }: | |
| let | |
| src = pkgs.lib.sourceByRegex ./. [ | |
| "app" | |
| "app/.*" | |
| "lib" | |
| "lib/.*" | |
| "test" | |
| "test/.*" | |
| "benchmark" | |
| "benchmark/.*" | |
| "Setup.hs" | |
| "my-template.cabal" | |
| "README.md" | |
| "CHANGELOG.md" | |
| "LICENSE" | |
| ]; | |
| in | |
| pkgs.haskPkgs.callCabal2nix "my-template" src { }; | |
| my-shell = { pkgs }: | |
| pkgs.haskPkgs.shellFor { | |
| withHoogle = true; | |
| packages = _: [ pkgs.my-package ]; | |
| buildInputs = with pkgs; [ | |
| nixfmt | |
| cabal-install | |
| haskellPackages.cabal-fmt | |
| haskellPackages.fourmolu | |
| haskellPackages.hlint | |
| haskellPackages.eventlog2html | |
| (haskell-language-server.override { | |
| supportedGhcVersions = [ compilerVersion ]; | |
| }) | |
| ]; | |
| }; | |
| outputs-overlay = pkgs: prev: { | |
| my-package = my-package { inherit pkgs; }; | |
| my-shell = my-shell { inherit pkgs; }; | |
| haskPkgs = pkgs.haskell.packages."ghc${compilerVersion}".override { | |
| overrides = self: super: { | |
| brick = self.callHackageDirect | |
| { | |
| pkg = "brick"; | |
| ver = "1.3"; | |
| sha256 = "sha256-6ds55VYxejriU1KeZiBPtWYWpduFDV1PvOdMcA/rUZw="; | |
| } | |
| { }; | |
| }; | |
| }; | |
| }; | |
| in | |
| flake-utils.lib.eachSystem supportedSystems (system: | |
| let | |
| pkgs = import nixpkgs { | |
| inherit system; | |
| config = { allowBroken = true; }; | |
| overlays = [ outputs-overlay ]; | |
| }; | |
| in | |
| { | |
| defaultPackage = pkgs.my-package; | |
| devShell = pkgs.my-shell; | |
| } | |
| ); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| inputs = { | |
| nixpkgs.url = "nixpkgs-pinned"; | |
| flake-utils.url = "github:numtide/flake-utils"; | |
| }; | |
| outputs = { self, nixpkgs, flake-utils }: | |
| let | |
| supportedSystems = [ "x86_64-linux" ]; | |
| outputs-overlay = pkgs: prev: { | |
| my-shell = | |
| let | |
| pypkgs = pkgs.python39.pkgs; | |
| python-redmine = pypkgs.buildPythonPackage rec { | |
| pname = "python-redmine"; | |
| version = "2.3.0"; | |
| src = pypkgs.fetchPypi { | |
| inherit pname version; | |
| sha256 = "sha256-loidGuWbWDAzfiwv/x4s5UED5Su7YyvXxkj30tAnTSU="; | |
| }; | |
| doCheck = false; | |
| propagatedBuildInputs = [ pypkgs.requests ]; | |
| }; | |
| python39-with-packages = pkgs.python39.withPackages | |
| (pkgs: with pkgs; [ | |
| requests | |
| pyyaml | |
| jinja2 | |
| python-redmine | |
| ] | |
| ); | |
| in | |
| pkgs.mkShell { | |
| buildInputs = [ | |
| python39-with-packages | |
| pkgs.python39Packages.black | |
| pkgs.python39Packages.flake8 | |
| pkgs.nodePackages.pyright | |
| ]; | |
| shellHook = '' | |
| PYTHONPATH=${python39-with-packages}/${python39-with-packages.sitePackages} | |
| ''; | |
| }; | |
| }; | |
| in | |
| flake-utils.lib.eachSystem supportedSystems (system: | |
| let | |
| pkgs = import nixpkgs { | |
| inherit system; | |
| overlays = [ outputs-overlay ]; | |
| }; | |
| in | |
| { | |
| devShell = pkgs.my-shell; | |
| }); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| description = "simple"; | |
| inputs = { | |
| nixpkgs.url = "nixpkgs-pinned"; | |
| flake-utils.url = "github:numtide/flake-utils/master"; | |
| }; | |
| outputs = { self, nixpkgs, flake-utils, ... }: | |
| let supportedSystems = [ "x86_64-linux" ]; in | |
| flake-utils.lib.eachSystem supportedSystems (system: | |
| let pkgs = import nixpkgs { inherit system; }; in | |
| { | |
| devShell = pkgs.mkShell { | |
| packages = [ | |
| pkgs.git | |
| ]; | |
| }; | |
| } | |
| ); | |
| } |
Author
Author
メモ: 同じ方法で見つけた、GHC 9.6 が入ってるコミット: 755c177ff9d7e6854ecd0f7a1218ee09bcb301b7
Author
メモ: hackage の revision 指定
async = pkgs.haskell.lib.overrideCabal
(self.callHackageDirect
{
pkg = "async";
ver = "2.2.4";
sha256 = "sha256-pYBuzx0NRMcvZtxmMeKZSXwyVvTVoHy5LwfvTTf2XnI=";
}
{ })
(drv: {
editedCabalFile = "sha256-RjZ9wMgybcvre5PyALVnSRwvYCm8z4Iri7Ju5mA5fgg=";
revision = "3"; # allow base-4.18
});
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
precondition:
ちなみに 8df4b1a は
git log origin/nixos-unstable --oneline | grep "from NixOS/haskell-updates" | head -1で見つけたもの。haskell-updates でビルド&テストされた直後に更新されたものなのでキャッシュのヒット率が高いらしい(同僚の方に教えていただいた)。
EDIT: https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+head%3Ahaskell-updates+is%3Aclosed から見つける方が簡単だった