From 75a4e09f1d241f7882a86d7f9c4aa1804a981209 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 28 Apr 2024 23:21:11 +0200 Subject: move overlays to root folder --- flake.nix | 6 +--- overlays/cgit-pink/default.nix | 5 ++++ overlays/cgit-pink/set-default-branch-main.patch | 26 +++++++++++++++++ overlays/emacs.nix | 4 +++ overlays/extra-packages.nix | 36 ++++++++++++++++++++++++ overlays/firefox.nix | 4 +++ overlays/htmlformat/default.nix | 3 ++ overlays/htmlformat/htmlformat.nix | 28 ++++++++++++++++++ overlays/rofi.nix | 7 +++++ packages/htmlformat/default.nix | 28 ------------------ patches/cgit-pink.patch | 26 ----------------- system/linde.nix | 7 ----- system/nanopi.nix | 1 - user/overlays/extra-packages.nix | 22 --------------- user/settings/development/web.nix | 2 +- user/settings/nix.nix | 3 -- user/settings/nixpkgs.nix | 6 ---- user/settings/rofi.nix | 9 ------ 18 files changed, 115 insertions(+), 108 deletions(-) create mode 100644 overlays/cgit-pink/default.nix create mode 100644 overlays/cgit-pink/set-default-branch-main.patch create mode 100644 overlays/emacs.nix create mode 100644 overlays/extra-packages.nix create mode 100644 overlays/firefox.nix create mode 100644 overlays/htmlformat/default.nix create mode 100644 overlays/htmlformat/htmlformat.nix create mode 100644 overlays/rofi.nix delete mode 100644 packages/htmlformat/default.nix delete mode 100644 patches/cgit-pink.patch delete mode 100644 user/overlays/extra-packages.nix diff --git a/flake.nix b/flake.nix index 8f5a7d36..ed8ccc47 100644 --- a/flake.nix +++ b/flake.nix @@ -50,11 +50,7 @@ }; in { - overlays.default = final: prev: { - self = { - htmlformat = final.callPackage ./packages/htmlformat { }; - }; - }; + overlays.default = import ./overlays/htmlformat; nixosConfigurations.prefect = nixpkgs.lib.nixosSystem { system = utils.lib.system.x86_64-linux; diff --git a/overlays/cgit-pink/default.nix b/overlays/cgit-pink/default.nix new file mode 100644 index 00000000..ba62b718 --- /dev/null +++ b/overlays/cgit-pink/default.nix @@ -0,0 +1,5 @@ +self: super: { + cgit-pink = super.cgit-pink.overrideAttrs (old: { + patches = [ ./cgit-pink.patch ]; + }); +} diff --git a/overlays/cgit-pink/set-default-branch-main.patch b/overlays/cgit-pink/set-default-branch-main.patch new file mode 100644 index 00000000..0e91525e --- /dev/null +++ b/overlays/cgit-pink/set-default-branch-main.patch @@ -0,0 +1,26 @@ +diff --git a/cgit.c b/cgit.c +index dd28a79..451f518 100644 +--- a/cgit.c ++++ b/cgit.c +@@ -489,7 +489,7 @@ static char *guess_defbranch(void) + + ref = resolve_ref_unsafe("HEAD", 0, &oid, NULL); + if (!ref || !skip_prefix(ref, "refs/heads/", &refname)) +- return "master"; ++ return "main"; + return xstrdup(refname); + } + +diff --git a/ui-repolist.c b/ui-repolist.c +index 97b11c5..cde9cd0 100644 +--- a/ui-repolist.c ++++ b/ui-repolist.c +@@ -53,7 +53,7 @@ static int get_repo_modtime(const struct cgit_repo *repo, time_t *mtime) + + strbuf_reset(&path); + strbuf_addf(&path, "%s/refs/heads/%s", repo->path, +- repo->defbranch ? repo->defbranch : "master"); ++ repo->defbranch ? repo->defbranch : "main"); + if (stat(path.buf, &s) == 0) { + *mtime = s.st_mtime; + r->mtime = *mtime; diff --git a/overlays/emacs.nix b/overlays/emacs.nix new file mode 100644 index 00000000..679e9a1d --- /dev/null +++ b/overlays/emacs.nix @@ -0,0 +1,4 @@ +let + sources = import ../nix/sources.nix; +in +import sources.emacs-overlay diff --git a/overlays/extra-packages.nix b/overlays/extra-packages.nix new file mode 100644 index 00000000..d0717756 --- /dev/null +++ b/overlays/extra-packages.nix @@ -0,0 +1,36 @@ +self: super: { + emacsPackagesFor = emacs: ( + (super.emacsPackagesFor emacs).overrideScope ( + eself: esuper: + esuper // { + tabnine-capf = super.callPackage ../packages/tabnine-capf.nix { + inherit eself; + }; + } + ) + ); + vimPlugins = super.vimPlugins.extend (final: prev: { + coc-tabnine = + let + inherit (super) tabnine; + in + prev.coc-tabnine.overrideAttrs { + buildInputs = [ tabnine ]; + + postFixup = '' + mkdir -p $target/binaries/${tabnine.version} + ln -s ${tabnine}/bin/ $target/binaries/${tabnine.version}/${tabnine.passthru.platform} + ''; + }; + }); + enchant = super.enchant.overrideAttrs (old: { + configureFlags = old.configureFlags ++ [ "--without-hspell" ] + # builtins.filter (c: c != "--with-hspell") old.configureFlags + ++ self.lib.optional super.stdenv.isDarwin "--with-applespell" + ; + buildInputs = + builtins.filter (c: c.name != "hspell") old.buildInputs + ++ self.lib.optionals super.stdenv.isDarwin (with super.darwin.apple_sdk.frameworks; [ Cocoa ]); + propagatedBuildInputs = builtins.filter (c: c.name != "hspell") old.propagatedBuildInputs; + }); +} diff --git a/overlays/firefox.nix b/overlays/firefox.nix new file mode 100644 index 00000000..b3b346bf --- /dev/null +++ b/overlays/firefox.nix @@ -0,0 +1,4 @@ +self: super: { + firefox-bin-unwrapped = super.firefox-bin-unwrapped.override { systemLocale = "en-GB"; }; + firefox-devedition-bin-unwrapped = super.firefox-devedition-bin-unwrapped.override { systemLocale = "en-GB"; }; +} diff --git a/overlays/htmlformat/default.nix b/overlays/htmlformat/default.nix new file mode 100644 index 00000000..93292c76 --- /dev/null +++ b/overlays/htmlformat/default.nix @@ -0,0 +1,3 @@ +self: super: { + htmlformat = super.callPackage ./htmlformat.nix { }; +} diff --git a/overlays/htmlformat/htmlformat.nix b/overlays/htmlformat/htmlformat.nix new file mode 100644 index 00000000..aa124ee5 --- /dev/null +++ b/overlays/htmlformat/htmlformat.nix @@ -0,0 +1,28 @@ +{ lib +, buildGoModule +, fetchFromGitHub +}: + +buildGoModule rec { + pname = "htmlformat"; + version = "unstable-2023-11-08"; + + src = fetchFromGitHub { + owner = "a-h"; + repo = "htmlformat"; + rev = "5bd994fe268e4d505a9793143fa85414c7d50887"; + hash = "sha256-YSl9GsXhc0L2oKGZLwwjUtpe5W6ra6kk74zvQdsDCMU="; + }; + + vendorHash = "sha256-uVfh1pPhfj6AyQDqFd1EDWshuyDRvbMDZj3SN5tCS2w="; + + ldflags = [ "-s" "-w" ]; + + meta = with lib; { + description = "Htmlformat"; + homepage = "https://github.com/a-h/htmlformat"; + license = licenses.mit; + maintainers = with maintainers; [ alanpearce ]; + mainProgram = "htmlformat"; + }; +} diff --git a/overlays/rofi.nix b/overlays/rofi.nix new file mode 100644 index 00000000..53efd0f8 --- /dev/null +++ b/overlays/rofi.nix @@ -0,0 +1,7 @@ +self: super: { + rofi = super.rofi.overrideAttrs (oldAttrs: rec { + postInstall = '' + ln $out/bin/rofi $out/bin/dmenu + ''; + }); +} diff --git a/packages/htmlformat/default.nix b/packages/htmlformat/default.nix deleted file mode 100644 index aa124ee5..00000000 --- a/packages/htmlformat/default.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ lib -, buildGoModule -, fetchFromGitHub -}: - -buildGoModule rec { - pname = "htmlformat"; - version = "unstable-2023-11-08"; - - src = fetchFromGitHub { - owner = "a-h"; - repo = "htmlformat"; - rev = "5bd994fe268e4d505a9793143fa85414c7d50887"; - hash = "sha256-YSl9GsXhc0L2oKGZLwwjUtpe5W6ra6kk74zvQdsDCMU="; - }; - - vendorHash = "sha256-uVfh1pPhfj6AyQDqFd1EDWshuyDRvbMDZj3SN5tCS2w="; - - ldflags = [ "-s" "-w" ]; - - meta = with lib; { - description = "Htmlformat"; - homepage = "https://github.com/a-h/htmlformat"; - license = licenses.mit; - maintainers = with maintainers; [ alanpearce ]; - mainProgram = "htmlformat"; - }; -} diff --git a/patches/cgit-pink.patch b/patches/cgit-pink.patch deleted file mode 100644 index 0e91525e..00000000 --- a/patches/cgit-pink.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/cgit.c b/cgit.c -index dd28a79..451f518 100644 ---- a/cgit.c -+++ b/cgit.c -@@ -489,7 +489,7 @@ static char *guess_defbranch(void) - - ref = resolve_ref_unsafe("HEAD", 0, &oid, NULL); - if (!ref || !skip_prefix(ref, "refs/heads/", &refname)) -- return "master"; -+ return "main"; - return xstrdup(refname); - } - -diff --git a/ui-repolist.c b/ui-repolist.c -index 97b11c5..cde9cd0 100644 ---- a/ui-repolist.c -+++ b/ui-repolist.c -@@ -53,7 +53,7 @@ static int get_repo_modtime(const struct cgit_repo *repo, time_t *mtime) - - strbuf_reset(&path); - strbuf_addf(&path, "%s/refs/heads/%s", repo->path, -- repo->defbranch ? repo->defbranch : "master"); -+ repo->defbranch ? repo->defbranch : "main"); - if (stat(path.buf, &s) == 0) { - *mtime = s.st_mtime; - r->mtime = *mtime; diff --git a/system/linde.nix b/system/linde.nix index 96ff92f8..7afdca9c 100644 --- a/system/linde.nix +++ b/system/linde.nix @@ -242,13 +242,6 @@ in nixpkgs = { config.allowUnfree = true; - overlays = [ - (self: super: { - cgit-pink = super.cgit-pink.overrideAttrs (old: { - patches = [ ../patches/cgit-pink.patch ]; - }); - }) - ]; }; programs.fish = { diff --git a/system/nanopi.nix b/system/nanopi.nix index 2d3551a4..3c4b4a0f 100755 --- a/system/nanopi.nix +++ b/system/nanopi.nix @@ -615,7 +615,6 @@ in }; }; nixpkgs.config.allowUnfree = true; - nixpkgs.overlays = [ ]; system.autoUpgrade = { enable = false; dates = "01:00"; diff --git a/user/overlays/extra-packages.nix b/user/overlays/extra-packages.nix deleted file mode 100644 index ebe4fb0c..00000000 --- a/user/overlays/extra-packages.nix +++ /dev/null @@ -1,22 +0,0 @@ -self: super: { - emacsPackagesFor = emacs: ( - (super.emacsPackagesFor emacs).overrideScope ( - eself: esuper: - esuper // { - tabnine-capf = super.callPackage ../packages/tabnine-capf.nix { - inherit eself; - }; - } - ) - ); - enchant = super.enchant.overrideAttrs (old: { - configureFlags = old.configureFlags ++ [ "--without-hspell" ] - # builtins.filter (c: c != "--with-hspell") old.configureFlags - ++ self.lib.optional super.stdenv.isDarwin "--with-applespell" - ; - buildInputs = - builtins.filter (c: c.name != "hspell") old.buildInputs - ++ self.lib.optionals super.stdenv.isDarwin (with super.darwin.apple_sdk.frameworks; [ Cocoa ]); - propagatedBuildInputs = builtins.filter (c: c.name != "hspell") old.propagatedBuildInputs; - }); -} diff --git a/user/settings/development/web.nix b/user/settings/development/web.nix index 1b1f53da..d7d0c2eb 100644 --- a/user/settings/development/web.nix +++ b/user/settings/development/web.nix @@ -10,7 +10,7 @@ prettier ] ++ (with pkgs; [ flyctl - self.htmlformat + htmlformat ]); home.shellAliases = { # 0.2.25 current completion command only affects `flyctl`, although `fly` is a link to `flyctl` diff --git a/user/settings/nix.nix b/user/settings/nix.nix index c24bb984..dd4ea824 100644 --- a/user/settings/nix.nix +++ b/user/settings/nix.nix @@ -27,9 +27,6 @@ in maintainers = [ "alanpearce" ]; nixpkgs = "builtins.getFlake \"nixpkgs\""; }; - nixpkgs.overlays = [ - (import ../overlays/extra-packages.nix) - ]; programs.emacs.extraPackages = epkgs: (with epkgs; [ nix-mode nix-update diff --git a/user/settings/nixpkgs.nix b/user/settings/nixpkgs.nix index 9f8af5c8..992f6742 100644 --- a/user/settings/nixpkgs.nix +++ b/user/settings/nixpkgs.nix @@ -10,10 +10,4 @@ in imports = [ ./nix.nix ]; - nixpkgs.overlays = [ - (self: super: { - firefox-bin-unwrapped = super.firefox-bin-unwrapped.override { systemLocale = "en-GB"; }; - firefox-devedition-bin-unwrapped = super.firefox-devedition-bin-unwrapped.override { systemLocale = "en-GB"; }; - }) - ]; } diff --git a/user/settings/rofi.nix b/user/settings/rofi.nix index c0c6990d..35d50a91 100644 --- a/user/settings/rofi.nix +++ b/user/settings/rofi.nix @@ -12,15 +12,6 @@ gui_if_available = false ''; - nixpkgs.overlays = [ - (self: super: { - rofi = super.rofi.overrideAttrs (oldAttrs: rec { - postInstall = '' - ln $out/bin/rofi $out/bin/dmenu - ''; - }); - }) - ]; programs.rofi = { enable = true; theme = "Arc"; -- cgit 1.4.1