diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..4bbaa47 --- /dev/null +++ b/flake.lock @@ -0,0 +1,239 @@ +{ + "nodes": { + "elisp-helpers": { + "flake": false, + "locked": { + "lastModified": 1710768267, + "narHash": "sha256-NX/dP39RzIKCiIEZPLZUYDUpgCqyagn3iK7c5NWfmEk=", + "owner": "emacs-twist", + "repo": "elisp-helpers", + "rev": "002e07aff027eedfdadec02d6830cb75a1aec9b5", + "type": "github" + }, + "original": { + "owner": "emacs-twist", + "repo": "elisp-helpers", + "type": "github" + } + }, + "emacs-overlay": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1712941527, + "narHash": "sha256-wD9XQFGW0qzRW1YHj6oklCHzgKNxjwS0tZ/hFGgiHX4=", + "owner": "nix-community", + "repo": "emacs-overlay", + "rev": "9f4406718ada7af83892e17355ef7fd202c20897", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "emacs-overlay", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1712014858, + "narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "9126214d0a59633752a136528f5f3b9aa8565b7d", + "type": "github" + }, + "original": { + "id": "flake-parts", + "type": "indirect" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gnu-elpa": { + "flake": false, + "locked": { + "lastModified": 1712667203, + "narHash": "sha256-KJ+G0wosKpmCm3UQ8Ko3R6Qynnu8kwzbmUA9CXcl12s=", + "ref": "main", + "rev": "bd4f5bf7462a377dbca534bf3ec703763cb5c7bd", + "revCount": 593, + "type": "git", + "url": "https://git.savannah.gnu.org/git/emacs/elpa.git" + }, + "original": { + "ref": "main", + "type": "git", + "url": "https://git.savannah.gnu.org/git/emacs/elpa.git" + } + }, + "melpa": { + "flake": false, + "locked": { + "lastModified": 1712589884, + "narHash": "sha256-4ia0UT/vQMsfrc6nsO1Ad8b8mYbH60hWJIhiiS/4rP4=", + "owner": "melpa", + "repo": "melpa", + "rev": "7f4fe79cff278ebd870fabfd26fe8e78c14630c7", + "type": "github" + }, + "original": { + "owner": "melpa", + "repo": "melpa", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1712791164, + "narHash": "sha256-3sbWO1mbpWsLepZGbWaMovSO7ndZeFqDSdX0hZ9nVyw=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "1042fd8b148a9105f3c0aca3a6177fd1d9360ba5", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1711703276, + "narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d8fe5e6c92d0d190646fb9f1056741a229980089", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1712741485, + "narHash": "sha256-bCs0+MSTra80oXAsnM6Oq62WsirOIaijQ/BbUY59tR4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b2cf36f43f9ef2ded5711b30b1f393ac423d8f72", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nongnu-elpa": { + "flake": false, + "locked": { + "lastModified": 1712340689, + "narHash": "sha256-knhVWWy22nmOs/5NT/Zuq0AHWXRAwRXDSdvwrFIxQOQ=", + "ref": "main", + "rev": "5623e3864f87f49d18bc48b3656dc0c2dea42973", + "revCount": 308, + "type": "git", + "url": "https://git.savannah.gnu.org/git/emacs/nongnu.git" + }, + "original": { + "ref": "main", + "type": "git", + "url": "https://git.savannah.gnu.org/git/emacs/nongnu.git" + } + }, + "org-babel": { + "locked": { + "lastModified": 1669954182, + "narHash": "sha256-tYXRO/+MbLDQNn/mqnWKrQrYvFY0gHbU29wYln7+mpY=", + "owner": "emacs-twist", + "repo": "org-babel", + "rev": "b448845abbbc8b742e9de547cd49ec886cd79cbf", + "type": "github" + }, + "original": { + "owner": "emacs-twist", + "repo": "org-babel", + "type": "github" + } + }, + "root": { + "inputs": { + "emacs-overlay": "emacs-overlay", + "flake-parts": "flake-parts", + "gnu-elpa": "gnu-elpa", + "melpa": "melpa", + "nixpkgs": "nixpkgs", + "nongnu-elpa": "nongnu-elpa", + "org-babel": "org-babel", + "twist": "twist" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "twist": { + "inputs": { + "elisp-helpers": "elisp-helpers" + }, + "locked": { + "lastModified": 1710770942, + "narHash": "sha256-dyNKByzB5dC/UlZ6GzjX+aFNsL8lHMUf9EWGNY7lttQ=", + "owner": "emacs-twist", + "repo": "twist.nix", + "rev": "4e1f8720308f58b840f7d8c64880adb3971252e8", + "type": "github" + }, + "original": { + "owner": "emacs-twist", + "repo": "twist.nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..fb6b751 --- /dev/null +++ b/flake.nix @@ -0,0 +1,117 @@ +{ + description = "mir's Emacs flake, apparently"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + emacs-overlay = { + url = "github:nix-community/emacs-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + twist.url = "github:emacs-twist/twist.nix"; + org-babel.url = "github:emacs-twist/org-babel"; + gnu-elpa = { + url = "git+https://git.savannah.gnu.org/git/emacs/elpa.git?ref=main"; + flake = false; + }; + melpa = { + url = "github:melpa/melpa"; + flake = false; + }; + nongnu-elpa = { + url = "git+https://git.savannah.gnu.org/git/emacs/nongnu.git?ref=main"; + flake = false; + }; + }; + + outputs = + inputs@{ flake-parts, ... }: + flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ "x86_64-linux" ]; + + flake = { + overlays.default = inputs.nixpkgs.lib.composeManyExtensions [ + inputs.emacs-overlay.overlays.emacs + inputs.org-babel.overlays.default + inputs.twist.overlays.default + + ( + final: prev: + let + emacsPackage = final.emacs-pgtk; + in + { + emacs-env = + (final.emacsTwist { + inherit emacsPackage; + + initFiles = [ (final.tangleOrgBabelFile "init.el" ./init.org { }) ]; + + lockDir = ./lock; + registries = import ./nix/registries.nix { + inherit inputs; + emacsSrc = emacsPackage.src; + }; + inputOverrides = import ./nix/inputOverrides.nix { inherit (inputs.nixpkgs) lib; }; + }).overrideScope + ( + _: tprev: { + elispPackages = tprev.elispPackages.overrideScope ( + prev.callPackage ./nix/packageOverrides.nix { inherit (tprev) emacs; } + ); + } + ); + + emacs-config = prev.callPackage inputs.self { + trivialBuild = final.callPackage "${inputs.nixpkgs}/pkgs/build-support/emacs/trivial.nix" { + emacs = final.emacs-env.overrideScope ( + _: tprev: { inherit (tprev.emacs) meta nativeComp withNativeCompilation; } + ); + }; + }; + } + ) + ]; + # homeManagerModules = { + # emacsConfig = import ./nix/home-manager.nix; + # }; + }; + + perSystem = + { + config, + pkgs, + inputs', + ... + }: + { + _module.args.pkgs = inputs'.nixpkgs.legacyPackages.extend inputs.self.overlays.default; + + packages = { + inherit (pkgs) emacs-config emacs-env; + + default = pkgs.writeShellApplication { + name = "test-emacs-config"; + runtimeInputs = [ + pkgs.emacs-env + pkgs.xorg.lndir + ]; + text = '' + XDG_DATA_DIRS="$XDG_DATA_DIRS:${ + builtins.concatStringsSep ":" (map (x: "${x}/share") pkgs.emacs-config.buildInputs) + }" + EMACS_DIR="$(mktemp -td emacs.XXXXXXXXXX)" + lndir -silent ${pkgs.emacs-config} "$EMACS_DIR" + emacs --init-directory "$EMACS_DIR" "$@" + ''; + }; + }; + + checks = { + build-config = config.packages.emacs-config; + build-env = config.packages.emacs-env; + }; + + apps = pkgs.emacs-env.makeApps { lockDirName = "lock"; }; + }; + }; +} diff --git a/init.el b/init.org similarity index 99% rename from init.el rename to init.org index 857af77..824fdf4 100644 --- a/init.el +++ b/init.org @@ -1,3 +1,4 @@ +#+begin_src elisp ;;; init.el --- basic initial declarations ;;; Commentary: ;; _ _ _ _ @@ -1248,3 +1249,4 @@ Taken from https://howardism.org/Technical/Emacs/eshell-why.html" (setq debug-on-error nil) ;;; init.el ends here +#+end_src elisp