From d66013efdf3732716934b0023b24cefd76b5434e Mon Sep 17 00:00:00 2001 From: Jade Lovelace Date: Mon, 15 Apr 2024 20:06:52 -0700 Subject: [PATCH] nix-eval-jobs: use lix --- flake.nix | 6 ++++-- npins/default.nix | 47 ++++++++++++++++++++++++++++++++++++++++++++++ npins/sources.json | 16 ++++++++++++++++ overlay.nix | 17 +++++++++++++++++ 4 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 npins/default.nix create mode 100644 npins/sources.json diff --git a/flake.nix b/flake.nix index b58990e..c83e664 100644 --- a/flake.nix +++ b/flake.nix @@ -23,8 +23,10 @@ in { inherit pkgs; - packages.default = pkgs.nixVersions.nix_2_18; - packages.nix-doc = pkgs.nix-doc; + packages = { + default = pkgs.nixVersions.nix_2_18; + inherit (pkgs) nix-doc nix-eval-jobs; + }; packages.system-profile = import ./system-profile.nix { inherit pkgs flakey-profile; }; }); diff --git a/npins/default.nix b/npins/default.nix new file mode 100644 index 0000000..4a7c372 --- /dev/null +++ b/npins/default.nix @@ -0,0 +1,47 @@ +# Generated by npins. Do not modify; will be overwritten regularly +let + data = builtins.fromJSON (builtins.readFile ./sources.json); + version = data.version; + + mkSource = spec: + assert spec ? type; let + path = + if spec.type == "Git" then mkGitSource spec + else if spec.type == "GitRelease" then mkGitSource spec + else if spec.type == "PyPi" then mkPyPiSource spec + else if spec.type == "Channel" then mkChannelSource spec + else builtins.throw "Unknown source type ${spec.type}"; + in + spec // { outPath = path; }; + + mkGitSource = { repository, revision, url ? null, hash, ... }: + assert repository ? type; + # At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository + # In the latter case, there we will always be an url to the tarball + if url != null then + (builtins.fetchTarball { + inherit url; + sha256 = hash; # FIXME: check nix version & use SRI hashes + }) + else assert repository.type == "Git"; builtins.fetchGit { + url = repository.url; + rev = revision; + # hash = hash; + }; + + mkPyPiSource = { url, hash, ... }: + builtins.fetchurl { + inherit url; + sha256 = hash; + }; + + mkChannelSource = { url, hash, ... }: + builtins.fetchTarball { + inherit url; + sha256 = hash; + }; +in +if version == 3 then + builtins.mapAttrs (_: mkSource) data.pins +else + throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`" diff --git a/npins/sources.json b/npins/sources.json new file mode 100644 index 0000000..70086ea --- /dev/null +++ b/npins/sources.json @@ -0,0 +1,16 @@ +{ + "pins": { + "nix-eval-jobs": { + "type": "Git", + "repository": { + "type": "Git", + "url": "git+ssh://git@git.lix.systems/lheckemann/nix-eval-jobs" + }, + "branch": "main", + "revision": "c3d8ca19b39f4cc5a2df1061baf649d1fe20517e", + "url": null, + "hash": "1bww5ymy9klysm5z5hi1i8604b4dfrkrvikhslwv0vkrbwvfk5p0" + } + }, + "version": 3 +} \ No newline at end of file diff --git a/overlay.nix b/overlay.nix index 81af2f6..7a05dd8 100644 --- a/overlay.nix +++ b/overlay.nix @@ -19,6 +19,11 @@ let lix-doc = final.callPackage (lix + "/lix-doc/package.nix") { }; in { + # used for things that one wouldn't necessarily want to update, but we + # nevertheless shove it in the overlay and fixed-point it in case one *does* + # want to do that. + lix-sources = import ./npins; + nixVersions = prev.nixVersions // rec { # FIXME: do something less scuffed nix_2_18 = (prev.nixVersions.nix_2_18.override { boehmgc = boehmgc-patched; }).overrideAttrs (old: { @@ -47,6 +52,18 @@ in nix_2_18_upstream = prev.nixVersions.nix_2_18; }; + nix-eval-jobs = (prev.nix-eval-jobs.override { + # lix + nix = final.nixVersions.nix_2_18; + }).overrideAttrs (old: { + # FIXME: should this be patches instead? + src = final.lix-sources.nix-eval-jobs; + + mesonBuildType = "debugoptimized"; + + ninjaFlags = old.ninjaFlags or [ ] ++ [ "-v" ]; + }); + # force these onto upstream so we are not regularly rebuilding electron prefetch-yarn-deps = prev.prefetch-yarn-deps.override { nix = final.nixVersions.nix_2_18_upstream;