From 555000326357afbb3da06d791274c032b0d7eb83 Mon Sep 17 00:00:00 2001 From: Minijackson Date: Mon, 18 Dec 2023 10:20:50 +0100 Subject: [PATCH 1/3] chore(nix): set flack.lock commit message --- flake.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flake.nix b/flake.nix index 5b099c3..e59051b 100644 --- a/flake.nix +++ b/flake.nix @@ -8,6 +8,8 @@ flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"; }; + nixConfig.commit-lockfile-summary = "chore(deps): update flake.lock"; + outputs = { self, nixpkgs, From c0e89a315716d3d5d56e65b46efbba603c4dd701 Mon Sep 17 00:00:00 2001 From: Minijackson Date: Mon, 18 Dec 2023 10:21:51 +0100 Subject: [PATCH 2/3] chore(deps): update Nix build to NixOS 23.11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/8f1180704ac35baded1a74164365ac7cdfba6f38' (2023-11-22) → 'github:NixOS/nixpkgs/1e2e384c5b7c50dbf8e9c441a9e58d85f408b01f' (2023-12-17) • Added input 'poetry2nix': 'github:nix-community/poetry2nix/9d9d434528404a22fb0c8283fea1ea3a7410ff80' (2023-12-14) • Added input 'poetry2nix/flake-utils': 'github:numtide/flake-utils/ff7b65b44d01cf9ba6a71320833626af21126384' (2023-09-12) • Added input 'poetry2nix/flake-utils/systems': 'github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e' (2023-04-09) • Added input 'poetry2nix/nix-github-actions': 'github:nix-community/nix-github-actions/4bb5e752616262457bc7ca5882192a564c0472d2' (2023-11-03) • Added input 'poetry2nix/nix-github-actions/nixpkgs': follows 'poetry2nix/nixpkgs' • Added input 'poetry2nix/nixpkgs': follows 'nixpkgs' • Added input 'poetry2nix/systems': 'github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e' (2023-04-09) • Added input 'poetry2nix/treefmt-nix': 'github:numtide/treefmt-nix/e82f32aa7f06bbbd56d7b12186d555223dc399d1' (2023-11-12) • Added input 'poetry2nix/treefmt-nix/nixpkgs': follows 'poetry2nix/nixpkgs' --- flake.lock | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++--- flake.nix | 21 +++++---- 2 files changed, 129 insertions(+), 16 deletions(-) diff --git a/flake.lock b/flake.lock index 7c28c5a..43c5537 100644 --- a/flake.lock +++ b/flake.lock @@ -104,6 +104,45 @@ "type": "github" } }, + "flake-utils_4": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "poetry2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1698974481, + "narHash": "sha256-yPncV9Ohdz1zPZxYHQf47S8S0VrnhV7nNhCawY46hDA=", + "owner": "nix-community", + "repo": "nix-github-actions", + "rev": "4bb5e752616262457bc7ca5882192a564c0472d2", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-github-actions", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1694499547, @@ -122,26 +161,51 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1700678569, - "narHash": "sha256-2Ki+2UvOidxEb3xB4ADqlbPQ2BZOF4uZMR094O8or2I=", + "lastModified": 1702780907, + "narHash": "sha256-blbrBBXjjZt6OKTcYX1jpe9SRof2P9ZYWPzq22tzXAA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "8f1180704ac35baded1a74164365ac7cdfba6f38", + "rev": "1e2e384c5b7c50dbf8e9c441a9e58d85f408b01f", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-23.05", + "ref": "nixos-23.11", "repo": "nixpkgs", "type": "github" } }, + "poetry2nix": { + "inputs": { + "flake-utils": "flake-utils_4", + "nix-github-actions": "nix-github-actions", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems_3", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1702591455, + "narHash": "sha256-vK54IZysaxuUOe+abJO0wD40bxqwfZ2aBOhUWS/O/oA=", + "owner": "nix-community", + "repo": "poetry2nix", + "rev": "9d9d434528404a22fb0c8283fea1ea3a7410ff80", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "poetry2nix", + "type": "github" + } + }, "root": { "inputs": { "epnix": "epnix", "flake-compat": "flake-compat", "flake-utils": "flake-utils_3", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs_2", + "poetry2nix": "poetry2nix" } }, "systems": { @@ -158,6 +222,56 @@ "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": { + "id": "systems", + "type": "indirect" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "poetry2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1699786194, + "narHash": "sha256-3h3EH1FXQkIeAuzaWB+nK0XK54uSD46pp+dMD3gAcB4=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "e82f32aa7f06bbbd56d7b12186d555223dc399d1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index e59051b..8b4dcc5 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,11 @@ description = "A very basic flake"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; + poetry2nix = { + url = "github:nix-community/poetry2nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; flake-utils.url = "github:numtide/flake-utils"; epnix.url = "github:epics-extensions/EPNix"; flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"; @@ -13,6 +17,7 @@ outputs = { self, nixpkgs, + poetry2nix, flake-utils, epnix, flake-compat, @@ -27,6 +32,8 @@ }) ]; }; + inherit (epnix.packages.${system}) epics-base; + inherit (poetry2nix.lib.mkPoetry2Nix {inherit pkgs;}) mkPoetryApplication; in { packages.default = let # Numpy 1.19.5 doesn't compile with Python3.10+ @@ -35,7 +42,7 @@ # support Python 3.6, which we need to support older systems. python = pkgs.python39; in - pkgs.poetry2nix.mkPoetryApplication { + mkPoetryApplication { projectDir = ./.; inherit python; @@ -43,15 +50,7 @@ nativeBuildInputs = with pkgs; [makeWrapper]; propagatedBuildInputs = with python.pkgs; [tkinter]; - overrides = pkgs.poetry2nix.overrides.withDefaults (_final: prev: { - reportlab = prev.reportlab.overridePythonAttrs (_old: { - buildInputs = with pkgs; [(freetype.overrideAttrs (_: {dontDisableStatic = true;}))]; - }); - }); - - postInstall = let - inherit (epnix.packages.x86_64-linux) epics-base; - in '' + postInstall = '' wrapProgram $out/bin/wetest \ --set PYEPICS_LIBCA "${epics-base}/lib/linux-x86_64/libca.so" ''; From d713b8daca83f4156b7bde7bb33f05e1a218d2bd Mon Sep 17 00:00:00 2001 From: Minijackson Date: Mon, 18 Dec 2023 10:23:28 +0100 Subject: [PATCH 3/3] chore(nix): better development environment Now provides the Python dependencies from poetry.lock, and the PYEPICS_LIBCA env var for pyepics --- flake.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 8b4dcc5..1982ad9 100644 --- a/flake.nix +++ b/flake.nix @@ -71,7 +71,9 @@ }; devShells.default = pkgs.mkShell { - nativeBuildInputs = with pkgs; [poetry python39Full]; + inputsFrom = [self.packages.${system}.default]; + nativeBuildInputs = with pkgs; [poetry]; + env.PYEPICS_LIBCA = "${epics-base}/lib/linux-x86_64/libca.so"; }; checks = import ./nix/checks {inherit pkgs;};