From 5fcd7ccacefc9ba5edb94dad09929797f3cd8d2d Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Fri, 8 Jul 2022 16:16:50 +0100 Subject: [PATCH 1/4] Remove dbgmd-00001.sign Empty file, also not referenced anywhere. --- dbgmd-00001.sign | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 dbgmd-00001.sign diff --git a/dbgmd-00001.sign b/dbgmd-00001.sign deleted file mode 100644 index e69de29..0000000 From 744cfb8a1d3ca071f266a3b916300680fd8ba3a2 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Fri, 8 Jul 2022 16:26:18 +0100 Subject: [PATCH 2/4] Remove flake-compat-helper.nix --- default.nix | 9 +- flake-compat-helper.nix | 183 ---------------------------------------- flake.lock | 17 ++++ flake.nix | 2 + 4 files changed, 27 insertions(+), 184 deletions(-) delete mode 100644 flake-compat-helper.nix diff --git a/default.nix b/default.nix index d756ecd..41fa9e0 100644 --- a/default.nix +++ b/default.nix @@ -63,7 +63,14 @@ assert (lib.assertMsg ((builtins.isPath doomPrivateDir) "doomPrivateDir must be either a path, a derivation or a stringified store path"); let - flake = import ./flake-compat-helper.nix { src = ./.; }; + flake = + (import + (let lock = with builtins; fromJSON (readFile ./flake.lock); in + builtins.fetchTarball { + url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; + sha256 = lock.nodes.flake-compat.locked.narHash; + }) + { src = ./.; }).defaultNix; lock = p: if dependencyOverrides ? ${p} then dependencyOverrides.${p} diff --git a/flake-compat-helper.nix b/flake-compat-helper.nix deleted file mode 100644 index 12f0647..0000000 --- a/flake-compat-helper.nix +++ /dev/null @@ -1,183 +0,0 @@ -# Based on flake-compat as of: -# Based on flake-compat as of: https://github.com/edolstra/flake-compat/blob/99f1c2157fba4bfe6211a321fd0ee43199025dbf/default.nix -# Instead of generating a shim for `default.nix` it exposes the `allNodes` method - - -#Compatibility function to allow flakes to be used by -# non-flake-enabled Nix versions. Given a source tree containing a -# 'flake.nix' and 'flake.lock' file, it fetches the flake inputs and -# calls the flake's 'outputs' function. It then returns an attrset -# containing 'defaultNix' (to be used in 'default.nix'), 'shellNix' -# (to be used in 'shell.nix'). - -{ src, system ? builtins.currentSystem or "unknown-system" }: - -let - - lockFilePath = src + "/flake.lock"; - - lockFile = builtins.fromJSON (builtins.readFile lockFilePath); - - fetchTree = - info: - if info.type == "github" then - { outPath = fetchTarball "https://api.${info.host or "github.com"}/repos/${info.owner}/${info.repo}/tarball/${info.rev}"; - rev = info.rev; - shortRev = builtins.substring 0 7 info.rev; - lastModified = info.lastModified; - lastModifiedDate = formatSecondsSinceEpoch info.lastModified; - narHash = info.narHash; - } - else if info.type == "git" then - { outPath = - builtins.fetchGit - ({ url = info.url; } - // (if info ? rev then { inherit (info) rev; } else {}) - // (if info ? ref then { inherit (info) ref; } else {}) - ); - lastModified = info.lastModified; - lastModifiedDate = formatSecondsSinceEpoch info.lastModified; - narHash = info.narHash; - } // (if info ? rev then { - rev = info.rev; - shortRev = builtins.substring 0 7 info.rev; - } else { - }) - else if info.type == "path" then - { outPath = builtins.path { path = info.path; }; - narHash = info.narHash; - } - else if info.type == "tarball" then - { outPath = fetchTarball info.url; - narHash = info.narHash; - } - else if info.type == "gitlab" then - { inherit (info) rev narHash lastModified; - outPath = fetchTarball "https://${info.host or "gitlab.com"}/api/v4/projects/${info.owner}%2F${info.repo}/repository/archive.tar.gz?sha=${info.rev}"; - shortRev = builtins.substring 0 7 info.rev; - } - else - # FIXME: add Mercurial, tarball inputs. - throw "flake input has unsupported input type '${info.type}'"; - - callFlake4 = flakeSrc: locks: - let - flake = import (flakeSrc + "/flake.nix"); - - inputs = builtins.mapAttrs (n: v: - if v.flake or true - then callFlake4 (fetchTree (v.locked // v.info)) v.inputs - else fetchTree (v.locked // v.info)) locks; - - outputs = flakeSrc // (flake.outputs (inputs // {self = outputs;})); - in - assert flake.edition == 201909; - outputs; - - callLocklessFlake = flakeSrc: - let - flake = import (flakeSrc + "/flake.nix"); - outputs = flakeSrc // (flake.outputs ({ self = outputs; })); - in outputs; - - rootSrc = let - # Try to clean the source tree by using fetchGit, if this source - # tree is a valid git repository. - tryFetchGit = src: - if isGit && !isShallow - then - let res = builtins.fetchGit src; - in if res.rev == "0000000000000000000000000000000000000000" then removeAttrs res ["rev" "shortRev"] else res - else { outPath = src; }; - # NB git worktrees have a file for .git, so we don't check the type of .git - isGit = builtins.pathExists (src + "/.git"); - isShallow = builtins.pathExists (src + "/.git/shallow"); - - in - { lastModified = 0; lastModifiedDate = formatSecondsSinceEpoch 0; } - // (if src ? outPath then src else tryFetchGit src); - - # Format number of seconds in the Unix epoch as %Y%m%d%H%M%S. - formatSecondsSinceEpoch = t: - let - rem = x: y: x - x / y * y; - days = t / 86400; - secondsInDay = rem t 86400; - hours = secondsInDay / 3600; - minutes = (rem secondsInDay 3600) / 60; - seconds = rem t 60; - - # Courtesy of https://stackoverflow.com/a/32158604. - z = days + 719468; - era = (if z >= 0 then z else z - 146096) / 146097; - doe = z - era * 146097; - yoe = (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365; - y = yoe + era * 400; - doy = doe - (365 * yoe + yoe / 4 - yoe / 100); - mp = (5 * doy + 2) / 153; - d = doy - (153 * mp + 2) / 5 + 1; - m = mp + (if mp < 10 then 3 else -9); - y' = y + (if m <= 2 then 1 else 0); - - pad = s: if builtins.stringLength s < 2 then "0" + s else s; - in "${toString y'}${pad (toString m)}${pad (toString d)}${pad (toString hours)}${pad (toString minutes)}${pad (toString seconds)}"; - - allNodes = - builtins.mapAttrs - (key: node: - let - sourceInfo = - if key == lockFile.root - then rootSrc - else fetchTree (node.info or {} // removeAttrs node.locked ["dir"]); - - subdir = if key == lockFile.root then "" else node.locked.dir or ""; - - flake = import (sourceInfo + (if subdir != "" then "/" else "") + subdir + "/flake.nix"); - - inputs = builtins.mapAttrs - (inputName: inputSpec: allNodes.${resolveInput inputSpec}) - (node.inputs or {}); - - # Resolve a input spec into a node name. An input spec is - # either a node name, or a 'follows' path from the root - # node. - resolveInput = inputSpec: - if builtins.isList inputSpec - then getInputByPath lockFile.root inputSpec - else inputSpec; - - # Follow an input path (e.g. ["dwarffs" "nixpkgs"]) from the - # root node, returning the final node. - getInputByPath = nodeName: path: - if path == [] - then nodeName - else - getInputByPath - # Since this could be a 'follows' input, call resolveInput. - (resolveInput lockFile.nodes.${nodeName}.inputs.${builtins.head path}) - (builtins.tail path); - - outputs = flake.outputs (inputs // { self = result; }); - - result = outputs // sourceInfo // { inherit inputs; inherit outputs; inherit sourceInfo; }; - in - if node.flake or true then - assert builtins.isFunction flake.outputs; - result - else - sourceInfo - ) - lockFile.nodes; - - result = - if !(builtins.pathExists lockFilePath) - then callLocklessFlake rootSrc - else if lockFile.version == 4 - then callFlake4 rootSrc (lockFile.inputs) - else if lockFile.version >= 5 && lockFile.version <= 7 - then allNodes.${lockFile.root} - else throw "lock file '${lockFilePath}' has unsupported version ${toString lockFile.version}"; - -in - result diff --git a/flake.lock b/flake.lock index 1d98f10..f8e1cda 100644 --- a/flake.lock +++ b/flake.lock @@ -145,6 +145,22 @@ "type": "github" } }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1650374568, + "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "b4a34015c698c7793d592d66adbab377907a2be8", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "locked": { "lastModified": 1656928814, @@ -331,6 +347,7 @@ "evil-org-mode": "evil-org-mode", "evil-quick-diff": "evil-quick-diff", "explain-pause-mode": "explain-pause-mode", + "flake-compat": "flake-compat", "flake-utils": "flake-utils", "format-all": "format-all", "nix-straight": "nix-straight", diff --git a/flake.nix b/flake.nix index ea260d2..7c1a721 100644 --- a/flake.nix +++ b/flake.nix @@ -81,6 +81,8 @@ nixpkgs.url = "nixpkgs/nixpkgs-unstable"; flake-utils.url = "github:numtide/flake-utils"; + flake-compat.url = "github:edolstra/flake-compat"; + flake-compat.flake = false; }; outputs = { self, nixpkgs, flake-utils, ... }@inputs: From ffa42074ba345211daa4bd04df2d6cd983634bd8 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Fri, 8 Jul 2022 16:48:39 +0100 Subject: [PATCH 3/4] Move patches to its own directory --- default.nix | 4 ++-- overrides.nix | 4 ++-- evil-escape.patch => patches/evil-escape.patch | 0 fix-paths.patch => patches/fix-paths.patch | 0 nix-integration.patch => patches/nix-integration.patch | 0 restart-emacs.patch => patches/restart-emacs.patch | 0 6 files changed, 4 insertions(+), 4 deletions(-) rename evil-escape.patch => patches/evil-escape.patch (100%) rename fix-paths.patch => patches/fix-paths.patch (100%) rename nix-integration.patch => patches/nix-integration.patch (100%) rename restart-emacs.patch => patches/restart-emacs.patch (100%) diff --git a/default.nix b/default.nix index 41fa9e0..e159b35 100644 --- a/default.nix +++ b/default.nix @@ -88,7 +88,7 @@ let phases = [ "unpackPhase" "patchPhase" "installPhase" ]; patches = [ (substituteAll { - src = ./fix-paths.patch; + src = ./patches/fix-paths.patch; private = builtins.toString doomPrivateDir; }) ]; @@ -176,7 +176,7 @@ let patches = [ (substituteAll { - src = ./nix-integration.patch; + src = ./patches/nix-integration.patch; local = doomLocal; }) ]; diff --git a/overrides.nix b/overrides.nix index 1ebb12e..97afb6f 100644 --- a/overrides.nix +++ b/overrides.nix @@ -9,7 +9,7 @@ self: super: { } // args); evil-escape = super.evil-escape.overrideAttrs (esuper: { - patches = [ ./evil-escape.patch ]; + patches = [ ./patches/evil-escape.patch ]; }); doom-snippets = self.straightBuild { @@ -80,7 +80,7 @@ self: super: { }; restart-emacs = super.restart-emacs.overrideAttrs (esuper: { - patches = [ ./restart-emacs.patch ]; + patches = [ ./patches/restart-emacs.patch ]; }); revealjs = self.straightBuild { diff --git a/evil-escape.patch b/patches/evil-escape.patch similarity index 100% rename from evil-escape.patch rename to patches/evil-escape.patch diff --git a/fix-paths.patch b/patches/fix-paths.patch similarity index 100% rename from fix-paths.patch rename to patches/fix-paths.patch diff --git a/nix-integration.patch b/patches/nix-integration.patch similarity index 100% rename from nix-integration.patch rename to patches/nix-integration.patch diff --git a/restart-emacs.patch b/patches/restart-emacs.patch similarity index 100% rename from restart-emacs.patch rename to patches/restart-emacs.patch From 526db4db0c4c59fa4d7fe3ed2ee0a0b7c8a8a414 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Fri, 8 Jul 2022 16:53:23 +0100 Subject: [PATCH 4/4] Remove evil-escape overwrite --- overrides.nix | 4 ---- patches/evil-escape.patch | 8 -------- 2 files changed, 12 deletions(-) delete mode 100644 patches/evil-escape.patch diff --git a/overrides.nix b/overrides.nix index 97afb6f..51c518a 100644 --- a/overrides.nix +++ b/overrides.nix @@ -8,10 +8,6 @@ self: super: { buildPhase = ":"; } // args); - evil-escape = super.evil-escape.overrideAttrs (esuper: { - patches = [ ./patches/evil-escape.patch ]; - }); - doom-snippets = self.straightBuild { pname = "doom-snippets"; postInstall = '' diff --git a/patches/evil-escape.patch b/patches/evil-escape.patch deleted file mode 100644 index 71a6077..0000000 --- a/patches/evil-escape.patch +++ /dev/null @@ -1,8 +0,0 @@ ---- a/evil-escape.el -+++ b/evil-ewcape.el -@@ -1,4 +1,4 @@ -- ;;; evil-escape.el --- Escape from anything with a customizable key sequence -+;;; evil-escape.el --- Escape from anything with a customizable key sequence - - ;; Copyright (C) 2014-2015 syl20bnr - ;;