diff options
author | Anderson Torres <torres.anderson.85@protonmail.com> | 2023-07-29 00:35:01 -0300 |
---|---|---|
committer | Anderson Torres <torres.anderson.85@protonmail.com> | 2023-08-05 14:36:24 +0000 |
commit | 9d5713843f65cd0dcf06d40dd34d8b1f2bd25da8 (patch) | |
tree | 952db2fa88424b92a3a1cbf99b0edd85666369d6 /pkgs/applications/editors/ed | |
parent | f8579c6c7291782f0ac19de28a77ca2343608771 (diff) |
ed: refactor
A crazy refactor that factors the sources to a separate file, in order to accomodate extra sources in parallel to the stable one.
Diffstat (limited to 'pkgs/applications/editors/ed')
-rw-r--r-- | pkgs/applications/editors/ed/default.nix | 55 | ||||
-rw-r--r-- | pkgs/applications/editors/ed/generic.nix | 30 | ||||
-rw-r--r-- | pkgs/applications/editors/ed/sources.nix | 34 |
3 files changed, 77 insertions, 42 deletions
diff --git a/pkgs/applications/editors/ed/default.nix b/pkgs/applications/editors/ed/default.nix index af6c8f7c6f8d5..cf27d772596f3 100644 --- a/pkgs/applications/editors/ed/default.nix +++ b/pkgs/applications/editors/ed/default.nix @@ -1,42 +1,13 @@ -{ lib, stdenv, fetchurl, lzip }: - -# Note: this package is used for bootstrapping fetchurl, and thus -# cannot use fetchpatch! All mutable patches (generated by GitHub or -# cgit) that are needed here should be included directly in Nixpkgs as -# files. - -stdenv.mkDerivation rec { - pname = "ed"; - version = "1.19"; - - src = fetchurl { - url = "mirror://gnu/ed/${pname}-${version}.tar.lz"; - hash = "sha256-zi8uXEJHkKqW0J2suT2bv9wLfrYknJy3U4RS6Ox3zUg="; - }; - - nativeBuildInputs = [ lzip ]; - - configureFlags = [ - "CC=${stdenv.cc.targetPrefix}cc" - ]; - - doCheck = true; - - meta = { - description = "An implementation of the standard Unix editor"; - longDescription = '' - GNU ed is a line-oriented text editor. It is used to create, - display, modify and otherwise manipulate text files, both - interactively and via shell scripts. A restricted version of ed, - red, can only edit files in the current directory and cannot - execute shell commands. Ed is the "standard" text editor in the - sense that it is the original editor for Unix, and thus widely - available. For most purposes, however, it is superseded by - full-screen editors such as GNU Emacs or GNU Moe. - ''; - license = lib.licenses.gpl3Plus; - homepage = "https://www.gnu.org/software/ed/"; - maintainers = [ ]; - platforms = lib.platforms.unix; - }; -} +{ lib, pkgs }: + +lib.makeScope pkgs.newScope (self: + let + inherit (self) callPackage; + in { + sources = import ./sources.nix { + inherit lib; + inherit (pkgs) fetchurl; + }; + + ed = callPackage (self.sources.ed) { }; + }) diff --git a/pkgs/applications/editors/ed/generic.nix b/pkgs/applications/editors/ed/generic.nix new file mode 100644 index 0000000000000..70ec6badf25ec --- /dev/null +++ b/pkgs/applications/editors/ed/generic.nix @@ -0,0 +1,30 @@ +{ pname +, version +, src +, patches ? [ ] +, meta +}: + +# Note: this package is used for bootstrapping fetchurl, and thus cannot use +# fetchpatch! All mutable patches (generated by GitHub or cgit) that are needed +# here should be included directly in Nixpkgs as files. + +{ lib +, stdenv +, fetchurl +, lzip +}: + +stdenv.mkDerivation { + inherit pname version src patches; + + nativeBuildInputs = [ lzip ]; + + configureFlags = [ + "CC=${stdenv.cc.targetPrefix}cc" + ]; + + doCheck = true; + + inherit meta; +} diff --git a/pkgs/applications/editors/ed/sources.nix b/pkgs/applications/editors/ed/sources.nix new file mode 100644 index 0000000000000..5d3535a834dc2 --- /dev/null +++ b/pkgs/applications/editors/ed/sources.nix @@ -0,0 +1,34 @@ +{ lib +, fetchurl +}: + +let + meta = { + description = "The GNU implementation of the standard Unix editor"; + longDescription = '' + GNU ed is a line-oriented text editor. It is used to create, display, + modify and otherwise manipulate text files, both interactively and via + shell scripts. A restricted version of ed, red, can only edit files in the + current directory and cannot execute shell commands. Ed is the 'standard' + text editor in the sense that it is the original editor for Unix, and thus + widely available. For most purposes, however, it is superseded by + full-screen editors such as GNU Emacs or GNU Moe. + ''; + license = lib.licenses.gpl3Plus; + homepage = "https://www.gnu.org/software/ed/"; + maintainers = with lib.maintainers; [ AndersonTorres ]; + platforms = lib.platforms.unix; + }; +in +{ + ed = let + pname = "ed"; + version = "1.19"; + src = fetchurl { + url = "mirror://gnu/ed/ed-${version}.tar.lz"; + hash = "sha256-zi8uXEJHkKqW0J2suT2bv9wLfrYknJy3U4RS6Ox3zUg="; + }; + in import ./generic.nix { + inherit pname version src meta; + }; +} |