All Projects → justinwoo → psc-package2nix

justinwoo / psc-package2nix

Licence: MIT license
Tool to derive a Nix expression from a psc-package.json configuration.

Programming Languages

haskell
3896 projects
Nix
1067 projects
Dhall
116 projects
purescript
368 projects
Makefile
30231 projects
shell
77523 projects

Projects that are alternatives of or similar to psc-package2nix

Jupyterwith
declarative and reproducible Jupyter environments - powered by Nix
Stars: ✭ 235 (+1707.69%)
Mutual labels:  nix
nix-gaming
Gaming on Nix
Stars: ✭ 142 (+992.31%)
Mutual labels:  nix
nixos-installer
Combining the power of Nix, Guile & Elm to install NixOS
Stars: ✭ 14 (+7.69%)
Mutual labels:  nix
rc
Structured system configuration (I moved from NixOS to GuixSD)
Stars: ✭ 97 (+646.15%)
Mutual labels:  nix
purescript.nix
📦 PureScript package management with Nix
Stars: ✭ 12 (-7.69%)
Mutual labels:  nix
comma
Comma runs software without installing it. [maintainers=@Artturin,@burke,@DavHau]
Stars: ✭ 626 (+4715.38%)
Mutual labels:  nix
Mach Nix
Create highly reproducible python environments
Stars: ✭ 231 (+1676.92%)
Mutual labels:  nix
nyoom.emacs
Configurable, Minimal, Fast emacs config based on Nano-emacs and Doom
Stars: ✭ 59 (+353.85%)
Mutual labels:  nix
nixify
Bootstrap nix-shell environments
Stars: ✭ 25 (+92.31%)
Mutual labels:  nix
theCore
theCore: C++ embedded framework
Stars: ✭ 76 (+484.62%)
Mutual labels:  nix
rust-nix-templater
Generates Nix build / dev files for Rust projects.
Stars: ✭ 49 (+276.92%)
Mutual labels:  nix
gradle2nix
Generate Nix expressions which build Gradle-based projects.
Stars: ✭ 71 (+446.15%)
Mutual labels:  nix
laptop
💻 Handy Dandy macOS Environment Setup
Stars: ✭ 41 (+215.38%)
Mutual labels:  nix
dotfiles
My NixOS configuration featuring awesome and neovim
Stars: ✭ 40 (+207.69%)
Mutual labels:  nix
eris
Serve your /nix/store directory over the internet ✨
Stars: ✭ 73 (+461.54%)
Mutual labels:  nix
Nox
Tools to make nix nicer to use
Stars: ✭ 232 (+1684.62%)
Mutual labels:  nix
docs.cachix.org
Documentation for Cachix service.
Stars: ✭ 41 (+215.38%)
Mutual labels:  nix
dns.nix
A Nix DSL for DNS zone files
Stars: ✭ 69 (+430.77%)
Mutual labels:  nix
nvfetcher
Generate nix sources expr for the latest version of packages
Stars: ✭ 95 (+630.77%)
Mutual labels:  nix
nix-straight.el
No description or website provided.
Stars: ✭ 25 (+92.31%)
Mutual labels:  nix

Psc-Package2Nix

Build Status

Double Warning

If you actually want to use this, you probably should look at https://github.com/justinwoo/soba. You can refer to the notes here for more literature.

Warning

You probably will want to use https://github.com/spacchetti/spago and https://github.com/justinwoo/spago2nix instead.


A tool to generate a Nix expression from Psc-Package configuration. You could also probably use Spago by using spago psc-package-insdhall. Works by prefetching Git SHAs of the dependencies you depend on.

Read the blog post about this project here: https://qiita.com/kimagure/items/85a64437f9af78398638. There's also a post about this whole setup (going from Bower): https://qiita.com/kimagure/items/aec640d0047d08d2ce90.

I (Justin) gave a talk about Psc-Package2Nix in the Helsinki Haskell meetup a while ago: https://speakerdeck.com/justinwoo/nix-ify-your-psc-package-dependencies. The talk is a little bit out of date but the core ideas are the same.

Spago users

Spago users should look at this project: https://twitter.com/jusrin00/status/1142419083255787526

Show me the code!

See test-build. However, this will in many ways not be what you want for development, so you might end up with using pp2n install; pp2n build in development.

Usage example

First, you should include psc-package2nix in some way. One way to do this would be to use my Easy-PureScript-Nix derivations, but otherwise you could use this repository directly as a source.

{ pkgs ? import <nixpkgs> {} }:

let
  pp2n = import (pkgs.fetchFromGitHub {
    owner = "justinwoo";
    repo = "psc-package2nix";
    rev = "cc48ccd64862366a44b4185a79de321f93755782";
    sha256 = "0cvd1v3d376jiwh4rfhlyijxw3j6jp9rkm9hdb7k7sjxqs1dsviv";
  }) { inherit pkgs; };

  easy-ps = import (pkgs.fetchFromGitHub {
    owner = "justinwoo";
    repo = "easy-purescript-nix";
    rev = "5d8808480436f178ccdc6593744cb6ca642cbb6c";
    sha256 = "0r80d4dmagvkgm44rpjszl84xwgcwdbks2x9inad7akcpmkc8nnh";
  });

in pkgs.stdenv.mkDerivation {
  name = "pp2n-test-shell";
  buildInputs = [pp2n easy-ps.purs];
}

In a project where you have a psc-package.json file, you should now be able to run pp2n psc-package2nix:

{
  "name": "pp2n-test",
  "set": "psc-0.12.3",
  "source": "https://github.com/purescript/package-sets.git",
  "depends": [
    "prelude"
  ]
}
> pp2n psc-package2nix
/nix/store/vcxj8hd3xjsqlpv45d0cwb44lz5h4zby-package-sets
built package set to .psc-package/psc-0.12.3/.set
fetching .psc-package2nix/prelude-v4.1.0
wrote packages.nix

Note that the package set is built by nix-build to the package set location (see package-sets README for more explanation). The hashes for all dependencies (including transitive dependencies in the package set) are then solved for and their hashes are stored as flat files in .psc-package2nix/ for usage in generating packages.nix.

With the packages.nix generated, now you can install your dependencies into your nix store and have them automatically copied to .psc-package under the correct psc-package directories. This you can accomplish with the various setsups in the test directories. And while you can edit packages.nix to your liking, you will find that the problem comes up that Psc-Package will not know how to find new packages, because it uses the package set file to resolve that information. You could try to use pp2n in place of Psc-Package for most operations you need, but it's still likely that you will instead want to provide for the package set file being available. If you truly must edit the contents of your package set often, you might consider combining this tool with Spago's psc-package insdhall tools.

But really, you can do almost anything you want with this. You might mix and match some various parts of what is here to fit your own needs.

Project development workflow with pp2n

By default, pp2n will install dependencies in a way that Psc-Package can also use.

> pp2n install
Installing .psc-package/psc-0.12.3/prelude/v4.1.0.

Now you can build either using pp2n build or using plain old psc-package build.

> pp2n build
Compiling Data.Symbol
Compiling Record.Unsafe
...

See the example repo here: https://github.com/justinwoo/pp2n-test

More Information

If you need more information on how Psc-Package works, you might see the Package-Sets README: https://github.com/purescript/package-sets

Complaints

PRs welcome

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].