Skip to content

Commit

Permalink
nix-update: refactor (#342397)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mic92 authored Sep 18, 2024
2 parents 3745f50 + d5137d4 commit 536e629
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 45 deletions.
11 changes: 11 additions & 0 deletions pkgs/by-name/ni/nix-update/nix-update-script.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
lib,
nix-update,
}:

{
attrPath ? null,
extraArgs ? [ ],
}:

[ "${lib.getExe nix-update}" ] ++ extraArgs ++ lib.optionals (attrPath != null) [ attrPath ]
94 changes: 57 additions & 37 deletions pkgs/by-name/ni/nix-update/package.nix
Original file line number Diff line number Diff line change
@@ -1,42 +1,62 @@
{ lib
, python3
, fetchFromGitHub
, nix
, nix-prefetch-git
, nixpkgs-review
{
lib,
callPackage,
fetchFromGitHub,
nix,
nix-prefetch-git,
nixpkgs-review,
python3Packages,
}:

python3.pkgs.buildPythonApplication rec {
pname = "nix-update";
version = "1.5.1";
pyproject = true;
let
self = python3Packages.buildPythonApplication {
pname = "nix-update";
version = "1.5.1";
pyproject = true;

src = fetchFromGitHub {
owner = "Mic92";
repo = pname;
rev = "refs/tags/${version}";
hash = "sha256-JXls4EgMDAWtd736nXS2lYTUv9QIjRpkCTimxNtMN7Q=";
};
src = fetchFromGitHub {
owner = "Mic92";
repo = "nix-update";
rev = "refs/tags/${self.version}";
hash = "sha256-JXls4EgMDAWtd736nXS2lYTUv9QIjRpkCTimxNtMN7Q=";
};

build-system = [ python3Packages.setuptools ];

makeWrapperArgs = [
"--prefix"
"PATH"
":"
(lib.makeBinPath [
nix
nix-prefetch-git
nixpkgs-review
])
];

checkPhase = ''
runHook preCheck
$out/bin/nix-update --help >/dev/null
runHook postCheck
'';

passthru = {
nix-update-script = callPackage ./nix-update-script.nix { nix-update = self; };
};

nativeBuildInputs = [
python3.pkgs.setuptools
];

makeWrapperArgs = [
"--prefix" "PATH" ":" (lib.makeBinPath [ nix nix-prefetch-git nixpkgs-review ])
];

checkPhase = ''
$out/bin/nix-update --help >/dev/null
'';

meta = with lib; {
description = "Swiss-knife for updating nix packages";
inherit (src.meta) homepage;
changelog = "https://github.com/Mic92/nix-update/releases/tag/${version}";
license = licenses.mit;
maintainers = with maintainers; [ figsoda mic92 ];
mainProgram = "nix-update";
platforms = platforms.all;
meta = {
homepage = "https://github.com/Mic92/nix-update/";
description = "Swiss-knife for updating nix packages";
changelog = "https://github.com/Mic92/nix-update/releases/tag/${self.version}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [
figsoda
mic92
];
mainProgram = "nix-update";
};
};
}
in
self
7 changes: 0 additions & 7 deletions pkgs/common-updater/nix-update.nix

This file was deleted.

2 changes: 1 addition & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ with pkgs;

unstableGitUpdater = callPackage ../common-updater/unstable-updater.nix { };

nix-update-script = callPackage ../common-updater/nix-update.nix { };
inherit (nix-update) nix-update-script;

### Push NixOS tests inside the fixed point

Expand Down

0 comments on commit 536e629

Please sign in to comment.