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 = outputs =
{ nixpkgs, home-manager, ... } @ inputs: { self, nixpkgs, home-manager, ... } @ inputs:
let let
system = "x86_64-linux"; system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system}; 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 in
{ {
# TCS config # TCS config
@@ -32,12 +37,13 @@
# Optionally use extraSpecialArgs # Optionally use extraSpecialArgs
# to pass through arguments to home.nix # to pass through arguments to home.nix
extraSpecialArgs = { inherit inputs; }; inherit extraSpecialArgs;
}; };
# Home # Home
homeConfigurations."j" = home-manager.lib.homeManagerConfiguration { homeConfigurations."j" = home-manager.lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;
inherit extraSpecialArgs;
# Specify your home configuration modules here, for example, # Specify your home configuration modules here, for example,
# the path to your home.nix. # the path to your home.nix.

View File

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