Skip to content

Commit

Permalink
Add first draft of flake.nix file
Browse files Browse the repository at this point in the history
  • Loading branch information
ad-si committed Feb 14, 2024
1 parent 12b7069 commit 3966f03
Show file tree
Hide file tree
Showing 2 changed files with 155 additions and 0 deletions.
87 changes: 87 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 @@
# WARNING:
# This is still a work in progress and not yet fully functional.
{
description = "Transity";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
purescript-overlay = {
url = "github:thomashoneyman/purescript-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = { self, nixpkgs, ... }@inputs:
let
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];

forAllSystems = nixpkgs.lib.genAttrs supportedSystems;

nixpkgsFor = forAllSystems (system: import nixpkgs {
inherit system;
config = { };
overlays = builtins.attrValues self.overlays;
});
in {
overlays = {
purescript = inputs.purescript-overlay.overlays.default;
};

packages = forAllSystems (system:
let pkgs = nixpkgsFor.${system}; in {
default = pkgs.buildNpmPackage {
name = "transity";
buildInputs = [ nixpkgsFor.${system}.nodejs_20 ];
src = ./.;
npmDepsHash = "sha256-yBjzdVe2nNGT3ACXhz/ZsOCm7d4ELvHGed9ZD410LAY=";
npmBuild = "make bundle";
installPhase = ''
mkdir $out
cp index.js $out
'';
};
});

devShells = forAllSystems (system:
let pkgs = nixpkgsFor.${system}; in {
default = pkgs.mkShell {
name = "transity";
inputsFrom = builtins.attrValues self.packages.${system};
buildInputs = with pkgs; [
nodejs_20
watchexec

# TODO: Currently still installed via npm
# purs
# purs-backend-es
# purs-tidy-bin.purs-tidy-0_10_1
# spago-unstable
];
};
});
};
}

0 comments on commit 3966f03

Please sign in to comment.