From 70d4d89850ddf987ff4607f6d10a99a442335622 Mon Sep 17 00:00:00 2001 From: Alessandro Candido Date: Fri, 17 May 2024 16:50:04 +0200 Subject: [PATCH] build: Update flake with rust and maturin --- flake.lock | 110 ++++++++++------------------------------------------- flake.nix | 56 +++++++++++++-------------- 2 files changed, 46 insertions(+), 120 deletions(-) diff --git a/flake.lock b/flake.lock index 3146adf01..b8125be0b 100644 --- a/flake.lock +++ b/flake.lock @@ -37,19 +37,21 @@ "type": "github" } }, - "flake-compat_2": { - "flake": false, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "lastModified": 1715865404, + "narHash": "sha256-/GJvTdTpuDjNn84j82cU6bXztE0MSkdnTWClUCRub78=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "8dc45382d5206bd292f9c2768b8058a8fd8311d9", "type": "github" }, "original": { - "owner": "edolstra", - "repo": "flake-compat", + "owner": "hercules-ci", + "repo": "flake-parts", "type": "github" } }, @@ -71,23 +73,6 @@ "type": "github" } }, - "flake-utils_2": { - "inputs": { - "systems": "systems_2" - }, - "locked": { - "lastModified": 1685518550, - "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", - "type": "github" - }, - "original": { - "id": "flake-utils", - "type": "indirect" - } - }, "gitignore": { "inputs": { "nixpkgs": [ @@ -166,24 +151,16 @@ "type": "github" } }, - "nixpkgs-python": { - "inputs": { - "flake-compat": "flake-compat_2", - "flake-utils": "flake-utils_2", - "nixpkgs": "nixpkgs_3" - }, + "nixpkgs-lib": { "locked": { - "lastModified": 1692934204, - "narHash": "sha256-dJG+DyQlWgeBEcCl9j3R5A4vcBnC2GLRacNeJgcZPo8=", - "owner": "cachix", - "repo": "nixpkgs-python", - "rev": "dfe9a33d0d9bd31650b69c36f8fff5f2d5342393", - "type": "github" + "lastModified": 1714640452, + "narHash": "sha256-QBx10+k6JWz6u7VsohfSw8g8hjdBZEf8CFzXH1/1Z94=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz" }, "original": { - "owner": "cachix", - "repo": "nixpkgs-python", - "type": "github" + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz" } }, "nixpkgs-regression": { @@ -234,22 +211,6 @@ "type": "github" } }, - "nixpkgs_3": { - "locked": { - "lastModified": 1685974512, - "narHash": "sha256-WLPHpe96RbPRO9iDtCxgsYkadTheRq7wqXWdGpR6g7w=", - "owner": "domenkozar", - "repo": "nixpkgs", - "rev": "1102477695918daba466123cc2ef694ed3a49939", - "type": "github" - }, - "original": { - "owner": "domenkozar", - "ref": "cpython-moduralize", - "repo": "nixpkgs", - "type": "github" - } - }, "pre-commit-hooks": { "inputs": { "flake-compat": [ @@ -281,9 +242,8 @@ "root": { "inputs": { "devenv": "devenv", - "nixpkgs": "nixpkgs_2", - "nixpkgs-python": "nixpkgs-python", - "systems": "systems_3" + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs_2" } }, "systems": { @@ -300,36 +260,6 @@ "repo": "default", "type": "github" } - }, - "systems_2": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_3": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 28ea23292..a6686959f 100644 --- a/flake.nix +++ b/flake.nix @@ -1,46 +1,42 @@ { inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; - systems.url = "github:nix-systems/default"; devenv.url = "github:cachix/devenv"; - nixpkgs-python.url = "github:cachix/nixpkgs-python"; - }; - - nixConfig = { - extra-trusted-public-keys = "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="; - extra-substituters = "https://devenv.cachix.org"; + flake-parts.url = "github:hercules-ci/flake-parts"; }; outputs = { self, nixpkgs, devenv, - systems, + flake-parts, ... - } @ inputs: let - forEachSystem = nixpkgs.lib.genAttrs (import systems); - in { - devShells = - forEachSystem - (system: let - pkgs = nixpkgs.legacyPackages.${system}; - in { - default = devenv.lib.mkShell { - inherit inputs pkgs; - modules = [ - { - languages.python = { + } @ inputs: + flake-parts.lib.mkFlake {inherit inputs;} { + imports = [inputs.devenv.flakeModule]; + systems = ["x86_64-linux" "aarch64-darwin"]; + + perSystem = {pkgs, ...}: { + devenv.shells.default = { + packages = with pkgs; [maturin]; + + languages = { + python = { + enable = true; + poetry = { enable = true; - poetry = { - enable = true; - install.enable = true; - install.allExtras = true; - }; - version = "3.11"; + install.enable = true; + install.allExtras = true; }; - } - ]; + }; + rust.enable = true; + }; }; - }); + }; + }; + + nixConfig = { + extra-trusted-public-keys = "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="; + extra-substituters = "https://devenv.cachix.org"; }; }