From f24dd8b6d5d080b62bae7af8ec4e93ba06e3d857 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Sat, 8 Feb 2025 10:17:39 +0800 Subject: [PATCH] wrapperPackages/dotfiles-wrapped: update inputs and format code --- .../dotfiles-wrapped/npins/default.nix | 66 ++++++++----------- .../dotfiles-wrapped/npins/sources.json | 12 ++-- 2 files changed, 34 insertions(+), 44 deletions(-) diff --git a/configs/wrapper-manager/dotfiles-wrapped/npins/default.nix b/configs/wrapper-manager/dotfiles-wrapped/npins/default.nix index 5e7d086e..b774a4b0 100644 --- a/configs/wrapper-manager/dotfiles-wrapped/npins/default.nix +++ b/configs/wrapper-manager/dotfiles-wrapped/npins/default.nix @@ -3,33 +3,22 @@ let data = builtins.fromJSON (builtins.readFile ./sources.json); version = data.version; - mkSource = - spec: + 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; }; + 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, - ... - }: + 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 @@ -41,40 +30,41 @@ let else assert repository.type == "Git"; let - urlToName = - url: rev: + 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}"; + 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 { + in builtins.fetchGit { url = repository.url; rev = revision; inherit name; # hash = hash; }; - mkPyPiSource = - { url, hash, ... }: + mkPyPiSource = { url, hash, ... }: builtins.fetchurl { inherit url; sha256 = hash; }; - mkChannelSource = - { url, hash, ... }: + mkChannelSource = { url, hash, ... }: builtins.fetchTarball { inherit url; sha256 = hash; }; -in -if version == 3 then +in if version == 3 then builtins.mapAttrs (_: mkSource) data.pins else - throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`" + throw "Unsupported format version ${ + toString version + } in sources.json. Try running `npins upgrade`" diff --git a/configs/wrapper-manager/dotfiles-wrapped/npins/sources.json b/configs/wrapper-manager/dotfiles-wrapped/npins/sources.json index db06425b..4b32b5ab 100644 --- a/configs/wrapper-manager/dotfiles-wrapped/npins/sources.json +++ b/configs/wrapper-manager/dotfiles-wrapped/npins/sources.json @@ -8,9 +8,9 @@ "repo": "doomemacs" }, "branch": "master", - "revision": "8b9168de6e6a9cabf13d1c92558e2ef71aa37a72", - "url": "https://github.com/doomemacs/doomemacs/archive/8b9168de6e6a9cabf13d1c92558e2ef71aa37a72.tar.gz", - "hash": "1b3dwzvxa3svi5bmzwbx847b0g9fggfdjbjacp7vy936x6ld51bc" + "revision": "2bc052425ca45a41532be0648ebd976d1bd2e6c1", + "url": "https://github.com/doomemacs/doomemacs/archive/2bc052425ca45a41532be0648ebd976d1bd2e6c1.tar.gz", + "hash": "0a1px0igzhzl7mjl0wkp9jnb3sjggpbi2rnj0w2kga08d8frahcb" }, "dotfiles": { "type": "Git", @@ -20,9 +20,9 @@ "repo": "dotfiles" }, "branch": "master", - "revision": "0766497a925b0e87efa7b319e823aeaa77f2e1dd", - "url": "https://github.com/foo-dogsquared/dotfiles/archive/0766497a925b0e87efa7b319e823aeaa77f2e1dd.tar.gz", - "hash": "0435h4cgz9wgyp9j6vygcbxp3i66vn29ab2jqpcpfgligipjnhhm" + "revision": "f2f7a9e221635e7e857b96ced7d651fc8e059a66", + "url": "https://github.com/foo-dogsquared/dotfiles/archive/f2f7a9e221635e7e857b96ced7d651fc8e059a66.tar.gz", + "hash": "181z505yqsscjngk78dpzfgw47a4ravr5xpfqyal9b38b2kvc6i9" }, "nixgl": { "type": "Git",