try refactoring overlays into flake inputs

This commit is contained in:
Noah Masur 2023-08-02 11:51:11 -04:00
parent 00564c0c40
commit e6d0852be0
8 changed files with 215 additions and 101 deletions

View File

@ -430,9 +430,15 @@
"telescope-nvim-src": "telescope-nvim-src", "telescope-nvim-src": "telescope-nvim-src",
"telescope-project-nvim-src": "telescope-project-nvim-src", "telescope-project-nvim-src": "telescope-project-nvim-src",
"toggleterm-nvim-src": "toggleterm-nvim-src", "toggleterm-nvim-src": "toggleterm-nvim-src",
"tree-sitter-bash": "tree-sitter-bash",
"tree-sitter-ini": "tree-sitter-ini",
"tree-sitter-puppet": "tree-sitter-puppet",
"tree-sitter-python": "tree-sitter-python",
"tree-sitter-rasi": "tree-sitter-rasi",
"vscode-terraform-snippets": "vscode-terraform-snippets", "vscode-terraform-snippets": "vscode-terraform-snippets",
"wallpapers": "wallpapers", "wallpapers": "wallpapers",
"wsl": "wsl" "wsl": "wsl",
"zenyd-mpv-scripts": "zenyd-mpv-scripts"
} }
}, },
"rust-overlay": { "rust-overlay": {
@ -540,6 +546,88 @@
"type": "github" "type": "github"
} }
}, },
"tree-sitter-bash": {
"flake": false,
"locked": {
"lastModified": 1688032601,
"narHash": "sha256-gl5F3IeZa2VqyH/qFj8ey2pRbGq4X8DL5wiyvRrH56U=",
"owner": "tree-sitter",
"repo": "tree-sitter-bash",
"rev": "493646764e7ad61ce63ce3b8c59ebeb37f71b841",
"type": "github"
},
"original": {
"owner": "tree-sitter",
"repo": "tree-sitter-bash",
"rev": "493646764e7ad61ce63ce3b8c59ebeb37f71b841",
"type": "github"
}
},
"tree-sitter-ini": {
"flake": false,
"locked": {
"lastModified": 1690815608,
"narHash": "sha256-IIpKzpA4q1jpYVZ75VZaxWHaqNt8TA427eMOui2s71M=",
"owner": "justinmk",
"repo": "tree-sitter-ini",
"rev": "7f11a02fb8891482068e0fe419965d7bade81a68",
"type": "github"
},
"original": {
"owner": "justinmk",
"repo": "tree-sitter-ini",
"type": "github"
}
},
"tree-sitter-puppet": {
"flake": false,
"locked": {
"lastModified": 1690231696,
"narHash": "sha256-YEjjy9WLwITERYqoeSVrRYnwVBIAwdc4o0lvAK9wizw=",
"owner": "amaanq",
"repo": "tree-sitter-puppet",
"rev": "9ce9a5f7d64528572aaa8d59459ba869e634086b",
"type": "github"
},
"original": {
"owner": "amaanq",
"repo": "tree-sitter-puppet",
"type": "github"
}
},
"tree-sitter-python": {
"flake": false,
"locked": {
"lastModified": 1690493803,
"narHash": "sha256-2btd/NRE6NuGNlx4cq535OrwtWXihiP3VMCJjPCiDOk=",
"owner": "tree-sitter",
"repo": "tree-sitter-python",
"rev": "5af00f64af6bbf822f208243cce5cf75396fb6f5",
"type": "github"
},
"original": {
"owner": "tree-sitter",
"repo": "tree-sitter-python",
"rev": "5af00f64af6bbf822f208243cce5cf75396fb6f5",
"type": "github"
}
},
"tree-sitter-rasi": {
"flake": false,
"locked": {
"lastModified": 1678701563,
"narHash": "sha256-2nYZoLcrxxxiOJEySwHUm93lzMg8mU+V7LIP63ntFdA=",
"owner": "Fymyte",
"repo": "tree-sitter-rasi",
"rev": "371dac6bcce0df5566c1cfebde69d90ecbeefd2d",
"type": "github"
},
"original": {
"owner": "Fymyte",
"repo": "tree-sitter-rasi",
"type": "github"
}
},
"vscode-terraform-snippets": { "vscode-terraform-snippets": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -591,6 +679,22 @@
"repo": "NixOS-WSL", "repo": "NixOS-WSL",
"type": "github" "type": "github"
} }
},
"zenyd-mpv-scripts": {
"flake": false,
"locked": {
"lastModified": 1650625438,
"narHash": "sha256-OBCuzCtgfSwj0i/rBNranuu4LRc47jObwQIJgQQoerg=",
"owner": "zenyd",
"repo": "mpv-scripts",
"rev": "19ea069abcb794d1bf8fac2f59b50d71ab992130",
"type": "github"
},
"original": {
"owner": "zenyd",
"repo": "mpv-scripts",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View File

@ -112,6 +112,40 @@
flake = false; flake = false;
}; };
# Tree-Sitter Grammars
tree-sitter-bash = {
# Fix: bash highlighting doesn't work as of this commit:
# https://github.com/NixOS/nixpkgs/commit/49cce41b7c5f6b88570a482355d9655ca19c1029
url =
"github:tree-sitter/tree-sitter-bash/493646764e7ad61ce63ce3b8c59ebeb37f71b841";
flake = false;
};
tree-sitter-python = {
# Fix: invalid node in position. Broken as of this commit (replaced with newer):
# https://github.com/NixOS/nixpkgs/commit/8ec3627796ecc899e6f47f5bf3c3220856ead9c5
url =
"github:tree-sitter/tree-sitter-python/5af00f64af6bbf822f208243cce5cf75396fb6f5";
flake = false;
};
tree-sitter-ini = {
url = "github:justinmk/tree-sitter-ini";
flake = false;
};
tree-sitter-puppet = {
url = "github:amaanq/tree-sitter-puppet";
flake = false;
};
tree-sitter-rasi = {
url = "github:Fymyte/tree-sitter-rasi";
flake = false;
};
# MPV Scripts
zenyd-mpv-scripts = {
url = "github:zenyd/mpv-scripts";
flake = false;
};
}; };
outputs = { nixpkgs, ... }@inputs: outputs = { nixpkgs, ... }@inputs:
@ -149,6 +183,8 @@
(import ./overlays/calibre-web.nix) (import ./overlays/calibre-web.nix)
(import ./overlays/disko.nix inputs) (import ./overlays/disko.nix inputs)
(import ./overlays/tree-sitter.nix inputs) (import ./overlays/tree-sitter.nix inputs)
(import ./overlays/caddy.nix inputs)
(import ./overlays/mpv-scripts.nix inputs)
(import ./overlays/betterlockscreen.nix) (import ./overlays/betterlockscreen.nix)
]; ];

View File

@ -31,21 +31,7 @@
pkgs.mpvScripts.autoload pkgs.mpvScripts.autoload
# Delete current file after quitting # Delete current file after quitting
(pkgs.stdenv.mkDerivation rec { pkgs.mpvScripts.mpv-delete-file
pname = "mpv-delete-file";
version = "0.1"; # made-up
src = pkgs.fetchFromGitHub {
owner = "zenyd";
repo = "mpv-scripts";
rev = "19ea069abcb794d1bf8fac2f59b50d71ab992130";
sha256 = "sha256-OBCuzCtgfSwj0i/rBNranuu4LRc47jObwQIJgQQoerg=";
} + "/delete_file.lua";
dontBuild = true;
dontUnpack = true;
installPhase =
"install -Dm644 ${src} $out/share/mpv/scripts/delete_file.lua";
passthru.scriptName = "delete_file.lua";
})
]; ];
}; };

View File

@ -44,10 +44,7 @@ in {
caddy.cidrAllowlist = cloudflareIpRanges; caddy.cidrAllowlist = cloudflareIpRanges;
# Tell Caddy to use Cloudflare DNS for ACME challenge validation # Tell Caddy to use Cloudflare DNS for ACME challenge validation
services.caddy.package = (pkgs.callPackage ../../../overlays/caddy.nix { services.caddy.package = pkgs.caddy-cloudflare; # Patched overlay
plugins = [ "github.com/caddy-dns/cloudflare" ];
# vendorSha256 = "sha256-K9HPZnr+hMcK5aEd1H4gEg6PXAaNrNWFvaHYm5m62JY=";
});
caddy.tlsPolicies = [{ caddy.tlsPolicies = [{
issuers = [{ issuers = [{
module = "acme"; module = "acme";

View File

@ -1,9 +1,14 @@
# Adds the Cloudflare DNS validation module # Adds the Cloudflare DNS validation module
{ lib, buildGo118Module, fetchFromGitHub, plugins ? [ ] }: inputs: _final: prev:
let let
goImports = lib.flip lib.concatMapStrings plugins (pkg: " _ \"${pkg}\"\n");
goGets = lib.flip lib.concatMapStrings plugins (pkg: "go get ${pkg}\n "); plugins = [ "github.com/caddy-dns/cloudflare" ];
goImports =
prev.lib.flip prev.lib.concatMapStrings plugins (pkg: " _ \"${pkg}\"\n");
goGets = prev.lib.flip prev.lib.concatMapStrings plugins
(pkg: "go get ${pkg}\n ");
main = '' main = ''
package main package main
import ( import (
@ -15,19 +20,16 @@ let
caddycmd.Main() caddycmd.Main()
} }
''; '';
in buildGo118Module rec {
pname = "caddy"; in {
version = "2.6.4"; caddy-cloudflare = prev.buildGo118Module {
pname = "caddy-cloudflare";
version = prev.caddy.version;
runVend = true; runVend = true;
subPackages = [ "cmd/caddy" ]; subPackages = [ "cmd/caddy" ];
src = fetchFromGitHub { src = prev.caddy.src;
owner = "caddyserver";
repo = "caddy";
rev = "v${version}";
sha256 = "sha256:3a3+nFHmGONvL/TyQRqgJtrSDIn0zdGy9YwhZP17mU0=";
};
vendorSha256 = "sha256:CrHqJcJ0knX+txQ5qvzW4JrU8vfi3FO3M/xtislIC1M="; vendorSha256 = "sha256:CrHqJcJ0knX+txQ5qvzW4JrU8vfi3FO3M/xtislIC1M=";
@ -49,10 +51,12 @@ in buildGo118Module rec {
cp vendor/go.mod ./ cp vendor/go.mod ./
''; '';
meta = with lib; { meta = with prev.lib; {
homepage = "https://caddyserver.com"; homepage = "https://caddyserver.com";
description = "Fast, cross-platform HTTP/2 web server with automatic HTTPS"; description =
"Fast, cross-platform HTTP/2 web server with automatic HTTPS";
license = licenses.asl20; license = licenses.asl20;
maintainers = with maintainers; [ Br1ght0ne techknowlogick ]; maintainers = with maintainers; [ Br1ght0ne techknowlogick ];
}; };
};
} }

17
overlays/mpv-scripts.nix Normal file
View File

@ -0,0 +1,17 @@
_final: prev: inputs: {
mpvScripts = prev.mpvScripts // {
# Delete current file after quitting
mpv-delete-file = prev.stdenv.mkDerivation rec {
pname = "mpv-delete-file";
version = "0.1"; # made-up
src = inputs.zenyd-mpv-scripts + "/delete_file.lua";
dontBuild = true;
dontUnpack = true;
installPhase =
"install -Dm644 ${src} $out/share/mpv/scripts/delete_file.lua";
passthru.scriptName = "delete_file.lua";
};
};
}

View File

@ -19,22 +19,20 @@ in {
nil = inputs.nil.packages.${prev.system}.nil; nil = inputs.nil.packages.${prev.system}.nil;
vscode-terraform-snippets = inputs.vscode-terraform-snippets; vscode-terraform-snippets = inputs.vscode-terraform-snippets;
nvim-lspconfig = nvim-lspconfig = withSrc prev.vimPlugins.nvim-lspconfig inputs.nvim-lspconfig;
(withSrc prev.vimPlugins.nvim-lspconfig inputs.nvim-lspconfig); cmp-nvim-lsp = withSrc prev.vimPlugins.cmp-nvim-lsp inputs.cmp-nvim-lsp;
cmp-nvim-lsp = (withSrc prev.vimPlugins.cmp-nvim-lsp inputs.cmp-nvim-lsp); null-ls-nvim = withSrc prev.vimPlugins.null-ls-nvim inputs.null-ls-nvim;
null-ls-nvim = (withSrc prev.vimPlugins.null-ls-nvim inputs.null-ls-nvim); comment-nvim = withSrc prev.vimPlugins.comment-nvim inputs.comment-nvim;
comment-nvim = (withSrc prev.vimPlugins.comment-nvim inputs.comment-nvim);
nvim-treesitter = nvim-treesitter =
(withSrc prev.vimPlugins.nvim-treesitter inputs.nvim-treesitter); withSrc prev.vimPlugins.nvim-treesitter inputs.nvim-treesitter;
telescope-nvim = telescope-nvim = withSrc prev.vimPlugins.telescope-nvim inputs.telescope-nvim;
(withSrc prev.vimPlugins.telescope-nvim inputs.telescope-nvim); telescope-project-nvim = withSrc prev.vimPlugins.telescope-project-nvim
telescope-project-nvim = (withSrc prev.vimPlugins.telescope-project-nvim inputs.telescope-project-nvim;
inputs.telescope-project-nvim);
toggleterm-nvim = toggleterm-nvim =
(withSrc prev.vimPlugins.toggleterm-nvim inputs.toggleterm-nvim); withSrc prev.vimPlugins.toggleterm-nvim inputs.toggleterm-nvim;
bufferline-nvim = bufferline-nvim =
(withSrc prev.vimPlugins.bufferline-nvim inputs.bufferline-nvim); withSrc prev.vimPlugins.bufferline-nvim inputs.bufferline-nvim;
nvim-tree-lua = (withSrc prev.vimPlugins.nvim-tree-lua inputs.nvim-tree-lua); nvim-tree-lua = withSrc prev.vimPlugins.nvim-tree-lua inputs.nvim-tree-lua;
# Packaging plugins entirely with Nix # Packaging plugins entirely with Nix
baleia-nvim = plugin "baleia-nvim" inputs.baleia-nvim-src; baleia-nvim = plugin "baleia-nvim" inputs.baleia-nvim-src;

View File

@ -4,57 +4,29 @@ inputs: _final: prev: {
# Fix: bash highlighting doesn't work as of this commit: # Fix: bash highlighting doesn't work as of this commit:
# https://github.com/NixOS/nixpkgs/commit/49cce41b7c5f6b88570a482355d9655ca19c1029 # https://github.com/NixOS/nixpkgs/commit/49cce41b7c5f6b88570a482355d9655ca19c1029
tree-sitter-bash = prev.tree-sitter-grammars.tree-sitter-bash.overrideAttrs tree-sitter-bash = prev.tree-sitter-grammars.tree-sitter-bash.overrideAttrs
(old: { (old: { src = inputs.tree-sitter-bash; });
src = prev.fetchFromGitHub {
owner = "tree-sitter";
repo = "tree-sitter-bash";
rev = "493646764e7ad61ce63ce3b8c59ebeb37f71b841";
sha256 = "sha256-gl5F3IeZa2VqyH/qFj8ey2pRbGq4X8DL5wiyvRrH56U=";
};
});
# Fix: invalid node in position. Broken as of this commit (replaced with newer): # Fix: invalid node in position. Broken as of this commit (replaced with newer):
# https://github.com/NixOS/nixpkgs/commit/8ec3627796ecc899e6f47f5bf3c3220856ead9c5 # https://github.com/NixOS/nixpkgs/commit/8ec3627796ecc899e6f47f5bf3c3220856ead9c5
tree-sitter-python = tree-sitter-python =
prev.tree-sitter-grammars.tree-sitter-python.overrideAttrs (old: { prev.tree-sitter-grammars.tree-sitter-python.overrideAttrs
src = prev.fetchFromGitHub { (old: { src = inputs.tree-sitter-python; });
owner = "tree-sitter";
repo = "tree-sitter-python";
rev = "5af00f64af6bbf822f208243cce5cf75396fb6f5";
sha256 = "sha256-2btd/NRE6NuGNlx4cq535OrwtWXihiP3VMCJjPCiDOk=";
};
});
# Add grammars not in nixpks # Add grammars not in nixpks
tree-sitter-ini = prev.tree-sitter.buildGrammar { tree-sitter-ini = prev.tree-sitter.buildGrammar {
language = "ini"; language = "ini";
version = "1.0.0"; version = "1.0.0";
src = prev.fetchFromGitHub { src = inputs.tree-sitter-ini;
owner = "justinmk";
repo = "tree-sitter-ini";
rev = "1a0ce072ebf3afac7d5603d9a95bb7c9a6709b44";
sha256 = "sha256-pPtKokpTgjoNzPW4dRkOnyzBBJFeJj3+CW3LbHSKsmU=";
};
}; };
tree-sitter-puppet = prev.tree-sitter.buildGrammar { tree-sitter-puppet = prev.tree-sitter.buildGrammar {
language = "puppet"; language = "puppet";
version = "1.0.0"; version = "1.0.0";
src = prev.fetchFromGitHub { src = inputs.tree-sitter-puppet;
owner = "amaanq";
repo = "tree-sitter-puppet";
rev = "v1.0.0";
sha256 = "sha256-vk5VJZ9zW2bBuc+DM+fwFyhM1htZGeLlmkjMAH66jBA=";
};
}; };
tree-sitter-rasi = prev.tree-sitter.buildGrammar { tree-sitter-rasi = prev.tree-sitter.buildGrammar {
language = "rasi"; language = "rasi";
version = "0.1.1"; version = "0.1.1";
src = prev.fetchFromGitHub { src = inputs.tree-sitter-rasi;
owner = "Fymyte";
repo = "tree-sitter-rasi";
rev = "371dac6bcce0df5566c1cfebde69d90ecbeefd2d";
sha256 = "sha256-2nYZoLcrxxxiOJEySwHUm93lzMg8mU+V7LIP63ntFdA=";
};
}; };
}; };