Skip to content

Commit

Permalink
flake.nix: init
Browse files Browse the repository at this point in the history
  • Loading branch information
vaibhavsagar committed Feb 4, 2024
1 parent 1eb79ec commit b8a42e7
Show file tree
Hide file tree
Showing 30 changed files with 229 additions and 115 deletions.
3 changes: 2 additions & 1 deletion callcc/default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{ system ? builtins.currentSystem }:
let
pkgs = import ../pkgs.nix;
overlay = sel: sup: {
Expand All @@ -12,7 +13,7 @@ let
};
};
};
nixpkgs = (import pkgs.nixpkgs { overlays = [ overlay ]; });
nixpkgs = (import pkgs.nixpkgs { inherit system; overlays = [ overlay ]; });
jupyterlab = nixpkgs.python3.withPackages (ps: [ ps.jupyterlab ps.notebook ]);
in nixpkgs.callPackage "${pkgs.ihaskell}/nix/release.nix" { compiler = "ghc948"; }{
extraEnvironmentBinaries = [jupyterlab];
Expand Down
3 changes: 2 additions & 1 deletion chart-diagrams/default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{ system ? builtins.currentSystem }:
let
pkgs = import ../pkgs.nix;
overlay = sel: sup: {
Expand All @@ -12,7 +13,7 @@ let
};
};
};
nixpkgs = (import pkgs.nixpkgs { overlays = [ overlay ]; });
nixpkgs = (import pkgs.nixpkgs { inherit system; overlays = [ overlay ]; });
jupyterlab = nixpkgs.python3.withPackages (ps: [ ps.jupyterlab ps.notebook ]);
in nixpkgs.callPackage "${pkgs.ihaskell}/nix/release.nix" { compiler = "ghc948"; }{
extraEnvironmentBinaries = [jupyterlab];
Expand Down
3 changes: 2 additions & 1 deletion codensity/default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{ system ? builtins.currentSystem }:
let
pkgs = import ../pkgs.nix;
overlay = sel: sup: {
Expand All @@ -12,7 +13,7 @@ let
};
};
};
nixpkgs = (import pkgs.nixpkgs { overlays = [ overlay ]; });
nixpkgs = (import pkgs.nixpkgs { inherit system; overlays = [ overlay ]; });
jupyterlab = nixpkgs.python3.withPackages (ps: [ ps.jupyterlab ps.notebook ]);
in nixpkgs.callPackage "${pkgs.ihaskell}/nix/release.nix" { compiler = "ghc948"; }{
extraEnvironmentBinaries = [jupyterlab];
Expand Down
3 changes: 2 additions & 1 deletion continuations/default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{ system ? builtins.currentSystem }:
let
pkgs = import ../pkgs.nix;
overlay = sel: sup: {
Expand All @@ -12,7 +13,7 @@ let
};
};
};
nixpkgs = (import pkgs.nixpkgs { overlays = [ overlay ]; });
nixpkgs = (import pkgs.nixpkgs { inherit system; overlays = [ overlay ]; });
jupyterlab = nixpkgs.python3.withPackages (ps: [ ps.jupyterlab ps.notebook ]);
in nixpkgs.callPackage "${pkgs.ihaskell}/nix/release.nix" { compiler = "ghc948"; }{
extraEnvironmentBinaries = [jupyterlab];
Expand Down
43 changes: 10 additions & 33 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,33 +1,10 @@
let
pkgs = import ./pkgs.nix;
nixpkgs = import pkgs.nixpkgs {};
notebooks = map (folder: {
name = folder;
path = import (./. + "/${folder}");
});
in nixpkgs.linkFarm "notebooks" (notebooks [
"callcc"
"chart-diagrams"
"codensity"
"continuations"
"deriving-via"
"docker"
"dragon-curve"
"efficient-combinator-parsers"
"git-from-scratch"
"graphviz"
"hamt"
"hs-updater"
"intmap"
"lambda"
"mph"
"refactoring-tarjan"
"revisiting-monadic-parsing-haskell"
"revisiting-poor-mans-concurrency"
"smt"
"solver"
"tarjan"
"trees-that-shrink"
"typeclasses"
"zulip-api"
])
(import
(
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
fetchTarball {
url = lock.nodes.flake-compat.locked.url or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{ src = ./.; }
).defaultNix
3 changes: 2 additions & 1 deletion deriving-via/default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{ system ? builtins.currentSystem }:
let
pkgs = import ../pkgs.nix;
overlay = sel: sup: {
Expand All @@ -12,7 +13,7 @@ let
};
};
};
nixpkgs = (import pkgs.nixpkgs { overlays = [ overlay ]; });
nixpkgs = (import pkgs.nixpkgs { inherit system; overlays = [ overlay ]; });
jupyterlab = nixpkgs.python3.withPackages (ps: [ ps.jupyterlab ps.notebook ]);
in nixpkgs.callPackage "${pkgs.ihaskell}/nix/release.nix" { compiler = "ghc948"; }{
extraEnvironmentBinaries = [jupyterlab];
Expand Down
3 changes: 2 additions & 1 deletion docker/default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{ system ? builtins.currentSystem }:
let
pkgs = import ../pkgs.nix;
overlay = sel: sup: {
Expand All @@ -12,7 +13,7 @@ let
};
};
};
nixpkgs = (import pkgs.nixpkgs { overlays = [ overlay ]; });
nixpkgs = (import pkgs.nixpkgs { inherit system; overlays = [ overlay ]; });
jupyterlab = nixpkgs.python3.withPackages (ps: [ ps.jupyterlab ps.notebook ]);
NB_USER = "jovyan";
NB_UID = "1000";
Expand Down
3 changes: 2 additions & 1 deletion dragon-curve/default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{ system ? builtins.currentSystem }:
let
pkgs = import ../pkgs.nix;
overlay = sel: sup: {
Expand All @@ -12,7 +13,7 @@ let
};
};
};
nixpkgs = (import pkgs.nixpkgs { overlays = [ overlay ]; });
nixpkgs = (import pkgs.nixpkgs { inherit system; overlays = [ overlay ]; });
jupyterlab = nixpkgs.python3.withPackages (ps: [ ps.jupyterlab ps.notebook ]);
in nixpkgs.callPackage "${pkgs.ihaskell}/nix/release.nix" { compiler = "ghc948"; }{
extraEnvironmentBinaries = [jupyterlab];
Expand Down
3 changes: 2 additions & 1 deletion efficient-combinator-parsers/default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{ system ? builtins.currentSystem }:
let
pkgs = import ../pkgs.nix;
overlay = sel: sup: {
Expand All @@ -12,7 +13,7 @@ let
};
};
};
nixpkgs = (import pkgs.nixpkgs { overlays = [ overlay ]; });
nixpkgs = (import pkgs.nixpkgs { inherit system; overlays = [ overlay ]; });
jupyterlab = nixpkgs.python3.withPackages (ps: [ ps.jupyterlab ps.notebook ]);
in nixpkgs.callPackage "${pkgs.ihaskell}/nix/release.nix" { compiler = "ghc948"; }{
extraEnvironmentBinaries = [jupyterlab];
Expand Down
110 changes: 110 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 57 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/release-23.11";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nix-filter.url = "github:numtide/nix-filter";
inputs.ihaskell.url = "github:IHaskell/IHaskell";
inputs.ihaskell.flake = false;
inputs.flake-compat.url = "github:edolstra/flake-compat";

nixConfig = {
extra-substituters = [
"https://ihaskell.cachix.org"
"https://vaibhavsagar.cachix.org"
];
extra-trusted-public-keys = [
"ihaskell.cachix.org-1:WoIvex/Ft/++sjYW3ntqPUL3jDGXIKDpX60pC8d5VLM="
"vaibhavsagar.cachix.org-1:PxFckJ8oAzgF4sdFJ855Fw38yCVbXmzJ98Cc6dGzcE0="
];
};

outputs = {self, nixpkgs, flake-utils, nix-filter, ...}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs { inherit system; };
notebook = folder: {
name = folder;
path = import (./. + "/${folder}") { inherit system; };
};
notebooks = map notebook [
"callcc"
"chart-diagrams"
"codensity"
"continuations"
"deriving-via"
"docker"
"dragon-curve"
"efficient-combinator-parsers"
"git-from-scratch"
"graphviz"
"hamt"
"hs-updater"
"intmap"
"lambda"
"mph"
"refactoring-tarjan"
"revisiting-monadic-parsing-haskell"
"revisiting-poor-mans-concurrency"
"smt"
"solver"
"tarjan"
"trees-that-shrink"
"typeclasses"
"zulip-api"
];
in {
packages = builtins.listToAttrs (map (n: {name = n.name; value = n.path;}) notebooks);
defaultPackage = pkgs.linkFarm "notebooks" notebooks;
});
}
3 changes: 2 additions & 1 deletion git-from-scratch/default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{ system ? builtins.currentSystem }:
let
pkgs = import ../pkgs.nix;
overlay = sel: sup: {
Expand All @@ -12,7 +13,7 @@ let
};
};
};
nixpkgs = (import pkgs.nixpkgs { overlays = [ overlay ]; });
nixpkgs = (import pkgs.nixpkgs { inherit system; overlays = [ overlay ]; });
jupyterlab = nixpkgs.python3.withPackages (ps: [ ps.jupyterlab ps.notebook ]);
cleanSource = name: type: let
baseName = baseNameOf (toString name);
Expand Down
3 changes: 2 additions & 1 deletion graphviz/default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{ system ? builtins.currentSystem }:
let
pkgs = import ../pkgs.nix;
overlay = sel: sup: {
Expand All @@ -12,7 +13,7 @@ let
};
};
};
nixpkgs = (import pkgs.nixpkgs { overlays = [ overlay ]; });
nixpkgs = (import pkgs.nixpkgs { inherit system; overlays = [ overlay ]; });
jupyterlab = nixpkgs.python3.withPackages (ps: [ ps.jupyterlab ps.notebook ]);
in nixpkgs.callPackage "${pkgs.ihaskell}/nix/release.nix" { compiler = "ghc948"; }{
extraEnvironmentBinaries = [ jupyterlab ];
Expand Down
3 changes: 2 additions & 1 deletion hamt/default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{ system ? builtins.currentSystem }:
let
pkgs = import ../pkgs.nix;
overlay = sel: sup: {
Expand All @@ -12,7 +13,7 @@ let
};
};
};
nixpkgs = (import pkgs.nixpkgs { overlays = [ overlay ]; });
nixpkgs = (import pkgs.nixpkgs { inherit system; overlays = [ overlay ]; });
jupyterlab = nixpkgs.python3.withPackages (ps: [ ps.jupyterlab ps.notebook ]);
in nixpkgs.callPackage "${pkgs.ihaskell}/nix/release.nix" { compiler = "ghc948"; }{
extraEnvironmentBinaries = [jupyterlab];
Expand Down
3 changes: 2 additions & 1 deletion hs-updater/default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{ system ? builtins.currentSystem }:
let
pkgs = import ../pkgs.nix;
overlay = sel: sup: {
Expand All @@ -13,7 +14,7 @@ let
};
};
};
nixpkgs = (import pkgs.nixpkgs { overlays = [ overlay ]; });
nixpkgs = (import pkgs.nixpkgs { inherit system; overlays = [ overlay ]; });
jupyterlab = nixpkgs.python3.withPackages (ps: [ ps.jupyterlab ps.notebook ]);
in nixpkgs.callPackage "${pkgs.ihaskell}/nix/release.nix" { compiler = "ghc948"; }{
extraEnvironmentBinaries = [ jupyterlab ];
Expand Down
3 changes: 2 additions & 1 deletion intmap/default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{ system ? builtins.currentSystem }:
let
pkgs = import ../pkgs.nix;
overlay = sel: sup: {
Expand All @@ -12,7 +13,7 @@ let
};
};
};
nixpkgs = (import pkgs.nixpkgs { overlays = [ overlay ]; });
nixpkgs = (import pkgs.nixpkgs { inherit system; overlays = [ overlay ]; });
jupyterlab = nixpkgs.python3.withPackages (ps: [ ps.jupyterlab ps.notebook ]);
in nixpkgs.callPackage "${pkgs.ihaskell}/nix/release.nix" { compiler = "ghc948"; }{
extraEnvironmentBinaries = [ jupyterlab ];
Expand Down
Loading

0 comments on commit b8a42e7

Please sign in to comment.