{"id":16711777,"url":"https://github.com/bburdette/hsnixinit","last_synced_at":"2025-06-22T04:04:18.994Z","repository":{"id":19926870,"uuid":"23193352","full_name":"bburdette/hsnixinit","owner":"bburdette","description":"Scripts to help automate setting up a haskell project on nixos.","archived":false,"fork":false,"pushed_at":"2015-01-12T18:29:59.000Z","size":248,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-15T04:13:39.992Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bburdette.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-21T15:52:57.000Z","updated_at":"2018-06-29T11:27:45.000Z","dependencies_parsed_at":"2022-07-27T00:47:06.321Z","dependency_job_id":null,"html_url":"https://github.com/bburdette/hsnixinit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bburdette/hsnixinit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bburdette%2Fhsnixinit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bburdette%2Fhsnixinit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bburdette%2Fhsnixinit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bburdette%2Fhsnixinit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bburdette","download_url":"https://codeload.github.com/bburdette/hsnixinit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bburdette%2Fhsnixinit/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261233100,"owners_count":23128194,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T20:26:28.794Z","updated_at":"2025-06-22T04:04:13.979Z","avatar_url":"https://github.com/bburdette.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"Automated setup of haskell projects, based on/inpired by [this blog post](http://wiki.ocharles.org.uk/Nix#how-do-i-use-cabal2nix-for-local-projects).\n\nThere are two scripts in this project:  setup.sh and addib.sh.  \n\nsetup.sh\n=========\n\nsetup.sh is a script to create shell.nix, default.nix, and an 'ns' script on nixos for a haskell project.  Then, you can use nix-shell or 'ns' to pull in the dependencies the project needs to build.  \n\nTo use, first git clone into a directory someplace:\n\n$ cd ~  \n$ git clone https://github.com/bburdette/hsnixinit\n\nThe script depends on cabal2nix, so install that.\n\n$ nix-env -i cabal2nix\n\nassuming myhaskellproj contains a cabal file named myhaskellproj.cabal:\n\n$ cd ~/code/myhaskellproj/  \n$ ~/hsnixinit/setup.sh myhaskellproj\n\nor \n\n$ ~/hsnixinit/setup.sh myhaskellproj ~/mynixpkgs\n\nif you have checked out nixpkgs someplace.   \n\nThis should create default.nix, shell.nix, and the ns script.  To pull in the dependencies for the project:\n\n$ ./ns\n\nOne caveat.  As of this writing the shell.nix included here does not work on nixos 14.04.  However it does work if you check out the newest 14.04 nixpkgs with git and use that.  It works on unstable or newer as well.   \n\nIf the ns script ran successfully, you should now have a command prompt like this:\n\n[nix-shell:~/code/myhaskellproject]$\n\nNow build the project:\n\n[nix-shell:~/code/myhaskellproject]$ cabal sandbox init  \n[nix-shell:~/code/myhaskellproject]$ cabal install\n\nand maybe make a link for convenience:\n\n[nix-shell:~/code/myhaskellproject]$ ln .cabal-sandbox/bin/myhaskellproj myhaskellproj\n\nand execute the program:\n\n[nix-shell:~/code/myhaskellproject]$ ./myhaskellproj\n\naddlib.sh\n=========\n\nAdd a haskell library to your local nixpkgs checkout, like this:\n\n$ ./addlib.sh nonEmpty non-empty ~/nixpkgs\n\nThe first argument is the 'import name' of the library, ie in your haskell file you'd say \nimport nonEmpty\n\nThe second is the 'cabal name', which you'd use in your .cabal file.  \n\nThe third argument is the directory of your nixpkgs git clone.  \n\nWhat it does:\n - makes a directory for the lib in the appropriate location in nixpkgs.\n - calls cabal2nix to create a default.nix in that directory\n - adds a line in \u003cnixpkgs\u003e/pkgs/top-level/haskell-packages.nix for the lib.\n\nIt looks like haskell-packages.nix is for the most part kept in alphabetical order.  This script doesn't maintain that order, it just puts the new lines at the beginning of the section.  You probably should put the new lines in the right place in the file before checking in your changes.  \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbburdette%2Fhsnixinit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbburdette%2Fhsnixinit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbburdette%2Fhsnixinit/lists"}