From d88a9bbd5f355b0e4f10054e8dac97ab563a87ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Thu, 10 Oct 2024 15:48:17 +0200 Subject: [PATCH 1/3] unpin python 3.11 Just use whatever nixpkgs has by default --- default.nix | 13 +++++-------- flake.lock | 18 +++++++++--------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/default.nix b/default.nix index 9ffc0c3..761a47a 100644 --- a/default.nix +++ b/default.nix @@ -2,15 +2,15 @@ pkgs ? import { }, }: -pkgs.python311.pkgs.buildPythonApplication { +pkgs.python3.pkgs.buildPythonApplication { pname = "nix-update"; - version = "1.0.0"; + version = "1.5.2"; src = ./.; format = "pyproject"; buildInputs = [ pkgs.makeWrapper ]; - nativeBuildInputs = [ pkgs.python311.pkgs.setuptools ]; + nativeBuildInputs = [ pkgs.python3.pkgs.setuptools ]; nativeCheckInputs = [ - pkgs.python311.pkgs.pytest + pkgs.python3.pkgs.pytest # technically not test inputs, but we need it for development in PATH pkgs.nixVersions.stable pkgs.nix-prefetch-git @@ -22,12 +22,9 @@ pkgs.python311.pkgs.buildPythonApplication { "--prefix PATH" ":" (pkgs.lib.makeBinPath [ - pkgs.nixVersions.stable or pkgs.nix_2_4 + pkgs.nixVersions.stable pkgs.nixpkgs-review pkgs.nix-prefetch-git ]) ]; - shellHook = '' - # workaround because `python setup.py develop` breaks for me - ''; } diff --git a/flake.lock b/flake.lock index d88499a..ab0e60a 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1726153070, - "narHash": "sha256-HO4zgY0ekfwO5bX0QH/3kJ/h4KvUDFZg8YpkNwIbg1U=", + "lastModified": 1727826117, + "narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "bcef6817a8b2aa20a5a6dbb19b43e63c5bf8619a", + "rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1", "type": "github" }, "original": { @@ -22,11 +22,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1727617520, - "narHash": "sha256-uNfh3aMyCekMpjtL/PZtl2Hz/YqNuUpCBEzVxt1QYck=", + "lastModified": 1728538411, + "narHash": "sha256-f0SBJz1eZ2yOuKUr5CA9BHULGXVSn6miBuUWdTyhUhU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "7eee17a8a5868ecf596bbb8c8beb527253ea8f4d", + "rev": "b69de56fac8c2b6f8fd27f2eca01dcda8e0a4221", "type": "github" }, "original": { @@ -50,11 +50,11 @@ ] }, "locked": { - "lastModified": 1727431250, - "narHash": "sha256-uGRlRT47ecicF9iLD1G3g43jn2e+b5KaMptb59LHnvM=", + "lastModified": 1727984844, + "narHash": "sha256-xpRqITAoD8rHlXQafYZOLvUXCF6cnZkPfoq67ThN0Hc=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "879b29ae9a0378904fbbefe0dadaed43c8905754", + "rev": "4446c7a6fc0775df028c5a3f6727945ba8400e64", "type": "github" }, "original": { From 66bc6c90428dbaca1ac2af331bf4c0f08bd292ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Thu, 10 Oct 2024 15:55:53 +0200 Subject: [PATCH 2/3] more reliable check if formatters are available Co-authored-by: Sandro --- default.nix | 2 +- treefmt.nix | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/default.nix b/default.nix index 761a47a..6b2642e 100644 --- a/default.nix +++ b/default.nix @@ -6,7 +6,7 @@ pkgs.python3.pkgs.buildPythonApplication { pname = "nix-update"; version = "1.5.2"; src = ./.; - format = "pyproject"; + pyproject = true; buildInputs = [ pkgs.makeWrapper ]; nativeBuildInputs = [ pkgs.python3.pkgs.setuptools ]; nativeCheckInputs = [ diff --git a/treefmt.nix b/treefmt.nix index a6f5ab9..cbc0445 100644 --- a/treefmt.nix +++ b/treefmt.nix @@ -9,18 +9,17 @@ # Used to find the project root projectRootFile = "flake.lock"; - programs.deno.enable = - pkgs.lib.meta.availableOn pkgs.stdenv.hostPlatform pkgs.deno && !pkgs.deno.meta.broken; + programs.deno.enable = (builtins.tryEval pkgs.deno).success; programs.mypy.enable = true; programs.yamlfmt.enable = true; - programs.nixfmt.enable = pkgs.lib.meta.availableOn pkgs.stdenv.buildPlatform pkgs.nixfmt-rfc-style.compiler; + programs.nixfmt.enable = (builtins.tryEval pkgs.nixfmt-rfc-style).success; programs.deadnix.enable = true; programs.ruff.format = true; programs.ruff.check = true; - programs.shellcheck.enable = pkgs.lib.meta.availableOn pkgs.stdenv.buildPlatform pkgs.shellcheck.compiler; + programs.shellcheck.enable = (builtins.tryEval pkgs.shellcheck).success; programs.shfmt.enable = true; settings.formatter.shfmt.includes = [ "*.envrc" ]; }; From e34e697e3001b4658fab76a7aa94c1e84992a2aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Sat, 9 Nov 2024 08:46:15 +0100 Subject: [PATCH 3/3] fix treefmt eval on riscv64 linux and x86_64 darwin --- flake.lock | 18 +++++++++--------- treefmt.nix | 7 ++++--- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/flake.lock b/flake.lock index ab0e60a..e72ce0f 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1727826117, - "narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=", + "lastModified": 1730504689, + "narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1", + "rev": "506278e768c2a08bec68eb62932193e341f55c90", "type": "github" }, "original": { @@ -22,11 +22,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1728538411, - "narHash": "sha256-f0SBJz1eZ2yOuKUr5CA9BHULGXVSn6miBuUWdTyhUhU=", + "lastModified": 1730958623, + "narHash": "sha256-JwQZIGSYnRNOgDDoIgqKITrPVil+RMWHsZH1eE1VGN0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b69de56fac8c2b6f8fd27f2eca01dcda8e0a4221", + "rev": "85f7e662eda4fa3a995556527c87b2524b691933", "type": "github" }, "original": { @@ -50,11 +50,11 @@ ] }, "locked": { - "lastModified": 1727984844, - "narHash": "sha256-xpRqITAoD8rHlXQafYZOLvUXCF6cnZkPfoq67ThN0Hc=", + "lastModified": 1730321837, + "narHash": "sha256-vK+a09qq19QNu2MlLcvN4qcRctJbqWkX7ahgPZ/+maI=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "4446c7a6fc0775df028c5a3f6727945ba8400e64", + "rev": "746901bb8dba96d154b66492a29f5db0693dbfcc", "type": "github" }, "original": { diff --git a/treefmt.nix b/treefmt.nix index cbc0445..4e51958 100644 --- a/treefmt.nix +++ b/treefmt.nix @@ -9,17 +9,18 @@ # Used to find the project root projectRootFile = "flake.lock"; - programs.deno.enable = (builtins.tryEval pkgs.deno).success; + programs.deno.enable = + pkgs.hostPlatform.system != "x86_64-darwin" && pkgs.hostPlatform.system != "riscv64-linux"; programs.mypy.enable = true; programs.yamlfmt.enable = true; - programs.nixfmt.enable = (builtins.tryEval pkgs.nixfmt-rfc-style).success; + programs.nixfmt.enable = pkgs.hostPlatform.system != "riscv64-linux"; programs.deadnix.enable = true; programs.ruff.format = true; programs.ruff.check = true; - programs.shellcheck.enable = (builtins.tryEval pkgs.shellcheck).success; + programs.shellcheck.enable = pkgs.hostPlatform.system != "riscv64-linux"; programs.shfmt.enable = true; settings.formatter.shfmt.includes = [ "*.envrc" ]; };