Files
nixos/Droidnix/Prompt
T
2026-03-25 12:27:50 +00:00

241 lines
7.2 KiB
Plaintext

Rewrite my ./generated/modules/traveldroid/apps/emacs/emacs.nix to integrate nicely with my existing flake.nix en host.nix
Avoid infinite recursion
Just look at how to rewrite this, ignore previous interactions around this nix.
Solve the error. That is really important.
Lopok at the way hyprland is using config files.
error:
… while calling the 'seq' builtin
at /nix/store/s7bvgynzfisna3jdq2cr4jx73xnhxs27-source/lib/modules.nix:402:18:
401| options = checked options;
402| config = checked (removeAttrs config [ "_module" ]);
| ^
403| _module = checked (config._module);
… while calling the 'throw' builtin
at /nix/store/s7bvgynzfisna3jdq2cr4jx73xnhxs27-source/lib/modules.nix:374:13:
373| else
374| throw baseMsg
| ^
375| else
error: The option `home' does not exist. Definition values:
- In `/nix/store/cpciwvh5yx2qw51ypda3lygshrr2834f-source/Droidnix/generated/modules/traveldroid/apps/emacs/emacs.nix':
{
file = {
"emacs/early-init.el" = {
source = "/nix/store/cpciwvh5yx2qw51ypda3lygshrr2834f-source/Droidnix/assets/traveldroid/conf/emacs/early-init.el";
target = ".emacs.d/early-init.el";
...
Did you mean `time', `boot' or `jobs'?
Command 'nix --extra-experimental-features 'nix-command flakes' build --print-out-paths '.#nixosConfigurations."traveldroid".config.system.build.nixos-rebuild' --no-link' returned non-zero exit status 1.
------------------------------------------------------------------------
{ pkgs, flakeRoot,... }:
{
programs.emacs = {
enable = true;
# install with tree sitter enabled
package = (pkgs.emacs-pgtk.override { withTreeSitter = true; });
extraPackages = epkgs: [
# also install all tree sitter grammars
epkgs.manualPackages.treesit-grammars.with-all-grammars
epkgs.nerd-icons # nerd fonts support
epkgs.doom-modeline # model line
epkgs.diminish # hides modes from modeline
epkgs.eldoc # doc support
epkgs.pulsar # pulses the cursor when jumping about
epkgs.which-key # help porcelain
epkgs.expreg # expand region
epkgs.vundo # undo tree
epkgs.puni # structured editing
epkgs.avy # jumping utility
epkgs.consult # emacs right click
epkgs.vertico # minibuffer completion
epkgs.marginalia # annotations for completions
epkgs.crux # utilities
epkgs.magit # git porcelain
epkgs.nerd-icons-corfu # nerd icons for completion
epkgs.corfu # completion
epkgs.cape # completion extensions
epkgs.orderless # search paradigm
epkgs.yasnippet # snippets support
epkgs.yasnippet-snippets # commonly used snippets
epkgs.rg # ripgrep
epkgs.exec-path-from-shell # load env and path
epkgs.eat # better shell
epkgs.rust-mode # rust mode (when rust-ts doesn't cut it)
epkgs.rustic # more rust things
epkgs.nix-mode # nix lang
epkgs.hcl-mode # hashicorp file mode
epkgs.shell-pop # quick shell popup
epkgs.envrc # support for loading .envrc
epkgs.nixpkgs-fmt # format nix files
epkgs.f # string + file utilities
epkgs.gptel # llm chat (mainly claude)
epkgs.catppuccin-theme # catppuccin theme
epkgs.eldoc-box # docs in a box
epkgs.sideline # mainly for flymake errors on the side
epkgs.sideline-flymake # mainly for flymake errors on the side
epkgs.sideline-eglot # mainly for flymake errors on the side
];
};
home.sessionVariables = {
EDITOR = "emacs";
XDG_SCREENSHOTS_DIR = "~/screenshots";
};
home.file = {
emacs-init = {
source = "${flakeRoot}/assets/traveldroid/conf/emacs/early-init.el";
target = ".emacs.d/early-init.el";
};
emacs = {
source = "${flakeRoot}/assets/traveldroid/conf/emacs/init.el";
target = ".emacs.d/init.el";
};
};
}
------------------------------------------------------------------------
flake.nix
{
description = "Droidnix: A dendritic NixOS + Home Manager configuration";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
import-tree.url = "github:vic/import-tree";
stylix = {
url = "github:nix-community/stylix";
inputs.nixpkgs.follows = "nixpkgs";
};
zen-browser = {
url = "github:youwen5/zen-browser-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
hyprland.url = "github:hyprwm/Hyprland";
};
outputs = { self, nixpkgs, home-manager, import-tree, stylix, hyprland, zen-browser, ... }:
let
system = "x86_64-linux";
flakeRoot = self;
in {
nixosConfigurations = {
traveldroid = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
./generated/hosts/traveldroid/host.nix
];
specialArgs = {
inherit flakeRoot;
inherit home-manager import-tree stylix hyprland zen-browser;
};
};
};
};
}
------------------------------------------------------------------------
host.nix
{ lib, config, pkgs, flakeRoot, import-tree, home-manager, ... }:
let
hostname = "traveldroid";
modulesPath = "${flakeRoot}/generated/modules/${hostname}";
usersPath = "${flakeRoot}/generated/users";
hostModules = import-tree modulesPath;
globalUsers = import-tree usersPath;
allModules = hostModules.imports ++ globalUsers.imports;
in
{
#################################
# Core system config
#################################
networking.hostName = hostname;
system.stateVersion = "26.05";
#################################
# Imports
#################################
imports =
[
./boot.nix
./hardware-configuration.nix
# REQUIRED for Home Manager
home-manager.nixosModules.home-manager
]
++ allModules;
#################################
# Home Manager integration
#################################
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
}
hyprland.nix
{ lib, config, pkgs, flakeRoot, home-manager, inputs, ... }:
let
username = config.defaultUser or "henrov";
assetPath = "${flakeRoot}/assets/traveldroid/conf/hypr/";
# Read all files in the asset directory
assetFiles = builtins.attrNames (builtins.readDir assetPath);
# Convert files to Home Manager xdg config entries
hyprFiles = lib.genAttrs assetFiles (f: {
# Destination path in home directory
name = ".config/hypr/${f}";
# Source file path
value = { source = "${assetPath}/${f}"; };
});
# Determine Hyprland package
hyprlandPkg =
pkgs.hyprland or
pkgs.hyprland-git or
inputs.hyprland.packages.${pkgs.system}.default;
in
{
environment.systemPackages = [ hyprlandPkg ];
_module.args.hmUsers = {
${username} = {
home.packages = [ hyprlandPkg ];
# Merge all files in the asset folder into ~/.config/hypr/
home.file = lib.mkMerge hyprFiles;
# Optional: Hyprland settings
settings.general."col.active_border" = "0xff97cbcd 0xff89b4fa";
};
};
}