File tree Expand file tree Collapse file tree 4 files changed +138
-0
lines changed Expand file tree Collapse file tree 4 files changed +138
-0
lines changed Original file line number Diff line number Diff line change 1+ {
2+ sources ? import ./npins ,
3+ pkgs ? import sources . nixpkgs { } ,
4+ } :
5+
6+ let
7+ inherit ( pkgs . lib ) genAttrs ;
8+
9+ packages = with pkgs ; [
10+ # Dependencies
11+ gmp
12+ mpfr
13+ ntl
14+ openblas
15+
16+ # Build tools
17+ autoconf
18+ automake
19+ gnumake
20+ libtool
21+ ] ;
22+
23+ stdenvs = [
24+ "clang"
25+ "gcc9"
26+ "gcc10"
27+ "gcc11"
28+ "gcc12"
29+ "gcc13"
30+ "gcc14"
31+ ] ;
32+ in
33+
34+ {
35+ devShell = pkgs . mkShell {
36+ name = "flint.dev" ;
37+ inherit packages ;
38+ passthru = genAttrs stdenvs (
39+ stdenv :
40+ ( pkgs . mkShell . override { stdenv = pkgs . ${ stdenv + "Stdenv" } ; } ) {
41+ name = "flint.dev-${ stdenv } " ;
42+ inherit packages ;
43+ }
44+ ) ;
45+ } ;
46+ }
Original file line number Diff line number Diff line change 1+ # Generated by npins. Do not modify; will be overwritten regularly
2+ let
3+ data = builtins . fromJSON ( builtins . readFile ./sources.json ) ;
4+ version = data . version ;
5+
6+ mkSource =
7+ spec :
8+ assert spec ? type ;
9+ let
10+ path =
11+ if spec . type == "Git" then
12+ mkGitSource spec
13+ else if spec . type == "GitRelease" then
14+ mkGitSource spec
15+ else if spec . type == "PyPi" then
16+ mkPyPiSource spec
17+ else if spec . type == "Channel" then
18+ mkChannelSource spec
19+ else
20+ builtins . throw "Unknown source type ${ spec . type } " ;
21+ in
22+ spec // { outPath = path ; } ;
23+
24+ mkGitSource =
25+ {
26+ repository ,
27+ revision ,
28+ url ? null ,
29+ hash ,
30+ branch ? null ,
31+ ...
32+ } :
33+ assert repository ? type ;
34+ # At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository
35+ # In the latter case, there we will always be an url to the tarball
36+ if url != null then
37+ ( builtins . fetchTarball {
38+ inherit url ;
39+ sha256 = hash ; # FIXME: check nix version & use SRI hashes
40+ } )
41+ else
42+ assert repository . type == "Git" ;
43+ let
44+ urlToName =
45+ url : rev :
46+ let
47+ matched = builtins . match "^.*/([^/]*)(\\ .git)?$" repository . url ;
48+
49+ short = builtins . substring 0 7 rev ;
50+
51+ appendShort = if ( builtins . match "[a-f0-9]*" rev ) != null then "-${ short } " else "" ;
52+ in
53+ "${ if matched == null then "source" else builtins . head matched } ${ appendShort } " ;
54+ name = urlToName repository . url revision ;
55+ in
56+ builtins . fetchGit {
57+ url = repository . url ;
58+ rev = revision ;
59+ inherit name ;
60+ # hash = hash;
61+ } ;
62+
63+ mkPyPiSource =
64+ { url , hash , ... } :
65+ builtins . fetchurl {
66+ inherit url ;
67+ sha256 = hash ;
68+ } ;
69+
70+ mkChannelSource =
71+ { url , hash , ... } :
72+ builtins . fetchTarball {
73+ inherit url ;
74+ sha256 = hash ;
75+ } ;
76+ in
77+ if version == 3 then
78+ builtins . mapAttrs ( _ : mkSource ) data . pins
79+ else
80+ throw "Unsupported format version ${ toString version } in sources.json. Try running `npins upgrade`"
Original file line number Diff line number Diff line change 1+ {
2+ "pins" : {
3+ "nixpkgs" : {
4+ "type" : " Channel" ,
5+ "name" : " nixpkgs-unstable" ,
6+ "url" : " https://releases.nixos.org/nixpkgs/nixpkgs-25.05pre744509.88a55dffa4d4/nixexprs.tar.xz" ,
7+ "hash" : " 031apspqfm8z4yczj8126chfc7mijnmnxzqg0inaz1dwi4pzwlbz"
8+ }
9+ },
10+ "version" : 3
11+ }
Original file line number Diff line number Diff line change 1+ ( import ./. { } ) . devShell
You can’t perform that action at this time.
0 commit comments