home-manager: upgrade symlink creation

This commit is contained in:
J. Fernando Sánchez
2026-06-10 23:06:27 +02:00
parent dc4b4968bc
commit 24e0a20c04
2 changed files with 31 additions and 22 deletions

View File

@@ -13,10 +13,15 @@
};
outputs =
{ nixpkgs, home-manager, ... } @ inputs:
{ self, nixpkgs, home-manager, ... } @ inputs:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
extraSpecialArgs = {
inherit inputs;
dotfilesSrc = self.outPath; # store copy, for readDir only
dotfiles = "/home/j/git/dotfiles"; # live path, for symlink targets
};
in
{
# TCS config
@@ -32,12 +37,13 @@
# Optionally use extraSpecialArgs
# to pass through arguments to home.nix
extraSpecialArgs = { inherit inputs; };
inherit extraSpecialArgs;
};
# Home
homeConfigurations."j" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
inherit extraSpecialArgs;
# Specify your home configuration modules here, for example,
# the path to your home.nix.

View File

@@ -1,12 +1,18 @@
{ config, pkgs, inputs, ... }:
{ config, pkgs, lib, inputs, dotfilesSrc, dotfiles, ... }:
let
dotfiles = "${config.home.homeDirectory}/git/dotfiles";
createDotLink = name: {
source = config.lib.file.mkOutOfStoreSymlink "${dotfiles}/${name}/.config/${name}";
recursive = true;
createDotLinks = name:
let
configDir = dotfilesSrc + "/${name}/.config";
allEntries = builtins.readDir configDir;
entries = builtins.attrNames allEntries; # both files and dirs
in
builtins.listToAttrs (map (entry: {
name = entry;
value = {
source = config.lib.file.mkOutOfStoreSymlink "${dotfiles}/${name}/.config/${entry}";
};
}) entries);
in
{
imports = [
@@ -86,6 +92,7 @@ in
jujutsu
jjui
lazyjj
meld
# Python
python3
@@ -189,13 +196,13 @@ in
{ name = "grc"; src = pkgs.fishPlugins.grc.src; }
];
};
home.shellAliases = {
nvimdiff = "nvim -d";
};
programs.starship = {
enable = true;
settings = {
add_newline = false;
};
};
# programs.starship = {
# enable = true;
# };
#programs.neovim.enable = true;
programs.neovim = {
@@ -248,13 +255,9 @@ in
fonts.fontconfig.enable = true;
xdg.configFile = {
"git" = createDotLink "git";
"niri" = createDotLink "niri";
"jj" = createDotLink "jj";
"helix" = createDotLink "helix";
"ghostty" = createDotLink "ghostty";
};
xdg.configFile = lib.mkMerge (map createDotLinks [
"git" "niri" "jj" "helix" "ghostty" "starship"
]);
home.file = {
".pdbrc" = { source = config.lib.file.mkOutOfStoreSymlink "${dotfiles}/python/.pdbrc";};
".pdb_startup.py" = { source = config.lib.file.mkOutOfStoreSymlink "${dotfiles}/python/.pdb_startup.py";};