From 64df68fa3045f4898a1a5ce12c71842c3cafba8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Vask=C3=B3?= Date: Sat, 25 Apr 2020 19:29:35 +0200 Subject: [PATCH 1/2] updating dependencies --- nix/sources.json | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/nix/sources.json b/nix/sources.json index 22b224e..120a8b3 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -5,10 +5,10 @@ "homepage": "", "owner": "hlissner", "repo": "doom-emacs", - "rev": "afcdae4fff28ab385da93d28cb819c9cd1769597", - "sha256": "0sg3glhziavrmsf45s4nip8846i67bxdc5b4vw87k4hf3h0jl1if", + "rev": "30dea4bf0c3854f991d02efa73c3d38c5d9a7640", + "sha256": "1kdl10dc91mfxlwac6v16393ysamd2csi2mfw91yr72k82slp898", "type": "tarball", - "url": "https://github.com/hlissner/doom-emacs/archive/afcdae4fff28ab385da93d28cb819c9cd1769597.tar.gz", + "url": "https://github.com/hlissner/doom-emacs/archive/30dea4bf0c3854f991d02efa73c3d38c5d9a7640.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "doom-snippets": { @@ -17,10 +17,10 @@ "homepage": "", "owner": "hlissner", "repo": "doom-snippets", - "rev": "feaedeb5505dedecf0a971b40ac30a1b7b785e52", - "sha256": "1jwfxx6mlj4zc6lmrk3vrvnsasmaxqnm5pzp9lr60qpf571z90s6", + "rev": "422f683adfbec1b01fe00524690b64dc9e702ae0", + "sha256": "1n1n2hid0cn1dkkivxl5p4c06mvdcnfpyv94f2gw8333bb3hyihc", "type": "tarball", - "url": "https://github.com/hlissner/doom-snippets/archive/feaedeb5505dedecf0a971b40ac30a1b7b785e52.tar.gz", + "url": "https://github.com/hlissner/doom-snippets/archive/422f683adfbec1b01fe00524690b64dc9e702ae0.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "emacs-overlay": { @@ -29,10 +29,10 @@ "homepage": "", "owner": "nix-community", "repo": "emacs-overlay", - "rev": "edf8dfaea171b245052e110a74d93ef8d5ffc138", - "sha256": "046qadky5vmxrsrj8h5d55dgkl7dwh2kbwrigkgjx77xdhphi5r5", + "rev": "7dbb74ccb0dccc8e0c67b819871932da27e0376d", + "sha256": "1fnhhvdir1ip5a6ggx6vzjzw915la216bwrhmsbkm9hx8l4jhjhi", "type": "tarball", - "url": "https://github.com/nix-community/emacs-overlay/archive/edf8dfaea171b245052e110a74d93ef8d5ffc138.tar.gz", + "url": "https://github.com/nix-community/emacs-overlay/archive/7dbb74ccb0dccc8e0c67b819871932da27e0376d.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "emacs-so-long": { @@ -113,10 +113,10 @@ "homepage": "https://code.orgmode.org/bzg/org-mode", "owner": "emacs-straight", "repo": "org-mode", - "rev": "c990d43a64ae8df2834367557fc1c709bcab5218", - "sha256": "014l8fifz4acgjighiic3r95iz18n0nrnfm8bs2hv7wpfibkl7mg", + "rev": "14d6f95bec975d882d5d0a047e81c74a1cd89edc", + "sha256": "1yyh7y08qcg9bh8s63i2x623vbdjp8ld9arxvznddabyiff431w8", "type": "tarball", - "url": "https://github.com/emacs-straight/org-mode/archive/c990d43a64ae8df2834367557fc1c709bcab5218.tar.gz", + "url": "https://github.com/emacs-straight/org-mode/archive/14d6f95bec975d882d5d0a047e81c74a1cd89edc.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "org-yt": { From c7217357bb0a6f601e598a81fea30a93b2db0798 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Vask=C3=B3?= Date: Sat, 25 Apr 2020 19:30:00 +0200 Subject: [PATCH 2/2] updating niv version --- nix/sources.nix | 88 ++++++++++++++++++++++++++----------------------- 1 file changed, 47 insertions(+), 41 deletions(-) diff --git a/nix/sources.nix b/nix/sources.nix index 4c0351c..8a725cb 100644 --- a/nix/sources.nix +++ b/nix/sources.nix @@ -6,20 +6,20 @@ let # The fetchers. fetch_ fetches specs of type . # - fetch_file = spec: + fetch_file = pkgs: spec: if spec.builtin or true then builtins_fetchurl { inherit (spec) url sha256; } else pkgs.fetchurl { inherit (spec) url sha256; }; - fetch_tarball = spec: + fetch_tarball = pkgs: spec: if spec.builtin or true then builtins_fetchTarball { inherit (spec) url sha256; } else pkgs.fetchzip { inherit (spec) url sha256; }; fetch_git = spec: - builtins.fetchGit { url = spec.repo; inherit (spec) rev ref; }; + builtins.fetchGit { url = spec.repo; inherit (spec) rev ref; }; fetch_builtin-tarball = spec: builtins.trace @@ -43,46 +43,36 @@ let '' (builtins_fetchurl { inherit (spec) url sha256; }); - # - # The sources to fetch. - # - - sources = builtins.fromJSON (builtins.readFile ./sources.json); - # # Various helpers # # The set of packages used when specs are fetched using non-builtins. - pkgs = - if hasNixpkgsPath - then - if hasThisAsNixpkgsPath - then import (builtins_fetchTarball { inherit (sources_nixpkgs) url sha256; }) {} - else import {} - else - import (builtins_fetchTarball { inherit (sources_nixpkgs) url sha256; }) {}; - - sources_nixpkgs = - if builtins.hasAttr "nixpkgs" sources - then sources.nixpkgs - else abort - '' - Please specify either (through -I or NIX_PATH=nixpkgs=...) or - add a package called "nixpkgs" to your sources.json. - ''; - - hasNixpkgsPath = (builtins.tryEval ).success; - hasThisAsNixpkgsPath = - (builtins.tryEval ).success && == ./.; + mkPkgs = sources: + let + sourcesNixpkgs = + import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) {}; + hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath; + hasThisAsNixpkgsPath = == ./.; + in + if builtins.hasAttr "nixpkgs" sources + then sourcesNixpkgs + else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then + import {} + else + abort + '' + Please specify either (through -I or NIX_PATH=nixpkgs=...) or + add a package called "nixpkgs" to your sources.json. + ''; # The actual fetching function. - fetch = name: spec: + fetch = pkgs: name: spec: if ! builtins.hasAttr "type" spec then abort "ERROR: niv spec ${name} does not have a 'type' attribute" - else if spec.type == "file" then fetch_file spec - else if spec.type == "tarball" then fetch_tarball spec + else if spec.type == "file" then fetch_file pkgs spec + else if spec.type == "tarball" then fetch_tarball pkgs spec else if spec.type == "git" then fetch_git spec else if spec.type == "builtin-tarball" then fetch_builtin-tarball spec else if spec.type == "builtin-url" then fetch_builtin-url spec @@ -117,12 +107,28 @@ let else fetchurl attrs; + # Create the final "sources" from the config + mkSources = config: + mapAttrs ( + name: spec: + if builtins.hasAttr "outPath" spec + then abort + "The values in sources.json should not have an 'outPath' attribute" + else + spec // { outPath = fetch config.pkgs name spec; } + ) config.sources; + + # The "config" used by the fetchers + mkConfig = + { sourcesFile ? ./sources.json + , sources ? builtins.fromJSON (builtins.readFile sourcesFile) + , pkgs ? mkPkgs sources + }: rec { + # The sources, i.e. the attribute set of spec name to spec + inherit sources; + + # The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers + inherit pkgs; + }; in -mapAttrs ( - name: spec: - if builtins.hasAttr "outPath" spec - then abort - "The values in sources.json should not have an 'outPath' attribute" - else - spec // { outPath = fetch name spec; } -) sources +mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }