From: Ismaƫl Bouya Date: Fri, 26 Apr 2019 11:52:30 +0000 (+0200) Subject: Use overlays for package overrides X-Git-Tag: nur_publish~102 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=676e68e3394eeb07a02745d1cf191db9fee9e610;p=perso%2FImmae%2FConfig%2FNix.git Use overlays for package overrides --- diff --git a/default.nix b/default.nix index ae3b2b7..1bac63e 100644 --- a/default.nix +++ b/default.nix @@ -1,178 +1,59 @@ -with import {}; -with import ./libs.nix { nixpkgs = import {}; }; -let - mypkgs = {}; - - mypkgs.taskwarrior = taskwarrior.overrideAttrs (old: rec { - postInstall = ''${old.postInstall} - mkdir -p "$out/share/vim/vimfiles/ftdetect" - mkdir -p "$out/share/vim/vimfiles/syntax" - ln -s "../../../../share/doc/task/scripts/vim/ftdetect/task.vim" "$out/share/vim/vimfiles/ftdetect/" - ln -s "../../../../share/doc/task/scripts/vim/syntax/taskrc.vim" "$out/share/vim/vimfiles/syntax/" - ln -s "../../../../share/doc/task/scripts/vim/syntax/taskdata.vim" "$out/share/vim/vimfiles/syntax/" - ln -s "../../../../share/doc/task/scripts/vim/syntax/taskedit.vim" "$out/share/vim/vimfiles/syntax/" - ''; - }); - - mypkgs.vit = (vit.override { taskwarrior = mypkgs.taskwarrior; }).overrideAttrs (old: - fetchedGithub ./fetched/vit.json // { - buildInputs = old.buildInputs ++ [perlPackages.TryTiny perlPackages.TextCharWidth]; - } - ); - - mypkgs.weboob = (pythonPackages.weboob.overridePythonAttrs { - setupPyBuildFlags = [ "--no-qt" "--xdg" ]; - }).overrideAttrs (old: rec { - version = "1.5"; - src = fetchurl { - url = "https://git.weboob.org/weboob/weboob/-/archive/${version}/${old.pname}-${version}.tar.gz"; - sha256 = "0l6q5nm5g0zn6gmf809059kddrbds27wgygxsfkqja9blks5vq7z"; - }; - postInstall = ''${old.postInstall or ""} - mkdir -p $out/share/bash-completion/completions/ - cp tools/weboob_bash_completion $out/share/bash-completion/completions/weboob - ''; - }); - - mypkgs.slrn = slrn.overrideAttrs (old: rec { - version = "1.0.3a"; - name = "slrn-${version}"; - src = fetchurl { - url = "http://www.jedsoft.org/releases/slrn/slrn-${version}.tar.bz2"; - sha256 = "1b1d9iikr60w0vq86y9a0l4gjl0jxhdznlrdp3r405i097as9a1v"; +with import { overlays = builtins.attrValues (import ./overlays); }; +with mylibs; + # https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh + # https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks + { + boinctui = callPackage ./pkgs/boinctui {}; + cnagios = callPackage ./pkgs/cnagios { inherit fetchedGithub; }; + duply = callPackage ./pkgs/duply {}; + flrn = callPackage ./pkgs/flrn { + slang = callPackage ./pkgs/slang_1 {}; + inherit fetchedGithub; }; - configureFlags = old.configureFlags ++ [ "--with-slrnpull" ]; - }); - - mypkgs.ldapvi = ldapvi.overrideAttrs (old: fetchedGit ./fetched/ldapvi.json); - - nixos = import ./nixos_tools.nix {}; - - mypkgs.pass = (pass.withExtensions (exts: [ exts.pass-otp ])).overrideAttrs (old: - fetchedGit ./fetched/pass.json // { - patches = old.patches ++ [ ./patches/pass-fix-pass-init.patch ]; - } - ); - - mypkgs.profanity = (profanity.override { - notifySupport = true; - inherit libnotify gpgme gdk_pixbuf; - python = python3; - }).overrideAttrs (old: rec { - configureFlags = old.configureFlags ++ [ "--enable-plugins" ]; - }); - - mypkgs.weechat = weechat.override { - configure = { availablePlugins, ... }: { - plugins = with availablePlugins; [ - # Make sure websocket_client is not 0.55.0, it provokes - # regular crashes - (python.withPackages (ps: with ps; [websocket_client emoji])) - perl - ruby - ]; + genius = callPackage ./pkgs/genius {}; + mtop = callPackage ./pkgs/mtop {}; + muttprint = callPackage ./pkgs/muttprint {}; + mutt-ics = callPackage ./pkgs/mutt-ics { inherit fetchedGithub; }; + nagios-cli = callPackage ./pkgs/nagios-cli { inherit fetchedGithub; }; + #nagnu = callPackage ./pkgs/nagnu { inherit fetchedGithub; }; + note = callPackage ./pkgs/note {}; + notmuch-python2 = callPackage ./pkgs/notmuch/notmuch-python { pythonPackages = python2Packages; }; + notmuch-python3 = callPackage ./pkgs/notmuch/notmuch-python { pythonPackages = python3Packages; }; + notmuch-vim = callPackage ./pkgs/notmuch/notmuch-vim {}; + pg_activity = callPackage ./pkgs/pg_activity { inherit fetchedGithub; }; + pgloader = callPackage ./pkgs/pgloader { inherit fetchedGithub; }; + telegram-cli = callPackage ./pkgs/telegram-cli { inherit fetchedGithub; }; + telegram-history-dump = callPackage ./pkgs/telegram-history-dump { inherit fetchedGithub; }; + telegramircd = callPackage ./pkgs/telegramircd { + telethon = callPackage ./pkgs/telethon_sync {}; + inherit fetchedGithub; }; - }; - - mypkgs.boinctui = callPackage ./pkgs/boinctui {}; - mypkgs.cnagios = callPackage ./pkgs/cnagios { inherit fetchedGithub; }; - mypkgs.duply = callPackage ./pkgs/duply {}; - mypkgs.flrn = callPackage ./pkgs/flrn { - slang = callPackage ./pkgs/slang_1 {}; - inherit fetchedGithub; - }; - mypkgs.genius = callPackage ./pkgs/genius {}; - mypkgs.mtop = callPackage ./pkgs/mtop {}; - mypkgs.muttprint = callPackage ./pkgs/muttprint {}; - mypkgs.mutt-ics = callPackage ./pkgs/mutt-ics { inherit fetchedGithub; }; - mypkgs.nagios-cli = callPackage ./pkgs/nagios-cli { inherit fetchedGithub; }; - #mypkgs.nagnu = callPackage ./pkgs/nagnu { inherit fetchedGithub; }; - mypkgs.note = callPackage ./pkgs/note {}; - mypkgs.notmuch-python2 = callPackage ./pkgs/notmuch/notmuch-python { pythonPackages = python2Packages; }; - mypkgs.notmuch-python3 = callPackage ./pkgs/notmuch/notmuch-python { pythonPackages = python3Packages; }; - mypkgs.notmuch-vim = callPackage ./pkgs/notmuch/notmuch-vim {}; - mypkgs.pg_activity = callPackage ./pkgs/pg_activity { inherit fetchedGithub; }; - mypkgs.pgloader = callPackage ./pkgs/pgloader { inherit fetchedGithub; }; - mypkgs.telegram-cli = callPackage ./pkgs/telegram-cli { inherit fetchedGithub; }; - mypkgs.telegram-history-dump = callPackage ./pkgs/telegram-history-dump { inherit fetchedGithub; }; - mypkgs.telegramircd = callPackage ./pkgs/telegramircd { - telethon = callPackage ./pkgs/telethon_sync {}; - inherit fetchedGithub; - }; - mypkgs.terminal-velocity = callPackage ./pkgs/terminal-velocity {}; - mypkgs.tiv = callPackage ./pkgs/tiv {}; - mypkgs.unicode = callPackage ./pkgs/unicode {}; - - mypkgs.cardano = callPackage ./pkgs/crypto/cardano { inherit fetchedGithub; }; - mypkgs.iota-cli-app = callPackage ./pkgs/crypto/iota-cli-app { inherit fetchedGithub; }; - mypkgs.sia = callPackage ./pkgs/crypto/sia {}; - - mypkgs.pelican = python3Packages.pelican.overrideAttrs(old: fetchedGithub ./fetched/pelican.json // rec { - propagatedBuildInputs = old.propagatedBuildInputs ++ [ python3Packages.pyyaml ]; - }); - - mypkgs.elinks = elinks.overrideAttrs (old: - fetchedGithub ./fetched/elinks.json // rec { - preConfigure = ''sh autogen.sh''; - buildInputs = old.buildInputs ++ [ gettext automake autoconf ]; - configureFlags = [ - "--disable-smb" "--without-x" "--enable-cgi" - "--enable-leds" "--enable-256-colors" - "--enable-html-highlight" "--with-zlib" - ]; - patches = []; - } - ); - - mypkgs.neomutt = neomutt.overrideAttrs (old: - rec { - buildInputs = old.buildInputs ++ [ gdbm ]; - configureFlags = old.configureFlags ++ [ "--gdbm" ]; - } - ); - - mypkgs.goaccess = goaccess.overrideAttrs(old: rec { - name = "goaccess-${version}"; - version = "1.3"; - src = fetchurl { - url = "https://tar.goaccess.io/${name}.tar.gz"; - sha256 = "16vv3pj7pbraq173wlxa89jjsd279004j4kgzlrsk1dz4if5qxwc"; - }; - configureFlags = old.configureFlags ++ [ "--enable-tcb=btree" ]; - buildInputs = old.buildInputs ++ [ tokyocabinet bzip2 ]; - }); - - mypkgs.yarn2nix = yarn2nixPackage.yarn2nix; - - - mypkgs.sc-im = sc-im.overrideAttrs (old: { - buildPhase = '' - cd src - sed -i Makefile -e 's@\...name.info@.local/state/$(name)info@' - cd .. - '' + old.buildPhase; - }); - - mypkgs.lesspipe = lesspipe.overrideAttrs(old: { - configureFlags = (old.configureFlags or []) ++ [ "--yes" ]; - }); - - - mypkgs.dwm = dwm.overrideAttrs(old: rec { - postPatch = '' - cp ${./patches/dwm_config.h} ./config.h - ''; - }); - - mypkgs.nixops = nixops.overrideAttrs (old: { - preConfigure = (old.preConfigure or "") + '' - sed -i -e "/'keyFile'/s/'path'/'string'/" nixops/backends/__init__.py - ''; - }); -# https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh -# https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks -in - mypkgs // { + terminal-velocity = callPackage ./pkgs/terminal-velocity {}; + tiv = callPackage ./pkgs/tiv {}; + unicode = callPackage ./pkgs/unicode {}; + + cardano = callPackage ./pkgs/crypto/cardano { inherit fetchedGithub; }; + iota-cli-app = callPackage ./pkgs/crypto/iota-cli-app { inherit fetchedGithub; }; + sia = callPackage ./pkgs/crypto/sia {}; + } // { # overlays + inherit weboob; + inherit taskwarrior; + inherit slrn; + inherit sc-im; + inherit lesspipe; + inherit neomutt; + inherit weechat; + inherit goaccess; + inherit profanity; + inherit nixops; + inherit dwm; + inherit vit; + inherit pass; + inherit elinks; + inherit pelican; + inherit ldapvi; + inherit (mylibs.yarn2nixPackage) yarn2nix; + } // { inherit nix-prefetch-scripts; inherit nix-generate-from-cpan; inherit timewarrior; @@ -222,7 +103,6 @@ in inherit lzo unzip bzip2 p7zip xz; # unrar is unfree inherit tig; - #inherit nixos; inherit emacs26-nox; inherit highlight sourceHighlight; pygmentize = python3Packages.pygments; diff --git a/fetched/ledger.json b/fetched/ledger.json deleted file mode 100644 index 6ea613b..0000000 --- a/fetched/ledger.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "tag": "7567fb7-next", - "meta": { - "name": "ledger", - "url": "https://github.com/ledger/ledger", - "branch": "next" - }, - "github": { - "owner": "ledger", - "repo": "ledger", - "rev": "7567fb7595c9937088abec6caaf7b59f8e2e772a", - "sha256": "07482bvd0mnvaad116cjlmg3ls6bg0ksy23gc99lmyz35nbf25v1", - "fetchSubmodules": true - } -} diff --git a/fetched/stgit.json b/fetched/stgit.json deleted file mode 100644 index 4b9575e..0000000 --- a/fetched/stgit.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "tag": "v0.19", - "meta": { - "name": "stgit", - "url": "https://github.com/ctmarinas/stgit", - "branch": "refs/tags/v0.19" - }, - "github": { - "owner": "ctmarinas", - "repo": "stgit", - "rev": "ac22e13b123f5aff693926c995bb29cf7c114c2b", - "sha256": "1dzl6cnyzwbzysp82x7w1yc03g25kwan3h0zpnzhhfhg6c904sis", - "fetchSubmodules": true - } -} diff --git a/overlays/default.nix b/overlays/default.nix new file mode 100644 index 0000000..a2d9927 --- /dev/null +++ b/overlays/default.nix @@ -0,0 +1,20 @@ +{ + mylibs = self: super: { mylibs = import ../libs.nix { nixpkgs = self; }; }; + + dwm = import ./dwm; + elinks = import ./elinks; + goaccess = import ./goaccess; + ldapvi = import ./ldapvi; + lesspipe = import ./lesspipe; + neomutt = import ./neomutt; + nixops = import ./nixops; + pass = import ./pass; + pelican = import ./pelican; + profanity = import ./profanity; + sc-im = import ./sc-im; + slrn = import ./slrn; + taskwarrior = import ./taskwarrior; + vit = import ./vit; + weboob = import ./weboob; + weechat = import ./weechat; +} diff --git a/overlays/dwm/default.nix b/overlays/dwm/default.nix new file mode 100644 index 0000000..96ed3ff --- /dev/null +++ b/overlays/dwm/default.nix @@ -0,0 +1,7 @@ +self: super: { + dwm = super.dwm.overrideAttrs(old: rec { + postPatch = '' + cp ${./dwm_config.h} ./config.h + ''; + }); +} diff --git a/patches/dwm_config.h b/overlays/dwm/dwm_config.h similarity index 100% rename from patches/dwm_config.h rename to overlays/dwm/dwm_config.h diff --git a/overlays/elinks/default.nix b/overlays/elinks/default.nix new file mode 100644 index 0000000..1744dc0 --- /dev/null +++ b/overlays/elinks/default.nix @@ -0,0 +1,14 @@ +self: super: { + elinks = super.elinks.overrideAttrs (old: + self.mylibs.fetchedGithub ./elinks.json // rec { + preConfigure = ''sh autogen.sh''; + buildInputs = old.buildInputs ++ (with self; [ gettext automake autoconf ]); + configureFlags = [ + "--disable-smb" "--without-x" "--enable-cgi" + "--enable-leds" "--enable-256-colors" + "--enable-html-highlight" "--with-zlib" + ]; + patches = []; + } + ); +} diff --git a/fetched/elinks.json b/overlays/elinks/elinks.json similarity index 100% rename from fetched/elinks.json rename to overlays/elinks/elinks.json diff --git a/overlays/goaccess/default.nix b/overlays/goaccess/default.nix new file mode 100644 index 0000000..12b28f3 --- /dev/null +++ b/overlays/goaccess/default.nix @@ -0,0 +1,13 @@ +self: super: { + goaccess = super.goaccess.overrideAttrs(old: rec { + name = "goaccess-${version}"; + version = "1.3"; + src = self.fetchurl { + url = "https://tar.goaccess.io/${name}.tar.gz"; + sha256 = "16vv3pj7pbraq173wlxa89jjsd279004j4kgzlrsk1dz4if5qxwc"; + }; + configureFlags = old.configureFlags ++ [ "--enable-tcb=btree" ]; + buildInputs = old.buildInputs ++ [ self.tokyocabinet self.bzip2 ]; + }); + +} diff --git a/overlays/ldapvi/default.nix b/overlays/ldapvi/default.nix new file mode 100644 index 0000000..030e676 --- /dev/null +++ b/overlays/ldapvi/default.nix @@ -0,0 +1,3 @@ +self: super: { + ldapvi = super.ldapvi.overrideAttrs (old: self.mylibs.fetchedGit ./ldapvi.json); +} diff --git a/fetched/ldapvi.json b/overlays/ldapvi/ldapvi.json similarity index 100% rename from fetched/ldapvi.json rename to overlays/ldapvi/ldapvi.json diff --git a/overlays/lesspipe/default.nix b/overlays/lesspipe/default.nix new file mode 100644 index 0000000..e53feae --- /dev/null +++ b/overlays/lesspipe/default.nix @@ -0,0 +1,5 @@ +self: super: { + lesspipe = super.lesspipe.overrideAttrs(old: { + configureFlags = (old.configureFlags or []) ++ [ "--yes" ]; + }); +} diff --git a/overlays/neomutt/default.nix b/overlays/neomutt/default.nix new file mode 100644 index 0000000..c8578c9 --- /dev/null +++ b/overlays/neomutt/default.nix @@ -0,0 +1,8 @@ +self: super: { + neomutt = super.neomutt.overrideAttrs (old: + { + buildInputs = old.buildInputs ++ [ self.gdbm ]; + configureFlags = old.configureFlags ++ [ "--gdbm" ]; + } + ); +} diff --git a/overlays/nixops/default.nix b/overlays/nixops/default.nix new file mode 100644 index 0000000..eb29ecd --- /dev/null +++ b/overlays/nixops/default.nix @@ -0,0 +1,7 @@ +self: super: { + nixops = super.nixops.overrideAttrs (old: { + preConfigure = (old.preConfigure or "") + '' + sed -i -e "/'keyFile'/s/'path'/'string'/" nixops/backends/__init__.py + ''; + }); +} diff --git a/overlays/pass/default.nix b/overlays/pass/default.nix new file mode 100644 index 0000000..df42cf1 --- /dev/null +++ b/overlays/pass/default.nix @@ -0,0 +1,8 @@ +self: super: { + pass = (super.pass.withExtensions (exts: [ exts.pass-otp ])).overrideAttrs (old: + self.mylibs.fetchedGit ./pass.json // { + patches = old.patches ++ [ ./pass-fix-pass-init.patch ]; + } + ); + +} diff --git a/patches/pass-fix-pass-init.patch b/overlays/pass/pass-fix-pass-init.patch similarity index 100% rename from patches/pass-fix-pass-init.patch rename to overlays/pass/pass-fix-pass-init.patch diff --git a/fetched/pass.json b/overlays/pass/pass.json similarity index 100% rename from fetched/pass.json rename to overlays/pass/pass.json diff --git a/overlays/pelican/default.nix b/overlays/pelican/default.nix new file mode 100644 index 0000000..5f60b8f --- /dev/null +++ b/overlays/pelican/default.nix @@ -0,0 +1,6 @@ +self: super: { + pelican = with self.python3Packages; + pelican.overrideAttrs(old: self.mylibs.fetchedGithub ./pelican.json // { + propagatedBuildInputs = old.propagatedBuildInputs ++ [ pyyaml ]; + }); +} diff --git a/fetched/pelican.json b/overlays/pelican/pelican.json similarity index 100% rename from fetched/pelican.json rename to overlays/pelican/pelican.json diff --git a/overlays/profanity/default.nix b/overlays/profanity/default.nix new file mode 100644 index 0000000..33861f1 --- /dev/null +++ b/overlays/profanity/default.nix @@ -0,0 +1,9 @@ +self: super: { + profanity = (super.profanity.override { + notifySupport = true; + inherit (self) libnotify gpgme gdk_pixbuf; + python = self.python3; + }).overrideAttrs (old: rec { + configureFlags = old.configureFlags ++ [ "--enable-plugins" ]; + }); +} diff --git a/overlays/sc-im/default.nix b/overlays/sc-im/default.nix new file mode 100644 index 0000000..f728655 --- /dev/null +++ b/overlays/sc-im/default.nix @@ -0,0 +1,9 @@ +self: super: { + sc-im = super.sc-im.overrideAttrs (old: { + buildPhase = '' + cd src + sed -i Makefile -e 's@\...name.info@.local/state/$(name)info@' + cd .. + '' + old.buildPhase; + }); +} diff --git a/overlays/slrn/default.nix b/overlays/slrn/default.nix new file mode 100644 index 0000000..6caef55 --- /dev/null +++ b/overlays/slrn/default.nix @@ -0,0 +1,11 @@ +self: super: { + slrn = super.slrn.overrideAttrs (old: rec { + version = "1.0.3a"; + name = "slrn-${version}"; + src = self.fetchurl { + url = "http://www.jedsoft.org/releases/slrn/slrn-${version}.tar.bz2"; + sha256 = "1b1d9iikr60w0vq86y9a0l4gjl0jxhdznlrdp3r405i097as9a1v"; + }; + configureFlags = old.configureFlags ++ [ "--with-slrnpull" ]; + }); +} diff --git a/overlays/taskwarrior/default.nix b/overlays/taskwarrior/default.nix new file mode 100644 index 0000000..64ea690 --- /dev/null +++ b/overlays/taskwarrior/default.nix @@ -0,0 +1,13 @@ +self: super: +{ + taskwarrior = super.taskwarrior.overrideAttrs (old: { + postInstall = ''${old.postInstall} + mkdir -p "$out/share/vim/vimfiles/ftdetect" + mkdir -p "$out/share/vim/vimfiles/syntax" + ln -s "../../../../share/doc/task/scripts/vim/ftdetect/task.vim" "$out/share/vim/vimfiles/ftdetect/" + ln -s "../../../../share/doc/task/scripts/vim/syntax/taskrc.vim" "$out/share/vim/vimfiles/syntax/" + ln -s "../../../../share/doc/task/scripts/vim/syntax/taskdata.vim" "$out/share/vim/vimfiles/syntax/" + ln -s "../../../../share/doc/task/scripts/vim/syntax/taskedit.vim" "$out/share/vim/vimfiles/syntax/" + ''; + }); +} diff --git a/overlays/vit/default.nix b/overlays/vit/default.nix new file mode 100644 index 0000000..4624284 --- /dev/null +++ b/overlays/vit/default.nix @@ -0,0 +1,8 @@ +self: super: +{ + vit = (super.vit.override { inherit (self) taskwarrior; }).overrideAttrs (old: + self.mylibs.fetchedGithub ./vit.json // { + buildInputs = old.buildInputs ++ (with self.perlPackages; [ TryTiny TextCharWidth ]); + } + ); +} diff --git a/fetched/vit.json b/overlays/vit/vit.json similarity index 100% rename from fetched/vit.json rename to overlays/vit/vit.json diff --git a/overlays/weboob/default.nix b/overlays/weboob/default.nix new file mode 100644 index 0000000..d0a15a7 --- /dev/null +++ b/overlays/weboob/default.nix @@ -0,0 +1,15 @@ +self: super: { + weboob = (self.pythonPackages.weboob.overridePythonAttrs { + setupPyBuildFlags = [ "--no-qt" "--xdg" ]; + }).overrideAttrs (old: rec { + version = "1.5"; + src = self.fetchurl { + url = "https://git.weboob.org/weboob/weboob/-/archive/${version}/${old.pname}-${version}.tar.gz"; + sha256 = "0l6q5nm5g0zn6gmf809059kddrbds27wgygxsfkqja9blks5vq7z"; + }; + postInstall = ''${old.postInstall or ""} + mkdir -p $out/share/bash-completion/completions/ + cp tools/weboob_bash_completion $out/share/bash-completion/completions/weboob + ''; + }); +} diff --git a/overlays/weechat/default.nix b/overlays/weechat/default.nix new file mode 100644 index 0000000..07c6d89 --- /dev/null +++ b/overlays/weechat/default.nix @@ -0,0 +1,14 @@ +self: super: { + weechat = super.weechat.override { + configure = { availablePlugins, ... }: { + plugins = with self; with availablePlugins; [ + # Make sure websocket_client is not 0.55.0, it provokes + # regular crashes + (python.withPackages (ps: with ps; [websocket_client emoji])) + perl + ruby + ]; + }; + }; + +}