Add home-manager WIP

This commit is contained in:
Sridhar Ratnakumar 2021-04-06 15:39:54 -04:00
parent 81cbe2a138
commit 96eb9081e9
3 changed files with 179 additions and 6 deletions

43
flake.lock generated
View file

@ -1,12 +1,30 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1617625716,
"narHash": "sha256-B36WKNVwtmRk3oqJ9XbOca0iy1Ga1dW6E26iavRFPKQ=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "cc60c22c69e6967b732d02f072a9f1e30454e4f6",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1617730239,
"narHash": "sha256-/ld88MfYZwO6kgHxsTFcViidEOxOSrYEgW/0uSl8EFc=",
"lastModified": 1617737732,
"narHash": "sha256-ZwXL2oC/x2YSYkDdnbyFiSD8v1D6uoJSUA3FX0o8BZ4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a05293a93c8498ee3b2e72afc91cbfbd04547918",
"rev": "f7ff87470148462b06ff5516ae9c4439f9519935",
"type": "github"
},
"original": {
@ -14,9 +32,26 @@
"type": "indirect"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1617636226,
"narHash": "sha256-iZhBWrOR2DoDs1C+0FlnM9AQLMol/qoGQ+d+S43CKJM=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "3d1a7716d7f1fccbd7d30ab3b2ed3db831f43bde",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
"home-manager": "home-manager",
"nixpkgs": "nixpkgs_2"
}
}
},

View file

@ -1,8 +1,23 @@
{
outputs = { self, nixpkgs }: {
description = "NixOS configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager";
};
outputs = { self, home-manager, nixpkgs }: {
nixosConfigurations.x1c7 = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [ ./configuration.nix ];
modules = [
./configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.srid = import ./home.nix;
}
];
};
};
}

123
home.nix Normal file
View file

@ -0,0 +1,123 @@
{ config, pkgs, ... }:
let
nix-thunk =
(import (builtins.fetchTarball "https://github.com/obsidiansystems/nix-thunk/archive/master.tar.gz") {}).command;
in {
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
# Home Manager needs a bit of information about you and the
# paths it should manage.
home.username = "srid";
home.homeDirectory = "/home/srid";
home.packages = with pkgs; [
cachix
# tig
# dotnet-sdk_5
# nix-thunk
];
programs = {
git = {
# package = pkgs.gitAndTools.gitFull;
enable = true;
userName = "Sridhar Ratnakumar";
userEmail = "srid@srid.ca";
aliases = {
co = "checkout";
ci = "commit";
cia = "commit --amend";
s = "status";
st = "status";
b = "branch";
p = "pull --rebase";
pu = "push";
};
ignores = [ "*~" "*.swp" ];
extraConfig = {
init.defaultBranch = "master";
#core.editor = "nvim";
#protocol.keybase.allow = "always";
credential.helper = "store --file ~/.git-credentials";
pull.rebase = "false";
};
};
tmux = {
enable = true;
shortcut = "a";
aggressiveResize = true;
baseIndex = 1;
newSession = true;
# Stop tmux+escape craziness.
escapeTime = 0;
# Force tmux to use /tmp for sockets (WSL2 compat)
secureSocket = false;
extraConfig = ''
# Mouse works as expected
set-option -g mouse on
# easy-to-remember split pane commands
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
'';
};
neovim = {
enable = true;
viAlias = true;
vimAlias = true;
# withNodeJs = true;
plugins = with pkgs.vimPlugins; [
vim-nix
];
};
bash = {
enable = true;
shellAliases = {
g = "git";
t = "tig";
l = "ls --color=always";
};
# Without this, none of the Nix stuff will be on PATH.
initExtra = ''
if [ -e ~/.nix-profile/etc/profile.d/nix.sh ]; then
. ~/.nix-profile/etc/profile.d/nix.sh;
export NIX_PATH=$HOME/.nix-defexpr/channels''${NIX_PATH:+:}$NIX_PATH
fi # added by Nix installer
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
# Add dotnet tools to PATH
export PATH=~/.dotnet/tools/:$PATH
# Rust
export PATH=/home/srid/.cargo/bin:$PATH
source $HOME/.cargo/env
'';
};
starship = {
enable = true;
};
bat.enable = true;
autojump.enable = true;
fzf.enable = true;
jq.enable = true;
};
# 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 can update Home Manager without changing this value. See
# the Home Manager release notes for a list of state version
# changes in each release.
home.stateVersion = "21.03";
}