Compare commits
	
		
			2 Commits
		
	
	
		
			b9bb26bd3a
			...
			72e503998c
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 72e503998c | |||
| 0790caf39a | 
							
								
								
									
										66
									
								
								default.nix
									
									
									
									
									
								
							
							
						
						
									
										66
									
								
								default.nix
									
									
									
									
									
								
							| @ -1,66 +0,0 @@ | |||||||
| let |  | ||||||
|   sources = import ./nix/sources.nix; |  | ||||||
|   jupyterOverlays = [ |  | ||||||
|     (import "${sources.jupyterWith}/nix/haskell-overlay.nix") |  | ||||||
|     (import "${sources.jupyterWith}/nix/python-overlay.nix") |  | ||||||
|   ]; |  | ||||||
| in |  | ||||||
|   { pkgs      ? import sources.nixpkgs { } |  | ||||||
|   , pkgsLinux ? import sources.nixpkgs { system = "x86_64-linux"; overlays = jupyterOverlays; } |  | ||||||
|   }: |  | ||||||
|   let |  | ||||||
|     jupyter = import sources.jupyterWith { pkgs = pkgsLinux; }; |  | ||||||
|     jupyterEnv = jupyter.jupyterlabWith { |  | ||||||
|       kernels = [ |  | ||||||
|         (jupyter.kernels.iPythonWith { |  | ||||||
|           name = "python"; |  | ||||||
|           packages = p: []; |  | ||||||
|         }) |  | ||||||
| 
 |  | ||||||
|         (jupyter.kernels.iHaskellWith { |  | ||||||
|           name = "haskell"; |  | ||||||
|           packages = p: with p; [ |  | ||||||
|             hvega formatting |  | ||||||
|             ihaskell-charts |  | ||||||
|             ihaskell-diagrams |  | ||||||
|             ihaskell-gnuplot |  | ||||||
|             ihaskell-graphviz |  | ||||||
|             ihaskell-hvega |  | ||||||
|             ihaskell-juicypixels |  | ||||||
|             ihaskell-magic |  | ||||||
|             ihaskell-plot |  | ||||||
|             hmatrix |  | ||||||
|             cassava |  | ||||||
|             attoparsec |  | ||||||
|             safe-exceptions |  | ||||||
|             transformers |  | ||||||
|             conduit |  | ||||||
|             conduit-extra |  | ||||||
|             bytestring |  | ||||||
|             text |  | ||||||
|           ]; |  | ||||||
|         }) |  | ||||||
|       ]; |  | ||||||
|     }; |  | ||||||
|   in |  | ||||||
|     pkgs.dockerTools.buildImage { |  | ||||||
|       name = "git.pbrinkmeier.de/paul/jup"; |  | ||||||
|       tag = "1.5"; |  | ||||||
|       contents = [ |  | ||||||
|         pkgsLinux.graphviz |  | ||||||
|       ]; |  | ||||||
|       config = { |  | ||||||
|         Env = [ "HOME=/data"]; |  | ||||||
|         Cmd = [ |  | ||||||
|           "${jupyterEnv}/bin/jupyter-lab" |  | ||||||
|           "--notebook-dir=/notebooks" |  | ||||||
|           "--ip=0.0.0.0" |  | ||||||
|           "--no-browser" |  | ||||||
|           # No authentication, has to be handled by reverse proxy! |  | ||||||
|           "--ServerApp.token=" |  | ||||||
|           "--ServerApp.password=" |  | ||||||
|           "--collaborative" |  | ||||||
|         ]; |  | ||||||
| 	WorkingDir = "/Notebooks"; |  | ||||||
|       }; |  | ||||||
|     } |  | ||||||
							
								
								
									
										609
									
								
								flake.lock
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										609
									
								
								flake.lock
									
									
									
										generated
									
									
									
										Normal file
									
								
							| @ -0,0 +1,609 @@ | |||||||
|  | { | ||||||
|  |   "nodes": { | ||||||
|  |     "flake-compat": { | ||||||
|  |       "flake": false, | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1673956053, | ||||||
|  |         "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", | ||||||
|  |         "owner": "edolstra", | ||||||
|  |         "repo": "flake-compat", | ||||||
|  |         "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "edolstra", | ||||||
|  |         "repo": "flake-compat", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     "flake-compat_2": { | ||||||
|  |       "flake": false, | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1673956053, | ||||||
|  |         "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", | ||||||
|  |         "owner": "edolstra", | ||||||
|  |         "repo": "flake-compat", | ||||||
|  |         "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "edolstra", | ||||||
|  |         "repo": "flake-compat", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     "flake-compat_3": { | ||||||
|  |       "flake": false, | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1627913399, | ||||||
|  |         "narHash": "sha256-hY8g6H2KFL8ownSiFeMOjwPC8P0ueXpCVEbxgda3pko=", | ||||||
|  |         "owner": "edolstra", | ||||||
|  |         "repo": "flake-compat", | ||||||
|  |         "rev": "12c64ca55c1014cdc1b16ed5a804aa8576601ff2", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "edolstra", | ||||||
|  |         "repo": "flake-compat", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     "flake-compat_4": { | ||||||
|  |       "flake": false, | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1673956053, | ||||||
|  |         "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", | ||||||
|  |         "owner": "edolstra", | ||||||
|  |         "repo": "flake-compat", | ||||||
|  |         "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "edolstra", | ||||||
|  |         "repo": "flake-compat", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     "flake-utils": { | ||||||
|  |       "inputs": { | ||||||
|  |         "systems": "systems" | ||||||
|  |       }, | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1681202837, | ||||||
|  |         "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", | ||||||
|  |         "owner": "numtide", | ||||||
|  |         "repo": "flake-utils", | ||||||
|  |         "rev": "cfacdce06f30d2b68473a46042957675eebb3401", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "numtide", | ||||||
|  |         "repo": "flake-utils", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     "flake-utils_2": { | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1667395993, | ||||||
|  |         "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", | ||||||
|  |         "owner": "numtide", | ||||||
|  |         "repo": "flake-utils", | ||||||
|  |         "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "numtide", | ||||||
|  |         "repo": "flake-utils", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     "flake-utils_3": { | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1629481132, | ||||||
|  |         "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", | ||||||
|  |         "owner": "numtide", | ||||||
|  |         "repo": "flake-utils", | ||||||
|  |         "rev": "997f7efcb746a9c140ce1f13c72263189225f482", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "numtide", | ||||||
|  |         "repo": "flake-utils", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     "gitignore": { | ||||||
|  |       "flake": false, | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1611672876, | ||||||
|  |         "narHash": "sha256-qHu3uZ/o9jBHiA3MEKHJ06k7w4heOhA+4HCSIvflRxo=", | ||||||
|  |         "owner": "hercules-ci", | ||||||
|  |         "repo": "gitignore.nix", | ||||||
|  |         "rev": "211907489e9f198594c0eb0ca9256a1949c9d412", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "hercules-ci", | ||||||
|  |         "repo": "gitignore.nix", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     "gitignore_2": { | ||||||
|  |       "inputs": { | ||||||
|  |         "nixpkgs": [ | ||||||
|  |           "jupyenv", | ||||||
|  |           "pre-commit-hooks", | ||||||
|  |           "nixpkgs" | ||||||
|  |         ] | ||||||
|  |       }, | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1660459072, | ||||||
|  |         "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", | ||||||
|  |         "owner": "hercules-ci", | ||||||
|  |         "repo": "gitignore.nix", | ||||||
|  |         "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "hercules-ci", | ||||||
|  |         "repo": "gitignore.nix", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     "hls": { | ||||||
|  |       "inputs": { | ||||||
|  |         "flake-compat": "flake-compat_3", | ||||||
|  |         "flake-utils": "flake-utils_3", | ||||||
|  |         "gitignore": "gitignore", | ||||||
|  |         "nixpkgs": "nixpkgs", | ||||||
|  |         "pre-commit-hooks": "pre-commit-hooks" | ||||||
|  |       }, | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1637213318, | ||||||
|  |         "narHash": "sha256-ZgxPwV7t4DyGYP7aXoetq+JHtd73XlOV2fYSflQmOXw=", | ||||||
|  |         "owner": "haskell", | ||||||
|  |         "repo": "haskell-language-server", | ||||||
|  |         "rev": "311107eabbf0537e0c192b2c377d282505b4eff1", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "haskell", | ||||||
|  |         "repo": "haskell-language-server", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     "ihaskell": { | ||||||
|  |       "inputs": { | ||||||
|  |         "flake-compat": [ | ||||||
|  |           "jupyenv", | ||||||
|  |           "flake-compat" | ||||||
|  |         ], | ||||||
|  |         "flake-utils": [ | ||||||
|  |           "jupyenv", | ||||||
|  |           "flake-utils" | ||||||
|  |         ], | ||||||
|  |         "hls": "hls", | ||||||
|  |         "nixpkgs": [ | ||||||
|  |           "jupyenv", | ||||||
|  |           "nixpkgs" | ||||||
|  |         ] | ||||||
|  |       }, | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1671426600, | ||||||
|  |         "narHash": "sha256-MahAFyp6AxY0H61U6zqJXM1NsckNNkK6iqONEtOPSK0=", | ||||||
|  |         "owner": "ihaskell", | ||||||
|  |         "repo": "ihaskell", | ||||||
|  |         "rev": "1c22a874ac0c8ed019229f4a0cd5a0bfda017357", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "ihaskell", | ||||||
|  |         "repo": "ihaskell", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     "jupyenv": { | ||||||
|  |       "inputs": { | ||||||
|  |         "flake-compat": "flake-compat_2", | ||||||
|  |         "flake-utils": "flake-utils_2", | ||||||
|  |         "ihaskell": "ihaskell", | ||||||
|  |         "nix-dart": "nix-dart", | ||||||
|  |         "nixpkgs": "nixpkgs_2", | ||||||
|  |         "nixpkgs-stable": "nixpkgs-stable", | ||||||
|  |         "npmlock2nix": "npmlock2nix", | ||||||
|  |         "opam-nix": "opam-nix", | ||||||
|  |         "poetry2nix": "poetry2nix", | ||||||
|  |         "pre-commit-hooks": "pre-commit-hooks_2", | ||||||
|  |         "rust-overlay": "rust-overlay" | ||||||
|  |       }, | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1679071568, | ||||||
|  |         "narHash": "sha256-3LAo9uXGTmfS4OsiiIuoxX9knEshziCyI1MxR40VKeU=", | ||||||
|  |         "owner": "tweag", | ||||||
|  |         "repo": "jupyenv", | ||||||
|  |         "rev": "3ad2c9512c9efd586cf63adde454e734a8ce049c", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "tweag", | ||||||
|  |         "repo": "jupyenv", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     "mirage-opam-overlays": { | ||||||
|  |       "flake": false, | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1661959605, | ||||||
|  |         "narHash": "sha256-CPTuhYML3F4J58flfp3ZbMNhkRkVFKmBEYBZY5tnQwA=", | ||||||
|  |         "owner": "dune-universe", | ||||||
|  |         "repo": "mirage-opam-overlays", | ||||||
|  |         "rev": "05f1c1823d891ce4d8adab91f5db3ac51d86dc0b", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "dune-universe", | ||||||
|  |         "repo": "mirage-opam-overlays", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     "nix-dart": { | ||||||
|  |       "inputs": { | ||||||
|  |         "flake-utils": [ | ||||||
|  |           "jupyenv", | ||||||
|  |           "flake-utils" | ||||||
|  |         ], | ||||||
|  |         "nixpkgs": [ | ||||||
|  |           "jupyenv", | ||||||
|  |           "nixpkgs" | ||||||
|  |         ], | ||||||
|  |         "pub2nix": "pub2nix" | ||||||
|  |       }, | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1673740150, | ||||||
|  |         "narHash": "sha256-JiZrr75JILHW7IaNW3MwpYn+084Q6/gnXScPR7Pozhs=", | ||||||
|  |         "owner": "djacu", | ||||||
|  |         "repo": "nix-dart", | ||||||
|  |         "rev": "8ee4e1a5ec0cc6c1e15860c4733f741485e8231e", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "djacu", | ||||||
|  |         "repo": "nix-dart", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     "nixpkgs": { | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1630887066, | ||||||
|  |         "narHash": "sha256-0ecIlrLsNIIa+zrNmzXXmbMBLZlmHU/aWFsa4bq99Hk=", | ||||||
|  |         "owner": "NixOS", | ||||||
|  |         "repo": "nixpkgs", | ||||||
|  |         "rev": "5e47a07e9f2d7ed999f2c7943b0896f5f7321ca3", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "NixOS", | ||||||
|  |         "ref": "nixpkgs-unstable", | ||||||
|  |         "repo": "nixpkgs", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     "nixpkgs-stable": { | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1672580127, | ||||||
|  |         "narHash": "sha256-3lW3xZslREhJogoOkjeZtlBtvFMyxHku7I/9IVehhT8=", | ||||||
|  |         "owner": "nixos", | ||||||
|  |         "repo": "nixpkgs", | ||||||
|  |         "rev": "0874168639713f547c05947c76124f78441ea46c", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "nixos", | ||||||
|  |         "ref": "nixos-22.05", | ||||||
|  |         "repo": "nixpkgs", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     "nixpkgs-stable_2": { | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1673800717, | ||||||
|  |         "narHash": "sha256-SFHraUqLSu5cC6IxTprex/nTsI81ZQAtDvlBvGDWfnA=", | ||||||
|  |         "owner": "NixOS", | ||||||
|  |         "repo": "nixpkgs", | ||||||
|  |         "rev": "2f9fd351ec37f5d479556cd48be4ca340da59b8f", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "NixOS", | ||||||
|  |         "ref": "nixos-22.11", | ||||||
|  |         "repo": "nixpkgs", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     "nixpkgs_2": { | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1673796341, | ||||||
|  |         "narHash": "sha256-1kZi9OkukpNmOaPY7S5/+SlCDOuYnP3HkXHvNDyLQcc=", | ||||||
|  |         "owner": "nixos", | ||||||
|  |         "repo": "nixpkgs", | ||||||
|  |         "rev": "6dccdc458512abce8d19f74195bb20fdb067df50", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "nixos", | ||||||
|  |         "ref": "nixos-unstable", | ||||||
|  |         "repo": "nixpkgs", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     "nixpkgs_3": { | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1681557730, | ||||||
|  |         "narHash": "sha256-j2E3639kS3Qop2jQPyqWCdenZNaqIdxfoTvAHnGuAGI=", | ||||||
|  |         "owner": "nixos", | ||||||
|  |         "repo": "nixpkgs", | ||||||
|  |         "rev": "85b081528b937df4bfcaee80c3541b58f397df8b", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "nixos", | ||||||
|  |         "ref": "nixos-unstable", | ||||||
|  |         "repo": "nixpkgs", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     "npmlock2nix": { | ||||||
|  |       "flake": false, | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1668989938, | ||||||
|  |         "narHash": "sha256-/IxdS0AiqSN0/VEOLnnfHyi4nP17yPrkhGf6KlXVwrc=", | ||||||
|  |         "owner": "nix-community", | ||||||
|  |         "repo": "npmlock2nix", | ||||||
|  |         "rev": "0ba0746d62974403daf717cded3f24c617622bc7", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "nix-community", | ||||||
|  |         "repo": "npmlock2nix", | ||||||
|  |         "rev": "0ba0746d62974403daf717cded3f24c617622bc7", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     "opam-nix": { | ||||||
|  |       "inputs": { | ||||||
|  |         "flake-compat": [ | ||||||
|  |           "jupyenv", | ||||||
|  |           "flake-compat" | ||||||
|  |         ], | ||||||
|  |         "flake-utils": [ | ||||||
|  |           "jupyenv", | ||||||
|  |           "flake-utils" | ||||||
|  |         ], | ||||||
|  |         "mirage-opam-overlays": "mirage-opam-overlays", | ||||||
|  |         "nixpkgs": [ | ||||||
|  |           "jupyenv", | ||||||
|  |           "nixpkgs" | ||||||
|  |         ], | ||||||
|  |         "opam-overlays": "opam-overlays", | ||||||
|  |         "opam-repository": "opam-repository", | ||||||
|  |         "opam2json": "opam2json" | ||||||
|  |       }, | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1669990974, | ||||||
|  |         "narHash": "sha256-wHhdlDUC/tBDVFBemeJPpqdIRdehKKbxbdMP0QjOhM4=", | ||||||
|  |         "owner": "tweag", | ||||||
|  |         "repo": "opam-nix", | ||||||
|  |         "rev": "75199758e1954f78286e7e79c0e3916e28b732b0", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "tweag", | ||||||
|  |         "repo": "opam-nix", | ||||||
|  |         "rev": "75199758e1954f78286e7e79c0e3916e28b732b0", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     "opam-overlays": { | ||||||
|  |       "flake": false, | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1654162756, | ||||||
|  |         "narHash": "sha256-RV68fUK+O3zTx61iiHIoS0LvIk0E4voMp+0SwRg6G6c=", | ||||||
|  |         "owner": "dune-universe", | ||||||
|  |         "repo": "opam-overlays", | ||||||
|  |         "rev": "c8f6ef0fc5272f254df4a971a47de7848cc1c8a4", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "dune-universe", | ||||||
|  |         "repo": "opam-overlays", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     "opam-repository": { | ||||||
|  |       "flake": false, | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1661161626, | ||||||
|  |         "narHash": "sha256-J3P+mXLwE2oEKTlMnx8sYRxwD/uNGSKM0AkAB7BNTxA=", | ||||||
|  |         "owner": "ocaml", | ||||||
|  |         "repo": "opam-repository", | ||||||
|  |         "rev": "54e69ff0949a3aaec0d5e3d67898bb7f279ab09f", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "ocaml", | ||||||
|  |         "repo": "opam-repository", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     "opam2json": { | ||||||
|  |       "inputs": { | ||||||
|  |         "nixpkgs": [ | ||||||
|  |           "jupyenv", | ||||||
|  |           "opam-nix", | ||||||
|  |           "nixpkgs" | ||||||
|  |         ] | ||||||
|  |       }, | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1665671715, | ||||||
|  |         "narHash": "sha256-7f75C6fIkiLzfkwLpJxlQIKf+YORGsXGV8Dr2LDDi+A=", | ||||||
|  |         "owner": "tweag", | ||||||
|  |         "repo": "opam2json", | ||||||
|  |         "rev": "32fa2dcd993a27f9e75ee46fb8b78a7cd5d05113", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "tweag", | ||||||
|  |         "repo": "opam2json", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     "poetry2nix": { | ||||||
|  |       "inputs": { | ||||||
|  |         "flake-utils": [ | ||||||
|  |           "jupyenv", | ||||||
|  |           "flake-utils" | ||||||
|  |         ], | ||||||
|  |         "nixpkgs": [ | ||||||
|  |           "jupyenv", | ||||||
|  |           "nixpkgs" | ||||||
|  |         ] | ||||||
|  |       }, | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1673926875, | ||||||
|  |         "narHash": "sha256-QOsT76Al0Igpo0u5vtQJuDSOxrocX3sTD523pLPEklc=", | ||||||
|  |         "owner": "nix-community", | ||||||
|  |         "repo": "poetry2nix", | ||||||
|  |         "rev": "a5c454a834cd290dd4d33102ab8b4aa37d850e65", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "nix-community", | ||||||
|  |         "repo": "poetry2nix", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     "pre-commit-hooks": { | ||||||
|  |       "inputs": { | ||||||
|  |         "flake-utils": [ | ||||||
|  |           "jupyenv", | ||||||
|  |           "ihaskell", | ||||||
|  |           "hls", | ||||||
|  |           "flake-utils" | ||||||
|  |         ], | ||||||
|  |         "nixpkgs": [ | ||||||
|  |           "jupyenv", | ||||||
|  |           "ihaskell", | ||||||
|  |           "hls", | ||||||
|  |           "nixpkgs" | ||||||
|  |         ] | ||||||
|  |       }, | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1624971177, | ||||||
|  |         "narHash": "sha256-Amf/nBj1E77RmbSSmV+hg6YOpR+rddCbbVgo5C7BS0I=", | ||||||
|  |         "owner": "cachix", | ||||||
|  |         "repo": "pre-commit-hooks.nix", | ||||||
|  |         "rev": "397f0713d007250a2c7a745e555fa16c5dc8cadb", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "cachix", | ||||||
|  |         "repo": "pre-commit-hooks.nix", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     "pre-commit-hooks_2": { | ||||||
|  |       "inputs": { | ||||||
|  |         "flake-compat": "flake-compat_4", | ||||||
|  |         "flake-utils": [ | ||||||
|  |           "jupyenv", | ||||||
|  |           "flake-utils" | ||||||
|  |         ], | ||||||
|  |         "gitignore": "gitignore_2", | ||||||
|  |         "nixpkgs": [ | ||||||
|  |           "jupyenv", | ||||||
|  |           "nixpkgs" | ||||||
|  |         ], | ||||||
|  |         "nixpkgs-stable": "nixpkgs-stable_2" | ||||||
|  |       }, | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1674075316, | ||||||
|  |         "narHash": "sha256-0uZuAcYBpNJLxr7n5O0vhwn3rSLpUTm9M5WGgmNQ+wM=", | ||||||
|  |         "owner": "cachix", | ||||||
|  |         "repo": "pre-commit-hooks.nix", | ||||||
|  |         "rev": "3e42a77571cc0463efa470dbcffa063977a521ab", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "cachix", | ||||||
|  |         "repo": "pre-commit-hooks.nix", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     "pub2nix": { | ||||||
|  |       "flake": false, | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1594192744, | ||||||
|  |         "narHash": "sha256-pDvcXSG1Mh2BpwkqAcNDJzcupV3pIAAtZJLfkiHMAz4=", | ||||||
|  |         "owner": "paulyoung", | ||||||
|  |         "repo": "pub2nix", | ||||||
|  |         "rev": "0c7ecca590fcd1616db8c6468f799ffef36c85e9", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "paulyoung", | ||||||
|  |         "repo": "pub2nix", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     "root": { | ||||||
|  |       "inputs": { | ||||||
|  |         "flake-compat": "flake-compat", | ||||||
|  |         "flake-utils": "flake-utils", | ||||||
|  |         "jupyenv": "jupyenv", | ||||||
|  |         "nixpkgs": "nixpkgs_3" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     "rust-overlay": { | ||||||
|  |       "inputs": { | ||||||
|  |         "flake-utils": [ | ||||||
|  |           "jupyenv", | ||||||
|  |           "flake-utils" | ||||||
|  |         ], | ||||||
|  |         "nixpkgs": [ | ||||||
|  |           "jupyenv", | ||||||
|  |           "nixpkgs" | ||||||
|  |         ] | ||||||
|  |       }, | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1674008920, | ||||||
|  |         "narHash": "sha256-ugwPxKjvmJ5GpzN/MHg8tuhe8nYi3SbJm5nWNy7CB0Q=", | ||||||
|  |         "owner": "oxalica", | ||||||
|  |         "repo": "rust-overlay", | ||||||
|  |         "rev": "eecc44934a0f6c02c02856b38bd3b6af3bec0870", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "oxalica", | ||||||
|  |         "repo": "rust-overlay", | ||||||
|  |         "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", | ||||||
|  |   "version": 7 | ||||||
|  | } | ||||||
							
								
								
									
										82
									
								
								flake.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										82
									
								
								flake.nix
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,82 @@ | |||||||
|  | { | ||||||
|  |   description = "Your jupyenv project"; | ||||||
|  | 
 | ||||||
|  |   nixConfig.extra-substituters = [ | ||||||
|  |     "https://tweag-jupyter.cachix.org" | ||||||
|  |   ]; | ||||||
|  |   nixConfig.extra-trusted-public-keys = [ | ||||||
|  |     "tweag-jupyter.cachix.org-1:UtNH4Zs6hVUFpFBTLaA4ejYavPo5EFFqgd7G7FxGW9g=" | ||||||
|  |   ]; | ||||||
|  | 
 | ||||||
|  |   inputs.flake-compat.url = "github:edolstra/flake-compat"; | ||||||
|  |   inputs.flake-compat.flake = false; | ||||||
|  |   inputs.flake-utils.url = "github:numtide/flake-utils"; | ||||||
|  |   inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; | ||||||
|  |   inputs.jupyenv.url = "github:tweag/jupyenv"; | ||||||
|  | 
 | ||||||
|  |   outputs = { | ||||||
|  |     self, | ||||||
|  |     flake-compat, | ||||||
|  |     flake-utils, | ||||||
|  |     nixpkgs, | ||||||
|  |     jupyenv, | ||||||
|  |     ... | ||||||
|  |   } @ inputs: | ||||||
|  |     flake-utils.lib.eachSystem | ||||||
|  |     [ | ||||||
|  |       flake-utils.lib.system.x86_64-linux | ||||||
|  |     ] | ||||||
|  |     ( | ||||||
|  |       system: let | ||||||
|  |         inherit (jupyenv.lib.${system}) mkJupyterlabNew; | ||||||
|  |         jupyterlab = mkJupyterlabNew ({...}: { | ||||||
|  |           nixpkgs = inputs.nixpkgs; | ||||||
|  |           imports = [(import ./kernels.nix)]; | ||||||
|  |         }); | ||||||
|  |         pkgs = nixpkgs.legacyPackages.${system}; | ||||||
|  |       in rec { | ||||||
|  |         packages = rec { | ||||||
|  |           inherit jupyterlab; | ||||||
|  |           contents = pkgs.buildEnv { | ||||||
|  |             name = "image-env"; | ||||||
|  |             paths = [ | ||||||
|  |               jupyterlab | ||||||
|  |               pkgs.coreutils | ||||||
|  |               pkgs.bash | ||||||
|  |               pkgs.nodejs | ||||||
|  |               pkgs.nodePackages.npm | ||||||
|  |             ]; | ||||||
|  |           }; | ||||||
|  | 
 | ||||||
|  |           docker-image = pkgs.dockerTools.buildImage { | ||||||
|  |             name = "git.pbrinkmeier.de/paul/jup"; | ||||||
|  |             tag = "1.6"; | ||||||
|  |             copyToRoot = contents; | ||||||
|  |             runAsRoot = '' | ||||||
|  |               mkdir -p usr | ||||||
|  |               ln -s /bin /usr/bin | ||||||
|  |             ''; | ||||||
|  |             config = { | ||||||
|  |               Env = [ | ||||||
|  |                 "HOME=/data" | ||||||
|  |               ]; | ||||||
|  |               Cmd = [ | ||||||
|  |                 "${contents}/bin/jupyter-lab" | ||||||
|  |                 "--notebook-dir=/notebooks" | ||||||
|  |                 "--ip=0.0.0.0" | ||||||
|  |                 "--no-browser" | ||||||
|  |                 # No authentication, has to be handled by reverse proxy! | ||||||
|  |                 "--ServerApp.token=" | ||||||
|  |                 "--ServerApp.password=" | ||||||
|  |                 "--collaborative" | ||||||
|  |               ]; | ||||||
|  |               WorkingDir = "/data"; | ||||||
|  |             }; | ||||||
|  |           }; | ||||||
|  |         }; | ||||||
|  |         packages.default = jupyterlab; | ||||||
|  |         apps.default.program = "${jupyterlab}/bin/jupyter-lab"; | ||||||
|  |         apps.default.type = "app"; | ||||||
|  |       } | ||||||
|  |     ); | ||||||
|  | } | ||||||
							
								
								
									
										34
									
								
								kernels.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								kernels.nix
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,34 @@ | |||||||
|  | {pkgs, ...}: { | ||||||
|  |   kernel.python.python = { | ||||||
|  |     enable = true; | ||||||
|  |     displayName = "Python 3"; | ||||||
|  |     extraPackages = ps: with ps; [ | ||||||
|  |     ]; | ||||||
|  |   }; | ||||||
|  | 
 | ||||||
|  |   kernel.haskell.haskell = { | ||||||
|  |     enable = true; | ||||||
|  |     displayName = "GHC 9.0.2"; | ||||||
|  |     haskellCompiler = "ghc902"; | ||||||
|  |     extraHaskellPackages = ps: with ps; [ | ||||||
|  |       hvega | ||||||
|  |       formatting | ||||||
|  |       ihaskell-charts | ||||||
|  |       ihaskell-diagrams | ||||||
|  |       ihaskell-gnuplot | ||||||
|  |       ihaskell-graphviz | ||||||
|  |       ihaskell-hvega | ||||||
|  |       ihaskell-juicypixels | ||||||
|  |       ihaskell-magic | ||||||
|  |       ihaskell-plot | ||||||
|  |       hmatrix | ||||||
|  |       cassava | ||||||
|  |       attoparsec | ||||||
|  |       safe-exceptions | ||||||
|  |       conduit | ||||||
|  |       conduit-extra | ||||||
|  |       text_2_0_1 | ||||||
|  |       bytestring_0_11_3_1 | ||||||
|  |     ]; | ||||||
|  |   }; | ||||||
|  | } | ||||||
| @ -1,5 +0,0 @@ | |||||||
| {}: |  | ||||||
| let |  | ||||||
|   sources = import ./sources.nix; |  | ||||||
| in |  | ||||||
|   import sources.nixpkgs {} |  | ||||||
| @ -1,26 +0,0 @@ | |||||||
| { |  | ||||||
|     "jupyterWith": { |  | ||||||
|         "branch": "master", |  | ||||||
|         "description": "declarative and reproducible Jupyter environments - powered by Nix", |  | ||||||
|         "homepage": "", |  | ||||||
|         "owner": "tweag", |  | ||||||
|         "repo": "jupyterWith", |  | ||||||
|         "rev": "2b10030df2a29beed10c02d5f64745b143206350", |  | ||||||
|         "sha256": "1blgksccq5zq20zd28sn0qpznjbc72vp066vwydk10z6chlpdzk2", |  | ||||||
|         "type": "tarball", |  | ||||||
|         "url": "https://github.com/tweag/jupyterWith/archive/2b10030df2a29beed10c02d5f64745b143206350.tar.gz", |  | ||||||
|         "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" |  | ||||||
|     }, |  | ||||||
|     "nixpkgs": { |  | ||||||
|         "branch": "nixpkgs-unstable", |  | ||||||
|         "description": "Nix Packages collection", |  | ||||||
|         "homepage": "", |  | ||||||
|         "owner": "NixOS", |  | ||||||
|         "repo": "nixpkgs", |  | ||||||
|         "rev": "b283b64580d1872333a99af2b4cef91bb84580cf", |  | ||||||
|         "sha256": "0gmrpfzc622xl1lv3ffaj104j2q3nmia7jywafqmgmrcdm9axkkp", |  | ||||||
|         "type": "tarball", |  | ||||||
|         "url": "https://github.com/NixOS/nixpkgs/archive/b283b64580d1872333a99af2b4cef91bb84580cf.tar.gz", |  | ||||||
|         "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" |  | ||||||
|     } |  | ||||||
| } |  | ||||||
							
								
								
									
										176
									
								
								nix/sources.nix
									
									
									
									
									
								
							
							
						
						
									
										176
									
								
								nix/sources.nix
									
									
									
									
									
								
							| @ -1,176 +0,0 @@ | |||||||
| # This file has been generated by Niv. |  | ||||||
| 
 |  | ||||||
| let |  | ||||||
| 
 |  | ||||||
|   # |  | ||||||
|   # The fetchers. fetch_<type> fetches specs of type <type>. |  | ||||||
|   # |  | ||||||
| 
 |  | ||||||
|   fetch_file = pkgs: name: spec: |  | ||||||
|     let |  | ||||||
|       name' = sanitizeName name + "-src"; |  | ||||||
|     in |  | ||||||
|       if spec.builtin or true then |  | ||||||
|         builtins_fetchurl { inherit (spec) url sha256; name = name'; } |  | ||||||
|       else |  | ||||||
|         pkgs.fetchurl { inherit (spec) url sha256; name = name'; }; |  | ||||||
| 
 |  | ||||||
|   fetch_tarball = pkgs: name: spec: |  | ||||||
|     let |  | ||||||
|       name' = sanitizeName name + "-src"; |  | ||||||
|     in |  | ||||||
|       if spec.builtin or true then |  | ||||||
|         builtins_fetchTarball { name = name'; inherit (spec) url sha256; } |  | ||||||
|       else |  | ||||||
|         pkgs.fetchzip { name = name'; inherit (spec) url sha256; }; |  | ||||||
| 
 |  | ||||||
|   fetch_git = name: spec: |  | ||||||
|     let |  | ||||||
|       ref = |  | ||||||
|         if spec ? ref then spec.ref else |  | ||||||
|           if spec ? branch then "refs/heads/${spec.branch}" else |  | ||||||
|             if spec ? tag then "refs/tags/${spec.tag}" else |  | ||||||
|               abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!"; |  | ||||||
|       submodules = if spec ? submodules then spec.submodules else false; |  | ||||||
|     in |  | ||||||
|       builtins.fetchGit { url = spec.repo; inherit (spec) rev; inherit ref; } |  | ||||||
|       // (if builtins.compareVersions builtins.nixVersion "2.4" >= 0 then { inherit submodules; } else {}); |  | ||||||
| 
 |  | ||||||
|   fetch_local = spec: spec.path; |  | ||||||
| 
 |  | ||||||
|   fetch_builtin-tarball = name: throw |  | ||||||
|     ''[${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`. |  | ||||||
|         $ niv modify ${name} -a type=tarball -a builtin=true''; |  | ||||||
| 
 |  | ||||||
|   fetch_builtin-url = name: throw |  | ||||||
|     ''[${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`. |  | ||||||
|         $ niv modify ${name} -a type=file -a builtin=true''; |  | ||||||
| 
 |  | ||||||
|   # |  | ||||||
|   # Various helpers |  | ||||||
|   # |  | ||||||
| 
 |  | ||||||
|   # https://github.com/NixOS/nixpkgs/pull/83241/files#diff-c6f540a4f3bfa4b0e8b6bafd4cd54e8bR695 |  | ||||||
|   sanitizeName = name: |  | ||||||
|     ( |  | ||||||
|       concatMapStrings (s: if builtins.isList s then "-" else s) |  | ||||||
|         ( |  | ||||||
|           builtins.split "[^[:alnum:]+._?=-]+" |  | ||||||
|             ((x: builtins.elemAt (builtins.match "\\.*(.*)" x) 0) name) |  | ||||||
|         ) |  | ||||||
|     ); |  | ||||||
| 
 |  | ||||||
|   # The set of packages used when specs are fetched using non-builtins. |  | ||||||
|   mkPkgs = sources: system: |  | ||||||
|     let |  | ||||||
|       sourcesNixpkgs = |  | ||||||
|         import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) { inherit system; }; |  | ||||||
|       hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath; |  | ||||||
|       hasThisAsNixpkgsPath = <nixpkgs> == ./.; |  | ||||||
|     in |  | ||||||
|       if builtins.hasAttr "nixpkgs" sources |  | ||||||
|       then sourcesNixpkgs |  | ||||||
|       else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then |  | ||||||
|         import <nixpkgs> {} |  | ||||||
|       else |  | ||||||
|         abort |  | ||||||
|           '' |  | ||||||
|             Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or |  | ||||||
|             add a package called "nixpkgs" to your sources.json. |  | ||||||
|           ''; |  | ||||||
| 
 |  | ||||||
|   # The actual fetching function. |  | ||||||
|   fetch = pkgs: name: spec: |  | ||||||
| 
 |  | ||||||
|     if ! builtins.hasAttr "type" spec then |  | ||||||
|       abort "ERROR: niv spec ${name} does not have a 'type' attribute" |  | ||||||
|     else if spec.type == "file" then fetch_file pkgs name spec |  | ||||||
|     else if spec.type == "tarball" then fetch_tarball pkgs name spec |  | ||||||
|     else if spec.type == "git" then fetch_git name spec |  | ||||||
|     else if spec.type == "local" then fetch_local spec |  | ||||||
|     else if spec.type == "builtin-tarball" then fetch_builtin-tarball name |  | ||||||
|     else if spec.type == "builtin-url" then fetch_builtin-url name |  | ||||||
|     else |  | ||||||
|       abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}"; |  | ||||||
| 
 |  | ||||||
|   # If the environment variable NIV_OVERRIDE_${name} is set, then use |  | ||||||
|   # the path directly as opposed to the fetched source. |  | ||||||
|   replace = name: drv: |  | ||||||
|     let |  | ||||||
|       saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name; |  | ||||||
|       ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}"; |  | ||||||
|     in |  | ||||||
|       if ersatz == "" then drv else |  | ||||||
|         # this turns the string into an actual Nix path (for both absolute and |  | ||||||
|         # relative paths) |  | ||||||
|         if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}"; |  | ||||||
| 
 |  | ||||||
|   # Ports of functions for older nix versions |  | ||||||
| 
 |  | ||||||
|   # a Nix version of mapAttrs if the built-in doesn't exist |  | ||||||
|   mapAttrs = builtins.mapAttrs or ( |  | ||||||
|     f: set: with builtins; |  | ||||||
|     listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set)) |  | ||||||
|   ); |  | ||||||
| 
 |  | ||||||
|   # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295 |  | ||||||
|   range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1); |  | ||||||
| 
 |  | ||||||
|   # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257 |  | ||||||
|   stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1)); |  | ||||||
| 
 |  | ||||||
|   # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269 |  | ||||||
|   stringAsChars = f: s: concatStrings (map f (stringToCharacters s)); |  | ||||||
|   concatMapStrings = f: list: concatStrings (map f list); |  | ||||||
|   concatStrings = builtins.concatStringsSep ""; |  | ||||||
| 
 |  | ||||||
|   # https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331 |  | ||||||
|   optionalAttrs = cond: as: if cond then as else {}; |  | ||||||
| 
 |  | ||||||
|   # fetchTarball version that is compatible between all the versions of Nix |  | ||||||
|   builtins_fetchTarball = { url, name ? null, sha256 }@attrs: |  | ||||||
|     let |  | ||||||
|       inherit (builtins) lessThan nixVersion fetchTarball; |  | ||||||
|     in |  | ||||||
|       if lessThan nixVersion "1.12" then |  | ||||||
|         fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; })) |  | ||||||
|       else |  | ||||||
|         fetchTarball attrs; |  | ||||||
| 
 |  | ||||||
|   # fetchurl version that is compatible between all the versions of Nix |  | ||||||
|   builtins_fetchurl = { url, name ? null, sha256 }@attrs: |  | ||||||
|     let |  | ||||||
|       inherit (builtins) lessThan nixVersion fetchurl; |  | ||||||
|     in |  | ||||||
|       if lessThan nixVersion "1.12" then |  | ||||||
|         fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; })) |  | ||||||
|       else |  | ||||||
|         fetchurl attrs; |  | ||||||
| 
 |  | ||||||
|   # Create the final "sources" from the config |  | ||||||
|   mkSources = config: |  | ||||||
|     mapAttrs ( |  | ||||||
|       name: spec: |  | ||||||
|         if builtins.hasAttr "outPath" spec |  | ||||||
|         then abort |  | ||||||
|           "The values in sources.json should not have an 'outPath' attribute" |  | ||||||
|         else |  | ||||||
|           spec // { outPath = replace name (fetch config.pkgs name spec); } |  | ||||||
|     ) config.sources; |  | ||||||
| 
 |  | ||||||
|   # The "config" used by the fetchers |  | ||||||
|   mkConfig = |  | ||||||
|     { sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null |  | ||||||
|     , sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile) |  | ||||||
|     , system ? builtins.currentSystem |  | ||||||
|     , pkgs ? mkPkgs sources system |  | ||||||
|     }: rec { |  | ||||||
|       # The sources, i.e. the attribute set of spec name to spec |  | ||||||
|       inherit sources; |  | ||||||
| 
 |  | ||||||
|       # The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers |  | ||||||
|       inherit pkgs; |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
| in |  | ||||||
| mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); } |  | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user