240 lines
5.5 KiB
Plaintext
240 lines
5.5 KiB
Plaintext
Rewrite my ./generated/modules/traveldroid/apps/emax.nix to integrate nicely with my existing flake.nix en host.nix
|
|
This version does not install emacs
|
|
Avoid infinite recursion
|
|
Just look at how to rewrite this, ignore previous interactions around this nix.
|
|
Look at hyprland.nix to see how to avoid the home error
|
|
|
|
------------------------------------------------------------------------
|
|
|
|
{ lib, pkgs, flakeRoot, home-manager, config, ... }:
|
|
|
|
let
|
|
username = config.defaultUser or "henrov";
|
|
|
|
emacsPkg = pkgs.emacs-pgtk.override { withTreeSitter = true; };
|
|
|
|
emacsExtraPackages = epkgs: [
|
|
epkgs.manualPackages.treesit-grammars.with-all-grammars
|
|
epkgs.nerd-icons
|
|
epkgs.doom-modeline
|
|
epkgs.diminish
|
|
epkgs.eldoc
|
|
epkgs.pulsar
|
|
epkgs.which-key
|
|
epkgs.expreg
|
|
epkgs.vundo
|
|
epkgs.puni
|
|
epkgs.avy
|
|
epkgs.consult
|
|
epkgs.vertico
|
|
epkgs.marginalia
|
|
epkgs.crux
|
|
epkgs.magit
|
|
epkgs.nerd-icons-corfu
|
|
epkgs.corfu
|
|
epkgs.cape
|
|
epkgs.orderless
|
|
epkgs.yasnippet
|
|
epkgs.yasnippet-snippets
|
|
epkgs.rg
|
|
epkgs.exec-path-from-shell
|
|
epkgs.eat
|
|
epkgs.rust-mode
|
|
epkgs.rustic
|
|
epkgs.nix-mode
|
|
epkgs.hcl-mode
|
|
epkgs.shell-pop
|
|
epkgs.envrc
|
|
epkgs.nixpkgs-fmt
|
|
epkgs.f
|
|
epkgs.gptel
|
|
epkgs.catppuccin-theme
|
|
epkgs.eldoc-box
|
|
epkgs.sideline
|
|
epkgs.sideline-flymake
|
|
epkgs.sideline-eglot
|
|
];
|
|
|
|
# Emacs config files
|
|
earlyInitFile = "${flakeRoot}/generated/.config/emacs/early-init.el";
|
|
initFile = "${flakeRoot}/generated/.config/emacs/init.el";
|
|
|
|
in
|
|
{
|
|
_module.args.hmUsers = {
|
|
${username} = {
|
|
|
|
home.sessionVariables = {
|
|
EDITOR = "emacs";
|
|
XDG_SCREENSHOTS_DIR = "~/screenshots";
|
|
};
|
|
|
|
programs.emacs = {
|
|
enable = true;
|
|
package = emacsPkg;
|
|
extraPackages = emacsExtraPackages;
|
|
};
|
|
|
|
home.file = {
|
|
".emacs.d/early-init.el" = { source = earlyInitFile; };
|
|
".emacs.d/init.el" = { source = initFile; };
|
|
};
|
|
};
|
|
};
|
|
}
|
|
|
|
|
|
|
|
------------------------------------------------------------------------
|
|
|
|
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";
|
|
};
|
|
|
|
emacs-overlay = {
|
|
url = "github:nix-community/emacs-overlay";
|
|
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, emacs-overlay, zen-browser, ... }:
|
|
let
|
|
system = "x86_64-linux";
|
|
flakeRoot = self;
|
|
in {
|
|
nixosConfigurations = {
|
|
traveldroid = nixpkgs.lib.nixosSystem {
|
|
inherit system;
|
|
|
|
modules = [
|
|
({ ... }: {
|
|
nixpkgs.overlays = [ emacs-overlay.overlays.default ];
|
|
})
|
|
./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";
|
|
};
|
|
};
|
|
}
|