Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions pkgs/development/tools/build-managers/gup/build.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
# NOTE: this file is copied from the upstream repository for this package.
# Please submit any changes you make here to https://github.com/timbertson/gup/
# NOTE: the `nixpkgs` version of this file is copied from the upstream repository
# for this package. Please make any changes to https://github.com/timbertson/gup/

{ stdenv, lib, python, which, pychecker ? null }:
{ src, version, meta ? {} }:
{ stdenv, lib, pythonPackages }:
{ src, version, meta ? {}, passthru ? {}, forceTests ? false }:
let
testInputs = [
pythonPackages.mocktest or null
pythonPackages.whichcraft
pythonPackages.nose
pythonPackages.nose_progressive
];
pychecker = pythonPackages.pychecker or null;
usePychecker = forceTests || pychecker != null;
enableTests = forceTests || (lib.all (dep: dep != null) testInputs);
in
stdenv.mkDerivation {
inherit src meta;
inherit src meta passthru;
name = "gup-${version}";
buildInputs = lib.remove null [ python which pychecker ];
SKIP_PYCHECKER = pychecker == null;
buildInputs = [ pythonPackages.python ]
++ (lib.optionals enableTests testInputs)
++ (lib.optional usePychecker pychecker)
;
SKIP_PYCHECKER = !usePychecker;
buildPhase = "make python";
inherit pychecker;
testPhase = if enableTests then "make test" else "true";
installPhase = ''
mkdir $out
cp -r python/bin $out/bin
Expand Down
6 changes: 6 additions & 0 deletions pkgs/development/tools/build-managers/gup/build.nix.gup
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -eu
if [ -n "${GUP_TARGET:-}" ]; then
gup --always
fi
curl -LSs -o "$1" https://raw.githubusercontent.com/timbertson/gup/master/nix/gup-python.nix
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you combine master version of build.nix with latest-release source version? Isn't that going to break?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could possibly do something more complex to get the branch that's just been updated, but practically speaking I'll always be updating to the latest release. If I ever need to update to an old release for some reason, I'd have to fix this up (although the .nix file doesn't change that much between versions anyway, so it still might not matter)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, if you commit to always prevent «master contains build.nix for the future release, not for the current» as the maintainer on both sides, then I guess that's acceptable.

26 changes: 13 additions & 13 deletions pkgs/development/tools/build-managers/gup/default.nix
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{ stdenv, fetchFromGitHub, lib, python, which }:
let
version = "0.5.5";
src = fetchFromGitHub {
sha256 = "12yv0j333z6jkaaal8my3jx3k4ml9hq8ldis5zfvr8179d4xah7q";
rev = "version-${version}";
repo = "gup";
owner = "timbertson";
};
in
{ stdenv, fetchFromGitHub, lib, pythonPackages, nix-update-source, curl }:
import ./build.nix
{ inherit stdenv lib python which; }
{ inherit src version;
{ inherit stdenv lib pythonPackages; }
{ inherit (nix-update-source.fetch ./src.json) src version;
meta = {
inherit (src.meta) homepage;
homepage = https://github.com/timbertson/gup/;
description = "A better make, inspired by djb's redo";
license = stdenv.lib.licenses.lgpl2Plus;
maintainers = [ stdenv.lib.maintainers.timbertson ];
platforms = stdenv.lib.platforms.all;
};
passthru = {
updateScript = ''
set -e
echo
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update.nix which runs the updateScript doesn't print a newline before invoking the script, but this update script wants its own line (since it prints a prompt)

cd ${toString ./.}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, this does work? nice…

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was pretty surprised, but yes!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(well, as long as you're building it from a checkout ./default.nix, not <nixpkgs> - that probably wouldn't work)

${nix-update-source}/bin/nix-update-source --prompt version src.json
./build.nix.gup build.nix
'';
};
}
17 changes: 17 additions & 0 deletions pkgs/development/tools/build-managers/gup/src.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"fetch": {
"args": {
"owner": "timbertson",
"repo": "gup",
"rev": "version-0.6.0",
"sha256": "053xnx39jh9kn9l572z4k0q7bbxjpisf1fm9aq27ybj2ha1rh6wr"
},
"fn": "fetchFromGitHub",
"rev": "version-0.6.0",
"version": "0.6.0"
},
"owner": "timbertson",
"repo": "gup",
"rev": "version-{version}",
"type": "fetchFromGitHub"
}
6 changes: 3 additions & 3 deletions pkgs/tools/package-management/nix-update-source/default.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{ lib, pkgs, fetchFromGitHub, python3Packages, nix-prefetch-scripts }:
python3Packages.buildPythonApplication rec {
version = "0.2.1";
version = "0.2.2";
name = "nix-update-source-${version}";
src = fetchFromGitHub {
owner = "timbertson";
repo = "nix-update-source";
rev = "version-${version}";
sha256 = "1w3aj0kjp8zhxkzqxnm5srrsqsvrmxhn4sqkr4kjffh61jg8jq8a";
sha256 = "0liigkr37ib2xy269bcp53ivpir4mpg6lzwnfrsqc4kbkz3l16gg";
};
propagatedBuildInputs = [ nix-prefetch-scripts ];
passthru = {
Expand All @@ -20,7 +20,7 @@ python3Packages.buildPythonApplication rec {
fetchFn = builtins.getAttr json.fetch.fn fetchers;
src = fetchFn json.fetch.args;
in
json // { inherit src; };
json // json.fetch // { inherit src; };
};
meta = {
description = "Utility to autimate updating of nix derivation sources";
Expand Down