From 2fc87419ac30fa558642d68e9d4503fba5139dea Mon Sep 17 00:00:00 2001 From: alejandro-angulo Date: Wed, 31 Jul 2024 20:03:15 -0700 Subject: [PATCH] Removed npins I can use flake's inputs features (I just have to mark the stuff I'm replacing with `flake = false`). --- flake.lock | 73 +++++++++++++++++- flake.nix | 12 +++ modules/home/apps/tmux/default.nix | 4 +- modules/home/tools/zsh/default.nix | 8 +- modules/nixos/suites/development/default.nix | 1 - npins/default.nix | 80 -------------------- npins/sources.json | 62 --------------- 7 files changed, 90 insertions(+), 150 deletions(-) delete mode 100644 npins/default.nix delete mode 100644 npins/sources.json diff --git a/flake.lock b/flake.lock index fec9b92..53842f2 100644 --- a/flake.lock +++ b/flake.lock @@ -25,6 +25,23 @@ "type": "github" } }, + "base16-shell": { + "flake": false, + "locked": { + "lastModified": 1663053609, + "narHash": "sha256-X89FsG9QICDw3jZvOCB/KsPBVOLUeE7xN3VCtf0DD3E=", + "owner": "chriskempson", + "repo": "base16-shell", + "rev": "588691ba71b47e75793ed9edfcfaa058326a6f41", + "type": "github" + }, + "original": { + "owner": "chriskempson", + "ref": "master", + "repo": "base16-shell", + "type": "github" + } + }, "deploy-rs": { "inputs": { "flake-compat": "flake-compat", @@ -475,16 +492,37 @@ "type": "github" } }, + "powerlevel10k": { + "flake": false, + "locked": { + "lastModified": 1719815653, + "narHash": "sha256-jzLWxLLBB1MZZKJgt5R4oueuQIiqCDKRp+W+PXALHRs=", + "owner": "romkatv", + "repo": "powerlevel10k", + "rev": "2b7da93df04acd04d84f5de827e5b14077839a4b", + "type": "github" + }, + "original": { + "owner": "romkatv", + "ref": "master", + "repo": "powerlevel10k", + "type": "github" + } + }, "root": { "inputs": { "agenix": "agenix", + "base16-shell": "base16-shell", "deploy-rs": "deploy-rs", "home-manager": "home-manager", "nixos-generators": "nixos-generators", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", "nixvim": "nixvim", - "snowfall-lib": "snowfall-lib" + "powerlevel10k": "powerlevel10k", + "snowfall-lib": "snowfall-lib", + "tmux-nerd-font-window-name": "tmux-nerd-font-window-name", + "zsh-syntax-highlighting": "zsh-syntax-highlighting" } }, "snowfall-lib": { @@ -569,6 +607,22 @@ "type": "github" } }, + "tmux-nerd-font-window-name": { + "flake": false, + "locked": { + "lastModified": 1711462967, + "narHash": "sha256-5BvzuxrYm/qbfbXLBDzZhJUae0JwNqf96otp/m1l26s=", + "owner": "joshmedeski", + "repo": "tmux-nerd-font-window-name", + "rev": "bc43f25e67ed2d87cb04e27983851da359d79df5", + "type": "github" + }, + "original": { + "owner": "joshmedeski", + "repo": "tmux-nerd-font-window-name", + "type": "github" + } + }, "treefmt-nix": { "inputs": { "nixpkgs": [ @@ -608,6 +662,23 @@ "repo": "flake-utils", "type": "github" } + }, + "zsh-syntax-highlighting": { + "flake": false, + "locked": { + "lastModified": 1704566212, + "narHash": "sha256-4rW2N+ankAH4sA6Sa5mr9IKsdAg7WTgrmyqJ2V1vygQ=", + "owner": "zsh-users", + "repo": "zsh-syntax-highlighting", + "rev": "e0165eaa730dd0fa321a6a6de74f092fe87630b0", + "type": "github" + }, + "original": { + "owner": "zsh-users", + "ref": "master", + "repo": "zsh-syntax-highlighting", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index a282cc3..b22c424 100644 --- a/flake.nix +++ b/flake.nix @@ -27,6 +27,18 @@ nixvim.url = "github:alejandro-angulo/nixvim-config"; nixvim.inputs.nixpkgs.follows = "nixpkgs"; + + base16-shell.url = "github:chriskempson/base16-shell/master"; + base16-shell.flake = false; + + zsh-syntax-highlighting.url = "github:zsh-users/zsh-syntax-highlighting/master"; + zsh-syntax-highlighting.flake = false; + + powerlevel10k.url = "github:romkatv/powerlevel10k/master"; + powerlevel10k.flake = false; + + tmux-nerd-font-window-name.url = "github:joshmedeski/tmux-nerd-font-window-name"; + tmux-nerd-font-window-name.flake = false; }; outputs = inputs: diff --git a/modules/home/apps/tmux/default.nix b/modules/home/apps/tmux/default.nix index 47128b2..229f997 100644 --- a/modules/home/apps/tmux/default.nix +++ b/modules/home/apps/tmux/default.nix @@ -1,6 +1,7 @@ { lib, config, + inputs, pkgs, namespace, ... @@ -8,7 +9,6 @@ inherit (lib) mkEnableOption; inherit (pkgs) tmuxPlugins; - sources = import ../../../../npins; cfg = config.${namespace}.apps.tmux; in { options.${namespace}.apps.tmux = { @@ -47,7 +47,7 @@ in { { pluginName = "tmux-nerd-font-window-name"; version = "2.1.1"; - src = sources.tmux-nerd-font-window-name; + src = inputs.tmux-nerd-font-window-name; nativeBuildInputs = [pkgs.makeWrapper]; rtpFilePath = "tmux-nerd-font-window-name.tmux"; postInstall = '' diff --git a/modules/home/tools/zsh/default.nix b/modules/home/tools/zsh/default.nix index 81d0f7d..a9fe070 100644 --- a/modules/home/tools/zsh/default.nix +++ b/modules/home/tools/zsh/default.nix @@ -1,12 +1,12 @@ { config, + inputs, lib, namespace, ... }: let inherit (lib) mkEnableOption mkIf; - sources = import ../../../../npins; cfg = config.${namespace}.tools.zsh; in { options.${namespace}.tools.zsh = { @@ -35,12 +35,12 @@ in { plugins = [ { name = "zsh-syntax-highlighting"; - src = sources.zsh-syntax-highlighting; + src = inputs.zsh-syntax-highlighting; file = "zsh-syntax-highlighting.zsh"; } { name = "powerlevel10k"; - src = sources.powerlevel10k; + src = inputs.powerlevel10k; file = "powerlevel10k.zsh-theme"; } { @@ -50,7 +50,7 @@ in { } { name = "base16-shell"; - src = sources.base16-shell; + src = inputs.base16-shell; file = "base16-shell.plugin.zsh"; } ]; diff --git a/modules/nixos/suites/development/default.nix b/modules/nixos/suites/development/default.nix index 378332d..e83c1d3 100644 --- a/modules/nixos/suites/development/default.nix +++ b/modules/nixos/suites/development/default.nix @@ -26,7 +26,6 @@ in { awscli2 direnv minio-client - npins pre-commit git ]; diff --git a/npins/default.nix b/npins/default.nix deleted file mode 100644 index 5e7d086..0000000 --- a/npins/default.nix +++ /dev/null @@ -1,80 +0,0 @@ -# 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 deleted file mode 100644 index 30da918..0000000 --- a/npins/sources.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "pins": { - "base16-shell": { - "type": "Git", - "repository": { - "type": "GitHub", - "owner": "chriskempson", - "repo": "base16-shell" - }, - "branch": "master", - "revision": "588691ba71b47e75793ed9edfcfaa058326a6f41", - "url": "https://github.com/chriskempson/base16-shell/archive/588691ba71b47e75793ed9edfcfaa058326a6f41.tar.gz", - "hash": "0w8g0gyvahkm6zqlwy6lw9ac3hragwh3hvrnvvq2082hdyq4bksz" - }, - "powerlevel10k": { - "type": "GitRelease", - "repository": { - "type": "GitHub", - "owner": "romkatv", - "repo": "powerlevel10k" - }, - "pre_releases": false, - "version_upper_bound": null, - "release_prefix": null, - "version": "v1.20.0", - "revision": "ff0311157d6b24fea21aa70699783f362b0f554f", - "url": "https://api.github.com/repos/romkatv/powerlevel10k/tarball/v1.20.0", - "hash": "1ha7qb601mk97lxvcj9dmbypwx7z5v0b7mkqahzsq073f4jnybhi" - }, - "tmux-nerd-font-window-name": { - "type": "GitRelease", - "repository": { - "type": "GitHub", - "owner": "joshmedeski", - "repo": "tmux-nerd-font-window-name" - }, - "pre_releases": false, - "version_upper_bound": null, - "release_prefix": null, - "version": "v2.1.1", - "revision": "57961cb0a99b76f20e02639d398c973d81971d05", - "url": "https://api.github.com/repos/joshmedeski/tmux-nerd-font-window-name/tarball/v2.1.1", - "hash": "1p1biwzr18skjqkjki05ki60dc5cqa9hnh6ldp4py9hw94a27zph" - }, - "zsh-syntax-highlighting": { - "type": "GitRelease", - "repository": { - "type": "GitHub", - "owner": "zsh-users", - "repo": "zsh-syntax-highlighting" - }, - "pre_releases": false, - "version_upper_bound": null, - "release_prefix": null, - "version": "0.8.0", - "revision": "b1379f1ee96b1fe25701c9418c75f81eaabdab56", - "url": "https://api.github.com/repos/zsh-users/zsh-syntax-highlighting/tarball/0.8.0", - "hash": "1yl8zdip1z9inp280sfa5byjbf2vqh2iazsycar987khjsi5d5w8" - } - }, - "version": 3 -} \ No newline at end of file