add flake.nix

This commit is contained in:
Valentin Boettcher 2021-12-07 19:38:34 +01:00
parent 2e68e98c2a
commit 090f17d7aa
2 changed files with 143 additions and 0 deletions

109
flake.lock generated Normal file
View file

@ -0,0 +1,109 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1638122382,
"narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "74f7e4319258e287b0f9cb95426c9853b282730b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1601282935,
"narHash": "sha256-WQAFV6sGGQxrRs3a+/Yj9xUYvhTpukQJIcMbIi7LCJ4=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "588973065fce51f4763287f0fda87a174d78bf48",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"mach-nix": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs",
"pypi-deps-db": "pypi-deps-db"
},
"locked": {
"lastModified": 1637687243,
"narHash": "sha256-Qm0hPR9ZT1EP7lRW4udAPeb4yv6D2ONcw9ayterTP18=",
"owner": "DavHau",
"repo": "mach-nix",
"rev": "31b21203a1350bff7c541e9dfdd4e07f76d874be",
"type": "github"
},
"original": {
"owner": "DavHau",
"repo": "mach-nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1622797669,
"narHash": "sha256-xIyWeoYExzF0KNaKcqfxEX58fN4JTIQxTJWbsAujllc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1ca6b0a0cc38dbba0441202535c92841dd39d1ae",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1638806821,
"narHash": "sha256-v2qd2Bsmzft53s43eCbN+4ocrLksRdFLyF/MAGuWuDA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "bc5d68306b40b8522ffb69ba6cff91898c2fbbff",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
},
"pypi-deps-db": {
"flake": false,
"locked": {
"lastModified": 1622970040,
"narHash": "sha256-u//RFnae/XMIhoy83G2uH2Qu/1LiUhVCdwwY1xj4Ufs=",
"owner": "DavHau",
"repo": "pypi-deps-db",
"rev": "be6591698c67a86a69c81fef72167e38d038a9fc",
"type": "github"
},
"original": {
"owner": "DavHau",
"repo": "pypi-deps-db",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"mach-nix": "mach-nix",
"nixpkgs": "nixpkgs_2"
}
}
},
"root": "root",
"version": 7
}

34
flake.nix Normal file
View file

@ -0,0 +1,34 @@
{
description = "binary representation for simple data structures";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
mach-nix.url = "github:DavHau/mach-nix";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, mach-nix }:
let
python = "python39";
in flake-utils.lib.eachSystem ["x86_64-linux"] (system:
let
pkgs = nixpkgs.legacyPackages.${system};
mach-nix-wrapper = import mach-nix { inherit pkgs python; };
binfootprint = (mach-nix-wrapper.buildPythonPackage {
src = ./.;
});
pythonShell = mach-nix-wrapper.mkPython {
packagesExtra = [binfootprint];
};
in {
devShell = pkgs.mkShell {
buildInputs = with pkgs; [pythonShell black pyright];
};
defaultPackage = binfootprint;
});
}