diff options
author | Alyssa Ross <hi@alyssa.is> | 2023-06-16 09:13:56 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2023-08-05 09:19:22 +0000 |
commit | 7517820d73ff3edcc8da721931aeeaf206929650 (patch) | |
tree | 32ddc2dd9ecba9f377b914bb84a719e560a4ee6e /overlays/patches/emacs/overlay/flake.nix | |
parent | 99fcaeccb89621dd492203ce1f2d551c06f228ed (diff) | |
parent | f95c33d692cc174df41e40330aec4abf2a94b673 (diff) | |
download | nixlib-7517820d73ff3edcc8da721931aeeaf206929650.tar nixlib-7517820d73ff3edcc8da721931aeeaf206929650.tar.gz nixlib-7517820d73ff3edcc8da721931aeeaf206929650.tar.bz2 nixlib-7517820d73ff3edcc8da721931aeeaf206929650.tar.lz nixlib-7517820d73ff3edcc8da721931aeeaf206929650.tar.xz nixlib-7517820d73ff3edcc8da721931aeeaf206929650.tar.zst nixlib-7517820d73ff3edcc8da721931aeeaf206929650.zip |
Merge https://github.com/nix-community/emacs-overlay
Diffstat (limited to 'overlays/patches/emacs/overlay/flake.nix')
-rw-r--r-- | overlays/patches/emacs/overlay/flake.nix | 105 |
1 files changed, 89 insertions, 16 deletions
diff --git a/overlays/patches/emacs/overlay/flake.nix b/overlays/patches/emacs/overlay/flake.nix index 36cfc4713fbd..894942cd74fd 100644 --- a/overlays/patches/emacs/overlay/flake.nix +++ b/overlays/patches/emacs/overlay/flake.nix @@ -1,33 +1,106 @@ { description = "Bleeding edge Emacs overlay"; - inputs.flake-utils.url = "github:numtide/flake-utils"; + nixConfig = { + extra-substituters = [ "https://nix-community.cachix.org" ]; + extra-trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ]; + }; + + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-23.05"; + }; outputs = { self , nixpkgs + , nixpkgs-stable , flake-utils - }: { + }: + let + importPkgs = path: attrs: import path (attrs // { + config.allowAliases = false; + overlays = [ self.overlays.default ]; + }); + in + { # self: super: must be named final: prev: for `nix flake check` to be happy - overlay = final: prev: - import ./default.nix final prev; - } // flake-utils.lib.eachDefaultSystem (system: ( - let - pkgs = import nixpkgs { - inherit system; - config.allowAliases = false; - overlays = [ self.overlay ]; + overlays = { + default = final: prev: import ./overlays final prev; + emacs = final: prev: import ./overlays/emacs.nix final prev; + package = final: prev: import ./overlays/package.nix final prev; + }; + # for backward compatibility, is safe to delete, not referenced anywhere + overlay = self.overlays.default; + } // flake-utils.lib.eachSystem [ "x86_64-linux" ] (system: + { + hydraJobs = + let + mkHydraJobs = pkgs: + let + mkEmacsSet = emacs: pkgs.recurseIntoAttrs ( + lib.filterAttrs + (n: v: builtins.typeOf v == "set" && ! lib.isDerivation v) + (pkgs.emacsPackagesFor emacs) + ); + inherit (pkgs) lib; + + in + { + emacsen = { + inherit (pkgs) emacs-unstable emacs-unstable-nox; + inherit (pkgs) emacs-unstable-pgtk; + inherit (pkgs) emacs-git emacs-git-nox; + inherit (pkgs) emacs-pgtk; + }; + + emacsen-cross = + let + crossTargets = [ "aarch64-multiplatform" ]; + in + lib.fold lib.recursiveUpdate { } + (builtins.map + (target: + let + targetPkgs = pkgs.pkgsCross.${target}; + in + lib.mapAttrs' (name: job: lib.nameValuePair "${name}-${target}" job) + ({ + inherit (targetPkgs) emacs-unstable emacs-unstable-nox; + inherit (targetPkgs) emacs-unstable-pgtk; + inherit (targetPkgs) emacs-git emacs-git-nox; + inherit (targetPkgs) emacs-pgtk; + })) + crossTargets); + + packages = mkEmacsSet pkgs.emacs; + packages-unstable = mkEmacsSet pkgs.emacs-unstable; + }; + + in + { + "23.05" = mkHydraJobs (importPkgs nixpkgs-stable { inherit system; }); + "unstable" = mkHydraJobs (importPkgs nixpkgs { inherit system; }); }; + }) // flake-utils.lib.eachDefaultSystem (system: ( + let + pkgs = importPkgs nixpkgs { inherit system; }; inherit (pkgs) lib; - overlayAttrs = builtins.attrNames (import ./. pkgs pkgs); + + overlayAttributes = lib.pipe (import ./. pkgs pkgs) [ + builtins.attrNames + (lib.partition (n: lib.isDerivation pkgs.${n})) + ]; + attributesToAttrset = attributes: lib.pipe attributes [ + (map (n: lib.nameValuePair n pkgs.${n})) + lib.listToAttrs + ]; in { - packages = - let - drvAttrs = builtins.filter (n: lib.isDerivation pkgs.${n}) overlayAttrs; - in - lib.listToAttrs (map (n: lib.nameValuePair n pkgs.${n}) drvAttrs); + lib = attributesToAttrset overlayAttributes.wrong; + packages = attributesToAttrset overlayAttributes.right; } )); |