Add my linux machine

This commit is contained in:
Natsu Kagami 2021-10-08 22:52:28 -04:00
parent 5aa68a423a
commit bed1754724
14 changed files with 465 additions and 36 deletions

53
X11/alacritty.nix Normal file
View file

@ -0,0 +1,53 @@
{ pkgs, config, lib, ... } :
let
pkgsUnstable = import <nixpkgs-unstable> {};
in
{
home.packages = [
# Enable the FSM font with NF variant
(pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
];
programs.alacritty = {
enable = true;
package = pkgsUnstable.alacritty;
settings = {
background_opacity = 0.95;
font = {
size = 14.0;
normal.family = "Fantasque Sans Mono Nerd Font";
};
shell = {
program = "/bin/sh";
args = [ "-ic" "fish" ];
};
colors = {
# Default colors
primary.background = "0xf1f1f1";
primary.foreground = "0x424242";
# Normal colors
normal.black = "0x212121";
normal.red = "0xc30771";
normal.green = "0x10a778";
normal.yellow = "0xa89c14";
normal.blue = "0x008ec4";
normal.magenta = "0x523c79";
normal.cyan = "0x20a5ba";
normal.white = "0xe0e0e0";
# Bright colors
bright.black = "0x212121";
bright.red = "0xfb007a";
bright.green = "0x5fd7af";
bright.yellow = "0xf3e430";
bright.blue = "0x20bbfc";
bright.magenta = "0x6855de";
bright.cyan = "0x4fb8cc";
bright.white = "0xf1f1f1";
};
};
};
}

36
X11/default.nix Normal file
View file

@ -0,0 +1,36 @@
{ pkgs, config, lib, ... } :
{
imports = [ ./packages.nix ];
home.sessionVariables = {
# Set up Java font style
_JAVA_OPTIONS = "-Dawt.useSystemAAFontSettings=lcd";
};
# X Session settings
xsession.enable = true;
# Wallpaper
home.file.wallpaper = {
source = ./. + "/wallpaper.jpg";
target = "wallpaper.jpg";
};
# Cursor
xsession.pointerCursor = {
package = pkgs.numix-cursor-theme;
name = "Numix-Cursor-Light";
size = 32;
};
# MIME set ups
xdg.enable = true;
xdg.mimeApps.enable = true;
xdg.mimeApps.defaultApplications = {
"x-scheme-handler/http" = [ "firefox.desktop" ];
"x-scheme-handler/https" = [ "firefox.desktop" ];
"x-scheme-handler/ftp" = [ "firefox.desktop" ];
"x-scheme-handler/ftps" = [ "firefox.desktop" ];
};
}

23
X11/hidpi.nix Normal file
View file

@ -0,0 +1,23 @@
{ pkgs, config, lib, ... } :
{
# X resources for 4k monitor
home.file."4k.Xresources" = {
target = ".config/X11/.Xresources";
text = ''
Xft.dpi: 192
! These might also be useful depending on your monitor and personal preference:
Xft.autohint: 0
Xft.lcdfilter: lcddefault
Xft.hintstyle: hintfull
Xft.hinting: 1
Xft.antialias: 1
Xft.rgba: rgb
'';
};
# Load 4k Xresources
xsession.initExtra = ''
xrdb -merge ~/.config/X11/.Xresources
feh --bg-fill ~/wallpaper.jpg
'';
}

128
X11/i3.nix Normal file
View file

@ -0,0 +1,128 @@
{ pkgs, config, lib, ... } :
let
mod = "Mod4";
workspaces = [
"1: web"
"2: chat"
"3: code"
"4: music"
"5: extra"
"6: 6"
"7: 7"
"8: 8"
"9: 9"
"10: 10"
];
wsAttrs = builtins.listToAttrs (
map
(i: { name = toString (remainder i 10); value = builtins.elemAt workspaces (i - 1); })
(range 1 11)
);
remainder = x: y: x - (builtins.div x y) * y;
range = from: to:
let
f = cur: if cur == to then [] else [cur] ++ f (cur + 1);
in f from;
in
{
## i3 window manager
xsession.windowManager.i3 = {
enable = true;
config.assigns = {
"${wsAttrs."1"}" = [ { class = "^Firefox$"; } ];
"${wsAttrs."2"}" = [ { class = "^Discord$"; } ];
};
config.bars = [ {
command = "${pkgs.i3-gaps}/bin/i3bar -t";
statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ~/.config/i3status-rust/config-default.toml";
position = "top";
colors = {
background = "#00000080";
statusline = "#ffffff";
separator = "#666666";
focusedWorkspace = { background = "#4c7899"; border = "#285577"; text = "#ffffff"; };
activeWorkspace = { background = "#333333"; border = "#5f676a"; text = "#ffffff"; };
inactiveWorkspace = { background = "#333333"; border = "#222222"; text = "#888888"; };
urgentWorkspace = { background = "#2f343a"; border = "#900000"; text = "#ffffff"; };
bindingMode = { background = "#2f343a"; border = "#900000"; text = "#ffffff"; };
};
} ];
config.fonts = { names = [ "FantasqueSansMono Nerd Font Mono" "monospace" ]; size = 11.0; };
config.gaps.outer = 5;
config.gaps.inner = 5;
config.gaps.smartGaps = true;
config.modifier = mod;
config.terminal = "alacritty";
config.window.titlebar = false;
# Keybindings
config.keybindings = lib.mkOptionDefault ({
## vim-style movements
"${mod}+h" = "focus left";
"${mod}+j" = "focus down";
"${mod}+k" = "focus up";
"${mod}+l" = "focus right";
"${mod}+Shift+h" = "move left";
"${mod}+Shift+j" = "move down";
"${mod}+Shift+k" = "move up";
"${mod}+Shift+l" = "move right";
## Splits
"${mod}+v" = "split v";
"${mod}+Shift+v" = "split h";
## Run
"${mod}+r" = "exec ${pkgs.dmenu}/bin/dmenu_run";
"${mod}+d" = "exec i3-dmenu-desktop --dmenu='${pkgs.dmenu}/bin/dmenu -i'";
} // (
builtins.listToAttrs (lib.flatten (map (key: [
{
name = "${mod}+${key}";
value = "workspace ${builtins.getAttr key wsAttrs}";
}
{
name = "${mod}+Shift+${key}";
value = "move to workspace ${builtins.getAttr key wsAttrs}";
}
]) (builtins.attrNames wsAttrs))
)));
};
# i3status
programs.i3status-rust.enable = true;
programs.i3status-rust.bars.default = {
icons = "material-nf";
theme = "native";
settings = {
icons_format = " <span font_family='FantasqueSansMono Nerd Font'>{icon}</span> ";
};
blocks = [
{
block = "bluetooth";
mac = "5C:52:30:D8:E2:9D";
format = "Airpods Pro {percentage}";
format_unavailable = "Airpods Pro XX";
}
{
block = "cpu";
format = "{utilization}";
}
{
block = "hueshift";
}
{
block = "memory";
}
{
block = "net";
}
{
block = "sound";
}
{
block = "time";
}
];
};
}

38
X11/packages.nix Normal file
View file

@ -0,0 +1,38 @@
{ pkgs, config, lib, ... }:
let
pkgsUnstable = import <nixpkgs-unstable> {};
# Override nss to open links in Firefox (https://github.com/NixOS/nixpkgs/issues/78961)
discordPkg = pkgsUnstable.discord.override { nss = pkgs.nss_latest; };
in
{
imports = [ ./alacritty.nix ./i3.nix ];
home.packages = (with pkgs; [
## GUI stuff
gnome.cheese # Webcam check
evince # PDF reader
gparted
vscode
feh
deluge # Torrent client
mailspring
discordPkg
# CLI stuff
xsel # Clipboard management
dex # .desktop file management, startup
sct # Display color temperature
]);
# Gnome-keyring
services.gnome-keyring.enable = true;
# Picom: X Compositor
services.picom = {
enable = true;
blur = true;
fade = true;
fadeDelta = 3;
shadow = true;
};
}

BIN
X11/wallpaper.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

View file

@ -6,6 +6,9 @@
./fish/fish.nix
];
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
# Enable the manual so we don't have to load it
manual.html.enable = true;
@ -36,11 +39,23 @@
nnn
## PDF Processors
poppler_utils
## htop replacement
bottom
# Databases
postgresql
];
home.sessionVariables = {
# Bat theme
BAT_THEME = "GitHub";
};
home.sessionPath = [
# Sometimes we want to install custom scripts here
"~/.local/bin"
];
# Programs
programs = {
bat = {
@ -50,12 +65,13 @@
};
};
bottom.enable = true;
broot.enable = true;
command-not-found.enable = true;
exa = {
enable = true;
enableAliases = true;
};
# later
@ -71,6 +87,26 @@
gitProtocol = "ssh";
};
git = {
enable = true;
delta = {
enable = true;
options = {
line-numbers = true;
side-by-side = true;
};
};
signing.key = null;
signing.signByDefault = true;
userEmail = "nki@nkagami.me";
userName = "Natsu Kagami";
extraConfig = {
init.defaultBranch = "master";
};
};
gpg.enable = true;
jq.enable = true;
nushell.enable = true;

8
config.nix Normal file
View file

@ -0,0 +1,8 @@
{
allowUnfree = true;
packageOverrides = pkgs: {
nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") {
inherit pkgs;
};
};
}

33
firefox.nix Normal file
View file

@ -0,0 +1,33 @@
{ pkgs, config, lib, ... } :
{
programs.firefox = {
enable = true;
package = pkgs.firefox.override {
cfg = {
# Tridactyl native connector
enableTridactylNative = true;
};
};
extensions = with pkgs.nur.repos.rycee.firefox-addons; [
bitwarden
grammarly
https-everywhere
multi-account-containers
octotree
reddit-enhancement-suite
refined-github
simple-tab-groups
sponsorblock
tridactyl
ublock-origin
web-scrobbler
];
profiles.nki.id = 0;
profiles.nki.isDefault = true;
profiles.nki.settings = {
"browser.search.region" = "CA";
};
};
}

View file

@ -1,8 +1,12 @@
{ config, pkgs, ... }:
let
pkgsUnstable = import <nixpkgs-unstable> {};
in
{
programs.fish = {
enable = true;
package = pkgsUnstable.fish;
functions = {
};
@ -29,6 +33,12 @@
# Source iTerm2 integration
source ~/.iterm2_shell_integration.fish
# Enable vi keybindings
fish_vi_key_bindings
## Set some kak-focused keybindings
bind -M default gi beginning-of-line
bind -M default gl end-of-line
'';
plugins = [
{

43
kagami-pc-home.nix Normal file
View file

@ -0,0 +1,43 @@
{ pkgs, config, lib, ... } :
{
imports = [
# Common configuration
./common.nix
# Set up X11-specific common configuration
./X11/default.nix
# We use our own firefox
./firefox.nix
# osu!
./osu.nix
];
# Home Manager needs a bit of information about you and the
# paths it should manage.
home.username = "nki";
home.homeDirectory = "/home/nki";
# More packages
home.packages = (with pkgs; [
# CLI stuff
python
zip
# TeX
texlive.combined.scheme-full
# Java & sbt
openjdk11
sbt
]);
# 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.05";
}

View file

@ -17,7 +17,11 @@ let
cargoDeps = drv.cargoDeps.overrideAttrs (lib.const {
inherit src;
outputHash = "1risazihwy6v3rc1lxram0z2my29b3w52d827963b7zfahgmsaq5";
outputHash = (
if pkgs.stdenv.isDarwin
then "1risazihwy6v3rc1lxram0z2my29b3w52d827963b7zfahgmsaq5"
else "0ywb9489jrb5lsycxlxzrj2khkcjhvzxbb0ckbpwwvg11r4ds240"
);
});
});
in

View file

@ -89,8 +89,8 @@ in
owner = "Screwtapello";
repo = "kakoune-inc-dec";
rev = "7bfe9c51";
sha256 = "0cxmk4yiy30lxd3h02g02b1d9pds2pa46p3pvamj9wwq9sai5xdi";
leaveDotGit = true;
sha256 = "0f33wqxqbfygxypf348jf1fiscac161wf2xvnh8zwdd3rq5yybl0";
# leaveDotGit = true;
};
}
]);

17
osu.nix Normal file
View file

@ -0,0 +1,17 @@
{ pkgs, config, lib, ... }:
let
pkgsUnstableOsu = import "/home/nki/nixpkgs/osu-lazer" {};
# osu = pkgs.osu-lazer.overrideAttrs (oldAttrs : rec {
# version = "2021.1006.1";
# src = pkgs.fetchFromGitHub {
# owner = "ppy";
# repo = "osu";
# rev = version;
# sha256 = "11qwrsp9kfxgz7dvh56mbgkry252ic3l5mgx3hwchrwzll71f0yd";
# };
# });
in
{
home.packages = [ pkgsUnstableOsu.osu-lazer ];
}