style: Switch to nixfmt from nixpkgs-fmt

Most of the ecosystem has moved to this formatter,
and many people configured their editors to autoformat it with this formatter.

Closes: https://git.snix.dev/snix/snix/issues/62
Change-Id: Icf39e7836c91fc2ae49fbe22a40a639105bfb0bd
Reviewed-on: https://cl.snix.dev/c/snix/+/30671
Reviewed-by: Florian Klink <flokli@flokli.de>
Tested-by: besadii
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
This commit is contained in:
Ilan Joselevich 2025-08-09 21:08:41 +02:00
parent 3443e6bd08
commit 91d02d8c84
136 changed files with 39952 additions and 11007 deletions

View file

@ -1,4 +1,5 @@
{ depot, ... }: {
{ depot, ... }:
{
package = import ./package.nix;
module = import ./module.nix;
}

View file

@ -1,13 +1,21 @@
{ config
, lib
, pkgs
, ...
{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.alertmanager-irc-relay;
yaml = pkgs.formats.yaml { };
configFile = yaml.generate "config.yaml" cfg.settings;
inherit (lib) mkEnableOption mkIf types mkOption mapAttrs mkPackageOption;
inherit (lib)
mkEnableOption
mkIf
types
mkOption
mapAttrs
mkPackageOption
;
in
{
options.services.alertmanager-irc-relay = {
@ -50,4 +58,3 @@ in
};
};
}

View file

@ -1,7 +1,7 @@
{ lib
, buildGoModule
, fetchFromGitHub
,
{
lib,
buildGoModule,
fetchFromGitHub,
}:
buildGoModule rec {
@ -17,7 +17,10 @@ buildGoModule rec {
vendorHash = "sha256-KX+TR0n14+95lldF+0KUo5DbqOKpUDaZNuKMBf0KHFQ=";
ldflags = [ "-s" "-w" ];
ldflags = [
"-s"
"-w"
];
meta = {
description = "Send Prometheus Alerts to IRC using Webhooks";

View file

@ -12,7 +12,12 @@
# search path, so the design space is unconstrained. The most obvious solution
# would be to implement some kind of search part ourselves. Unfortunately, there
# is no portable way to access environment variables in BQN at the moment.
{ depot, pkgs, lib, ... }:
{
depot,
pkgs,
lib,
...
}:
let
src = pkgs.fetchFromGitHub {
@ -26,14 +31,15 @@ let
in
pkgs.runCommandNoCC "bqn-libs-${builtins.substring 0 7 src.rev}"
{
nativeBuildInputs = [
pkgs.cbqn
];
meta.license = lib.licenses.bsd0;
} ''
BQN "${src}/test/main.bqn"
{
nativeBuildInputs = [
pkgs.cbqn
];
meta.license = lib.licenses.bsd0;
}
''
BQN "${src}/test/main.bqn"
install -Dm644 "${src}/"*.bqn -t "$out/lib"
install -Dm644 "${src}/LICENSE" -t "$out/share/doc/bqn-libs"
''
install -Dm644 "${src}/"*.bqn -t "$out/lib"
install -Dm644 "${src}/LICENSE" -t "$out/share/doc/bqn-libs"
''

View file

@ -1,9 +1,10 @@
{ pkgs, ... }:
pkgs.callPackage "${(pkgs.fetchFromGitHub {
owner = "hlolli";
repo = "clj2nix";
rev = "3d0a38c954c8e0926f57de1d80d357df05fc2f94";
sha256 = "0y77b988qdgsrp4w72v1f5rrh33awbps2qdgp2wr2nmmi44541w5";
})}/clj2nix.nix"
{ }
pkgs.callPackage "${
(pkgs.fetchFromGitHub {
owner = "hlolli";
repo = "clj2nix";
rev = "3d0a38c954c8e0926f57de1d80d357df05fc2f94";
sha256 = "0y77b988qdgsrp4w72v1f5rrh33awbps2qdgp2wr2nmmi44541w5";
})
}/clj2nix.nix" { }

View file

@ -12,7 +12,12 @@
# other folders below //third_party, other than the ones mentioned
# above.
{ pkgs, depot, localSystem, ... }:
{
pkgs,
depot,
localSystem,
...
}:
{
# Expose a partially applied NixOS, expecting an attribute set with
@ -25,10 +30,11 @@
# needs to be partially evaluated in NixOS configuration before
# module imports are resolved.
nixos =
{ configuration
, specialArgs ? { }
, system ? localSystem
, ...
{
configuration,
specialArgs ? { },
system ? localSystem,
...
}:
let
eval = import (pkgs.path + "/nixos/lib/eval-config.nix") {
@ -39,13 +45,14 @@
};
# This is for `nixos-rebuild build-vm'.
vmConfig = (import (pkgs.path + "/nixos/lib/eval-config.nix") {
inherit specialArgs system;
modules = [
configuration
(pkgs.path + "/nixos/modules/virtualisation/qemu-vm.nix")
];
}).config;
vmConfig =
(import (pkgs.path + "/nixos/lib/eval-config.nix") {
inherit specialArgs system;
modules = [
configuration
(pkgs.path + "/nixos/modules/virtualisation/qemu-vm.nix")
];
}).config;
in
{
inherit (eval) pkgs config options;

View file

@ -1,7 +1,8 @@
# This file imports the pinned disko.
{ depot ? { }
, ...
{
depot ? { },
...
}:
{

View file

@ -1,6 +1,7 @@
# Patches that the Lix core team developed for git.lix.systems
# Re-applied for git.snix.dev
{ ... }: {
{ ... }:
{
patches = {
# Show a link to upstream for a nixos/nix repository.
upstream_link = ./upstream-link.patch;

View file

@ -1,7 +1,8 @@
# This file imports the pinned nix-gerrit.
{ depot ? { }
, ...
{
depot ? { },
...
}:
let

View file

@ -8,15 +8,16 @@
# in //default.nix passes this attribute as the `pkgs` argument to all
# readTree derivations.
{ depot ? { }
, externalArgs ? { }
, depotOverlays ? true
, localSystem ? externalArgs.localSystem or builtins.currentSystem
, crossSystem ? externalArgs.crossSystem or localSystem
{
depot ? { },
externalArgs ? { },
depotOverlays ? true,
localSystem ? externalArgs.localSystem or builtins.currentSystem,
crossSystem ? externalArgs.crossSystem or localSystem,
# additional overlays to be applied.
# Useful when calling this file in a view exported from depot.
, additionalOverlays ? [ ]
, ...
additionalOverlays ? [ ],
...
}:
let
@ -24,20 +25,18 @@ let
# Includes everything but overlays which are only passed to unstable nixpkgs.
commonNixpkgsArgs = {
# allow users to inject their config into builds (e.g. to test CA derivations)
config =
(if externalArgs ? nixpkgsConfig then externalArgs.nixpkgsConfig else { })
// {
allowUnfree = true;
allowUnfreeRedistributable = true;
allowBroken = true;
# Forbids our meta.ci attribute
# https://github.com/NixOS/nixpkgs/pull/191171#issuecomment-1260650771
checkMeta = false;
permittedInsecurePackages = [
# only used inside tests
"nix-2.3.18"
];
};
config = (if externalArgs ? nixpkgsConfig then externalArgs.nixpkgsConfig else { }) // {
allowUnfree = true;
allowUnfreeRedistributable = true;
allowBroken = true;
# Forbids our meta.ci attribute
# https://github.com/NixOS/nixpkgs/pull/191171#issuecomment-1260650771
checkMeta = false;
permittedInsecurePackages = [
# only used inside tests
"nix-2.3.18"
];
};
inherit localSystem crossSystem;
};
@ -69,12 +68,21 @@ let
};
};
in
import nixpkgsSrc (commonNixpkgsArgs // {
overlays = [
commitsOverlay
stableOverlay
] ++ (if depotOverlays then [
depot.third_party.overlays.tvl
(import depot.third_party.sources.rust-overlay)
] else [ ] ++ additionalOverlays);
})
import nixpkgsSrc (
commonNixpkgsArgs
// {
overlays = [
commitsOverlay
stableOverlay
]
++ (
if depotOverlays then
[
depot.third_party.overlays.tvl
(import depot.third_party.sources.rust-overlay)
]
else
[ ] ++ additionalOverlays
);
}
)

View file

@ -1,9 +1,10 @@
# This overlay is used to make TVL-specific modifications in the
# nixpkgs tree, where required.
{ lib
, depot
, localSystem
, ...
{
lib,
depot,
localSystem,
...
}:
self: super:
@ -43,14 +44,13 @@ depot.nix.readTree.drvTargets {
# https://github.com/NixOS/nixpkgs/pull/320197
fuse =
if super.stdenv.isDarwin then
super.fuse.overrideAttrs
(old: rec {
version = "4.8.0";
src = super.fetchurl {
url = "https://github.com/osxfuse/osxfuse/releases/download/macfuse-${version}/macfuse-${version}.dmg";
hash = "sha256-ucTzO2qdN4QkowMVvC3+4pjEVjbwMsB0xFk+bvQxwtQ=";
};
})
super.fuse.overrideAttrs (old: rec {
version = "4.8.0";
src = super.fetchurl {
url = "https://github.com/osxfuse/osxfuse/releases/download/macfuse-${version}/macfuse-${version}.dmg";
hash = "sha256-ucTzO2qdN4QkowMVvC3+4pjEVjbwMsB0xFk+bvQxwtQ=";
};
})
else
super.fuse;

View file

@ -14,53 +14,57 @@ let
httpdSrc = pkgs.radicle-httpd.src;
in
lib.fix (self: pkgs.buildNpmPackage rec {
pname = "radicle-explorer";
version = (builtins.fromJSON (builtins.readFile "${src}/package.json")).version;
lib.fix (
self:
pkgs.buildNpmPackage rec {
pname = "radicle-explorer";
version = (builtins.fromJSON (builtins.readFile "${src}/package.json")).version;
# source should be synced with the httpd, which is already in nixpkgs
src = pkgs.fetchgit {
inherit (httpdSrc) url rev;
hash = "sha256:09m13238h6j7g02r6332ihgyyzbjx90pgz14rz29pgv7936h6il8";
};
# source should be synced with the httpd, which is already in nixpkgs
src = pkgs.fetchgit {
inherit (httpdSrc) url rev;
hash = "sha256:09m13238h6j7g02r6332ihgyyzbjx90pgz14rz29pgv7936h6il8";
};
# This might change during nixpkgs bumps and will need updating. Need to fix
# upstream so that there is a normal, callable derivation.
npmDepsHash = "sha256:1hbrzfjkfc0q8qk03yi6qb9zqm57h7hnkn7fl0yxkrzbrljaljaz";
# This might change during nixpkgs bumps and will need updating. Need to fix
# upstream so that there is a normal, callable derivation.
npmDepsHash = "sha256:1hbrzfjkfc0q8qk03yi6qb9zqm57h7hnkn7fl0yxkrzbrljaljaz";
patches = [
./0001-remove-dependency-on-plausible.patch
];
patches = [
./0001-remove-dependency-on-plausible.patch
];
postPatch = ''
patchShebangs --build ./scripts
mkdir -p "public/twemoji"
cp -t public/twemoji -r -- ${twemoji-assets}/assets/svg/*
: >scripts/install-twemoji-assets
'';
dontConfigure = true;
doCheck = false;
postPatch = ''
patchShebangs --build ./scripts
mkdir -p "public/twemoji"
cp -t public/twemoji -r -- ${twemoji-assets}/assets/svg/*
: >scripts/install-twemoji-assets
'';
dontConfigure = true;
doCheck = false;
installPhase = ''
runHook preInstall
mkdir -p "$out"
cp -r -t "$out" build/*
runHook postInstall
'';
installPhase = ''
runHook preInstall
mkdir -p "$out"
cp -r -t "$out" build/*
runHook postInstall
'';
# Override the build-time configuration with other preferred seeds which are
# displayed on the landing page.
passthru.withPreferredSeeds = seeds:
let
originalConfig = builtins.fromJSON (builtins.readFile "${src}/config/default.json");
config = originalConfig // {
preferredSeeds = seeds;
};
newConfig = pkgs.writeText "local.json" (builtins.toJSON config);
in
self.overrideAttrs (_: {
preBuild = ''
cp ${newConfig} config/local.json
'';
});
})
# Override the build-time configuration with other preferred seeds which are
# displayed on the landing page.
passthru.withPreferredSeeds =
seeds:
let
originalConfig = builtins.fromJSON (builtins.readFile "${src}/config/default.json");
config = originalConfig // {
preferredSeeds = seeds;
};
newConfig = pkgs.writeText "local.json" (builtins.toJSON config);
in
self.overrideAttrs (_: {
preBuild = ''
cp ${newConfig} config/local.json
'';
});
}
)

View file

@ -7,18 +7,23 @@ let
inherit (pkgs) fetchpatch;
buildRustCrate =
attrs@{ edition ? "2018"
, pname
, crateName ? pname
, ...
}: pkgs.buildRustCrate (attrs // {
inherit
crateName
edition
;
});
attrs@{
edition ? "2018",
pname,
crateName ? pname,
...
}:
pkgs.buildRustCrate (
attrs
// {
inherit
crateName
edition
;
}
);
in
depot.nix.readTree.drvTargets rec{
depot.nix.readTree.drvTargets rec {
cfg-if = buildRustCrate {
pname = "cfg-if";
version = "1.0.0";
@ -106,7 +111,11 @@ depot.nix.readTree.drvTargets rec{
excludes = [ "Cargo.toml" ];
})
];
dependencies = [ bitflags libc inotify-sys ];
dependencies = [
bitflags
libc
inotify-sys
];
sha256 = "0lqwk7yf6bzc2jzj5iji2p3f29zdpllqd207vgg7jswmg2gqnlqc";
};
@ -136,14 +145,20 @@ depot.nix.readTree.drvTargets rec{
sha256 = "1gb4r6mjwd645jqh02nhn60i7qkw8cgy3xq1r4clnmvz3cmkv1l0";
dependencies = [ memchr ];
buildDependencies = [ version-check ];
features = [ "std" "alloc" ];
features = [
"std"
"alloc"
];
};
base64 = buildRustCrate {
pname = "base64";
version = "0.13.0";
sha256 = "0i0jk5sgq37kc4c90d1g7dp7zvphbg0dbqc1ajnn0vffjxblgamg";
features = [ "alloc" "std" ];
features = [
"alloc"
"std"
];
};
bufstream = buildRustCrate {
@ -180,8 +195,14 @@ depot.nix.readTree.drvTargets rec{
pname = "chrono";
version = "0.4.22";
edition = "2018";
dependencies = [ num-traits num-integer ];
features = [ "alloc" "std" ];
dependencies = [
num-traits
num-integer
];
features = [
"alloc"
"std"
];
sha256 = "01vbn93ba1q2afq10qis41j847damk5ifgn1all337mcscl345fn";
};
@ -216,7 +237,10 @@ depot.nix.readTree.drvTargets rec{
epoll = buildRustCrate {
pname = "epoll";
version = "4.3.3";
dependencies = [ bitflags libc ];
dependencies = [
bitflags
libc
];
sha256 = "1wc8dsd0dhqgskmkwd82fzqsy2hg0wm3833jxhzxkrwcip25yr3a";
};
@ -244,7 +268,11 @@ depot.nix.readTree.drvTargets rec{
pname = "serde_json";
version = "1.0.62";
sha256 = "0sgc8dycigq0nxr4j613m4q733alfb2i10s6nz80lsbbqgrka21q";
dependencies = [ serde ryu itoa ];
dependencies = [
serde
ryu
itoa
];
features = [ "std" ];
};
@ -260,7 +288,10 @@ depot.nix.readTree.drvTargets rec{
version = "0.9.0";
edition = "2015";
sha256 = "1zgl8l15i19lzp90icgwyi6zqdd31b9vm8w129f41d1zd0hs7ayq";
dependencies = [ log serde ];
dependencies = [
log
serde
];
};
semver-parser = buildRustCrate {

View file

@ -7,134 +7,177 @@ let
# The fetchers. fetch_<type> fetches specs of type <type>.
#
fetch_file = pkgs: name: spec:
fetch_file =
pkgs: name: spec:
let
name' = sanitizeName name + "-src";
in
if spec.builtin or true then
builtins_fetchurl { inherit (spec) url sha256; name = name'; }
builtins_fetchurl {
inherit (spec) url sha256;
name = name';
}
else
pkgs.fetchurl { inherit (spec) url sha256; name = name'; };
pkgs.fetchurl {
inherit (spec) url sha256;
name = name';
};
fetch_tarball = pkgs: name: spec:
fetch_tarball =
pkgs: name: spec:
let
name' = sanitizeName name + "-src";
in
if spec.builtin or true then
builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
builtins_fetchTarball {
name = name';
inherit (spec) url sha256;
}
else
pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
pkgs.fetchzip {
name = name';
inherit (spec) url sha256;
};
fetch_git = name: spec:
fetch_git =
name: spec:
let
ref =
spec.ref or (
if spec ? branch then "refs/heads/${spec.branch}" else
if spec ? tag then "refs/tags/${spec.tag}" else
abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!"
if spec ? branch then
"refs/heads/${spec.branch}"
else if spec ? tag then
"refs/tags/${spec.tag}"
else
abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!"
);
submodules = spec.submodules or false;
submoduleArg =
let
nixSupportsSubmodules = builtins.compareVersions builtins.nixVersion "2.4" >= 0;
emptyArgWithWarning =
if submodules
then
builtins.trace
(
"The niv input \"${name}\" uses submodules "
+ "but your nix's (${builtins.nixVersion}) builtins.fetchGit "
+ "does not support them"
)
{ }
else { };
if submodules then
builtins.trace (
"The niv input \"${name}\" uses submodules "
+ "but your nix's (${builtins.nixVersion}) builtins.fetchGit "
+ "does not support them"
) { }
else
{ };
in
if nixSupportsSubmodules
then { inherit submodules; }
else emptyArgWithWarning;
if nixSupportsSubmodules then { inherit submodules; } else emptyArgWithWarning;
in
builtins.fetchGit
({ url = spec.repo; inherit (spec) rev; inherit ref; } // submoduleArg);
builtins.fetchGit (
{
url = spec.repo;
inherit (spec) rev;
inherit ref;
}
// submoduleArg
);
fetch_local = spec: spec.path;
fetch_builtin-tarball = name: throw
''[${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`.
$ niv modify ${name} -a type=tarball -a builtin=true'';
fetch_builtin-tarball =
name:
throw ''
[${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`.
$ niv modify ${name} -a type=tarball -a builtin=true'';
fetch_builtin-url = name: throw
''[${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`.
$ niv modify ${name} -a type=file -a builtin=true'';
fetch_builtin-url =
name:
throw ''
[${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`.
$ niv modify ${name} -a type=file -a builtin=true'';
#
# Various helpers
#
# https://github.com/NixOS/nixpkgs/pull/83241/files#diff-c6f540a4f3bfa4b0e8b6bafd4cd54e8bR695
sanitizeName = name:
(
concatMapStrings (s: if builtins.isList s then "-" else s)
(
builtins.split "[^[:alnum:]+._?=-]+"
((x: builtins.elemAt (builtins.match "\\.*(.*)" x) 0) name)
)
);
sanitizeName =
name:
(concatMapStrings (s: if builtins.isList s then "-" else s) (
builtins.split "[^[:alnum:]+._?=-]+" ((x: builtins.elemAt (builtins.match "\\.*(.*)" x) 0) name)
));
# The set of packages used when specs are fetched using non-builtins.
mkPkgs = sources: system:
mkPkgs =
sources: system:
let
sourcesNixpkgs =
import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) { inherit system; };
sourcesNixpkgs = import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) {
inherit system;
};
hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
hasThisAsNixpkgsPath = <nixpkgs> == ./.;
in
if builtins.hasAttr "nixpkgs" sources
then sourcesNixpkgs
else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
if builtins.hasAttr "nixpkgs" sources then
sourcesNixpkgs
else if hasNixpkgsPath && !hasThisAsNixpkgsPath then
import <nixpkgs> { }
else
abort
''
Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
add a package called "nixpkgs" to your sources.json.
'';
abort ''
Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
add a package called "nixpkgs" to your sources.json.
'';
# The actual fetching function.
fetch = pkgs: name: spec:
fetch =
pkgs: name: spec:
if ! builtins.hasAttr "type" spec then
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 pkgs name spec
else if spec.type == "tarball" then fetch_tarball pkgs name spec
else if spec.type == "git" then fetch_git name spec
else if spec.type == "local" then fetch_local spec
else if spec.type == "builtin-tarball" then fetch_builtin-tarball name
else if spec.type == "builtin-url" then fetch_builtin-url name
else if spec.type == "file" then
fetch_file pkgs name spec
else if spec.type == "tarball" then
fetch_tarball pkgs name spec
else if spec.type == "git" then
fetch_git name spec
else if spec.type == "local" then
fetch_local spec
else if spec.type == "builtin-tarball" then
fetch_builtin-tarball name
else if spec.type == "builtin-url" then
fetch_builtin-url name
else
abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}";
# If the environment variable NIV_OVERRIDE_${name} is set, then use
# the path directly as opposed to the fetched source.
replace = name: drv:
replace =
name: drv:
let
saneName = stringAsChars (c: if (builtins.match "[a-zA-Z0-9]" c) == null then "_" else c) name;
ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}";
in
if ersatz == "" then drv else
# this turns the string into an actual Nix path (for both absolute and
# relative paths)
if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}";
if ersatz == "" then
drv
else
# this turns the string into an actual Nix path (for both absolute and
# relative paths)
if builtins.substring 0 1 ersatz == "/" then
/. + ersatz
else
/. + builtins.getEnv "PWD" + "/${ersatz}";
# Ports of functions for older nix versions
# a Nix version of mapAttrs if the built-in doesn't exist
mapAttrs = builtins.mapAttrs or (
f: set: with builtins;
listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set))
);
mapAttrs =
builtins.mapAttrs or (
f: set:
with builtins;
listToAttrs (
map (attr: {
name = attr;
value = f attr set.${attr};
}) (attrNames set)
)
);
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295
range = first: last: if first > last then [ ] else builtins.genList (n: first + n) (last - first + 1);
range =
first: last: if first > last then [ ] else builtins.genList (n: first + n) (last - first + 1);
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257
stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1));
@ -148,7 +191,12 @@ let
optionalAttrs = cond: as: if cond then as else { };
# fetchTarball version that is compatible between all the versions of Nix
builtins_fetchTarball = { url, name ? null, sha256 }@attrs:
builtins_fetchTarball =
{
url,
name ? null,
sha256,
}@attrs:
let
inherit (builtins) lessThan nixVersion fetchTarball;
in
@ -158,7 +206,12 @@ let
fetchTarball attrs;
# fetchurl version that is compatible between all the versions of Nix
builtins_fetchurl = { url, name ? null, sha256 }@attrs:
builtins_fetchurl =
{
url,
name ? null,
sha256,
}@attrs:
let
inherit (builtins) lessThan nixVersion fetchurl;
in
@ -168,26 +221,25 @@ let
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 = replace name (fetch config.pkgs name spec); }
)
config.sources;
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 = replace name (fetch config.pkgs name spec); }
) config.sources;
# The "config" used by the fetchers
mkConfig =
{ sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null
, sources ? if sourcesFile == null then { } else builtins.fromJSON (builtins.readFile sourcesFile)
, system ? builtins.currentSystem
, pkgs ? mkPkgs sources system
}: rec {
{
sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null,
sources ? if sourcesFile == null then { } else builtins.fromJSON (builtins.readFile sourcesFile),
system ? builtins.currentSystem,
pkgs ? mkPkgs sources system,
}:
rec {
# The sources, i.e. the attribute set of spec name to spec
inherit sources;