-{ pkgs ? import <nixpkgs> {} }:
+{ sources ? import ./nix/sources.nix }:
let
+ pkgs = import sources.nixpkgs-env {};
pkgs_ = pkgs;
mypkgs = import ./pkgs { pkgs = pkgs_; };
in
mylibs.yarn2nixPackage.yarn2nix nix
nixops nix-prefetch-scripts nix-generate-from-cpan
nix-zsh-completions bundix nodePackages.bower2nix
- nodePackages.node2nix
+ nodePackages.node2nix niv
# (nixos {}).nixos-generate-config
# (nixos {}).nixos-install
# (nixos {}).nixos-enter
--- /dev/null
+This directory is handled by niv, but it prefers to have a directory
+named "nix"
--- /dev/null
+{
+ "niv": {
+ "branch": "master",
+ "description": "Easy dependency management for Nix projects",
+ "homepage": "https://github.com/nmattia/niv",
+ "owner": "nmattia",
+ "repo": "niv",
+ "rev": "372f96bff217a7a019de27667d04118cffa9841b",
+ "sha256": "1l0z6162zw60pdcdj03aq64qgf1vyzmf24i9pxca64i4sprl1b7p",
+ "type": "tarball",
+ "url": "https://github.com/nmattia/niv/archive/372f96bff217a7a019de27667d04118cffa9841b.tar.gz",
+ "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
+ },
+ "nixpkgs-env": {
+ "branch": "nixos-19.03",
+ "description": "A read-only mirror of NixOS/nixpkgs tracking the released channels. Send issues and PRs to",
+ "homepage": "https://github.com/NixOS/nixpkgs",
+ "owner": "NixOS",
+ "repo": "nixpkgs-channels",
+ "rev": "34c7eb7545d155cc5b6f499b23a7cb1c96ab4d59",
+ "sha256": "11z6ajj108fy2q5g8y4higlcaqncrbjm3dnv17pvif6avagw4mcb",
+ "type": "tarball",
+ "url": "https://github.com/NixOS/nixpkgs-channels/archive/34c7eb7545d155cc5b6f499b23a7cb1c96ab4d59.tar.gz",
+ "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
+ },
+ "nixpkgs-nixops": {
+ "channel_link": "https://nixos.org/channels/nixos-19.03",
+ "revision": "173677.daf861a810d",
+ "sha256": "0v5bhdiyg1xv1dzsy7jbm301ighsvmi87wibw96iiky8sqs6qd4z",
+ "type": "tarball",
+ "url": "https://releases.nixos.org/nixos/19.03/nixos-19.03.173677.daf861a810d/nixexprs.tar.xz",
+ "url_template": "https://releases.nixos.org/nixos/<version>/nixos-<version>.<revision>/nixexprs.tar.xz",
+ "version": "19.03"
+ },
+ "nixpkgs-nixops-previous": {
+ "channel_link": "https://nixos.org/channels/nixos-19.03",
+ "revision": "173677.daf861a810d",
+ "sha256": "0v5bhdiyg1xv1dzsy7jbm301ighsvmi87wibw96iiky8sqs6qd4z",
+ "type": "tarball",
+ "url": "https://releases.nixos.org/nixos/19.03/nixos-19.03.173677.daf861a810d/nixexprs.tar.xz",
+ "url_template": "https://releases.nixos.org/nixos/<version>/nixos-<version>.<revision>/nixexprs.tar.xz",
+ "version": "19.03"
+ },
+ "nixpkgs-nixops-next": {
+ "channel_link": "https://nixos.org/channels/nixos-19.03",
+ "revision": "173677.daf861a810d",
+ "sha256": "0v5bhdiyg1xv1dzsy7jbm301ighsvmi87wibw96iiky8sqs6qd4z",
+ "type": "tarball",
+ "url": "https://releases.nixos.org/nixos/19.03/nixos-19.03.173677.daf861a810d/nixexprs.tar.xz",
+ "url_template": "https://releases.nixos.org/nixos/<version>/nixos-<version>.<revision>/nixexprs.tar.xz",
+ "version": "19.03"
+ }
+}
--- /dev/null
+# This file has been generated by Niv.
+
+let
+
+ #
+ # The fetchers. fetch_<type> fetches specs of type <type>.
+ #
+
+ 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 = pkgs: name: spec:
+ let
+ ok = str: ! builtins.isNull (builtins.match "[a-zA-Z0-9+-._?=]" str);
+ # sanitize the name, though nix will still fail if name starts with period
+ name' = stringAsChars (x: if ! ok x then "-" else x) "${name}-src";
+ in
+ if spec.builtin or true then
+ builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
+ else
+ pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
+
+ fetch_git = spec:
+ builtins.fetchGit { url = spec.repo; inherit (spec) rev ref; };
+
+ 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'';
+
+ #
+ # Various helpers
+ #
+
+ # The set of packages used when specs are fetched using non-builtins.
+ mkPkgs = sources:
+ let
+ sourcesNixpkgs =
+ import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) {};
+ hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
+ hasThisAsNixpkgsPath = <nixpkgs> == ./.;
+ in
+ 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.
+ '';
+
+ # The actual fetching function.
+ 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 pkgs spec
+ else if spec.type == "tarball" then fetch_tarball pkgs name spec
+ else if spec.type == "git" then fetch_git 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}";
+
+ # 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))
+ );
+
+ # 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);
+
+ # 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));
+
+ # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269
+ stringAsChars = f: s: concatStrings (map f (stringToCharacters s));
+ concatStrings = builtins.concatStringsSep "";
+
+ # fetchTarball version that is compatible between all the versions of Nix
+ builtins_fetchTarball = { url, name, sha256 }@attrs:
+ let
+ inherit (builtins) lessThan nixVersion fetchTarball;
+ in
+ if lessThan nixVersion "1.12" then
+ fetchTarball { inherit name url; }
+ else
+ fetchTarball attrs;
+
+ # fetchurl version that is compatible between all the versions of Nix
+ builtins_fetchurl = { url, sha256 }@attrs:
+ let
+ inherit (builtins) lessThan nixVersion fetchurl;
+ in
+ if lessThan nixVersion "1.12" then
+ fetchurl { inherit url; }
+ 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
+mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }
mylibs = import ../lib { inherit pkgs; };
in
rec {
+ sources = import ../nix/sources.nix;
myEnvironments = callPackage ../environments {};
- boinctui = callPackage ../pkgs/boinctui {};
- cnagios = callPackage ../pkgs/cnagios { inherit mylibs; };
- duply = callPackage ../pkgs/duply {};
- flrn = callPackage ../pkgs/flrn { inherit mylibs; slang = callPackage ../pkgs/slang_1 {}; };
- genius = callPackage ../pkgs/genius {};
- mtop = callPackage ../pkgs/mtop {};
- muttprint = callPackage ../pkgs/muttprint {};
- mutt-ics = callPackage ../pkgs/mutt-ics { inherit mylibs; };
- nagios-cli = callPackage ../pkgs/nagios-cli { inherit mylibs; };
- nagnu = callPackage ../pkgs/nagnu { inherit mylibs; };
- note = callPackage ../pkgs/note {};
- notmuch-python2 = callPackage ../pkgs/notmuch/notmuch-python { pythonPackages = python2Packages; };
- notmuch-python3 = callPackage ../pkgs/notmuch/notmuch-python { pythonPackages = python3Packages; };
- notmuch-vim = callPackage ../pkgs/notmuch/notmuch-vim {};
- openarc = callPackage ../pkgs/openarc { inherit mylibs; };
- opendmarc = callPackage ../pkgs/opendmarc { libspf2 = callPackage ../pkgs/opendmarc/libspf2.nix {}; };
- pg_activity = callPackage ../pkgs/pg_activity { inherit mylibs; };
- pgloader = callPackage ../pkgs/pgloader {};
- predixy = callPackage ../pkgs/predixy { inherit mylibs; };
- rrsync_sudo = callPackage ../pkgs/rrsync_sudo {};
- telegram-cli = callPackage ../pkgs/telegram-cli { inherit mylibs; };
- telegram-history-dump = callPackage ../pkgs/telegram-history-dump { inherit mylibs; };
- telegramircd = callPackage ../pkgs/telegramircd { inherit mylibs; telethon = callPackage ../pkgs/telethon_sync {}; };
- terminal-velocity = callPackage ../pkgs/terminal-velocity {};
- tiv = callPackage ../pkgs/tiv {};
- unicodeDoc = callPackage ../pkgs/unicode {};
+ boinctui = callPackage ./boinctui {};
+ cnagios = callPackage ./cnagios { inherit mylibs; };
+ duply = callPackage ./duply {};
+ flrn = callPackage ./flrn { inherit mylibs; slang = callPackage ./slang_1 {}; };
+ genius = callPackage ./genius {};
+ mtop = callPackage ./mtop {};
+ muttprint = callPackage ./muttprint {};
+ mutt-ics = callPackage ./mutt-ics { inherit mylibs; };
+ nagios-cli = callPackage ./nagios-cli { inherit mylibs; };
+ nagnu = callPackage ./nagnu { inherit mylibs; };
+ note = callPackage ./note {};
+ notmuch-python2 = callPackage ./notmuch/notmuch-python { pythonPackages = python2Packages; };
+ notmuch-python3 = callPackage ./notmuch/notmuch-python { pythonPackages = python3Packages; };
+ notmuch-vim = callPackage ./notmuch/notmuch-vim {};
+ openarc = callPackage ./openarc { inherit mylibs; };
+ opendmarc = callPackage ./opendmarc { libspf2 = callPackage ./opendmarc/libspf2.nix {}; };
+ pg_activity = callPackage ./pg_activity { inherit mylibs; };
+ pgloader = callPackage ./pgloader {};
+ predixy = callPackage ./predixy { inherit mylibs; };
+ rrsync_sudo = callPackage ./rrsync_sudo {};
+ telegram-cli = callPackage ./telegram-cli { inherit mylibs; };
+ telegram-history-dump = callPackage ./telegram-history-dump { inherit mylibs; };
+ telegramircd = callPackage ./telegramircd { inherit mylibs; telethon = callPackage ./telethon_sync {}; };
+ terminal-velocity = callPackage ./terminal-velocity {};
+ tiv = callPackage ./tiv {};
+ unicodeDoc = callPackage ./unicode {};
- cardano = callPackage ../pkgs/crypto/cardano { inherit mylibs; };
- cardano-cli = callPackage ../pkgs/crypto/cardano-cli {};
- iota-cli-app = callPackage ../pkgs/crypto/iota-cli-app { inherit mylibs; };
- sia = callPackage ../pkgs/crypto/sia {};
+ cardano = callPackage ./crypto/cardano { inherit mylibs; };
+ cardano-cli = callPackage ./crypto/cardano-cli {};
+ iota-cli-app = callPackage ./crypto/iota-cli-app { inherit mylibs; };
+ sia = callPackage ./crypto/sia {};
- pure-ftpd = callPackage ../pkgs/pure-ftpd {};
- mpd = (callPackage ../pkgs/mpd_0_21 {}).mpd;
- mpd-small = (callPackage ../pkgs/mpd_0_21 {}).mpd-small;
+ pure-ftpd = callPackage ./pure-ftpd {};
+ mpd = (callPackage ./mpd_0_21 {}).mpd;
+ mpd-small = (callPackage ./mpd_0_21 {}).mpd-small;
bitlbee-mastodon = callPackage ./bitlbee-mastodon {};
sha256 = "0dh8qc3lzrba5mxxxh57i1374wc7ha3c30h7wsmj5zr7bhc5zm4p";
}) {}).monero;
+ niv = (import sources.niv {}).niv;
}