From 91c6618202df4ec81bb07666b2d5ac2e3bb99adc Mon Sep 17 00:00:00 2001 From: Tom Charnock Date: Tue, 13 May 2025 20:31:33 +0200 Subject: [PATCH] Accidental big update to flake, but actually just fixing the version of nixpkgs to 24.11 --- flake.lock | 45 +++++++++++++++++++++++---------------------- flake.nix | 43 ++++++++++++++++++++++++++++++++++++------- 2 files changed, 59 insertions(+), 29 deletions(-) diff --git a/flake.lock b/flake.lock index 8c4095e..bc6eda2 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", "type": "github" }, "original": { @@ -26,11 +26,11 @@ ] }, "locked": { - "lastModified": 1703863825, - "narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=", + "lastModified": 1729742964, + "narHash": "sha256-B4mzTcQ0FZHdpeWcpDYPERtyjJd/NIuaQ9+BV1h+MpA=", "owner": "nix-community", "repo": "nix-github-actions", - "rev": "5163432afc817cf8bd1f031418d1869e4c9d5547", + "rev": "e04df33f62cdcf93d73e9a04142464753a16db67", "type": "github" }, "original": { @@ -41,33 +41,33 @@ }, "nixpkgs": { "locked": { - "lastModified": 1727089097, - "narHash": "sha256-ZMHMThPsthhUREwDebXw7GX45bJnBCVbfnH1g5iuSPc=", + "lastModified": 1746957726, + "narHash": "sha256-k9ut1LSfHCr0AW82ttEQzXVCqmyWVA5+SHJkS5ID/Jo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "568bfef547c14ca438c56a0bece08b8bb2b71a9c", + "rev": "a39ed32a651fdee6842ec930761e31d1f242cb94", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixpkgs-unstable", + "ref": "nixos-24.11", "repo": "nixpkgs", "type": "github" } }, "nixpkgs_2": { "locked": { - "lastModified": 1719763542, - "narHash": "sha256-mXkOj9sJ0f69Nkc2dGGOWtof9d1YNY8Le/Hia3RN+8Q=", + "lastModified": 1730157240, + "narHash": "sha256-P8wF4ag6Srmpb/gwskYpnIsnspbjZlRvu47iN527ABQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e6cdd8a11b26b4d60593733106042141756b54a3", + "rev": "75e28c029ef2605f9841e0baa335d70065fe7ae2", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-unstable-small", "repo": "nixpkgs", + "rev": "75e28c029ef2605f9841e0baa335d70065fe7ae2", "type": "github" } }, @@ -80,11 +80,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1727169160, - "narHash": "sha256-m/3tT0Wvk2V4H15riZC/yT7i7t+8V58HTDpthKV5yhk=", + "lastModified": 1743690424, + "narHash": "sha256-cX98bUuKuihOaRp8dNV1Mq7u6/CQZWTPth2IJPATBXc=", "owner": "nix-community", "repo": "poetry2nix", - "rev": "7624b3e0275d9b52dbdda46ef7ffee66b36ff823", + "rev": "ce2369db77f45688172384bbeb962bc6c2ea6f94", "type": "github" }, "original": { @@ -124,8 +124,9 @@ "type": "github" }, "original": { - "id": "systems", - "type": "indirect" + "owner": "nix-systems", + "repo": "default", + "type": "github" } }, "treefmt-nix": { @@ -136,11 +137,11 @@ ] }, "locked": { - "lastModified": 1719749022, - "narHash": "sha256-ddPKHcqaKCIFSFc/cvxS14goUhCOAwsM1PbMr0ZtHMg=", + "lastModified": 1730120726, + "narHash": "sha256-LqHYIxMrl/1p3/kvm2ir925tZ8DkI0KA10djk8wecSk=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "8df5ff62195d4e67e2264df0b7f5e8c9995fd0bd", + "rev": "9ef337e492a5555d8e17a51c911ff1f02635be15", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index e8ecbab..825eae2 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,5 @@ { - inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11"; inputs.poetry2nix.url = "github:nix-community/poetry2nix"; outputs = { self, nixpkgs, poetry2nix }: @@ -7,20 +7,49 @@ supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; forAllSystems = nixpkgs.lib.genAttrs supportedSystems; pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system}); + getPythonEnv = system: let + systemPkgs = pkgs.${system}; + python = systemPkgs.python3; + #.override { + # packageOverrides = final: prev: { + # pillow = prev.pillow.overridePythonAttrs (old: { + # buildInputs = [ systemPkgs.libavif systemPkgs.libwebp ]; + # nativeBuildInputs = [ systemPkgs.pkg-config ]; + # #preConfigure = '' + # # export AVIF_ROOT=${systemPkgs.libavif} + # # export WEBP_ROOT=${systemPkgs.libwebp} + # # ${old.preConfigure or ""} + # #''; + # shellHook = '' + # export AVIF_ROOT=${systemPkgs.libavif} + # export WEBP_ROOT=${systemPkgs.libwebp} + # ${old.shellHook or ""} + # ''; + # }); + # }; + #}; + poetryLib = poetry2nix.lib.mkPoetry2Nix { pkgs = systemPkgs; }; + inherit (poetryLib) mkPoetryApplication mkPoetryEnv; + in { + systemPkgs = systemPkgs; + python = python; + mkPoetryApplication = mkPoetryApplication; + mkPoetryEnv = mkPoetryEnv; + }; in { packages = forAllSystems (system: let - inherit (poetry2nix.lib.mkPoetry2Nix { pkgs = pkgs.${system}; }) mkPoetryApplication; + env = getPythonEnv system; in { - default = mkPoetryApplication { projectDir = self; }; + default = env.mkPoetryApplication { python = env.python; projectDir = self; }; }); devShells = forAllSystems (system: let - inherit (poetry2nix.lib.mkPoetry2Nix { pkgs = pkgs.${system}; }) mkPoetryEnv; + env = getPythonEnv system; in { - default = pkgs.${system}.mkShellNoCC { - packages = with pkgs.${system}; [ - (mkPoetryEnv { projectDir = self; }) + default = env.systemPkgs.mkShellNoCC { + packages = with env.systemPkgs; [ + (env.mkPoetryEnv { python = env.python; projectDir = self; }) poetry ]; };