Skip to content

Commit

Permalink
Added Nix flake.
Browse files Browse the repository at this point in the history
  • Loading branch information
bwbush committed Aug 9, 2024
1 parent 57dea11 commit bd43915
Show file tree
Hide file tree
Showing 3 changed files with 131 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
_build/
*.agdai
61 changes: 61 additions & 0 deletions flake.lock

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

68 changes: 68 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
description = "IOG Prelude";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/cb9a96f23c491c081b38eab96d22fa958043c9fa";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs { inherit system; };
lib = pkgs.stdEnv.lib;
localEmacs = (pkgs.emacs.pkgs.withPackages (epkgs: (with epkgs.melpaStablePackages; [
epkgs.agda2-mode
])));
agda-stdlib = pkgs.agdaPackages.standard-library.overrideAttrs (oldAtts: rec {
version = "2.0";
src = pkgs.fetchFromGitHub {
repo = "agda-stdlib";
owner = "agda";
rev = "v${version}";
sha256 = "sha256-TjGvY3eqpF+DDwatT7A78flyPcTkcLHQ1xcg+MKgCoE=";
};
preConfigure = ''
runhaskell GenerateEverything.hs
rm EverythingSafe.agda
'';
});
localAgda = pkgs.agda.withPackages (ps: [
agda-stdlib
]);
iog-prelude = pkgs.agdaPackages.mkDerivation {
pname = "iog-prelude";
version = "0.1";
meta = { };
src = pkgs.fetchFromGitHub {
repo = "iog-agda-prelude";
owner = "functionally";
rev = "2b780014456447bfe2a936be04a0e06f3f1ebba8";
sha256 = "sha256-z3Or2gPin7fZzVkIhEkRVu8+KFxjNfKh6Ik5sM7qqks=";
};
preConfigure = ''
echo "module Everything where" > Everything.agda
find src -type f | sed -e '/Dec\.agda$/d;s@^src/\(.*\)\.agda$@open import \1@;s@/@.@g' >> Everything.agda
'';
buildInputs = [ agda-stdlib ];
};
in
{
packages.default = iog-prelude;
defaultPackage = iog-prelude;
devShell = pkgs.mkShell {
buildInputs = [
pkgs.nixpkgs-fmt
localAgda
localEmacs
pkgs.mononoki
];
};
}
);

nixConfig = {
bash-prompt = "\\n\\[\\033[1;32m\\][iog-prelude:\\w]\\$\\[\\033[0m\\] ";
};
}

0 comments on commit bd43915

Please sign in to comment.