Add home-manager baseline

This commit is contained in:
GHOSCHT 2023-12-26 13:59:30 +01:00
parent 9b851c37b8
commit 37d462c75f
Signed by: ghoscht
GPG key ID: 2C2C1C62A5388E82
21 changed files with 518 additions and 27 deletions

View file

@ -1,5 +1,21 @@
{ {
"nodes": { "nodes": {
"base16-schemes": {
"flake": false,
"locked": {
"lastModified": 1689473676,
"narHash": "sha256-L0RhUr9+W5EPWBpLcmkKpUeCEWRs/kLzVMF3Vao2ZU0=",
"owner": "tinted-theming",
"repo": "base16-schemes",
"rev": "d95123ca6377cd849cfdce92c0a24406b0c6a789",
"type": "github"
},
"original": {
"owner": "tinted-theming",
"repo": "base16-schemes",
"type": "github"
}
},
"hardware": { "hardware": {
"locked": { "locked": {
"lastModified": 1702453208, "lastModified": 1702453208,
@ -36,6 +52,45 @@
"type": "github" "type": "github"
} }
}, },
"nh": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1703024852,
"narHash": "sha256-mVJ/99zkqpqDDs68jYIVYyQH6NBgciKnUg8AfWyXSAM=",
"owner": "viperml",
"repo": "nh",
"rev": "37b0d469a328a5b5969eacdf137f1e6b86c75a1d",
"type": "github"
},
"original": {
"owner": "viperml",
"repo": "nh",
"type": "github"
}
},
"nix-colors": {
"inputs": {
"base16-schemes": "base16-schemes",
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1695388192,
"narHash": "sha256-2jelpE7xK+4M7jZNyWL7QYOYegQLYBDQS5bvdo8XRUQ=",
"owner": "misterio77",
"repo": "nix-colors",
"rev": "37227f274b34a3b51649166deb94ce7fec2c6a4c",
"type": "github"
},
"original": {
"owner": "misterio77",
"repo": "nix-colors",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1703068421, "lastModified": 1703068421,
@ -52,6 +107,21 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs-lib": {
"locked": {
"lastModified": 1694911725,
"narHash": "sha256-8YqI+YU1DGclEjHsnrrGfqsQg3Wyga1DfTbJrN3Ud0c=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "819180647f428a3826bfc917a54449da1e532ce0",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixpkgs-unstable": { "nixpkgs-unstable": {
"locked": { "locked": {
"lastModified": 1697059129, "lastModified": 1697059129,
@ -72,6 +142,8 @@
"inputs": { "inputs": {
"hardware": "hardware", "hardware": "hardware",
"home-manager": "home-manager", "home-manager": "home-manager",
"nh": "nh",
"nix-colors": "nix-colors",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable" "nixpkgs-unstable": "nixpkgs-unstable"
} }

View file

@ -14,10 +14,11 @@
home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager.inputs.nixpkgs.follows = "nixpkgs";
hardware.url = "github:nixos/nixos-hardware"; hardware.url = "github:nixos/nixos-hardware";
nh = {
# Shameless plug: looking for a way to nixify your themes and make url = "github:viperml/nh";
# everything match nicely? Try nix-colors! inputs.nixpkgs.follows = "nixpkgs";
# nix-colors.url = "github:misterio77/nix-colors"; };
nix-colors.url = "github:misterio77/nix-colors";
}; };
outputs = { outputs = {

View file

@ -5,6 +5,8 @@
}: { }: {
imports = [ imports = [
./global ./global
./features/games
./features/coding
]; ];
# colorscheme = inputs.nix-colors.colorschemes.paraiso; # colorscheme = inputs.nix-colors.colorschemes.paraiso;

View file

@ -0,0 +1,6 @@
{
programs.bat = {
enable = true;
config.theme = "base16";
};
}

View file

@ -0,0 +1,9 @@
{
programs.btop = {
enable = true;
settings = {
color_theme = "Default";
theme_background = false;
};
};
}

View file

@ -0,0 +1,31 @@
{pkgs, ...}: {
imports = [
./bat.nix
./direnv.nix
./fish.nix
./git.nix
./gpg.nix
./pfetch.nix
./btop.nix
./nix-index.nix
./lazygit.nix
];
home.packages = with pkgs; [
comma # Install and run programs by sticking a , before them
distrobox # Nice escape hatch, integrates docker images with my environment
bc # Calculator
eza # Better ls
ripgrep # Better grep
fd # Better find
httpie # Better curl
diffsitter # Better diff
jq # JSON pretty printer and manipulator
timer # To help with my ADHD paralysis
lazydocker # Docker TUI
nvd # Differ
nix-output-monitor
nh # Nice wrapper for NixOS and HM
];
}

View file

@ -0,0 +1,6 @@
{
programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
}

View file

@ -0,0 +1,88 @@
{
config,
lib,
pkgs,
...
}: let
inherit (lib) mkIf;
hasPackage = pname: lib.any (p: p ? pname && p.pname == pname) config.home.packages;
hasRipgrep = hasPackage "ripgrep";
hasExa = hasPackage "eza";
hasNeovim = config.programs.neovim.enable;
hasLazygit = config.programs.lazygit.enable;
hasLazydocker = hasPackage "lazydocker";
hasNixYourShell = hasPackage "nix-your-shell";
hasShellColor = config.programs.shellcolor.enable;
shellcolor = "${pkgs.shellcolord}/bin/shellcolor";
in {
programs.fish = {
enable = true;
interactiveShellInit = ''
${
if hasNixYourShell
then "nix-your-shell fish | source"
else ""
}
'';
plugins = [
{
name = "grc";
src = pkgs.fishPlugins.grc.src;
}
{
name = "fzf";
src = pkgs.fishPlugins.fzf.src;
}
{
name = "tide";
src = pkgs.fishPlugins.tide.src;
}
{
name = "sponge";
src = pkgs.fishPlugins.sponge.src;
}
{
name = "autopair";
src = pkgs.fishPlugins.autopair.src;
}
];
shellAliases = {
lzg = mkIf hasLazygit "lazygit";
lzd = mkIf hasLazydocker "lazydocker";
batt = ''upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -e "percentage" -e "state"'';
hx = "~/Documents/heliox-cli/target/debug/heliox-cli --mode";
slp = "systemctl suspend";
sdn = "shutdown 0";
};
shellAbbrs = rec {
jqless = "jq -C | less -r";
n = "nix";
nd = "nix develop -c $SHELL";
ns = "nix shell";
nsn = "nix shell nixpkgs#";
nb = "nix build";
nbn = "nix build nixpkgs#";
nf = "nix flake";
nr = "nixos-rebuild --flake .";
nrs = "nixos-rebuild --flake . switch";
snr = "sudo nixos-rebuild --flake .";
snrs = "sudo nixos-rebuild --flake . switch";
hm = "home-manager --flake .";
hms = "home-manager --flake . switch";
ls = mkIf hasExa "eza";
exa = mkIf hasExa "eza";
vim = mkIf hasNeovim "nvim";
vi = vim;
v = vim;
};
functions = {
# Disable greeting
fish_greeting = "";
};
};
home.packages = with pkgs; [grc fzf nix-your-shell];
}

21
home/features/cli/git.nix Normal file
View file

@ -0,0 +1,21 @@
{pkgs, ...}: {
#Prefer IPv4 for ssh
home.file.".ssh/config".text = "AddressFamily inet";
programs.git = {
enable = true;
userName = "GHOSCHT";
userEmail = "31184695+GHOSCHT@users.noreply.github.com";
package = pkgs.gitAndTools.gitFull;
extraConfig = {
commit.gpgsign = true;
user.signingkey = "0x2C2C1C62A5388E82";
init.defaultBranch = "main";
};
lfs.enable = true;
aliases = {
graph = "log --decorate --oneline --graph";
};
};
}

25
home/features/cli/gpg.nix Normal file
View file

@ -0,0 +1,25 @@
{
lib,
pkgs,
...
}: {
programs.gpg = {
enable = true;
};
services.gpg-agent = {
enable = true;
enableSshSupport = true;
enableFishIntegration = true;
enableZshIntegration = true;
pinentryFlavor = "gnome3";
};
# Prevent clobbering SSH_AUTH_SOCK
home.sessionVariables.GSM_SKIP_SSH_AGENT_WORKAROUND = "1";
# Disable gnome-keyring ssh-agent
xdg.configFile."autostart/gnome-keyring-ssh.desktop".text = ''
${lib.fileContents "${pkgs.gnome3.gnome-keyring}/etc/xdg/autostart/gnome-keyring-ssh.desktop"}
Hidden=true
'';
}

View file

@ -0,0 +1,5 @@
{
programs.lazygit = {
enable = true;
};
}

View file

@ -0,0 +1,33 @@
{pkgs, ...}: let
update-script = pkgs.writeShellApplication {
name = "fetch-nix-index-database";
runtimeInputs = with pkgs; [wget coreutils];
text = ''
filename="index-x86_64-linux"
mkdir -p ~/.cache/nix-index
cd ~/.cache/nix-index
wget -N "https://github.com/Mic92/nix-index-database/releases/latest/download/$filename"
ln -f "$filename" files
'';
};
in {
programs.nix-index.enable = true;
systemd.user.services.nix-index-database-sync = {
Unit = {Description = "fetch mic92/nix-index-database";};
Service = {
Type = "oneshot";
ExecStart = "${update-script}/bin/fetch-nix-index-database";
Restart = "on-failure";
RestartSec = "5m";
};
};
systemd.user.timers.nix-index-database-sync = {
Unit = {Description = "Automatic github:mic92/nix-index-database fetching";};
Timer = {
OnBootSec = "10m";
OnUnitActiveSec = "24h";
};
Install = {WantedBy = ["timers.target"];};
};
}

View file

@ -0,0 +1,6 @@
{pkgs, ...}: {
home = {
packages = with pkgs; [pfetch];
sessionVariables.PF_INFO = "ascii title os kernel uptime shell term desktop scheme palette";
};
}

View file

@ -0,0 +1,7 @@
{pkgs, ...}: {
imports = [
./nvim.nix
./vscode.nix
./intellij.nix
];
}

View file

@ -0,0 +1,5 @@
{pkgs, ...}: {
home.packages = with pkgs.unstable; [
(jetbrains.plugins.addPlugins jetbrains.idea-ultimate ["ideavim"])
];
}

View file

@ -0,0 +1,30 @@
{
config,
lib,
pkgs,
vars,
...
}: let
in {
home = {
file.".config/nvim/lua/custom/" = {
source = ../../../rsc/config/nvim;
recursive = true;
};
packages = with pkgs; [
gcc
black
python310Packages.debugpy # is this working?
mypy
ruff
nodePackages.pyright
clang-tools_16
rnix-lsp
rust-analyzer
nodePackages.eslint_d
nodePackages.jsonlint
alejandra
];
};
}

View file

@ -0,0 +1,83 @@
{
config,
lib,
pkgs,
vars,
...
}: let
in {
programs.vscode = {
enable = true;
package = pkgs.vscodium;
enableUpdateCheck = false;
extensions = with pkgs.vscode-extensions;
[
catppuccin.catppuccin-vsc
pkief.material-icon-theme
vscodevim.vim
bbenoist.nix
ms-python.python
ms-toolsai.jupyter
ms-toolsai.jupyter-renderers
ms-toolsai.jupyter-keymap
]
++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
{
name = "remote-ssh-edit";
publisher = "ms-vscode-remote";
version = "0.47.2";
sha256 = "1hp6gjh4xp2m1xlm1jsdzxw9d8frkiidhph6nvl24d0h8z34w49g";
}
{
name = "cpptools";
publisher = "ms-vscode";
version = "1.19.1";
sha256 = "sha256-yUZTLnN4nomFp5I0VgRz7rRMkeMU9QzY+dzEdUUASek=";
}
{
name = "camkes-syntax-highlighting";
publisher = "hensoldt-cyber-gmbh";
version = "1.1.3";
sha256 = "sha256-dRhsFGSjR/Vp5aJgMDwCZQtwmmfNXbM85ViTIq5ORwY=";
}
];
userSettings = {
#Theming
"workbench.colorTheme" = "Catppuccin Mocha";
"catppuccin.accentColor" = "teal";
"workbench.iconTheme" = "material-icon-theme";
"window.menuBarVisibility" = "toggle";
"editor.minimap.autohide" = false;
#Extensions - General
"extensions.autoCheckUpdates" = false;
"extensions.autoUpdate" = false;
# Startup
"workbench.startupEditor" = "none";
# Vim
"editor.lineNumbers" = "relative";
};
keybindings = [
# Navigating Autosuggest and Quick Open entries
{
"key" = "ctrl+j";
"command" = "selectNextSuggestion";
"when" = "suggestWidgetVisible";
}
{
"key" = "ctrl+k";
"command" = "selectPrevSuggestion";
"when" = "suggestWidgetVisible";
}
{
"key" = "ctrl+j";
"command" = "workbench.action.quickOpenSelectNext";
"when" = "inQuickOpen";
}
{
"key" = "ctrl+k";
"command" = "workbench.action.quickOpenSelectPrevious";
"when" = "inQuickOpen";
}
];
};
}

View file

@ -0,0 +1,5 @@
{pkgs, ...}: {
imports = [
./steam.nix
];
}

View file

@ -0,0 +1,30 @@
{
pkgs,
lib,
config,
...
}: let
steam-with-pkgs = pkgs.steam.override {
extraPkgs = pkgs:
with pkgs; [
xorg.libXcursor
xorg.libXi
xorg.libXinerama
xorg.libXScrnSaver
libpng
libpulseaudio
libvorbis
stdenv.cc.cc.lib
libkrb5
keyutils
gamescope
mangohud
];
};
in {
home.packages = with pkgs; [
gamescope
mangohud
protontricks
];
}

View file

@ -6,38 +6,43 @@
lib, lib,
config, config,
pkgs, pkgs,
vars,
... ...
}: { }: {
# You can import other home-manager modules here # You can import other home-manager modules here
imports = [ imports =
# If you want to use modules your own flake exports (from modules/home-manager): [
# outputs.homeManagerModules.example # If you want to use modules your own flake exports (from modules/home-manager):
# outputs.homeManagerModules.example
# Or modules exported from other flakes (such as nix-colors): # Or modules exported from other flakes (such as nix-colors):
# inputs.nix-colors.homeManagerModules.default # inputs.nix-colors.homeManagerModules
# You can also split up your configuration and import pieces of it here: # You can also split up your configuration and import pieces of it here:
# ./nvim.nix ../features/cli
]; ]
++ (builtins.attrValues outputs.homeManagerModules);
nixpkgs = { nixpkgs = {
# You can add overlays here # You can add overlays here
overlays = [ overlays =
# Add overlays your own flake exports (from overlays and pkgs dir): [
outputs.overlays.additions # Add overlays your own flake exports (from overlays and pkgs dir):
outputs.overlays.modifications # outputs.overlays.additions
outputs.overlays.unstable-packages # outputs.overlays.modifications
# outputs.overlays.unstable-packages
# You can also add overlays exported from other flakes: # You can also add overlays exported from other flakes:
# neovim-nightly-overlay.overlays.default # neovim-nightly-overlay.overlays.default
# Or define it inline, for example: # Or define it inline, for example:
# (final: prev: { # (final: prev: {
# hi = final.hello.overrideAttrs (oldAttrs: { # hi = final.hello.overrideAttrs (oldAttrs: {
# patches = [ ./change-hello-to-hi.patch ]; # patches = [ ./change-hello-to-hi.patch ];
# }); # });
# }) # })
]; ]
++ (builtins.attrValues outputs.overlays);
# Configure your nixpkgs instance # Configure your nixpkgs instance
config = { config = {
# Disable if you don't want unfree packages # Disable if you don't want unfree packages
@ -59,7 +64,7 @@
}; };
home = { home = {
username = lib.mkDefault "ghoscht"; username = lib.mkDefault vars.user;
homeDirectory = lib.mkDefault "/home/${config.home.username}"; homeDirectory = lib.mkDefault "/home/${config.home.username}";
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
stateVersion = "23.11"; stateVersion = "23.11";

View file

@ -3,6 +3,27 @@
# This one brings our custom packages from the 'pkgs' directory # This one brings our custom packages from the 'pkgs' directory
additions = final: _prev: import ../pkgs {pkgs = final;}; additions = final: _prev: import ../pkgs {pkgs = final;};
# Third party overlays
nh = inputs.nh.overlays.default;
# For every flake input, aliases 'pkgs.inputs.${flake}' to
# 'inputs.${flake}.packages.${pkgs.system}' or
# 'inputs.${flake}.legacyPackages.${pkgs.system}'
flake-inputs = final: _: {
inputs =
builtins.mapAttrs
(
_: flake: let
legacyPackages = (flake.legacyPackages or {}).${final.system} or {};
packages = (flake.packages or {}).${final.system} or {};
in
if legacyPackages != {}
then legacyPackages
else packages
)
inputs;
};
# This one contains whatever you want to overlay # This one contains whatever you want to overlay
# You can change versions, add patches, set compilation flags, anything really. # You can change versions, add patches, set compilation flags, anything really.
# https://nixos.wiki/wiki/Overlays # https://nixos.wiki/wiki/Overlays