From 84f9bf297f19e54157646a814512f360ca0a16f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Fernando=20S=C3=A1nchez?= Date: Sun, 31 Aug 2025 19:17:09 +0200 Subject: [PATCH] Create flake.nix --- flake.lock | 48 ++++++ flake.nix | 46 ++++++ home-manager/common.nix | 151 ++++++++++++++++++ home-manager/lenny.nix | 15 ++ .../home.nix => home-manager/old.nix | 0 home-manager/personal.nix | 13 ++ 6 files changed, 273 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 home-manager/common.nix create mode 100644 home-manager/lenny.nix rename homemanager/.config/home-manager/home.nix => home-manager/old.nix (100%) create mode 100644 home-manager/personal.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..ab3ab0e --- /dev/null +++ b/flake.lock @@ -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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..691edf0 --- /dev/null +++ b/flake.nix @@ -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 + ]; + }; + }; +} diff --git a/home-manager/common.nix b/home-manager/common.nix new file mode 100644 index 0000000..cc49541 --- /dev/null +++ b/home-manager/common.nix @@ -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; + + + +} diff --git a/home-manager/lenny.nix b/home-manager/lenny.nix new file mode 100644 index 0000000..e40e248 --- /dev/null +++ b/home-manager/lenny.nix @@ -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"; + }; + }; + +} diff --git a/homemanager/.config/home-manager/home.nix b/home-manager/old.nix similarity index 100% rename from homemanager/.config/home-manager/home.nix rename to home-manager/old.nix diff --git a/home-manager/personal.nix b/home-manager/personal.nix new file mode 100644 index 0000000..3b07f7e --- /dev/null +++ b/home-manager/personal.nix @@ -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"; + }; + }; + +}