feat(flake, eat): remove flake-parts, add eat

This commit is contained in:
Artur Manuel 2025-03-16 20:04:03 +00:00
commit 465da6e488
Signed by: amadaluzia
SSH key fingerprint: SHA256:Zwg7gBuZyaG48ucAZneJwltiXu0+tJb7c3lYt9AYlLg
4 changed files with 86 additions and 102 deletions

View file

@ -1,5 +1,6 @@
;; -*- lexical-binding: t -*- ;; -*- lexical-binding: t -*-
(use-package emacs (use-package emacs
:init :init
(setq frame-resize-pixelwise t (setq frame-resize-pixelwise t
@ -29,20 +30,21 @@
:hook (prog-mode . display-line-numbers-mode)) :hook (prog-mode . display-line-numbers-mode))
(use-package mood-line (use-package mood-line
:hook (after-init . mood-line-mode)) :hook after-init)
(use-package helm (use-package helm
:bind (("C-x C-f" . helm-find-files) :bind (("C-x C-f" . helm-find-files)
("M-x" . helm-M-x) ("M-x" . helm-M-x)
("M-s o" . helm-occur) ("M-s o" . helm-occur)
("C-h a" . helm-apropos)) ("C-h a" . helm-apropos)
:hook (after-init . helm-mode)) ("C-x b" . helm-buffers))
:hook after-init)
(use-package savehist (use-package savehist
:hook (after-init . savehist-mode)) :hook after-init)
(use-package which-key (use-package which-key
:hook (after-init . which-key-mode)) :hook after-init)
(use-package base16-theme (use-package base16-theme
:config :config
@ -54,8 +56,9 @@
(use-package rust-mode (use-package rust-mode
:mode "\\.rs\\'") :mode "\\.rs\\'")
(use-package envrc (when (executable-find "direnv")
:hook (after-init . envrc-global-mode)) (use-package envrc
:hook after-init))
(use-package eglot (use-package eglot
:hook (prog-mode . eglot-ensure)) :hook (prog-mode . eglot-ensure))
@ -74,19 +77,15 @@
:config :config
(setq c-basic-offset 4)) (setq c-basic-offset 4))
(use-package vterm (use-package eat
:preface :bind (("C-x p t" . eat-project)
(defun project-vterm (&optional arg) ("C-c t" . eat)))
(interactive)
(let* ((default-directory (project-root (project-current 1)))
(vterm-buffer-name (project-prefixed-buffer-name "vterm")))
(vterm arg)))
:bind (("C-x p t" . project-vterm)
("C-c t" . vterm)))
(use-package spacious-padding (use-package spacious-padding
:config :config
(spacious-padding-mode) (spacious-padding-mode))
)
(use-package notmuch
:if (executable-find "notmuch"))
(provide 'config) (provide 'config)

23
flake.lock generated
View file

@ -53,31 +53,10 @@
"type": "github" "type": "github"
} }
}, },
"parts": {
"inputs": {
"nixpkgs-lib": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1741352980,
"narHash": "sha256-+u2UunDA4Cl5Fci3m7S643HzKmIDAe+fiXrLqYsR2fs=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "f4330d22f1c5d2ba72d3d22df5597d123fdb60a9",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"emacs": "emacs", "emacs": "emacs",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs"
"parts": "parts"
} }
} }
}, },

View file

@ -2,35 +2,36 @@
description = "Pankomacs"; description = "Pankomacs";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
emacs = { emacs = {
url = "github:nix-community/emacs-overlay"; url = "github:nix-community/emacs-overlay";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
}; };
outputs = inputs: outputs =
inputs.parts.lib.mkFlake { inputs:
inherit inputs; let
} { inherit (inputs.nixpkgs) lib;
systems = [ systems = [
"x86_64-linux" "x86_64-linux"
]; ];
forAllSystems = lib.genAttrs systems;
imports = [ pkgs = builtins.listToAttrs (
./lib.nix map (system: {
]; name = system;
value = import inputs.nixpkgs {
perSystem = {pkgs, ...}: { inherit system;
formatter = pkgs.alejandra;
packages = {
pgtk = inputs.self.lib.mkEmacs {
inherit pkgs;
emacs = pkgs.emacs30-pgtk;
};
}; };
}) systems
);
in
{
lib = import ./lib.nix inputs;
formatter = forAllSystems (system: pkgs.${system}.nixfmt-rfc-style);
packages = forAllSystems (system: {
pgtk = inputs.self.lib.mkPankomacs {
pkgs = pkgs.${system};
emacs = pkgs.${system}.emacs30-pgtk;
}; };
});
}; };
} }

53
lib.nix
View file

@ -1,33 +1,32 @@
{inputs, ...}: { inputs:
flake.lib = inputs.nixpkgs.lib.extend (_: _: let let
mkEmacsPackage = { mkEmacsPackage =
{
epkgs, epkgs,
pname, pname,
version, version,
src, src,
deps ? [], deps ? (epkgs: [ ]),
}: }:
epkgs.callPackage ( epkgs.trivialBuild {
{trivialBuild}:
trivialBuild {
inherit pname version src; inherit pname version src;
buildInputs = deps; buildInputs = deps epkgs;
propagatedUserEnvPkgs = deps; propagatedUserEnvPkgs = deps epkgs;
} };
) {inherit (epkgs) trivialBuild;};
mkEmacs = { mkPankomacs =
{
pkgs, pkgs,
emacs, emacs,
}: }:
(pkgs.appendOverlays [inputs.emacs.overlays.default]).emacsWithPackagesFromUsePackage { (pkgs.appendOverlays [ inputs.emacs.overlays.default ]).emacsWithPackagesFromUsePackage {
package = emacs; package = emacs;
defaultInitFile = true; defaultInitFile = true;
config = ./config.el; config = ./config.el;
extraEmacsPackages = epkgs: extraEmacsPackages =
epkgs:
builtins.attrValues { builtins.attrValues {
inherit inherit (epkgs)
(epkgs)
spacious-padding spacious-padding
mood-line mood-line
helm helm
@ -37,21 +36,27 @@
haskell-mode haskell-mode
qml-mode qml-mode
envrc envrc
vterm eat
notmuch
; ;
treesit-grammars = epkgs.treesit-grammars.with-all-grammars; treesit-grammars = epkgs.treesit-grammars.with-all-grammars;
}; };
override = _: prev: override =
builtins.listToAttrs (map (name: { _: prev:
builtins.listToAttrs (
map
(name: {
inherit name; inherit name;
value = prev.emacs; value = prev.emacs;
}) [ })
[
"use-package" "use-package"
"savehist" "savehist"
"which-key" "which-key"
]); ]
);
}; };
in { in
inherit mkEmacs mkEmacsPackage; {
}); inherit mkPankomacs mkEmacsPackage;
} }