summary refs log tree commit diff stats
path: root/npins
diff options
context:
space:
mode:
Diffstat (limited to 'npins')
-rw-r--r--npins/default.nix80
-rw-r--r--npins/sources.json107
2 files changed, 187 insertions, 0 deletions
diff --git a/npins/default.nix b/npins/default.nix
new file mode 100644
index 00000000..5e7d086e
--- /dev/null
+++ b/npins/default.nix
@@ -0,0 +1,80 @@
+# 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,
+      branch ? null,
+      ...
+    }:
+    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";
+      let
+        urlToName =
+          url: rev:
+          let
+            matched = builtins.match "^.*/([^/]*)(\\.git)?$" repository.url;
+
+            short = builtins.substring 0 7 rev;
+
+            appendShort = if (builtins.match "[a-f0-9]*" rev) != null then "-${short}" else "";
+          in
+          "${if matched == null then "source" else builtins.head matched}${appendShort}";
+        name = urlToName repository.url revision;
+      in
+      builtins.fetchGit {
+        url = repository.url;
+        rev = revision;
+        inherit name;
+        # 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 00000000..f785a2d4
--- /dev/null
+++ b/npins/sources.json
@@ -0,0 +1,107 @@
+{
+  "pins": {
+    "agenix": {
+      "type": "Git",
+      "repository": {
+        "type": "GitHub",
+        "owner": "ryantm",
+        "repo": "agenix"
+      },
+      "branch": "main",
+      "revision": "e600439ec4c273cf11e06fe4d9d906fb98fa097c",
+      "url": "https://github.com/ryantm/agenix/archive/e600439ec4c273cf11e06fe4d9d906fb98fa097c.tar.gz",
+      "hash": "006ngydiykjgqs85cl19h9klq8kaqm5zs0ng51dnwy7nzgqxzsdr"
+    },
+    "darwin": {
+      "type": "Git",
+      "repository": {
+        "type": "GitHub",
+        "owner": "lnl7",
+        "repo": "nix-darwin"
+      },
+      "branch": "master",
+      "revision": "5d6e0851b60508cffd66b4a6982440a40720338d",
+      "url": "https://github.com/lnl7/nix-darwin/archive/5d6e0851b60508cffd66b4a6982440a40720338d.tar.gz",
+      "hash": "0hfj4jib2dd7alyp4m74p0spfc2x0cqgk4q6p8lz07rqzyl5nrka"
+    },
+    "emacs-overlay": {
+      "type": "Git",
+      "repository": {
+        "type": "GitHub",
+        "owner": "nix-community",
+        "repo": "emacs-overlay"
+      },
+      "branch": "master",
+      "revision": "d9492638daa77fca7bf84e5b218cd95598ac3f72",
+      "url": "https://github.com/nix-community/emacs-overlay/archive/d9492638daa77fca7bf84e5b218cd95598ac3f72.tar.gz",
+      "hash": "0wr8y84g8q45y0vahvwx5px7728i88qskj3657g2i8j08skndlw6"
+    },
+    "home-manager": {
+      "type": "Git",
+      "repository": {
+        "type": "GitHub",
+        "owner": "nix-community",
+        "repo": "home-manager"
+      },
+      "branch": "master",
+      "revision": "fcac3d6d88302a5e64f6cb8014ac785e08874c8d",
+      "url": "https://github.com/nix-community/home-manager/archive/fcac3d6d88302a5e64f6cb8014ac785e08874c8d.tar.gz",
+      "hash": "172sb8wdqm5fcx85gwzbf0b3l846s4b3ldfrpdhq5lf27lb20w81"
+    },
+    "nix-index-database": {
+      "type": "Git",
+      "repository": {
+        "type": "GitHub",
+        "owner": "Mic92",
+        "repo": "nix-index-database"
+      },
+      "branch": "main",
+      "revision": "26a0f969549cf4d56f6e9046b9e0418b3f3b94a5",
+      "url": "https://github.com/Mic92/nix-index-database/archive/26a0f969549cf4d56f6e9046b9e0418b3f3b94a5.tar.gz",
+      "hash": "0ag1ma5qy7h3zxsvg24qzqlfnfvdkrkj36rp1lakbsj1ilks9plc"
+    },
+    "nixos-hardware": {
+      "type": "Git",
+      "repository": {
+        "type": "GitHub",
+        "owner": "NixOS",
+        "repo": "nixos-hardware"
+      },
+      "branch": "master",
+      "revision": "009b764ac98a3602d41fc68072eeec5d24fc0e49",
+      "url": "https://github.com/NixOS/nixos-hardware/archive/009b764ac98a3602d41fc68072eeec5d24fc0e49.tar.gz",
+      "hash": "1cg4qrzwkd3xdmp70rniync25kgm123400i5l8m7jjqv186mxi3l"
+    },
+    "nixpkgs": {
+      "type": "Channel",
+      "name": "nixos-unstable",
+      "url": "https://releases.nixos.org/nixos/unstable/nixos-25.05beta761040.303bd8071377/nixexprs.tar.xz",
+      "hash": "15xz52bchv05cd4yxi4qhym9l7z0qr7hnw34pl098rjikp6yqbvw"
+    },
+    "nur": {
+      "type": "Git",
+      "repository": {
+        "type": "GitHub",
+        "owner": "nix-community",
+        "repo": "NUR"
+      },
+      "branch": "main",
+      "revision": "eb2e9317b9e301ed5cbe2b07cb57b33558b79670",
+      "url": "https://github.com/nix-community/NUR/archive/eb2e9317b9e301ed5cbe2b07cb57b33558b79670.tar.gz",
+      "hash": "0gg453khpw5255rc6jgndid8qh2l9nh0jnrc1mlp24zjjqn567g8"
+    },
+    "srvos": {
+      "type": "Git",
+      "repository": {
+        "type": "GitHub",
+        "owner": "nix-community",
+        "repo": "srvos"
+      },
+      "branch": "main",
+      "revision": "b3065811ae1c822b856af8a254e07703172a0e76",
+      "url": "https://github.com/nix-community/srvos/archive/b3065811ae1c822b856af8a254e07703172a0e76.tar.gz",
+      "hash": "1lirn8klqj1vx0c42hmh7p6bn1s8rwxd6m1r27z93w333q7knbss"
+    }
+  },
+  "version": 3
+}
\ No newline at end of file