feat: add dotfiles submodule and home-manager config
- Add dotfiles repo as submodule in assets/dotfiles/ - Rewrite home.nix with direct file references instead of stow service - Remove old custom dotfiles.nix service (replaced by home-manager) - Clean up services/default.nix import
This commit is contained in:
1
.gitmodules
vendored
1
.gitmodules
vendored
@@ -4,3 +4,4 @@
|
|||||||
[submodule "assets/dotfiles"]
|
[submodule "assets/dotfiles"]
|
||||||
path = assets/dotfiles
|
path = assets/dotfiles
|
||||||
url = ssh://git@code.lazyworkhorse.net:2222/gortium/dotfiles.git
|
url = ssh://git@code.lazyworkhorse.net:2222/gortium/dotfiles.git
|
||||||
|
branch = master
|
||||||
|
|||||||
1
assets/dotfiles
Submodule
1
assets/dotfiles
Submodule
Submodule assets/dotfiles added at 8e9204bc21
@@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./dotfiles.nix
|
|
||||||
./systemd
|
./systemd
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,69 +0,0 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
|
||||||
|
|
||||||
with lib;
|
|
||||||
|
|
||||||
let
|
|
||||||
cfg = config.services.dotfiles;
|
|
||||||
stowDir = cfg.stowDir;
|
|
||||||
|
|
||||||
# Function to recursively find all files in a directory
|
|
||||||
findFiles = dir:
|
|
||||||
let
|
|
||||||
files = builtins.attrNames (builtins.readDir dir);
|
|
||||||
in
|
|
||||||
concatMap (name:
|
|
||||||
let
|
|
||||||
path = dir + "/${name}";
|
|
||||||
in
|
|
||||||
if (builtins.typeOf (builtins.readDir path) == "set")
|
|
||||||
then findFiles path
|
|
||||||
else [ path ]
|
|
||||||
) files;
|
|
||||||
|
|
||||||
# Get a list of all packages (directories) in the stow directory
|
|
||||||
stowPackages = builtins.attrNames (builtins.readDir stowDir);
|
|
||||||
|
|
||||||
# Create an attribute set where each attribute is a package name
|
|
||||||
# and the value is a list of files to be linked.
|
|
||||||
homeManagerLinks = listToAttrs (map (pkg:
|
|
||||||
let
|
|
||||||
pkgPath = stowDir + "/${pkg}";
|
|
||||||
files = findFiles pkgPath;
|
|
||||||
in
|
|
||||||
nameValuePair pkg (map (file: {
|
|
||||||
source = file;
|
|
||||||
target = removePrefix (pkgPath + "/") file;
|
|
||||||
}) files)
|
|
||||||
) stowPackages);
|
|
||||||
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options.services.dotfiles = {
|
|
||||||
enable = mkEnableOption "Enable dotfiles management";
|
|
||||||
|
|
||||||
stowDir = mkOption {
|
|
||||||
type = types.path;
|
|
||||||
description = "The directory where your stow packages are located.";
|
|
||||||
};
|
|
||||||
|
|
||||||
user = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
description = "The user to manage dotfiles for.";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
|
||||||
home-manager.users.${cfg.user} = {
|
|
||||||
home.file =
|
|
||||||
let
|
|
||||||
allFiles = concatLists (attrValues homeManagerLinks);
|
|
||||||
in
|
|
||||||
listToAttrs (map (file:
|
|
||||||
nameValuePair file.target {
|
|
||||||
source = file.source;
|
|
||||||
}
|
|
||||||
) allFiles);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,12 +1,63 @@
|
|||||||
{ pkgs, ... }: {
|
{ pkgs, lib, config, inputs, ... }:
|
||||||
services.dotfiles = {
|
|
||||||
enable = true;
|
|
||||||
stowDir = ../../../assets/dotfiles;
|
|
||||||
user = "gortium";
|
|
||||||
};
|
|
||||||
|
|
||||||
|
let
|
||||||
|
dotfiles = ./assets/dotfiles;
|
||||||
|
in {
|
||||||
home.username = "gortium";
|
home.username = "gortium";
|
||||||
home.homeDirectory = "/home/gortium";
|
home.homeDirectory = "/home/gortium";
|
||||||
home.stateVersion = "23.11"; # Please change this to your version.
|
home.stateVersion = "23.11";
|
||||||
programs.home-manager.enable = true;
|
programs.home-manager.enable = true;
|
||||||
|
|
||||||
|
home.file = {
|
||||||
|
# zsh
|
||||||
|
".zshrc".source = "${dotfiles}/zsh/.zshrc";
|
||||||
|
|
||||||
|
# tmux
|
||||||
|
".tmux.conf".source = "${dotfiles}/tmux/.tmux.conf";
|
||||||
|
|
||||||
|
# kitty
|
||||||
|
".config/kitty/kitty.conf".source = "${dotfiles}/kitty/.config/kitty/kitty.conf";
|
||||||
|
|
||||||
|
# nvim
|
||||||
|
".config/nvim/init.lua".source = "${dotfiles}/nvim/.config/nvim/init.lua";
|
||||||
|
|
||||||
|
# starship
|
||||||
|
".config/starship.toml".source = "${dotfiles}/starship/.config/starship.toml";
|
||||||
|
|
||||||
|
# btop
|
||||||
|
".config/btop/btop.conf".source = "${dotfiles}/btop/.config/btop/btop.conf";
|
||||||
|
|
||||||
|
# waybar
|
||||||
|
".config/waybar/style.css".source = "${dotfiles}/waybar/.config/waybar/style.css";
|
||||||
|
".config/waybar/config.jsonc".source = "${dotfiles}/waybar/.config/waybar/config.jsonc";
|
||||||
|
|
||||||
|
# wofi
|
||||||
|
".config/wofi/style.css".source = "${dotfiles}/wofi/.config/wofi/style.css";
|
||||||
|
".config/wofi/config".source = "${dotfiles}/wofi/.config/wofi/config";
|
||||||
|
|
||||||
|
# yazi
|
||||||
|
".config/yazi/yazi.toml".source = "${dotfiles}/yazi/.config/yazi/yazi.toml";
|
||||||
|
|
||||||
|
# hyprland
|
||||||
|
".config/hypr/hyprland.conf".source = "${dotfiles}/hypr/.config/hypr/hyprland.conf";
|
||||||
|
|
||||||
|
# doom emacs
|
||||||
|
".config/doom/config.el".source = "${dotfiles}/doom/.config/doom/config.el";
|
||||||
|
".config/doom/init.el".source = "${dotfiles}/doom/.config/doom/init.el";
|
||||||
|
".config/doom/packages.el".source = "${dotfiles}/doom/.config/doom/packages.el";
|
||||||
|
};
|
||||||
|
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
# core
|
||||||
|
git zsh tmux starship
|
||||||
|
# editors
|
||||||
|
neovim kitty
|
||||||
|
# tools
|
||||||
|
btop yazi ripgrep fd fzf
|
||||||
|
# wayland
|
||||||
|
waybar wofi
|
||||||
|
];
|
||||||
|
|
||||||
|
programs.zsh.enable = true;
|
||||||
|
programs.starship.enable = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user