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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
メモ: hackage の revision 指定