From 090f17d7aaf599614d0752c97e1825bd93eb0a8d Mon Sep 17 00:00:00 2001 From: Valentin Boettcher Date: Tue, 7 Dec 2021 19:38:34 +0100 Subject: [PATCH] add flake.nix --- flake.lock | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 34 +++++++++++++++++ 2 files changed, 143 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..dd7c124 --- /dev/null +++ b/flake.lock @@ -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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..ca78db0 --- /dev/null +++ b/flake.nix @@ -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; + }); +}