Init commit

This commit is contained in:
Serhii Korzh 2024-03-03 16:56:25 +01:00
commit 12484b62e1
18 changed files with 841 additions and 0 deletions

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# My NixOS configuration
README coming soon!!

48
flake.lock Normal file
View File

@ -0,0 +1,48 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1708988456,
"narHash": "sha256-RCz7Xe64tN2zgWk+MVHkzg224znwqknJ1RnB7rVqUWw=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "1d085ea4444d26aa52297758b333b449b2aa6fca",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1708807242,
"narHash": "sha256-sRTRkhMD4delO/hPxxi+XwLqPn8BuUq6nnj4JqLwOu0=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "73de017ef2d18a04ac4bfd0c02650007ccb31c2a",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

41
flake.nix Normal file
View File

@ -0,0 +1,41 @@
{
description = "My NixOS configuration using flakes!";
nixConfig.extra-experimental-features = "nix-command flakes";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, ... }@inputs:
let
lib = nixpkgs.lib;
system = "x86_64-linux";
in
{
nixosConfigurations = {
default = lib.nixosSystem {
inherit system;
specialArgs = {inherit inputs;};
modules = [
"./machines/wośpbook"
inputs.home-manager.nixosModules.default
];
};
work = lib.nixosSystem {
inherit system;
specialArgs = {inherit inputs;};
modules = [
./machines/workstation
inputs.home-manager.nixosModules.default
];
};
};
};
}

View File

@ -0,0 +1,23 @@
[colors.bright]
black = "0x475258"
blue = "0x7fbbb3"
cyan = "0x83c092"
green = "0xa7c080"
magenta = "0xd699b6"
red = "0xe67e80"
white = "0xd3c6aa"
yellow = "0xdbbc7f"
[colors.normal]
black = "0x475258"
blue = "0x7fbbb3"
cyan = "0x83c092"
green = "0xa7c080"
magenta = "0xd699b6"
red = "0xe67e80"
white = "0xd3c6aa"
yellow = "0xdbbc7f"
[colors.primary]
background = "0x2d353b"
foreground = "0xd3c6aa"

View File

@ -0,0 +1,23 @@
[colors.bright]
black = "0xe0dcc7"
blue = "0x3a94c5"
cyan = "0x35a77c"
green = "0x8da101"
magenta = "0xdf69ba"
red = "0xf85552"
white = "0xe0dcc7"
yellow = "0xdfa000"
[colors.normal]
black = "0x5c6a72"
blue = "0x3a94c5"
cyan = "0x35a77c"
green = "0x8da101"
magenta = "0xdf69ba"
red = "0xf85552"
white = "0xe0dcc7"
yellow = "0xdfa000"
[colors.primary]
background = "0xfdf6e3"
foreground = "0x5c6a72"

105
home-manager/common.nix Normal file
View File

@ -0,0 +1,105 @@
{ config, pkgs, ... }:
{
imports = [
./modules/gpg.nix
./modules/git.nix
./modules/alacritty.nix
./modules/zellij.nix
./modules/helix.nix
];
# Do not update without checking the docs first.
home.stateVersion = "22.11";
home.packages = with pkgs; [
(pkgs.nerdfonts.override { fonts = [ "FiraCode" ]; })
(pkgs.writeShellScriptBin "my-hello" ''
echo "Hello, ${config.home.username}!"
'')
gnome.gnome-tweaks
gnomeExtensions.user-themes
gnomeExtensions.caffeine
ungoogled-chromium
librewolf
libreoffice
joplin-desktop
bitwarden
authy
];
fonts.fontconfig.enable = true;
home.file = {
".config/helix/".source = ./helix;
".config/alacritty/themes/".source = ./alacritty/themes;
};
home.sessionVariables = {
EDITOR = "hx";
};
programs.home-manager.enable = true;
programs.fish = {
enable = true;
plugins = [
{ name = "tide"; src = pkgs.fishPlugins.tide.src; }
{ name = "z"; src = pkgs.fishPlugins.z.src; }
];
# TODO: check your config from dotfiles
};
# TODO: install keyd or another way to use CapsLock for Esc
# TODO: color-scheme-monitor?
programs.fzf = {
enable = true;
};
programs.bat = {
enable = true;
};
programs.nnn = {
enable = true;
};
programs.vscode = {
enable = true;
package = pkgs.vscodium;
};
gtk = {
enable = true;
iconTheme = {
name = "Papirus-Dark";
package = pkgs.papirus-icon-theme;
};
cursorTheme = {
name = "Numix-Cursor";
package = pkgs.numix-cursor-theme;
};
};
home.pointerCursor = {
name = "Numix-Cursor";
package = pkgs.numix-cursor-theme;
size = 36;
x11.enable = true;
};
dconf.settings = {
"org/gnome/shell" = {
disable-user-extensions = false;
enabled-extensions = [
"caffeine@patapon.info"
"user-theme@gnome-shell-extensions.gcampax.github.com"
];
};
"org/gnome/desktop/interface" = {
enable-hot-corners = false;
};
};
}

View File

@ -0,0 +1,25 @@
theme = "everforest_dark"
[editor]
line-number = "relative"
cursorline = true
auto-save = true
bufferline = "multiple"
color-modes = true
[editor.soft-wrap]
enable = true
[editor.statusline]
right = ["diagnostics", "selections", "position", "position-percentage", "file-encoding"]
mode.normal = "NORMAL"
mode.insert = "INSERT"
mode.select = "SELECT"
[editor.cursor-shape]
normal = "block"
insert = "bar"
select = "underline"
[editor.file-picker]
hidden = false

View File

@ -0,0 +1,39 @@
{ pkgs, ... }:
{
programs.alacritty = {
enable = true;
settings = {
env.TERM = "xterm-256color";
window.decorations = "full";
font.normal.family = "FiraCode Nerd Font";
font.normal.style = "Regular";
font.bold.family = "FiraCode Nerd Font";
font.bold.style = "Bold";
font.italic.family = "FiraCode Nerd Font";
font.italic.style = "MediumItalic";
font.bold_italic.family = "FiraCode Nerd Font";
font.bold_italic.style = "BoldItalic";
font.size = 14.0;
font.offset = {
x = 0;
y = 4;
};
scrolling = {
history = 10000;
multiplier = 3;
};
colors.draw_bold_text_with_bright_colors = true;
shell = "${pkgs.fish}/bin/fish";
import = ["~/.config/alacritty/themes/everforest_dark.toml"];
keyboard.bindings = [
{
key = "F11";
action = "ToggleFullscreen";
}
];
# TODO: check wezterm for an alternative
};
};
}

View File

@ -0,0 +1,124 @@
{
programs.lazygit = {
enable = true;
settings = {
git = {
paging = {
colorArg = "always";
pager = "delta --dark --paging=never";
};
overrideGpg = true;
};
};
};
programs.git = {
enable = true;
userName = "Serhii Korzh";
userEmail = "serge.korzh@pm.me";
# TODO: check aliases that I'm used to and change email according to project used
delta = {
enable = true;
options = {
navigate = true;
syntax-theme = "base16";
features = "side-by-side line-numbers decorations";
whitespace-error-style = "22 reverse";
decorations = {
commit-decoration-style = "bold yellow box ul";
file-style = "bold yellow ul";
file-decoration-style = "none";
};
};
};
signing = {
signByDefault = true;
key = null;
};
extraConfig = {
core = {
whitespace = "space-before-tab, trailing-space";
};
credential = {
helper = "cache --timeout=1800";
};
commit = {
verbose = true;
};
diff = {
algorithm = "histogram";
renames = "copies";
mnemonicprefix = true;
colormoved = "default";
};
push = {
default = "simple";
autoSetupRemote = true;
};
merge = {
conflictstyle = "zdiff3";
};
rerere = {
enabled = 1;
};
pull = {
rebase = true;
};
rebase = {
autostash = true;
updateRefs = true;
};
transfer = {
credentialsInUrl = "warn";
};
absorb = {
maxstack = 50;
};
};
aliases = {
a = "add";
ap = "add --patch";
b = "branch -vv";
bd = "branch -d";
bdd = "branch -D";
c = "commit";
ca = "commit --amend";
co = "checkout";
cp = "cherry-pick";
d = "diff";
dc = "diff --cached";
ds = "diff --staged";
f = "fetch";
fx = "commit --fixup";
g = "grep -n";
hrd = "reset --hard";
l = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset %C(yellow)%an%Creset' --all --abbrev-commit --date=relative";
ls = "log --stat --oneline"; # show log with filediffs only
m = "merge";
mm = "merge origin/master";
p = "push";
pf = "push --force-with-lease";
pl = "pull --rebase";
r = "rebase";
ra = "rebase --abort";
rc = "rebase --continue";
ri = "rebase --interactive --autosquash";
rom = "rebase origin/master";
rs = "rebase --skip";
s = "status";
sh = "!git-sh";
sq = "commit --squash";
st = "diff-tree --no-commit-id --name-only -r"; # show file tree of commit
sw = "show";
w = "whatchanged";
undo = "reset --soft HEAD^";
standup = "shortlog --since='1 week ago'";
who = "shortlog -s -n --no-merges";
};
};
}

View File

@ -0,0 +1,19 @@
{
programs.gpg = {
enable = true;
settings = {
no-emit-version = true;
no-comments = true;
display-charset = "utf-8";
keyid-format = "0xlong";
with-fingerprint = true;
use-agent = true;
};
};
services.gpg-agent = {
enable = true;
defaultCacheTtl = 1800;
enableSshSupport = true;
};
}

View File

@ -0,0 +1,47 @@
{ pkgs, ... }:
{
programs.helix = {
enable = true;
package = pkgs.helix;
extraPackages = with pkgs; [
nodePackages."bash-language-server"
nodePackages."@volar/vue-language-server"
nodePackages."@tailwindcss/language-server"
nodePackages."typescript-language-server"
vscode-langservers-extracted
efm-langserver # Used by Prettier
python311Packages.python-lsp-server
dockerfile-language-server-nodejs
elmPackages.elm-language-server
yaml-language-server
marksman # Markdown
nil # Nix
## These seem to be not working
# nodePackages_latest.vscode-css-languageserver-bin
# nodePackages_latest.vscode-html-languageserver-bin
# nodePackages_latest.vscode-json-languageserver
## Provided by rustup installed as a system package
# rust-analyzer
## Not used for now
# texlab # LaTeX
# elixir-ls
# lua-language-server
# haskell-language-server
## Not working
nodePackages_latest.vls # Vue, not working
# graphql-lsp
## Debugger - not thested if it's working
lldb
# lldb_16
## Hopefully, I'll never make use of that. UPD: it's unfree lol, won't install
# nodePackages_latest.intelephense
];
};
}

View File

@ -0,0 +1,23 @@
{
programs.zellij = {
enable = true;
enableFishIntegration = true;
settings = {
default_shell = "fish";
theme = "everforest-dark";
themes.everforest-dark = {
bg = "#2b3339";
fg = "#d3c6aa";
black = "#4b565c";
red = "#e67e80";
green = "#a7c080";
yellow = "#dbbc7f";
blue = "#7fbbb3";
magenta = "#d699b6";
cyan = "#83c092";
white = "#d3c6aa";
orange = "#FF9E64";
};
};
};
}

31
home-manager/personal.nix Normal file
View File

@ -0,0 +1,31 @@
{ pkgs, ... }:
{
imports = [
./common.nix
];
home.username = "serge";
home.homeDirectory = "/home/serge";
# TODO: remove unused
home.packages = with pkgs; [
vivaldi
protonvpn-gui
tidal-hifi
telegram-desktop
signal-desktop
vlc
libsForQt5.neochat
nuclear
tauon
rhythmbox
libsForQt5.vvave
libsForQt5.elisa
zettlr
offpunk
castor
geopard
syncthing
];
}

21
home-manager/work.nix Normal file
View File

@ -0,0 +1,21 @@
{ pkgs, ... }:
{
imports = [
./common.nix
];
home.username = "work";
home.homeDirectory = "/home/work";
home.packages = with pkgs; [
firefox # Yuck!
thunderbird
slack
dbeaver
];
programs.helix.extraPackages = [
pkgs.nodePackages_latest.intelephense
];
}

141
machines/common.nix Normal file
View File

@ -0,0 +1,141 @@
{ pkgs, inputs, ... }:
{
imports = [
inputs.home-manager.nixosModules.default
];
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Enable networking
networking.networkmanager.enable = true;
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Set your time zone.
time.timeZone = "Europe/Warsaw";
# Select internationalisation properties.
i18n.defaultLocale = "en_GB.UTF-8";
# TODO: check what this option does.
security.polkit.enable = true;
# Enable the X11 windowing system.
services.xserver.enable = true;
# Enable the GNOME Desktop Environment.
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
programs.dconf.enable = true;
# Configure keymap in X11
services.xserver = {
xkb = {
layout = "us";
variant = "";
};
};
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable sound with pipewire.
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
home-manager = {
useGlobalPkgs = true;
extraSpecialArgs = { inherit inputs; };
};
# Enable docker (rooted)
virtualisation.docker.enable = true;
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
git
alacritty
helix
rustc
rustup
wget
curl
nodejs
wl-clipboard
];
# Enables vendor fish completions: https://nixos.wiki/wiki/Fish
programs.fish.enable = true;
# Enables flatpak
services.flatpak.enable = true;
# Fuse filesystem to be able to run scripts with a !/bin/bash shebang and others
services.envfs.enable = true;
# Use Caps as Escape
services.interception-tools = {
enable = true;
udevmonConfig = ''
- JOB: "${pkgs.interception-tools}/bin/intercept -g $DEVNODE | ${pkgs.interception-tools-plugins.caps2esc}/bin/caps2esc | ${pkgs.interception-tools}/bin/uinput -d $DEVNODE"
DEVICE:
EVENTS:
EV_KEY: [KEY_CAPSLOCK, KEY_ESC]
'';
};
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.05"; # Did you read the comment?
}

View File

@ -0,0 +1,41 @@
{ config, pkgs, inputs, ... }:
{
imports = [
./hardware-configuration.nix
../common.nix
];
networking.hostName = "kiwee";
i18n.extraLocaleSettings = {
LC_ADDRESS = "pl_PL.UTF-8";
LC_IDENTIFICATION = "pl_PL.UTF-8";
LC_MEASUREMENT = "pl_PL.UTF-8";
LC_MONETARY = "pl_PL.UTF-8";
LC_NAME = "pl_PL.UTF-8";
LC_NUMERIC = "pl_PL.UTF-8";
LC_PAPER = "pl_PL.UTF-8";
LC_TELEPHONE = "pl_PL.UTF-8";
LC_TIME = "pl_PL.UTF-8";
};
users.users.serge = {
isNormalUser = true;
uid = 1000;
description = "Serhii Korzh";
extraGroups = [ "networkmanager" "wheel" "docker" ];
};
home-manager.users = {
"serge" = import ../../home-manager/work.nix;
};
# Enable automatic login for the user.
services.xserver.displayManager.autoLogin.enable = true;
services.xserver.displayManager.autoLogin.user = "serge";
# Workaround for GNOME autologin: https://github.com/NixOS/nixpkgs/issues/103746#issuecomment-945091229
# systemd.services."getty@tty1".enable = false;
# systemd.services."autovt@tty1".enable = false;
}

View File

@ -0,0 +1,41 @@
{
imports =
[
./hardware-configuration.nix
../common.nix
];
networking.hostName = "nixos";
i18n.extraLocaleSettings = {
LC_ADDRESS = "fi_FI.UTF-8";
LC_IDENTIFICATION = "fi_FI.UTF-8";
LC_MEASUREMENT = "fi_FI.UTF-8";
LC_MONETARY = "fi_FI.UTF-8";
LC_NAME = "fi_FI.UTF-8";
LC_NUMERIC = "fi_FI.UTF-8";
LC_PAPER = "fi_FI.UTF-8";
LC_TELEPHONE = "fi_FI.UTF-8";
LC_TIME = "fi_FI.UTF-8";
};
# ----------------------------------------------------
users.users.serge = {
isNormalUser = true;
uid = 1000;
description = "Serge Korzh";
extraGroups = [ "networkmanager" "wheel" "docker" ];
};
users.users.work = {
isNormalUser = true;
uid = 1001;
description = "Work";
extraGroups = [ "networkmanager" "wheel" "docker" ];
};
home-manager.users = {
"serge" = import ../../home-manager/personal.nix;
"work" = import ../../home-manager/work.nix;
};
}

View File

@ -0,0 +1,46 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/f97fe659-70fa-4279-9c46-9224ca6c9e9a";
fsType = "ext4";
};
boot.initrd.luks.devices."luks-ab0f78e7-55a7-45ef-b2b4-6e25e8e5a263".device = "/dev/disk/by-uuid/ab0f78e7-55a7-45ef-b2b4-6e25e8e5a263";
# TODO: check where it came from (used to be in configuration.nix before)
boot.initrd.luks.devices."luks-ac1d5f26-f6f0-4bf5-b685-dfd9808f9aa8".device = "/dev/disk/by-uuid/ac1d5f26-f6f0-4bf5-b685-dfd9808f9aa8";
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/20F9-A60E";
fsType = "vfat";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/4c5f4e9d-b800-4414-b53e-2714f3841fb1"; }
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp60s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}