moving home-manager stuff to one sharable file

This commit is contained in:
ari committed 2024-08-09 21:40:07 -04:00
1 parent c1d43499cb
commit 618429e3c0
10 files changed
+212 -104

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
{
description = "Home Manager configuration of ari";
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
{
homeConfigurations."ari" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
# Specify your home configuration modules here, for example,
# the path to your home.nix.
modules = [ ./home.nix ];
# Optionally use extraSpecialArgs
# to pass through arguments to home.nix
};
};
}
+76
View File
@@ -0,0 +1,76 @@
{ config, pkgs, ... }:
{
# Home Manager needs a bit of information about you and the paths it should
# manage.
home.username = "ari";
home.homeDirectory = "/home/ari";
# 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 = "24.05"; # Please read the comment before changing.
# The home.packages option allows you to install Nix packages into your
# environment.
home.packages = [
# # Adds the 'hello' command to your environment. It prints a friendly
# # "Hello, world!" when run.
# pkgs.hello
# # 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/ari/etc/profile.d/hm-session-vars.sh
#
home.sessionVariables = {
# EDITOR = "emacs";
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
}
+1 -1
View File
@@ -1,7 +1,7 @@
{ user, dataDir ? "/mnt/Data", unstable }:
{ pkgs, lib, config, ... }:
let
zshFWBook = builtins.filterSource (p: t: true) ../configs/fwbook;
zshFWBook = builtins.filterSource (p: t: true) ./scripts/fwbook;
zshFunctions = zshFWBook + "/functions.sh";
in
{
File renamed without changes.
File renamed without changes.
+101
View File
@@ -0,0 +1,101 @@
{ stateVersion
, enableDevelopmentKit
, name
, fullName
, email
, extraGitConfigs ? [ ]
}:
let
gitconfigs =
(builtins.filterSource (path: type: type != "directory") ./gitconfigs);
gitconfigFiles = builtins.attrNames (builtins.readDir gitconfigs);
commonGitConfigs = {
delta = { enable = true; };
extraConfig = {
color = { ui = "auto"; };
push = {
default = "upstream";
autoSetupRemote = true;
};
init = { defaultBranch = "main"; };
};
includes =
(builtins.map (f: { path = gitconfigs + "/" + f; }) gitconfigFiles)
++ extraGitConfigs;
};
commonProgramsConfig = { pkgs }: {
bat.enable = true;
neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
};
direnv.enable = true;
lsd = {
enable = true;
enableAliases = true;
};
zsh = {
enable = true;
autosuggestion.enable = true;
initExtra = ''
export PROMPT='%(!.%{%F{yellow}%}.)$USER@%{$fg[white]%}%M %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
'';
};
zsh.oh-my-zsh = {
enable = true;
plugins = [ "git" "sudo" ];
theme = "robbyrussell";
};
tmux = {
enable = true;
clock24 = true;
mouse = true;
plugins = with pkgs.tmuxPlugins; [ nord cpu battery sidebar ];
};
};
in
{
makeRootUser = { pkgs, ... }: {
home = {
stateVersion = stateVersion;
shellAliases = {
cat = "bat";
};
};
programs = {
git = {
enable = true;
userName = "root";
} // commonGitConfigs;
} // (commonProgramsConfig { pkgs = pkgs; });
};
makeCommonUser = { pkgs, ... }: {
home = {
stateVersion = stateVersion;
shellAliases = {
cat = "bat";
};
packages = with pkgs;
[ jq nixpkgs-fmt ipfetch nixd ]
++ (if enableDevelopmentKit then [
rye
devenv
uv
devbox
terraform
kubectl
] else
[ ]);
};
programs = {
git = {
enable = true;
userName = fullName;
userEmail = email;
} // commonGitConfigs;
} // (commonProgramsConfig { pkgs = pkgs; });
};
}
-1
View File
@@ -12,7 +12,6 @@
{ pkgs, ... }: {
imports = [
(import ./core.nix { user = user; })
./rootUser.nix
(import ./user.nix { user = user; })
(import ./containers/default.nix ({
user = user;
-4
View File
@@ -1,4 +0,0 @@
{ pkgs, ... }:
{
users.users.root.shell = pkgs.zsh;
}
+1
View File
@@ -16,6 +16,7 @@ in
};
config = {
users.users.root.shell = pkgs.zsh;
home-manager.users.root.programs.git.userEmail = "root@${cfg.hostName}";
networking.hostName = cfg.hostName;
};
+3 -98
View File
@@ -4,10 +4,7 @@ with lib;
let
cfg = config.skyg;
gitconfigs =
(builtins.filterSource (path: type: type != "directory") ./gitconfigs);
gitconfigFiles = builtins.attrNames (builtins.readDir gitconfigs);
hm = (import ../home-manager.nix cfg.user);
in
{
options = {
@@ -41,99 +38,7 @@ in
config = {
programs.zsh.enable = true;
home-manager.users.root = {
home.stateVersion = cfg.home-manager.version;
programs.git = {
enable = true;
userName = "root";
};
programs.zsh = {
enable = true;
autosuggestion.enable = true;
};
programs.zsh.oh-my-zsh.enable = true;
};
home-manager.users.${cfg.user.name} = {
home = {
sessionVariables = { };
stateVersion = cfg.home-manager.version;
shellAliases = {
cat = "bat";
};
packages = with pkgs;
[ jq nixfmt-classic devenv ipfetch nixd ]
++ (if cfg.user.enableDevelopmentKit then [
rye
uv
devbox
terraform
kubectl
] else
[ ]);
};
programs = {
bat.enable = true;
neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
};
direnv.enable = true;
lsd = {
enable = true;
enableAliases = true;
};
git = {
enable = true;
userName = cfg.user.fullName;
userEmail = cfg.user.email;
delta = { enable = true; };
extraConfig = {
color = { ui = "auto"; };
push = {
default = "upstream";
autoSetupRemote = true;
};
init = { defaultBranch = "main"; };
};
includes =
(builtins.map (f: { path = gitconfigs + "/" + f; }) gitconfigFiles)
++ cfg.user.extraGitConfigs;
};
zsh = {
enable = true;
autosuggestion.enable = true;
initExtra = ''
export PROMPT='%(!.%{%F{yellow}%}.)$USER@%{$fg[white]%}%M %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
'';
};
zsh.oh-my-zsh = {
enable = true;
plugins = [ "git" "sudo" ];
theme = "robbyrussell";
};
tmux = {
enable = true;
clock24 = true;
mouse = true;
plugins = with pkgs.tmuxPlugins; [ nord cpu battery sidebar ];
};
};
};
home-manager.users.root = hm.makeRootUser { pkgs = pkgs; };
home-manager.users.${cfg.user.name} = hm.makeCommonUser { pkgs = pkgs; };
};
}
# user = {
# name = "ari";
# fullName = "Ari Sosnovsky";
# email = "ariel@sosnovsky.ca";
# };
# sumoUser = rec {
# name = "asosnovsky";
# fullName = user.fullName;
# email = "${name}@sumologic.com";
# homepath = "/Users/${name}";
# extraGitConfigs = [{ path = "${homepath}/.config/mysumo/gitconfig"; }];
# };