-
-
Save aveltras/faaa4f464c69929af0d8a62132e02e01 to your computer and use it in GitHub Desktop.
nix library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ lib ? import ./nix/lib.nix { depsPath = ./nix/deps; } }: | |
let | |
pkgs = lib.fetchDep "nixpkgs"; | |
shell = pkgs.mkShell { | |
buildInputs = [ | |
pkgs.haskellPackages.ghc | |
(lib.addDep pkgs) | |
]; | |
}; | |
in { | |
inherit pkgs shell; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ depsPath }: | |
rec { | |
githubTarball = {owner, repo, rev, sha256}: | |
builtins.fetchTarball { url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; inherit sha256; }; | |
fetchDep = dep: import (githubTarball (builtins.fromJSON (builtins.readFile (depsPath + "/${dep}.json")))) {}; | |
addDep = nixpkgs: (nixpkgs.writeScriptBin "add-dep" '' | |
${nixpkgs.nix-prefetch-github}/bin/nix-prefetch-github --no-prefetch $@ > ${depsPath}/$2.json | |
''); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[user@laptop:~/Code/skeleton-nix]$ nix-shell | |
these derivations will be built: | |
/nix/store/vyv3iznl81zcqkl68gp133smvi3jmnpz-add-dep.drv | |
building '/nix/store/vyv3iznl81zcqkl68gp133smvi3jmnpz-add-dep.drv'... | |
[nix-shell:~/Code/skeleton-nix]$ add-dep nikita-volkov hasql | |
/nix/store/8c7azl6f1fxgh6g2p8nxmfv2jm8j84m3-add-dep/bin/add-dep: ligne 1: /nix/store/xr9xwwz6b1zqihci28g02qghp3vvwqan-deps/hasql.json: Read-only file system |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment