refac modules

This commit is contained in:
Dmitriy Pleshevskiy 2024-04-16 02:51:46 +03:00
parent 8bda171d56
commit 9092a13846
Signed by: pleshevskiy
GPG Key ID: 17041163DA10A9A2
179 changed files with 2416 additions and 1538 deletions

Binary file not shown.

View File

@ -109,7 +109,44 @@
"type": "github"
}
},
"firefox-addons": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
},
"locked": {
"dir": "repos/rycee/pkgs/firefox-addons",
"lastModified": 1713127732,
"narHash": "sha256-07prd+in1ZUcxETxPyWtFjl7xPKwlXzk9a47Q3RnHXU=",
"owner": "nix-community",
"repo": "nur-combined",
"rev": "6edb2a1a43dbd2f8b32876268a530ce82c64013f",
"type": "github"
},
"original": {
"dir": "repos/rycee/pkgs/firefox-addons",
"owner": "nix-community",
"ref": "master",
"repo": "nur-combined",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1629284811,
"narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c5d161cc0af116a2e17f54316f0bf43f0819785c",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
@ -400,16 +437,16 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1711460390,
"narHash": "sha256-akSgjDZL6pVHEfSE6sz1DNSXuYX6hq+P/1Z5IoYWs7E=",
"owner": "NixOS",
"lastModified": 1627814220,
"narHash": "sha256-P+MDgdZw2CBk9X1ZZaUgHgN+32pTfLFf3XVIBOXirI4=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "44733514b72e732bd49f5511bd0203dea9b9a434",
"rev": "ab5b6828af26215bf2646c31961da5d3749591ef",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.11",
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
@ -430,6 +467,22 @@
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1711460390,
"narHash": "sha256-akSgjDZL6pVHEfSE6sz1DNSXuYX6hq+P/1Z5IoYWs7E=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "44733514b72e732bd49f5511bd0203dea9b9a434",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nlsp-settings-nvim": {
"flake": false,
"locked": {
@ -578,12 +631,13 @@
"root": {
"inputs": {
"agenix": "agenix",
"flake-utils": "flake-utils",
"firefox-addons": "firefox-addons",
"flake-utils": "flake-utils_2",
"hardware": "hardware",
"home-manager": "home-manager_2",
"myneovim": "myneovim",
"nil": "nil",
"nixpkgs": "nixpkgs",
"nixpkgs": "nixpkgs_2",
"nixpkgs-unstable": "nixpkgs-unstable",
"vnetod": "vnetod",
"wired": "wired"

View File

@ -5,6 +5,8 @@
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
hardware.url = "github:NixOS/nixos-hardware/master";
firefox-addons.url = "github:nix-community/nur-combined/master?dir=repos/rycee/pkgs/firefox-addons";
agenix = {
url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs";
@ -44,7 +46,10 @@
};
outputs = inputs @ { self, flake-utils, nixpkgs, ... }:
flake-utils.lib.eachDefaultSystem
let
inherit (flake-utils.lib) eachSystem system;
in
eachSystem [ system.x86_64-linux ]
(system:
let
pkgs = import nixpkgs { inherit system; };
@ -60,7 +65,7 @@
(name: program: { type = "app"; program = toString program; })
(flake-utils.lib.flattenTree {
deploy = lib.recurseIntoAttrs (lib.mapAttrs
(hostname: machine: pkgs.writeShellScript "deploy-${hostname}" ''
(hostname: machine: pkgs.writeShellScript "deploy/${hostname}" ''
${nixos-rebuild}/bin/nixos-rebuild switch \
--flake .#${hostname} \
--target-host root@${machine.config.deployment.targetHost} \
@ -69,7 +74,7 @@
vpsMachines);
switch = lib.recurseIntoAttrs (lib.mapAttrs
(hostname: machine: pkgs.writeShellScript "switch-${hostname}" ''
(hostname: machine: pkgs.writeShellScript "switch/${hostname}" ''
${nixos-rebuild}/bin/nixos-rebuild switch --flake .#${hostname} $@
'')
localMachines);
@ -101,21 +106,22 @@
(hostname: { system
, specialArgs ? { }
, extraModules ? [ ]
, extraHomeModule ? null
, targetHost ? null
, nixpkgs ? inputs.nixpkgs
}:
nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = { inherit inputs extraHomeModule; } // specialArgs;
specialArgs = {
inherit inputs;
globalData = import ./data.nix;
} // specialArgs;
modules =
(with inputs; [
agenix.nixosModules.default
home-manager.nixosModule
])
++ extraModules
++ [
# deployment settings
({ lib, ... }: {
@ -132,10 +138,20 @@
({ ... }: {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.sharedModules = [
{
imports = [
./modules/home-manager
inputs.wired.homeManagerModules.default
];
}
];
})
]
++ [ ./nixos/hosts/${hostname} ];
++ extraModules
++ [ ./modules/nixos ]
++ [ ./hosts/${hostname}/configuration.nix ];
})
(import ./nixos/hosts inputs);
(import ./hosts inputs);
};
}

View File

@ -1,50 +0,0 @@
{ config, lib, pkgs, ... }:
let
exaPackage = pkgs.unstable.eza.override { gitSupport = true; };
in
{
programs.eza = {
enable = true;
package = exaPackage;
};
programs.zsh.shellAliases =
let
defaultArgs = "--icons --classify --group-directories-first --all";
bin = "${exaPackage}/bin/exa ${defaultArgs}";
in
lib.mkIf config.programs.zsh.enable {
ls = "${bin} --oneline";
lt = "${bin} --tree --level=3";
ll = "${bin} --long --header";
};
programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
programs.zoxide = {
enable = true;
enableZshIntegration = config.programs.zsh.enable;
};
home.packages = with pkgs; [
# tools
xh # friendly and fast tool for sending HTTP requests
fd # a simple, fast and user-friendly alternative to find
bat # a cat clone with syntax highlighting and git integration
ripgrep # a fuzzy finder
vnetod # a tool to change env sections
gnumake
libnotify # tool to send notifications via cli
deno
unstable.nickel
nixpkgs-fmt # nix formatter
unstable.nil # nix lsp server
docker-compose
];
}

View File

@ -1,110 +0,0 @@
{ pkgs, ... }:
let
myneovim = pkgs.myneovim.override {
viAlias = true;
vimAlias = true;
enableDevIcons = true;
enableTabby = true;
enableOrgMode = true;
extraConfig = ''
aug extra_ftdetect
au!
au BufNewFile,BufRead *.d2 setfiletype d2
au BufNewFile,BufRead *.ncl setfiletype nickel
au BufNewFile,BufRead *.psql setfiletype psql
aug END
'';
plugins = with pkgs.myneovim.nix2lua; {
nvimTree.settings = {
renderer = {
group_empty = true;
full_name = true;
};
tab.sync = {
open = true;
close = true;
};
};
telescope.settings = {
extensions.live_grep_args = {
auto_quoting = true;
mappings.i = {
"<C-K>" = join "." [
(mkCall "require" [ "telescope-live-grep-args.actions" ])
(mkCall "quote_prompt" [ ])
];
};
};
};
lspSaga.settings = {
border_style = "rounded";
symbol_in_winbar.enable = false;
code_action_lightbulb.enable = false;
code_action_keys = { quit = "<Esc>"; };
definition_action_keys = { quit = "<Esc>"; };
rename_action_quit = "<C-c>";
};
lspConfig = {
servers = {
nickel_ls = { };
nil_ls = { };
tsserver = { };
eslint = { };
volar = {
init_options = {
typescript.tsdk = "./node_modules/typescript/lib";
};
};
denols = {
root_dir = mkCall "root_pattern" [ "deno.json" "deno.jsonc" ];
};
rust_analyzer = {
settings.rust-analyzer = {
"server.path" = "rust-analyzer";
"updates.prompt" = false;
"updates.checkOnStartup" = false;
"checkOnSave.enable" = true;
"checkOnSave.command" = "clippy";
"cargo.autoreload" = true;
};
};
pylsp = { };
ltex = {
language = "en-US";
languageToolHttpServerUri = "http://localhost:8081";
};
};
};
lualine.settings = {
options.ignore_focus = [ "NvimTree" ];
sections = {
lualine_a = [
[ "filename" (mkNamedField "path" 1) ]
];
lualine_b = [ "branch" "diff" "diagnostics" ];
lualine_c = [ "lsp_progress" ];
lualine_x = [ "filesize" "filetype" ];
lualine_y = [ "progress" ];
lualine_z = [ "location" "mode" ];
};
};
orgmode.settings = {
org_agenda_files = [ "~/orgs/**/*" ];
org_default_notes_file = "~/orgs/refile.org";
win_split_mode = "tabnew";
org_hide_leading_stars = true;
};
};
};
in
{
home.packages = [
pkgs.ltex-ls
myneovim
pkgs.unstable.arduino-ide
];
home.sessionVariables.EDITOR = "nvim";
}

View File

@ -1,175 +0,0 @@
{ config, lib, pkgs, ... }:
let
exec = cmd: ":${cmd}<Enter>";
fill = cmd: ":${cmd}<space>";
globalBinds = {
"gt" = exec "next-tab";
"gT" = exec "prev-tab";
};
commonMessageBinds = {
"U" = exec "unsubscribe";
"dd" = exec "delete";
"mA" = exec "archive flat";
"mS" = exec "move Junk";
"mI" = exec "move INBOX";
};
in
{
accounts.email.maildirBasePath = "${config.xdg.dataHome}/mail";
# See: https://git.sbruder.de/simon/nixos-config/src/branch/master/users/simon/modules/mail/aerc/default.nix
programs.aerc = {
enable = true;
package = pkgs.unstable.aerc;
# https://git.sr.ht/~rjarry/aerc/tree/master/item/doc/aerc-config.5.scd
extraConfig = {
general = {
unsafe-accounts-conf = true;
};
ui = {
# See https://godoc.org/time#Time.Format
timestamp-format = "2006-01-02 15:04 MST";
this-day-time-format = "15:04";
this-week-time-format = "Monday 15:04";
this-year-time-format = "02 January";
pinned-tab-marker = "";
border-char-vertical = "";
border-char-horizontal = "";
fuzzy-complete = true;
new-message-bell = true;
index-columns = "date<20,from<30,flags>4,subject<*";
column-from = "{{ .From | emails | join \", \" }}";
};
statusline = {
display-mode = "icon";
};
filters = {
".headers" = "colorize";
"text/html" = "html | colorize";
"text/plain" = "colorize";
"text/rfc822-headers" = "colorize";
# "text/*" = "${pkgs.bat}/bin/bat -fpp --file-name='$AERC_FILENAME'";
"message/delivery-status" = "cat | colorize";
};
hooks = {
mail-received = "notify-send \"New mail from $AERC_FROM_NAME\" \"$AERC_SUBJECT\"";
};
};
extraBinds = {
messages = lib.mkMerge [
globalBinds
commonMessageBinds
{
"q" = exec "quit";
"j" = exec "next";
"<Down>" = exec "next";
"<C-d>" = exec "next 50%";
"k" = exec "prev";
"<Up>" = exec "prev";
"<C-b>" = exec "prev 50%";
"gg" = exec "select 0";
"G" = exec "select -1";
"J" = exec "next-folder";
"K" = exec "prev-folder";
"c" = fill "cf";
"<Enter>" = exec "view";
"C" = exec "compose";
"/" = fill "search";
"\\" = fill "filter";
"n" = exec "next-result";
"N" = exec "prev-result";
#"D" = exec "modify-labels +deleted -inbox";
#"A" = exec "modify-labels -inbox";
#"ms" = exec "modify-labels +spam -inbox";
#"mS" = exec "modify-labels -spam +inbox";
}
];
view = lib.mkMerge [
globalBinds
commonMessageBinds
{
"q" = exec "close";
"O" = exec "open";
"S" = fill "save";
"f" = exec "forward";
"rr" = exec "reply -a";
"rq" = exec "reply -aq";
"Rr" = exec "reply";
"Rq" = exec "reply -q";
"<C-k>" = exec "prev-part";
"<C-j>" = exec "next-part";
"J" = exec "next";
"K" = exec "prev";
}
];
compose = lib.mkMerge [
globalBinds
{
"$ex" = "<C-x>";
"<C-k>" = exec "prev-field";
"<C-j>" = exec "next-field";
"<tab>" = exec "next-field";
}
];
"compose::editor" = {
"$noinherit" = "true";
"$ex" = "<C-x>";
"<C-k>" = exec "prev-field";
"<C-j>" = exec "next-field";
};
"compose::review" = {
"y" = exec "send";
"n" = exec "abort";
"p" = exec "postpone";
"q" = exec "choose -o d discard abort -o p postpone postpone";
"e" = exec "edit";
"a" = fill "attach";
"d" = fill "detach";
};
};
stylesets.default = {
"*.selected.reverse" = true;
"title.reverse" = true;
"header.bold" = true;
"*error.bold" = true;
"error.fg" = 1;
"warning.fg" = 3;
"success.fg" = 2;
"msglist_unread.bold" = true;
"msglist_deleted.fg" = 10;
"tab.fg" = 0;
"tab.selected.reverse" = false;
"tab.selected.bold" = true;
"tab.selected.bg" = 2;
"dirlist_default.bg" = 18;
"border.fg" = 0;
"statusline_default.bg" = 18;
"statusline_error.fg" = 1;
"statusline_error.reverse" = true;
"statusline_success.fg" = 2;
"statusline_success.reverse" = true;
"completion_default.bg" = 0;
};
};
}

View File

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

View File

@ -1,21 +0,0 @@
{ config, pkgs, ... }:
let
passDataDir = "${config.xdg.dataHome}/pass";
myPassPackage = pkgs.pass.withExtensions (ext: [
ext.pass-audit
ext.pass-update
]);
in
{
programs.password-store = {
enable = true;
package = myPassPackage;
settings = {
PASSWORD_STORE_DIR = "${passDataDir}/store";
};
};
services.pass-secret-service.enable = true;
}

View File

@ -1,69 +0,0 @@
{ lib, config, pkgs, ... }:
{
# fish and zsh support for nix-shell
home.packages = with pkgs; [ any-nix-shell ];
programs.zsh = {
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
defaultKeymap = "viins";
dotDir = ".config/zsh";
history = {
path = "${config.xdg.dataHome}/zsh/zsh_history";
expireDuplicatesFirst = true;
ignorePatterns = [
"rm *"
"kill *"
];
};
oh-my-zsh.enable = true;
initExtra = ''
any-nix-shell zsh --info-right | source /dev/stdin
'';
};
programs.starship = {
enable = true;
enableZshIntegration = config.programs.zsh.enable;
settings = {
add_newline = true;
format = lib.concatStrings [
"$hostname"
"$directory"
"$git_branch"
"$git_commit"
"$git_state"
"$git_metrics"
"$git_status"
"$shlvl"
"$nix_shell"
"$cmd_duration"
"$jobs"
"$line_break"
"$character"
];
character = {
success_symbol = "[](bold green)";
error_symbol = "[](bold red)";
};
git_commit.commit_hash_length = 6;
shlvl = {
disabled = false;
format = "[$symbol$shlvl]($style) ";
symbol = " ";
threshold = 3;
};
hostname.ssh_symbol = "";
};
};
}

View File

@ -1,86 +0,0 @@
{ lib, ... }:
let
mkColorOption = description: lib.mkOption {
type = lib.types.str;
inherit description;
};
in
{
options.local.theme = {
bar = {
background = mkColorOption "Background pane color";
mainText = mkColorOption "Main text color";
inactiveText = mkColorOption "Inactive text color";
};
window = {
activeBorder = mkColorOption "Window active border color";
inactiveBorder = mkColorOption "Window inactive border color";
background = mkColorOption "Terminal background color";
mainText = mkColorOption "Terminal main text color";
cursorText = mkColorOption "Cursor text color";
cursor = mkColorOption "Cursor background color";
cursorVi = mkColorOption "Cursor Vi Mode background color";
searchText = mkColorOption "Search text color";
search = mkColorOption "Search match background";
searchFocused = mkColorOption "Search focused match background";
footerText = mkColorOption "Footer bar text color";
footer = mkColorOption "Footer bar background color";
hintsText = mkColorOption "Keyboard regex hints text color";
hintsStart = mkColorOption "Keyboard regex hints start background color";
hintsEnd = mkColorOption "Keyboard regex hints end background color";
selectionText = mkColorOption "Selection text color";
selection = mkColorOption "Selection background color";
regular = {
color0 = mkColorOption null;
color1 = mkColorOption null;
color2 = mkColorOption null;
color3 = mkColorOption null;
color4 = mkColorOption null;
color5 = mkColorOption null;
color6 = mkColorOption null;
color7 = mkColorOption null;
};
bold = {
color8 = mkColorOption null;
color9 = mkColorOption null;
color10 = mkColorOption null;
color11 = mkColorOption null;
color12 = mkColorOption null;
color13 = mkColorOption null;
color14 = mkColorOption null;
color15 = mkColorOption null;
};
extended = {
color16 = mkColorOption null;
color17 = mkColorOption null;
color18 = mkColorOption null;
color19 = mkColorOption null;
};
};
notification = {
background = mkColorOption "Notification background color";
summary = mkColorOption "Notification summary text color";
body = mkColorOption "Notification body text color";
appName = mkColorOption "Notification app name text color";
lowBorder = mkColorOption "Notification low priority border color";
normalBorder = mkColorOption "Notification normal priority border color";
criticalBorder = mkColorOption "Notification critical priority border color";
pausedBorder = mkColorOption "Notification paused border color";
};
highlights = {
success = mkColorOption "Success color";
warning = mkColorOption "Warnings color";
error = mkColorOption "Errors color";
critical = mkColorOption "Clitical color";
link = mkColorOption "Links color";
tags = mkColorOption "Search results, tags color";
};
syntax = {
markText = mkColorOption "Text color for marked background";
mark1 = mkColorOption "Marked color 1";
mark2 = mkColorOption "Marked color 2";
mark3 = mkColorOption "Marked color 3";
};
};
}

View File

@ -1,20 +0,0 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
(google-cloud-sdk.withExtraComponents (
let gc = google-cloud-sdk.components; in [
gc.gke-gcloud-auth-plugin
gc.kubectl
]
))
postgresql_14 # 🤷 I need only psql
];
/*
programs.zsh.initExtra = lib.mkAfter ''
eval $(kubectl completion zsh)
'';
*/
}

Binary file not shown.

View File

@ -1,62 +0,0 @@
{ config
, pkgs
, lib
, inputs
, extraHomeModule ? null
, extraJanHomeModule ? null
, ...
}:
let
data = import ../../../data.nix;
in
{
nixpkgs.overlays = lib.mkAfter [
inputs.myneovim.overlays.default
inputs.nil.overlays.default
inputs.vnetod.overlays.default
inputs.wired.overlays.default
];
programs.zsh.enable = true;
users.users.jan = {
isNormalUser = true;
extraGroups = [
"wheel" # Enable sudo for the user.
(lib.mkIf config.networking.networkmanager.enable "networkmanager")
(lib.mkIf config.virtualisation.docker.enable "docker")
(lib.mkIf config.services.transmission.enable "transmission")
(lib.mkIf config.services.kubo.enable config.services.kubo.group)
(lib.mkIf config.programs.adb.enable "adbusers")
(lib.mkIf config.programs.adb.enable "plugdev")
(lib.mkIf config.hardware.pulseaudio.systemWide "pulse-access")
];
shell = pkgs.zsh;
hashedPasswordFile = config.age.secrets.users-jan-passfile.path;
openssh.authorizedKeys.keys = data.publicKeys.users.jan;
};
users.groups.plugdev = lib.mkIf config.programs.adb.enable { };
home-manager.users.jan = { lib, ... }: {
imports = [
inputs.wired.homeManagerModules.default
./home.nix
extraHomeModule
extraJanHomeModule
];
home.stateVersion = config.system.stateVersion;
home.packages = [
(pkgs.callPackage ../../../packages/git-crypt-rm-gpg-user { })
];
};
nix.settings.trusted-users = lib.mkAfter [ "jan" ];
age.secrets.users-jan-passfile.file = ../../../secrets/users-jan-passfile.age;
}

View File

@ -1,88 +0,0 @@
{ pkgs, ... }:
{
imports = [
./accounts.secret.nix
./git
../../modules/window_manager
../../modules/terminal/wezterm.nix
../../modules/terminal/alacritty.nix
../../modules/shell.nix
../../modules/notifications
../../modules/file_manager
../../modules/mail
../../modules/pass.nix
../../modules/dev_tools.nix
../../modules/editor.nix
../../modules/work_tools.nix
../../modules/themes
../../modules/themes/catppuccin/frappe.nix
];
xdg.enable = true;
home.keyboard = {
model = "pc105";
layout = "us,ru";
variant = "dvorak,";
options = [ "grp:win_space_toggle" ];
};
# a fork of firefox, focused on privacy, security and freedom
programs.librewolf = {
enable = true;
package = with pkgs.unstable; librewolf.override {
nativeMessagingHosts = [ passff-host ];
};
# See: https://librewolf.net/docs/settings/
settings = {
"webgl.disabled" = false;
};
};
home.packages = with pkgs.unstable; [
simplex-chat-desktop # simplex chat client
tdesktop # telegram client
nheko # matrix client
image-roll
vlc
# playerctl
gimp
libresprite
# office
libreoffice
hunspell
hunspellDicts.ru_RU
hunspellDicts.en_US
# tools
procs
bottom
asciinema # record the terminal
neofetch # command-line system information
bind.dnsutils
kubo # ipfs
woodpecker-cli
# games
mindustry
pkgs.widelands
];
home.file = {
"pictures/wallpapers" = {
source = ./wallpapers;
recursive = true;
};
};
}

View File

@ -1,35 +0,0 @@
{ config
, pkgs
, lib
, inputs
, extraHomeModule ? null
, ...
}:
{
nixpkgs.overlays = lib.mkAfter [
inputs.wired.overlays.default
];
local.nix.allowUnfreePackages = [ "skypeforlinux" ];
programs.zsh.enable = true;
users.users.nas = {
isNormalUser = true;
shell = pkgs.zsh;
hashedPasswordFile = config.age.secrets.users-nas-passfile.path;
};
home-manager.users.nas = { lib, ... }: {
imports = [
inputs.wired.homeManagerModules.default
./home.nix
extraHomeModule
];
home.stateVersion = config.system.stateVersion;
};
age.secrets.users-nas-passfile.file = ../../../secrets/users-nas-passfile.age;
}

View File

@ -1,34 +0,0 @@
{ pkgs, ... }:
{
imports = [
../../modules/window_manager
../../modules/terminal/wezterm.nix
../../modules/shell.nix
../../modules/notifications
../../modules/themes
../../modules/themes/catppuccin/frappe.nix
];
xdg.enable = true;
home.keyboard = {
model = "pc105";
layout = "us,ru";
options = [ "grp:win_space_toggle" ];
};
home.packages = with pkgs.unstable; [
skypeforlinux
tdesktop
libreoffice
image-roll
gnome.nautilus
gnome.gedit
# browser
firefox
];
}

View File

@ -0,0 +1,13 @@
{ ... }:
{
# Use the systemd-boot EFI boot loader.
boot.loader = {
systemd-boot = {
enable = true;
configurationLimit = 10;
};
efi.canTouchEfiVariables = true;
};
}

View File

@ -0,0 +1,9 @@
{ ... }:
{
imports = [
./boot.nix
./networking.nix
./wireguard
];
}

View File

@ -0,0 +1,13 @@
{ ... }:
{
networking = {
hostName = "laptop"; # Define your hostname.
networkmanager.enable = true;
firewall.allowedTCPPortRanges = [
{ from = 33000; to = 33999; }
];
};
}

View File

@ -0,0 +1,21 @@
{ config, ... }:
let
serverData = import ../../../tatos/data.secret.nix;
in
{
age.secrets.wireguard-asus-gl553vd-private = {
file = ./wireguard-asus-gl553vd-private.age;
mode = "0400";
};
local.services.vpn.wireguard = {
enable = true;
ip = "10.20.30.4/24";
privateKeyFile = config.age.secrets.wireguard-asus-gl553vd-private.path;
server = {
inherit (serverData) addr;
inherit (serverData.wireguard) port publicKey;
};
};
}

View File

@ -0,0 +1,31 @@
{ globalData, ... }:
{
imports = [
./hardware-configuration
./configs
./users
];
################################################################################
# Programs
################################################################################
local.programs.browsers.tor-browser = {
enable = true;
container = {
enable = true;
externalInterface = "wg0";
sshAuthorizedKeys = globalData.publicKeys.users.jan;
};
};
################################################################################
# Services
################################################################################
# Enable the Docker
virtualisation.docker.enable = true;
# Torrent
# services.transmission.enable = true;
}

View File

@ -0,0 +1,36 @@
{ ... }:
{
# Include the results of the hardware scan.
imports = [ ./generated.nix ];
# Enable keyboard on the boot
boot.initrd.availableKernelModules = [ "hid_asus" ];
# Enable containers
# See: https://github.com/NixOS/nixpkgs/issues/38676
boot.kernelModules = [ "veth" ];
networking = {
useDHCP = false;
interfaces = {
wlp2s0.useDHCP = true;
};
};
# configure mouse and touchpad
services.xserver.libinput = {
enable = true;
touchpad = {
accelSpeed = "0.5";
disableWhileTyping = true;
};
};
hardware.bluetooth.enable = true;
services.logind.extraConfig = ''
# dont shutdown when power button is short-pressed
HandlePowerKey=ignore
'';
}

View File

@ -10,15 +10,7 @@
boot = {
initrd = {
availableKernelModules = [
"hid_asus"
"xhci_pci"
"ahci"
"usbhid"
"usb_storage"
"sd_mod"
"rtsx_pci_sdmmc"
];
availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
kernelModules = [ ];
};

View File

@ -0,0 +1,19 @@
{ ... }:
{
imports = [
./jan.nix
# ../../../users/nas.nix
];
home-manager.sharedModules = [
{
local.window-manager.polybar.wifiDevice = "wlp2s0";
local.programs.terminals = {
wezterm.fontSize = 10.0;
alacritty.fontSize = 8.0;
};
}
];
}

View File

@ -0,0 +1,15 @@
{ ... }:
{
imports = [ ../../../users/jan ];
home-manager.users.jan = {
local.window-manager = {
xmonad.projects = import ./xmonad-projects.secret.nix;
};
# local.programs.dev-tools.k8s.enable = true;
local.programs.libreoffice.enable = true;
};
}

46
hosts/default.nix Normal file
View File

@ -0,0 +1,46 @@
{ ... } @ inputs:
let
hardware = inputs.hardware.nixosModules;
in
{
home = {
system = "x86_64-linux";
extraModules = [
hardware.common-gpu-amd
../modules/machine.nix
./networking.secret.nix
];
};
asus-gl553vd = {
system = "x86_64-linux";
extraModules = [
hardware.common-cpu-intel
../modules/machine.nix
./networking.secret.nix
];
};
istal = {
system = "x86_64-linux";
extraModules = [
../modules/vps.nix
];
targetHost = (import ./istal/data.secret.nix).addr;
};
tatos = {
system = "x86_64-linux";
extraModules = [
../modules/vps.nix
];
targetHost = (import ./tatos/data.secret.nix).addr;
};
}

View File

@ -0,0 +1,51 @@
{ pkgs, ... }:
let
buildToolsVersion = "33.0.2";
androidComposition = pkgs.unstable.androidenv.composeAndroidPackages {
platformToolsVersion = "34.0.5";
buildToolsVersions = [ buildToolsVersion ];
includeEmulator = false;
emulatorVersion = "34.1.9";
platformVersions = [ "29" "30" "33" ];
includeSources = false;
includeSystemImages = false;
systemImageTypes = [ "google_apis_playstore" ];
abiVersions = [ "armeabi-v7a" "arm64-v8a" ];
cmakeVersions = [ "3.10.2" ];
includeNDK = true;
ndkVersions = [ "23.2.8568313" ];
useGoogleAPIs = false;
useGoogleTVAddOns = false;
includeExtras = [
"extras;google;gcm"
];
};
in
{
# TODO: try to remove this.
nixpkgs.config.allowUnfree = true;
local.nix.allowUnfreePackages = [ "android-sdk-cmdline-tools" ];
programs.adb.enable = true;
programs.java = {
enable = true;
package = pkgs.jdk17;
};
nixpkgs.config.android_sdk.accept_license = true;
environment.variables = rec {
ANDROID_SDK_ROOT = "${androidComposition.androidsdk}/libexec/android-sdk";
ANDROID_NDK_ROOT = "${ANDROID_SDK_ROOT}/ndk-bundle";
# Use the same buildToolsVersion here
# GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${ANDROID_SDK_ROOT}/build-tools/${buildToolsVersion}/aapt2";
# JAVA_HOME = pkgs.jdk17.home;
};
services.udev.extraRules = ''
SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0666", GROUP="plugdev"
'';
}

View File

@ -0,0 +1,13 @@
{ config, lib, ... }:
{
local.nix.allowUnfreePackages =
lib.optional config.boot.loader.grub.memtest86.enable "memtest86";
# Use the GRUB 2 boot loader.
boot.loader.grub = {
enable = true;
device = "/dev/sdb";
# memtest86.enable = true;
};
}

View File

@ -0,0 +1,11 @@
{ ... }:
{
imports = [
./android.nix
./boot.nix
./networking.nix
./printer.nix
./wireguard
];
}

View File

@ -0,0 +1,9 @@
{ ... }:
{
networking.hostName = "home";
networking.networkmanager.enable = true;
networking.firewall.allowedTCPPortRanges = [
# { from = 1300; to = 1400; }
];
}

View File

@ -0,0 +1,16 @@
{ pkgs, ... }:
{
local.nix.allowUnfreePackages = [ "cnijfilter2" ];
services = {
avahi = {
enable = true;
nssmdns = true;
};
printing = {
enable = true;
drivers = with pkgs; [ gutenprint cnijfilter2 ];
};
};
}

View File

@ -0,0 +1,21 @@
{ config, ... }:
let
serverData = import ../../../tatos/data.secret.nix;
in
{
age.secrets.wireguard-home-private = {
file = ./wireguard-home-private.age;
mode = "0400";
};
local.services.vpn.wireguard = {
enable = true;
ip = "10.20.30.3/24";
privateKeyFile = config.age.secrets.wireguard-home-private.path;
server = {
inherit (serverData) addr;
inherit (serverData.wireguard) port publicKey;
};
};
}

View File

@ -0,0 +1,32 @@
{ globalData, ... }:
{
imports = [
./hardware-configuration
./configs
./users
];
################################################################################
# Programs
################################################################################
local.programs.browsers.tor-browser = {
enable = true;
container = {
enable = true;
externalInterface = "wg0";
sshAuthorizedKeys = globalData.publicKeys.users.jan;
};
};
################################################################################
# Services
################################################################################
local.services.i2pd.enable = true;
local.services.octoprint.enable = true;
virtualisation.docker.enable = true;
# Torrent client
services.transmission.enable = true;
}

View File

@ -0,0 +1,52 @@
{ config, ... }:
{
# Include the results of the hardware scan.
imports = [ ./generated.nix ];
# Add support of usb
boot.initrd.availableKernelModules = [ "usb_storage" ];
# Enable containers
# See: https://github.com/NixOS/nixpkgs/issues/38676
boot.kernelModules = [ "veth" ];
boot.extraModulePackages = with config.boot.kernelPackages; [
rtl88x2bu # wifi
];
networking = {
useDHCP = false;
interfaces = {
wlp3s0.useDHCP = true;
# wlp11s0f3u2.useDHCP = true;
};
};
# extra configs
hardware.bluetooth.enable = true;
# All monitors in the right order
# Source: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/x11/xserver.nix#L83
services.xserver.xrandrHeads = [
{
output = "DP-3";
monitorConfig = ''
Option "PreferredMode" "1920x1080"
Option "Rotate" "right"
'';
}
{
output = "DP-1";
primary = true;
monitorConfig = ''
Option "PreferredMode" "2560x1440"
'';
}
];
services.logind.extraConfig = ''
# dont shutdown when power button is short-pressed
HandlePowerKey=ignore
'';
}

View File

@ -10,7 +10,7 @@
boot = {
initrd = {
availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" "usb_storage" ];
availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" ];
kernelModules = [ ];
};

View File

@ -0,0 +1,19 @@
{ ... }:
{
imports = [
./jan.nix
../../../users/nas
];
home-manager.sharedModules = [
{
local.window-manager.polybar.wifiDevice = "wlp3s0";
local.programs.terminals = {
wezterm.fontSize = 10.0;
alacritty.fontSize = 8.0;
};
}
];
}

41
hosts/home/users/jan.nix Normal file
View File

@ -0,0 +1,41 @@
{ pkgs, ... }:
{
imports = [ ../../../users/jan ];
home-manager.users.jan = {
local.window-manager = {
xmonad.projects = import ./xmonad-projects.secret.nix;
};
local.programs.editors.arduino-ide.enable = true;
local.programs.dev-tools.k8s.enable = true;
local.programs.libreoffice = {
enable = true;
spellCheckDicts = with pkgs.hunspellDicts; [
ru_RU
en_US
];
};
# Extra packages
home.packages = with pkgs.unstable; [
# 3d programs
blender
cura
godot_4
# electronics
kicad-small
# librepcb
];
# games
local.games = {
mindustry.enable = true;
widelands.enable = true;
};
};
}

Binary file not shown.

View File

@ -0,0 +1,13 @@
{ globalData, ... }:
{
imports = [
./hardware-configuration
./services
];
networking.hostName = "istal";
networking.domain = "local";
users.users.root.openssh.authorizedKeys.keys = globalData.publicKeys.users.janistal;
}

View File

@ -0,0 +1,8 @@
{ ... }:
{
imports = [
./generated.nix
./networking.secret.nix
];
}

View File

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

View File

@ -1,9 +1,9 @@
{ config, pkgs, ... }:
let
tatosData = import ../../tatos/data.secret.nix;
tatosData = import ../../../tatos/data.secret.nix;
istalData = import ../data.secret.nix;
istalData = import ../../data.secret.nix;
inherit (istalData.wireguard) port;
in
{
@ -52,7 +52,7 @@ in
};
age.secrets.wireguard-istal-private = {
file = ../../../../secrets/wireguard-istal-private.age;
file = ./wireguard-istal-private.age;
mode = "0400";
};
}

BIN
hosts/networking.secret.nix Normal file

Binary file not shown.

View File

@ -0,0 +1,12 @@
{ globalData, ... }:
{
imports = [
./hardware-configuration
./services
];
networking.hostName = "tatos";
users.users.root.openssh.authorizedKeys.keys = globalData.publicKeys.users.jan;
}

View File

@ -0,0 +1,8 @@
{ ... }:
{
imports = [
./generated.nix
./networking.secret.nix
];
}

View File

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

View File

@ -3,9 +3,9 @@
# Source: https://habr.com/ru/companies/xakep/articles/699000/
let
istalData = import ../../istal/data.secret.nix;
istalData = import ../../../istal/data.secret.nix;
tatosData = import ../data.secret.nix;
tatosData = import ../../data.secret.nix;
port = tatosData.wireguard.port;
update_ru_routes = pkgs.callPackage ./update_ru_routes.nix { };
@ -95,7 +95,7 @@ in
};
age.secrets.wireguard-tatos-private = {
file = ../../../../secrets/wireguard-tatos-private.age;
file = ./wireguard-tatos-private.age;
mode = "0400";
};
}

View File

@ -1,4 +1,4 @@
{ config, pkgs, ... }:
{ ... }:
{
# Select internationalisation properties.
@ -8,20 +8,9 @@
users.mutableUsers = false;
# Enable the OpenSSH daemon.
# is required for the agenix module
services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configuration.nix.
# system.copySystemConfiguration = true;
# 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
@ -29,5 +18,4 @@
# 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 = "22.11"; # Did you read the comment?
}

View File

@ -0,0 +1,9 @@
{ ... }:
{
imports = [
./keyboard.nix
./themes
./window-manager
];
}

View File

@ -0,0 +1,25 @@
{ config, lib, ... }:
let
cfg = config.local.keyboard;
in
{
options.local.keyboard = with lib; {
enable = mkEnableOption "base keyboard configs";
variant = mkOption {
description = "keyboard layout variant in us,ru order";
type = types.str;
default = ",";
};
};
config = lib.mkIf cfg.enable {
home.keyboard = {
model = "pc105";
layout = "us,ru";
variant = cfg.variant;
# variant = "dvorak,";
options = [ "grp:win_space_toggle" ];
};
};
}

View File

@ -1,7 +1,6 @@
{ config, ... }:
{ ... }:
let
# See: https://github.com/catppuccin/catppuccin
# palettes
rosewater = "#f2d5cf"; # Links, URLs
@ -38,7 +37,7 @@ let
crust = "#232634";
in
{
config.local.theme = {
config.local.themes."catppuccin/frappe" = {
bar = {
background = mantle;
mainText = text;

View File

@ -0,0 +1,99 @@
{ lib, ... }:
let
mkColorOption = description: lib.mkOption {
type = lib.types.str;
inherit description;
};
in
{
# TODO: add enable option
options.local.theme.name = with lib; mkOption {
type = types.str;
default = "catppuccin/frappe";
};
options.local.themes = with lib; mkOption {
default = { };
type = with types; attrsOf (submodule {
options = {
bar = {
background = mkColorOption "Background pane color";
mainText = mkColorOption "Main text color";
inactiveText = mkColorOption "Inactive text color";
};
window = {
activeBorder = mkColorOption "Window active border color";
inactiveBorder = mkColorOption "Window inactive border color";
background = mkColorOption "Terminal background color";
mainText = mkColorOption "Terminal main text color";
cursorText = mkColorOption "Cursor text color";
cursor = mkColorOption "Cursor background color";
cursorVi = mkColorOption "Cursor Vi Mode background color";
searchText = mkColorOption "Search text color";
search = mkColorOption "Search match background";
searchFocused = mkColorOption "Search focused match background";
footerText = mkColorOption "Footer bar text color";
footer = mkColorOption "Footer bar background color";
hintsText = mkColorOption "Keyboard regex hints text color";
hintsStart = mkColorOption "Keyboard regex hints start background color";
hintsEnd = mkColorOption "Keyboard regex hints end background color";
selectionText = mkColorOption "Selection text color";
selection = mkColorOption "Selection background color";
regular = {
color0 = mkColorOption null;
color1 = mkColorOption null;
color2 = mkColorOption null;
color3 = mkColorOption null;
color4 = mkColorOption null;
color5 = mkColorOption null;
color6 = mkColorOption null;
color7 = mkColorOption null;
};
bold = {
color8 = mkColorOption null;
color9 = mkColorOption null;
color10 = mkColorOption null;
color11 = mkColorOption null;
color12 = mkColorOption null;
color13 = mkColorOption null;
color14 = mkColorOption null;
color15 = mkColorOption null;
};
extended = {
color16 = mkColorOption null;
color17 = mkColorOption null;
color18 = mkColorOption null;
color19 = mkColorOption null;
};
};
notification = {
background = mkColorOption "Notification background color";
summary = mkColorOption "Notification summary text color";
body = mkColorOption "Notification body text color";
appName = mkColorOption "Notification app name text color";
lowBorder = mkColorOption "Notification low priority border color";
normalBorder = mkColorOption "Notification normal priority border color";
criticalBorder = mkColorOption "Notification critical priority border color";
pausedBorder = mkColorOption "Notification paused border color";
};
highlights = {
success = mkColorOption "Success color";
warning = mkColorOption "Warnings color";
error = mkColorOption "Errors color";
critical = mkColorOption "Clitical color";
link = mkColorOption "Links color";
tags = mkColorOption "Search results, tags color";
};
syntax = {
markText = mkColorOption "Text color for marked background";
mark1 = mkColorOption "Marked color 1";
mark2 = mkColorOption "Marked color 2";
mark3 = mkColorOption "Marked color 3";
};
};
});
};
imports = [ ./catppuccin/frappe.nix ];
}

View File

@ -3,16 +3,18 @@
with lib;
let
cfg = config.local.polybar;
cfg = config.local.window-manager.polybar;
inherit (config.services.polybar) package;
themeCfg = config.local.theme;
themeCfg = config.local.themes."${config.local.theme.name}";
exchangerate = import ./scripts/exchangerate.nix { inherit themeCfg pkgs; };
external_ip = import ./scripts/external_ip.nix { inherit themeCfg pkgs; };
in
{
options.local.polybar = with lib; {
options.local.window-manager.polybar = with lib; {
enable = mkEnableOption "polybar";
wifiDevice = mkOption {
type = types.str;
example = "wlp11s0f3u2";
@ -20,7 +22,7 @@ in
};
};
config = {
config = lib.mkIf cfg.enable {
systemd.user.services.polybar = {
# Add additional /usr/bin to run custom scripts
Service.Environment = mkForce "PATH=${package}/bin:/run/current-system/sw/bin";

View File

@ -1,8 +1,8 @@
{ config, pkgs, lib, ... }:
let
cfg = config.local.xmonad;
themeCfg = config.local.theme;
cfg = config.local.window-manager.xmonad;
themeCfg = config.local.themes."${config.local.theme.name}";
projectType = with lib; types.submodule {
options = {
@ -50,15 +50,15 @@ let
xmonadProjects = lib.concatStringsSep " , " (map mkXmonadProject cfg.projects);
in
{
options.local.xmonad = with lib;
{
projects = mkOption {
type = types.listOf projectType;
default = [ ];
};
options.local.window-manager.xmonad = with lib; {
enable = mkEnableOption "xmonad window manager";
projects = mkOption {
type = types.listOf projectType;
default = [ ];
};
};
config = {
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [
xclip # access x clipboard from a console
dmenu # menu for x window system

View File

@ -0,0 +1,10 @@
{ ... }:
{
imports = [
./games.nix
./shell.nix
./configs
./programs
./services
];
}

View File

@ -0,0 +1,17 @@
{ config, pkgs, lib, ... }:
let
cfg = config.local.games;
in
{
options.local.games = with lib; {
mindustry.enable = mkEnableOption "mindustry";
widelands.enable = mkEnableOption "widelands";
unciv.enable = mkEnableOption "unciv";
};
config.home.packages =
lib.optional cfg.mindustry.enable pkgs.unstable.mindustry
++ lib.optional cfg.widelands.enable pkgs.widelands
++ lib.optional cfg.unciv.enable pkgs.unstable.unciv;
}

View File

@ -0,0 +1,179 @@
{ config, lib, pkgs, ... }:
let
exec = cmd: ":${cmd}<Enter>";
fill = cmd: ":${cmd}<space>";
globalBinds = {
"gt" = exec "next-tab";
"gT" = exec "prev-tab";
};
commonMessageBinds = {
"U" = exec "unsubscribe";
"dd" = exec "delete";
"mA" = exec "archive flat";
"mS" = exec "move Junk";
"mI" = exec "move INBOX";
};
in
{
options.local.programs.aerc.enable = lib.mkEnableOption "aerc";
config = lib.mkIf config.local.programs.aerc.enable {
accounts.email.maildirBasePath = "${config.xdg.dataHome}/mail";
# See: https://git.sbruder.de/simon/nixos-config/src/branch/master/users/simon/modules/mail/aerc/default.nix
programs.aerc = {
enable = true;
package = pkgs.unstable.aerc;
# https://git.sr.ht/~rjarry/aerc/tree/master/item/doc/aerc-config.5.scd
extraConfig = {
general = {
unsafe-accounts-conf = true;
};
ui = {
# See https://godoc.org/time#Time.Format
timestamp-format = "2006-01-02 15:04 MST";
this-day-time-format = "15:04";
this-week-time-format = "Monday 15:04";
this-year-time-format = "02 January";
pinned-tab-marker = "";
border-char-vertical = "";
border-char-horizontal = "";
fuzzy-complete = true;
new-message-bell = true;
index-columns = "date<20,from<30,flags>4,subject<*";
column-from = "{{ .From | emails | join \", \" }}";
};
statusline = {
display-mode = "icon";
};
filters = {
".headers" = "colorize";
"text/html" = "html | colorize";
"text/plain" = "colorize";
"text/rfc822-headers" = "colorize";
# "text/*" = "${pkgs.bat}/bin/bat -fpp --file-name='$AERC_FILENAME'";
"message/delivery-status" = "cat | colorize";
};
hooks = {
mail-received = "notify-send \"New mail from $AERC_FROM_NAME\" \"$AERC_SUBJECT\"";
};
};
extraBinds = {
messages = lib.mkMerge [
globalBinds
commonMessageBinds
{
"q" = exec "quit";
"j" = exec "next";
"<Down>" = exec "next";
"<C-d>" = exec "next 50%";
"k" = exec "prev";
"<Up>" = exec "prev";
"<C-b>" = exec "prev 50%";
"gg" = exec "select 0";
"G" = exec "select -1";
"J" = exec "next-folder";
"K" = exec "prev-folder";
"c" = fill "cf";
"<Enter>" = exec "view";
"C" = exec "compose";
"/" = fill "search";
"\\" = fill "filter";
"n" = exec "next-result";
"N" = exec "prev-result";
#"D" = exec "modify-labels +deleted -inbox";
#"A" = exec "modify-labels -inbox";
#"ms" = exec "modify-labels +spam -inbox";
#"mS" = exec "modify-labels -spam +inbox";
}
];
view = lib.mkMerge [
globalBinds
commonMessageBinds
{
"q" = exec "close";
"O" = exec "open";
"S" = fill "save";
"f" = exec "forward";
"rr" = exec "reply -a";
"rq" = exec "reply -aq";
"Rr" = exec "reply";
"Rq" = exec "reply -q";
"<C-k>" = exec "prev-part";
"<C-j>" = exec "next-part";
"J" = exec "next";
"K" = exec "prev";
}
];
compose = lib.mkMerge [
globalBinds
{
"$ex" = "<C-x>";
"<C-k>" = exec "prev-field";
"<C-j>" = exec "next-field";
"<tab>" = exec "next-field";
}
];
"compose::editor" = {
"$noinherit" = "true";
"$ex" = "<C-x>";
"<C-k>" = exec "prev-field";
"<C-j>" = exec "next-field";
};
"compose::review" = {
"y" = exec "send";
"n" = exec "abort";
"p" = exec "postpone";
"q" = exec "choose -o d discard abort -o p postpone postpone";
"e" = exec "edit";
"a" = fill "attach";
"d" = fill "detach";
};
};
stylesets.default = {
"*.selected.reverse" = true;
"title.reverse" = true;
"header.bold" = true;
"*error.bold" = true;
"error.fg" = 1;
"warning.fg" = 3;
"success.fg" = 2;
"msglist_unread.bold" = true;
"msglist_deleted.fg" = 10;
"tab.fg" = 0;
"tab.selected.reverse" = false;
"tab.selected.bold" = true;
"tab.selected.bg" = 2;
"dirlist_default.bg" = 18;
"border.fg" = 0;
"statusline_default.bg" = 18;
"statusline_error.fg" = 1;
"statusline_error.reverse" = true;
"statusline_success.fg" = 2;
"statusline_success.reverse" = true;
"completion_default.bg" = 0;
};
};
};
}

View File

@ -0,0 +1,18 @@
{ config, pkgs, lib, ... }:
let cfg = config.local.programs.communication; in
{
options.local.programs.communication = with lib; {
simplex-chat.enable = mkEnableOption "SimplexChat";
telegram.enable = mkEnableOption "tdesktop. telegram client";
matrix.enable = mkEnableOption "nheko. matrix client";
skype.enable = mkEnableOption "skype";
};
config.home.packages = with pkgs.unstable;
lib.optional cfg.simplex-chat.enable simplex-chat-desktop
++ lib.optional cfg.telegram.enable tdesktop
++ lib.optional cfg.matrix.enable nheko
++ lib.optional cfg.skype.enable skypeforlinux;
}

View File

@ -0,0 +1,14 @@
{ ... }:
{
imports = [
./aerc.nix
./communication.nix
./dev-tools.nix
./libreoffice.nix
./share-files.nix
./editors
./file-managers
./terminals
];
}

View File

@ -0,0 +1,97 @@
{ config, lib, pkgs, ... }:
let
cfg = config.local.programs.dev-tools;
in
{
options.local.programs.dev-tools = with lib; {
base.enable = mkEnableOption "base tools";
nix.enable = mkEnableOption "tools for nix developer";
web.enable = mkEnableOption "tools for web developer";
k8s.enable = mkEnableOption "k8s tools";
psql = {
enable = mkEnableOption "psql";
package = mkOption {
type = types.package;
default = pkgs.postgresql;
};
};
eza.enable = mkEnableOption "eza. ls replacement";
direnv.enable = mkEnableOption "direnv";
zoxide.enable = mkEnableOption "zoxide";
};
config = lib.mkMerge [
(lib.mkIf cfg.base.enable {
home.packages = with pkgs; [
gnumake
bat # a cat clone with syntax highlighting and git integration
fd # a simple, fast and user-friendly alternative to find
ripgrep # a fuzzy finder
libnotify # tool to send notifications via cli
];
})
(lib.mkIf cfg.eza.enable {
programs.eza = {
enable = true;
package = pkgs.unstable.eza.override { gitSupport = false; };
};
programs.zsh.shellAliases =
let
defaultArgs = "--icons --classify --group-directories-first --all";
bin = "${config.programs.eza.package}/bin/exa ${defaultArgs}";
in
lib.mkIf config.programs.zsh.enable {
ls = "${bin} --oneline";
lt = "${bin} --tree --level=3";
ll = "${bin} --long --header";
};
})
(lib.mkIf cfg.direnv.enable {
programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
})
(lib.mkIf cfg.zoxide.enable {
programs.zoxide = {
enable = true;
enableZshIntegration = config.programs.zsh.enable;
};
})
(lib.mkIf cfg.web.enable {
home.packages = with pkgs.unstable; [
xh # friendly and fast tool for sending HTTP requests
deno
docker-compose
];
})
(lib.mkIf cfg.nix.enable {
home.packages = with pkgs.unstable; [
nixpkgs-fmt # nix formatter
nil # nix lsp server
];
})
(lib.mkIf cfg.k8s.enable {
home.packages = with pkgs; [
(google-cloud-sdk.withExtraComponents (
let gc = google-cloud-sdk.components; in [
gc.gke-gcloud-auth-plugin
gc.kubectl
]
))
];
})
(lib.mkIf cfg.psql.enable {
home.packages = [ cfg.psql.package ];
})
];
}

View File

@ -0,0 +1,9 @@
{ config, pkgs, lib, ... }:
{
options.local.programs.editors.arduino-ide.enable = lib.mkEnableOption "arduino-ide";
config.home.packages = lib.optional
config.local.programs.editors.arduino-ide.enable
pkgs.unstable.arduino-ide;
}

View File

@ -0,0 +1,9 @@
{ ... }:
{
imports = [
./arduino-ide.nix
./gedit.nix
./neovim.nix
];
}

View File

@ -0,0 +1,9 @@
{ config, pkgs, lib, ... }:
{
options.local.programs.editors.gedit.enable = lib.mkEnableOption "gnome gedit";
config.home.packages = lib.optional
config.local.programs.editors.gedit.enable
pkgs.unstable.gedit;
}

View File

@ -0,0 +1,179 @@
{ config, pkgs, lib, ... }:
let
cfg = config.local.programs.editors.neovim;
# TODO: add more configs
myneovim = pkgs.myneovim.override {
viAlias = true;
vimAlias = true;
enableDevIcons = true;
enableTabby = true;
enableOrgMode = true;
extraConfig = ''
aug extra_ftdetect
au!
au BufNewFile,BufRead *.d2 setfiletype d2
au BufNewFile,BufRead *.ncl setfiletype nickel
au BufNewFile,BufRead *.psql setfiletype psql
aug END
'';
plugins = with pkgs.myneovim.nix2lua; (lib.mkMerge [
{
nvimTree.settings = {
renderer = {
group_empty = true;
full_name = true;
};
tab.sync = {
open = true;
close = true;
};
};
telescope.settings = {
extensions.live_grep_args = {
auto_quoting = true;
mappings.i = {
"<C-K>" = join "." [
(mkCall "require" [ "telescope-live-grep-args.actions" ])
(mkCall "quote_prompt" [ ])
];
};
};
};
lspSaga.settings = {
border_style = "rounded";
symbol_in_winbar.enable = false;
code_action_lightbulb.enable = false;
code_action_keys = { quit = "<Esc>"; };
definition_action_keys = { quit = "<Esc>"; };
rename_action_quit = "<C-c>";
};
lspConfig.servers = {
nickel_ls = { };
tsserver = { };
eslint = { };
volar = {
init_options = {
typescript.tsdk = "./node_modules/typescript/lib";
};
};
denols = {
root_dir = mkCall "root_pattern" [ "deno.json" "deno.jsonc" ];
};
pylsp = { };
};
lualine.settings = {
options.ignore_focus = [ "NvimTree" ];
sections = {
lualine_a = [
[ "filename" (mkNamedField "path" 1) ]
];
lualine_b = [ "branch" "diff" "diagnostics" ];
lualine_c = [ "lsp_progress" ];
lualine_x = [ "filesize" "filetype" ];
lualine_y = [ "progress" ];
lualine_z = [ "location" "mode" ];
};
};
}
(lib.mkIf cfg.orgmode.enable {
orgmode.settings = {
org_agenda_files = [ "~/orgs/**/*" ];
org_default_notes_file = "~/orgs/refile.org";
win_split_mode = "tabnew";
org_hide_leading_stars = true;
};
})
(lib.mkIf cfg.ltex.enable {
lspConfig.servers.ltex = {
language = "en-US";
languageToolHttpServerUri = "http://localhost:8081";
};
})
(lib.mkIf cfg.nix.enable {
lspConfig.servers.nil_ls = { };
})
(lib.mkIf cfg.rust.enable {
lspConfig.servers.rust_analyzer = {
settings.rust-analyzer = {
"server.path" = "rust-analyzer";
"updates.prompt" = false;
"updates.checkOnStartup" = false;
"checkOnSave.enable" = true;
"checkOnSave.command" = "clippy";
"cargo.autoreload" = true;
};
};
})
(lib.mkIf (cfg.typescript.enable || cfg.vue.enable) {
lspConfig.servers = {
tsserver = { };
eslint = { };
};
})
(lib.mkIf cfg.vue.enable {
lspConfig.servers.volar = {
init_options = {
typescript.tsdk = "./node_modules/typescript/lib";
};
};
})
(lib.mkIf cfg.deno.enable {
lspConfig.servers.denols = {
root_dir = mkCall "root_pattern" [ "deno.json" "deno.jsonc" ];
};
})
(lib.mkIf cfg.python.enable {
lspConfig.servers.pylsp = { };
})
(lib.mkIf cfg.nickel.enable {
lspConfig.servers.nickel_ls = { };
})
]);
};
in
{
options.local.programs.editors.neovim = with lib; {
enable = mkEnableOption "neovim";
defaultEditor = mkOption {
description = "set neovim as default editor";
type = types.bool;
default = false;
};
ltex.enable = mkEnableOption "ltex language server";
orgmode.enable = mkEnableOption "orgmode";
nix.enable = mkEnableOptions "nix";
rust.enable = mkEnableOption "rust";
typescript.enable = mkEnableOption "typescript";
vue.enable = mkEnableOption "vue";
deno.enable = mkEnableOption "deno";
python.enable = mkEnableOption "python";
nickel.enable = mkEnableOption "nickel";
};
config = lib.mkIf cfg.enable (lib.mkMerge [
{
home.packages = [ myneovim ];
}
(lib.mkIf cfg.ltex.enable {
home.packages = [ pkgs.ltex-ls ];
})
(lib.mkIf cfg.defaultEditor {
home.sessionVariables.EDITOR = "nvim";
})
]);
}

View File

@ -0,0 +1,8 @@
{ ... }:
{
imports = [
./nautilus.nix
./vifm
];
}

View File

@ -0,0 +1,12 @@
{ config, pkgs, lib, ... }:
let
cfg = config.local.programs.file-managers.nautilus;
in
{
options.local.programs.file-managers.nautilus = with lib; {
enable = mkEnableOption "nautilus";
};
config.home.packages = with pkgs.unstable; lib.optional cfg.enable gnome.nautilus;
}

View File

@ -1,7 +1,6 @@
{ pkgs, lib, ... }:
{ config, pkgs, lib, ... }:
let
viu = pkgs.rustPlatform.buildRustPackage {
pname = "viu";
version = "23-10-2022";
@ -20,16 +19,20 @@ let
};
in
{
home.packages = [
pkgs.vifm
viu # terminal image viewer
pkgs.libarchive
pkgs.zip
pkgs.unzip
];
options.local.programs.file-managers.vifm.enable = lib.mkEnableOption "vifm";
xdg.configFile = {
"vifm/vifmrc".source = ./vifmrc;
"vifm/colors/catppuccin".source = ./vifm_catppuccin.vifm;
config = lib.mkIf config.local.programs.file-managers.vifm.enable {
home.packages = [
pkgs.vifm
viu # terminal image viewer
pkgs.libarchive
pkgs.zip
pkgs.unzip
];
xdg.configFile = {
"vifm/vifmrc".source = ./vifmrc;
"vifm/colors/catppuccin".source = ./vifm_catppuccin.vifm;
};
};
}

View File

@ -0,0 +1,24 @@
{ config, pkgs, lib, ... }:
let
cfg = config.local.programs.libreoffice;
in
{
options.local.programs.libreoffice = with lib; {
enable = mkEnableOption "libreoffice";
spellCheckDicts = mkOption {
type = types.listOf types.package;
default = [ ];
};
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs; (
[ libreoffice ]
++ lib.optional (cfg.spellCheckDicts != [ ]) hunspell
++ cfg.spellCheckDicts
);
};
}

View File

@ -0,0 +1,20 @@
{ config, pkgs, lib, ... }:
let
cfg = config.local.programs.share-files;
in
{
options.local.programs.share-files = with lib; {
onionshare.enable = mkEnableOption "onionshare";
croc.enable = mkEnableOption "croc";
};
config.home.packages =
# OnionShare is an open-source tool that lets you securely and anonymously share files,
# host websites, and chat with friends using the Tor network.
lib.optional cfg.onionshare.enable pkgs.onionshare-gui
# Easily and securely send things from one computer to another
++ lib.optional cfg.croc.enable pkgs.croc;
}

View File

@ -1,11 +1,12 @@
{ lib, config, pkgs, ... }:
{ lib, config, ... }:
let
cfg = config.local.alacritty;
themeCfg = config.local.theme;
cfg = config.local.programs.terminals.alacritty;
themeCfg = config.local.themes."${config.local.theme.name}";
in
{
options.local.alacritty = with lib; {
options.local.programs.terminals.alacritty = with lib; {
enable = mkEnableOption "alacritty";
fontSize = mkOption {
type = types.number;
default = 11.0;
@ -13,7 +14,7 @@ in
};
};
config = {
config = lib.mkIf cfg.enable {
programs.alacritty = {
enable = true;
settings = {

View File

@ -0,0 +1,9 @@
{ ... }:
{
imports = [
./alacritty.nix
./wezterm.nix
];
}

View File

@ -1,11 +1,12 @@
{ lib, config, ... }:
let
cfg = config.local.wezterm;
themeCfg = config.local.theme;
cfg = config.local.programs.terminals.wezterm;
themeCfg = config.local.themes."${config.local.theme.name}";
in
{
options.local.wezterm = with lib; {
options.local.programs.terminals.wezterm = with lib; {
enable = mkEnableOption "wezterm";
fontSize = mkOption {
type = types.number;
default = 11.0;
@ -13,7 +14,7 @@ in
};
};
config = {
config = lib.mkIf cfg.enable {
programs.wezterm = {
enable = true;
colorSchemes = {

View File

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

View File

@ -1,6 +1,8 @@
{ config, pkgs, ... }:
let themeCfg = config.local.theme; in
let
themeCfg = config.local.themes."${config.local.theme.name}";
in
{
services.wired = {
enable = true;

View File

@ -0,0 +1,73 @@
{ lib, config, pkgs, ... }:
{
options.local.shell.enable = lib.mkEnableOption "enable shell";
config = lib.mkIf config.local.shell.enable {
# fish and zsh support for nix-shell
home.packages = with pkgs; [ any-nix-shell ];
programs.zsh = {
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
defaultKeymap = "viins";
dotDir = ".config/zsh";
history = {
path = "${config.xdg.dataHome}/zsh/zsh_history";
expireDuplicatesFirst = true;
ignorePatterns = [
"rm *"
"kill *"
];
};
oh-my-zsh.enable = true;
initExtra = ''
any-nix-shell zsh --info-right | source /dev/stdin
'';
};
programs.starship = {
enable = true;
enableZshIntegration = config.programs.zsh.enable;
settings = {
add_newline = true;
format = lib.concatStrings [
"$hostname"
"$directory"
"$git_branch"
"$git_commit"
"$git_state"
"$git_metrics"
"$git_status"
"$shlvl"
"$nix_shell"
"$cmd_duration"
"$jobs"
"$line_break"
"$character"
];
character = {
success_symbol = "[](bold green)";
error_symbol = "[](bold red)";
};
git_commit.commit_hash_length = 6;
shlvl = {
disabled = false;
format = "[$symbol$shlvl]($style) ";
symbol = " ";
threshold = 3;
};
hostname.ssh_symbol = "";
};
};
};
}

Some files were not shown because too many files have changed in this diff Show More