Create flake.nix

This commit is contained in:
J. Fernando Sánchez
2025-08-31 19:17:09 +02:00
parent fa7041ff8b
commit 84f9bf297f
6 changed files with 273 additions and 0 deletions

48
flake.lock generated Normal file
View File

@@ -0,0 +1,48 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1756579987,
"narHash": "sha256-duCce8zGsaMsrqqOmLOsuaV1PVIw/vXWnKuLKZClsGg=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "99a69bdf8a3c6bf038c4121e9c4b6e99706a187a",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1756542300,
"narHash": "sha256-tlOn88coG5fzdyqz6R93SQL5Gpq+m/DsWpekNFhqPQk=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "d7600c775f877cd87b4f5a831c28aa94137377aa",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

46
flake.nix Normal file
View File

@@ -0,0 +1,46 @@
{
description = "Home Manager configuration of j";
inputs = {
# Specify the source of Home Manager and Nixpkgs.
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{ nixpkgs, home-manager, ... }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in
{
# TCS config
homeConfigurations."j@lenny" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
# Specify your home configuration modules here, for example,
# the path to your home.nix.
modules = [
./home-manager/common.nix
./home-manager/lenny.nix
];
# Optionally use extraSpecialArgs
# to pass through arguments to home.nix
};
# Home
homeConfigurations."j" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
# Specify your home configuration modules here, for example,
# the path to your home.nix.
modules = [
./home-manager/common.nix
];
};
};
}

151
home-manager/common.nix Normal file
View File

@@ -0,0 +1,151 @@
{ config, pkgs, ... }:
{
# Home Manager needs a bit of information about you and the paths it should
# manage.
home.username = "j";
home.homeDirectory = "/home/j";
# This value determines the Home Manager release that your configuration is
# compatible with. This helps avoid breakage when a new Home Manager release
# introduces backwards incompatible changes.
#
# You should not change this value, even if you update Home Manager. If you do
# want to update the value, then make sure to first check the Home Manager
# release notes.
home.stateVersion = "25.05"; # Please read the comment before changing.
# The home.packages option allows you to install Nix packages into your
# environment.
home.packages = with pkgs; [
# Desktop
pavucontrol
wofi
waybar
pkgs.nerd-fonts.fira-code
pkgs.nerd-fonts.monoid
wezterm
# Editors
emacs
neovim
helix
# Utils
jq
bat # less alternative
eza # Better ld
zoxide # better cd
yazi # File manager
# Shells
fish
grc # Colorizer
fishPlugins.grc
starship
# Dev tools
git
#uutils-coreutils
# # It is sometimes useful to fine-tune packages, for example, by applying
# # overrides. You can do that directly here, just don't forget the
# # parentheses. Maybe you want to install Nerd Fonts with a limited number of
# # fonts?
# (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
# # You can also create simple shell scripts directly inside your
# # configuration. For example, this adds a command 'my-hello' to your
# # environment:
# (pkgs.writeShellScriptBin "my-hello" ''
# echo "Hello, ${config.home.username}!"
# '')
];
# Home Manager is pretty good at managing dotfiles. The primary way to manage
# plain files is through 'home.file'.
home.file = {
# # Building this configuration will create a copy of 'dotfiles/screenrc' in
# # the Nix store. Activating the configuration will then make '~/.screenrc' a
# # symlink to the Nix store copy.
# ".screenrc".source = dotfiles/screenrc;
# # You can also set the file content immediately.
# ".gradle/gradle.properties".text = ''
# org.gradle.console=verbose
# org.gradle.daemon.idletimeout=3600000
# '';
};
# Home Manager can also manage your environment variables through
# 'home.sessionVariables'. These will be explicitly sourced when using a
# shell provided by Home Manager. If you don't want to manage your shell
# through Home Manager then you have to manually source 'hm-session-vars.sh'
# located at either
#
# ~/.nix-profile/etc/profile.d/hm-session-vars.sh
#
# or
#
# ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh
#
# or
#
# /etc/profiles/per-user/j/etc/profile.d/hm-session-vars.sh
#
home.sessionVariables = {
# EDITOR = "emacs";
EDITOR = "nvim";
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
programs.eza = {
enableFishIntegration = true;
icons = "auto";
git = true;
extraOptions = [
"--color=always"
"--tree"
"--level=1"
"--group-directories=first"
"--dereference"
];
};
programs.fish = {
enable = true;
interactiveShellInit = ''set fish_greeting '';
plugins = [
{ name = "grc"; src = pkgs.fishPlugins.grc.src; }
];
};
programs.starship = {
enable = true;
settings = {
add_newline = false;
};
};
programs.zoxide.enable = true;
programs.bash = {
enable = true;
initExtra = ''
if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]]
then
shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION=""
exec ${pkgs.fish}/bin/fish $LOGIN_OPTION
fi
''; # Launch fish on startup
};
fonts.fontconfig.enable = true;
}

15
home-manager/lenny.nix Normal file
View File

@@ -0,0 +1,15 @@
{ config, pkgs, ... }:
{
home.packages = with pkgs; [
jujutsu
];
programs.git = {
enable = true;
userName = "Fernando Sánchez";
userEmail = "f.sanchez@thechannelstore.tv";
extraConfig = {
init.defaultBranch = "main";
};
};
}

13
home-manager/personal.nix Normal file
View File

@@ -0,0 +1,13 @@
{ config, pkgs, ... }:
{
home.packages = with pkgs; [ ];
programs.git = {
enable = true;
userName = "J. Fernando Sánchez";
userEmail = "balkian@gmail.com";
extraConfig = {
init.defaultBranch = "main";
};
};
}