]> Git — Sourcephile - haskell/symantic-parser.git/blob - flake.nix
wip
[haskell/symantic-parser.git] / flake.nix
1 {
2 # Update inputs with:
3 # nix flake update --recreate-lock-file
4 inputs.nixpkgs.url = "flake:nixpkgs";
5 # This is needed until all-hies supports glibc-2.31
6 inputs.nixpkgs-2003.url = "github:nixos/nixpkgs/nixos-20.03";
7 inputs.flake-utils.url = "github:numtide/flake-utils";
8 #inputs.haskell-nix.url = "github:input-output-hk/haskell.nix";
9 inputs.all-hies.url = "github:infinisil/all-hies";
10 inputs.all-hies.flake = false;
11 outputs = inputs: let
12 in inputs.flake-utils.lib.eachDefaultSystem (system: let
13 pkgs = inputs.nixpkgs.legacyPackages.${system};
14 /*
15 projectName = "symantic-parser";
16 pkgs = import inputs.haskell-nix.sources.nixpkgs (inputs.haskell-nix.nixpkgsArgs // {
17 localSystem = { inherit system; };
18 overlays = inputs.haskell-nix.nixpkgsArgs.overlays ++ [
19 (import inputs.all-hies {}).overlay
20 ];
21 });
22 compiler-nix-name = "ghc865";
23 project = pkgs.haskell-nix.cabalProject {
24 src = pkgs.haskell-nix.haskellLib.cleanGit {
25 name = projectName;
26 src = ./.;
27 };
28 inherit compiler-nix-name;
29 #index-state = "2020-08-31T00:00:00Z";
30 # To be kept up to date with source-repository-package entries in cabal.project
31 sha256map = {
32 };
33 # Update by commenting materialized and running:
34 # nix run .#materialize
35 #materialized = ./plan-nix;
36 };
37 */
38 in {
39 defaultPackage = import ./default.nix { inherit pkgs; };
40 devShell = (import ./default.nix {
41 ghc = "ghc883";
42 pkgs = import inputs.nixpkgs-2003 {
43 inherit system;
44 overlays = [
45 (import inputs.all-hies {}).overlay
46 /*
47 (self: super: {
48 inherit (inputs.nixpkgs-2003.legacyPackages.${system}) glibc texinfo gmp;
49 glibc = super.glibc.overrideAttrs (_: rec {
50 name = "glibc-${version}";
51 version = "2.30";
52 src = pkgs.fetchurl {
53 url = "mirror://gnu/glibc/glibc-${version}.tar.xz";
54 inherit sha256;
55 };
56 });
57 })
58 */
59 ];
60 };
61 }).shell;
62 /*
63 # Build with: nix build
64 defaultPackage = project.${projectName}.components.exes."playground";
65 #packages.${projectName} = project;
66 # Run with: nix run .#benchmarks
67 apps."benchmarks" = {
68 type = "app";
69 program = "${project.${projectName}.components.exes."benchmarks"}/bin/benchmarks";
70 };
71 # Run with: nix run .#playground
72 apps."playground" = {
73 type = "app";
74 program = "${inputs.self.defaultPackage.${system}}/bin/playground";
75 };
76 # Run with: nix run .#materialize
77 apps.materialize = {
78 type = "app";
79 program = (pkgs.writeShellScript "materialize" ''
80 ${pkgs.rsync}/bin/rsync --delete -ai ${project.plan-nix}/ plan-nix/
81 '').outPath;
82 };
83 # Run with: nix run .#register
84 apps.register = {
85 type = "app";
86 program = (pkgs.writeShellScript "register" ''
87 set -x
88 nix-store --add-root nix.root --indirect --realise ${project.roots}
89 '').outPath;
90 };
91 # Get a development environment with: nix shell
92 devShell = project.shellFor {
93 packages = hpkgs: [
94 hpkgs."${projectName}"
95 ];
96 #components = hpkgs: [];
97 #additional = hpkgs: [];
98 withHoogle = false;
99 tools = {
100 cabal = "3.2.0.0";
101 #hie = "unstable";
102 #hlint = "2.2.11";
103 };
104 builtInputs = with project.haskellPackages; [
105 ];
106 exactDeps = true;
107 shellHook = ''
108 nix-store --add-root nix.root --indirect --realise ${project.roots}
109 '';
110 };
111 */
112 }
113 );
114 }