nix-update

This commit is contained in:
kp2pml30 2025-01-12 14:35:10 +00:00
parent 94da1ce936
commit 284b131058
24 changed files with 7276 additions and 161 deletions

8
flake.lock generated
View file

@ -61,16 +61,16 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1736344531,
"narHash": "sha256-8YVQ9ZbSfuUk2bUf2KRj60NRraLPKPS0Q4QFTbc+c2c=",
"lastModified": 1736200483,
"narHash": "sha256-JO+lFN2HsCwSLMUWXHeOad6QUxOuwe9UOAF/iSl1J4I=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "bffc22eb12172e6db3c5dde9e3e5628f8e3e7912",
"rev": "3f0a8ac25fb674611b98089ca3a5dd6480175751",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"ref": "nixos-24.11",
"repo": "nixpkgs",
"type": "github"
}

View file

@ -1,6 +1,6 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
nixos-wsl = {
url = "github:nix-community/NixOS-WSL/main";
inputs.nixpkgs.follows = "nixpkgs";
@ -9,53 +9,62 @@
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
#vscode-server = {
# url = "github:nix-community/nixos-vscode-server";
# inputs.nixpkgs.follows = "nixpkgs";
#};
};
outputs = inputs@{ self, nixpkgs, nixos-wsl, home-manager, ... }:
let
rootPath = self;
additionalArgs = { inherit inputs rootPath; };
importArg = inputs // { pkgs = nixpkgs; lib = nixpkgs.lib; } // additionalArgs;
hostNameMod = name: { networking.hostName = "kp2pml30-${name}"; };
makeNamedSys = nameArg: arg: {
"${nameArg}" =
nixpkgs.lib.nixosSystem
((builtins.removeAttrs arg ["modules"]) // { specialArgs = additionalArgs; modules = arg.modules ++ [(hostNameMod nameArg)]; });
};
makeSys = { sys }: [
(makeNamedSys "server-${sys}" {
system = sys;
lib = nixpkgs.lib;
in
{
nixosConfigurations = {
personal-laptop = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./nix/common.nix
./nix/server.nix
];
})
{
networking.hostName = "kp2pml30-personal-laptop";
networking.hostId = "e31a5cc0";
(makeNamedSys "personal-${sys}" {
system = sys;
modules = [
./nix/common.nix
./nix/personal.nix
];
})
time.timeZone = "Asia/Yerevan";
}
(makeNamedSys "personal-${sys}-wsl" {
system = sys;
./nix/hardware/ideapad.nix
./nix/common.nix
./nix/personal
{
kp2pml30 = {
xserver = true;
vscode = true;
kitty = true;
opera = true;
steam = true;
};
}
];
specialArgs = additionalArgs;
};
personal-wsl = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
{
networking.hostName = "kp2pml30-personal-wsl";
networking.hostId = "e31a5cbf";
}
./nix/wsl.nix
./nix/common.nix
./nix/personal.nix
];
})
] ;
in
{
nixosConfigurations =
builtins.foldl'
(x: y: x // y)
{}
(builtins.concatMap makeSys [ { sys = "x86_64-linux"; } ])
;
specialArgs = additionalArgs;
};
};
};
}

566
home/.config/awesome/rc.lua Normal file
View file

@ -0,0 +1,566 @@
-- If LuaRocks is installed, make sure that packages installed through it are
-- found (e.g. lgi). If LuaRocks is not installed, do nothing.
pcall(require, "luarocks.loader")
-- Standard awesome library
local gears = require("gears")
local awful = require("awful")
require("awful.autofocus")
-- Widget and layout library
local wibox = require("wibox")
-- Theme handling library
local beautiful = require("beautiful")
-- Notification library
local naughty = require("naughty")
local menubar = require("menubar")
local hotkeys_popup = require("awful.hotkeys_popup")
-- Enable hotkeys help widget for VIM and other apps
-- when client with a matching name is opened:
require("awful.hotkeys_popup.keys")
-- {{{ Error handling
-- Check if awesome encountered an error during startup and fell back to
-- another config (This code will only ever execute for the fallback config)
if awesome.startup_errors then
naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, there were errors during startup!",
text = awesome.startup_errors })
end
-- Handle runtime errors after startup
do
local in_error = false
awesome.connect_signal("debug::error", function (err)
-- Make sure we don't go into an endless error loop
if in_error then return end
in_error = true
naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, an error happened!",
text = tostring(err) })
in_error = false
end)
end
-- }}}
-- {{{ Variable definitions
-- Themes define colours, icons, font and wallpapers.
beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua")
-- This is used later as the default terminal and editor to run.
terminal = "kitty"
editor = os.getenv("EDITOR") or "nano"
editor_cmd = terminal .. " -e " .. editor
-- Default modkey.
-- Usually, Mod4 is the key with a logo between Control and Alt.
-- If you do not like this or do not have such a key,
-- I suggest you to remap Mod4 to another key using xmodmap or other tools.
-- However, you can use another modifier like Mod1, but it may interact with others.
modkey = "Mod4"
-- Table of layouts to cover with awful.layout.inc, order matters.
awful.layout.layouts = {
awful.layout.suit.floating,
awful.layout.suit.tile,
awful.layout.suit.tile.left,
awful.layout.suit.tile.bottom,
awful.layout.suit.tile.top,
awful.layout.suit.fair,
awful.layout.suit.fair.horizontal,
awful.layout.suit.spiral,
awful.layout.suit.spiral.dwindle,
awful.layout.suit.max,
awful.layout.suit.max.fullscreen,
awful.layout.suit.magnifier,
awful.layout.suit.corner.nw,
-- awful.layout.suit.corner.ne,
-- awful.layout.suit.corner.sw,
-- awful.layout.suit.corner.se,
}
-- }}}
-- {{{ Menu
-- Create a launcher widget and a main menu
myawesomemenu = {
{ "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end },
{ "manual", terminal .. " -e man awesome" },
{ "edit config", editor_cmd .. " " .. awesome.conffile },
{ "restart", awesome.restart },
{ "quit", function() awesome.quit() end },
}
mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
{ "open terminal", terminal }
}
})
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
menu = mymainmenu })
-- Menubar configuration
menubar.utils.terminal = terminal -- Set the terminal for applications that require it
-- }}}
-- Keyboard map indicator and switcher
mykeyboardlayout = awful.widget.keyboardlayout()
-- {{{ Wibar
-- Create a textclock widget
mytextclock = wibox.widget.textclock()
-- Create a wibox for each screen and add it
local taglist_buttons = gears.table.join(
awful.button({ }, 1, function(t) t:view_only() end),
awful.button({ modkey }, 1, function(t)
if client.focus then
client.focus:move_to_tag(t)
end
end),
awful.button({ }, 3, awful.tag.viewtoggle),
awful.button({ modkey }, 3, function(t)
if client.focus then
client.focus:toggle_tag(t)
end
end),
awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end),
awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end)
)
local tasklist_buttons = gears.table.join(
awful.button({ }, 1, function (c)
if c == client.focus then
c.minimized = true
else
c:emit_signal(
"request::activate",
"tasklist",
{raise = true}
)
end
end),
awful.button({ }, 3, function()
awful.menu.client_list({ theme = { width = 250 } })
end),
awful.button({ }, 4, function ()
awful.client.focus.byidx(1)
end),
awful.button({ }, 5, function ()
awful.client.focus.byidx(-1)
end))
local function set_wallpaper(s)
-- Wallpaper
if beautiful.wallpaper then
local wallpaper = beautiful.wallpaper
-- If wallpaper is a function, call it with the screen
if type(wallpaper) == "function" then
wallpaper = wallpaper(s)
end
gears.wallpaper.maximized(wallpaper, s, true)
end
end
-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
screen.connect_signal("property::geometry", set_wallpaper)
awful.screen.connect_for_each_screen(function(s)
-- Wallpaper
set_wallpaper(s)
-- Each screen has its own tag table.
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1])
-- Create a promptbox for each screen
s.mypromptbox = awful.widget.prompt()
-- Create an imagebox widget which will contain an icon indicating which layout we're using.
-- We need one layoutbox per screen.
s.mylayoutbox = awful.widget.layoutbox(s)
s.mylayoutbox:buttons(gears.table.join(
awful.button({ }, 1, function () awful.layout.inc( 1) end),
awful.button({ }, 3, function () awful.layout.inc(-1) end),
awful.button({ }, 4, function () awful.layout.inc( 1) end),
awful.button({ }, 5, function () awful.layout.inc(-1) end)))
-- Create a taglist widget
s.mytaglist = awful.widget.taglist {
screen = s,
filter = awful.widget.taglist.filter.all,
buttons = taglist_buttons
}
-- Create a tasklist widget
s.mytasklist = awful.widget.tasklist {
screen = s,
filter = awful.widget.tasklist.filter.currenttags,
buttons = tasklist_buttons
}
-- Create the wibox
s.mywibox = awful.wibar({ position = "top", screen = s })
-- Add widgets to the wibox
s.mywibox:setup {
layout = wibox.layout.align.horizontal,
{ -- Left widgets
layout = wibox.layout.fixed.horizontal,
mylauncher,
s.mytaglist,
s.mypromptbox,
},
s.mytasklist, -- Middle widget
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
mykeyboardlayout,
wibox.widget.systray(),
mytextclock,
s.mylayoutbox,
},
}
end)
-- }}}
-- {{{ Mouse bindings
root.buttons(gears.table.join(
awful.button({ }, 3, function () mymainmenu:toggle() end),
awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev)
))
-- }}}
-- {{{ Key bindings
globalkeys = gears.table.join(
awful.key({ modkey, }, "s", hotkeys_popup.show_help,
{description="show help", group="awesome"}),
awful.key({ modkey, "Shift" }, "Left", awful.tag.viewprev,
{description = "view previous", group = "tag"}),
awful.key({ modkey, "Shift" }, "Right", awful.tag.viewnext,
{description = "view next", group = "tag"}),
awful.key({ modkey, }, "Escape", awful.tag.history.restore,
{description = "go back", group = "tag"}),
awful.key({ modkey, }, "Left",
function ()
awful.client.focus.byidx( 1)
end,
{description = "focus next by index", group = "client"}
),
awful.key({ modkey, }, "Right",
function ()
awful.client.focus.byidx(-1)
end,
{description = "focus previous by index", group = "client"}
),
awful.key({ modkey, }, "w", function () mymainmenu:show() end,
{description = "show main menu", group = "awesome"}),
-- Layout manipulation
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end,
{description = "swap with next client by index", group = "client"}),
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end,
{description = "swap with previous client by index", group = "client"}),
awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end,
{description = "focus the next screen", group = "screen"}),
awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end,
{description = "focus the previous screen", group = "screen"}),
awful.key({ modkey, }, "u", awful.client.urgent.jumpto,
{description = "jump to urgent client", group = "client"}),
awful.key({ modkey, }, "Tab",
function ()
awful.client.focus.history.previous()
if client.focus then
client.focus:raise()
end
end,
{description = "go back", group = "client"}),
-- Standard program
awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end,
{description = "open a terminal", group = "launcher"}),
awful.key({ modkey, "Shift" }, "r", awesome.restart,
{description = "reload awesome", group = "awesome"}),
awful.key({ modkey, "Shift" }, "q", awesome.quit,
{description = "quit awesome", group = "awesome"}),
awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end,
{description = "increase master width factor", group = "layout"}),
awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end,
{description = "decrease master width factor", group = "layout"}),
awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end,
{description = "increase the number of master clients", group = "layout"}),
awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1, nil, true) end,
{description = "decrease the number of master clients", group = "layout"}),
awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end,
{description = "increase the number of columns", group = "layout"}),
awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end,
{description = "decrease the number of columns", group = "layout"}),
awful.key({ modkey, }, "space", function () awful.layout.inc( 1) end,
{description = "select next", group = "layout"}),
awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) end,
{description = "select previous", group = "layout"}),
awful.key({ modkey, "Control" }, "n",
function ()
local c = awful.client.restore()
-- Focus restored client
if c then
c:emit_signal(
"request::activate", "key.unminimize", {raise = true}
)
end
end,
{description = "restore minimized", group = "client"}),
-- Prompt
awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end,
{description = "run prompt", group = "launcher"}),
awful.key({ modkey }, "d", function () awful.spawn("rofi -show drun") end,
{description = "run prompt", group = "launcher"}),
awful.key({ modkey }, "x",
function ()
awful.prompt.run {
prompt = "Run Lua code: ",
textbox = awful.screen.focused().mypromptbox.widget,
exe_callback = awful.util.eval,
history_path = awful.util.get_cache_dir() .. "/history_eval"
}
end,
{description = "lua execute prompt", group = "awesome"}),
-- Menubar
awful.key({ modkey }, "p", function() menubar.show() end,
{description = "show the menubar", group = "launcher"})
)
clientkeys = gears.table.join(
awful.key({ modkey, }, "f",
function (c)
c.fullscreen = not c.fullscreen
c:raise()
end,
{description = "toggle fullscreen", group = "client"}),
awful.key({ modkey }, "q", function (c) c:kill() end,
{description = "close", group = "client"}),
awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ,
{description = "toggle floating", group = "client"}),
awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end,
{description = "move to master", group = "client"}),
awful.key({ modkey, }, "o", function (c) c:move_to_screen() end,
{description = "move to screen", group = "client"}),
awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end,
{description = "toggle keep on top", group = "client"}),
awful.key({ modkey, }, "n",
function (c)
-- The client currently has the input focus, so it cannot be
-- minimized, since minimized clients can't have the focus.
c.minimized = true
end ,
{description = "minimize", group = "client"}),
awful.key({ modkey, }, "m",
function (c)
c.maximized = not c.maximized
c:raise()
end ,
{description = "(un)maximize", group = "client"}),
awful.key({ modkey, "Control" }, "m",
function (c)
c.maximized_vertical = not c.maximized_vertical
c:raise()
end ,
{description = "(un)maximize vertically", group = "client"}),
awful.key({ modkey, "Shift" }, "m",
function (c)
c.maximized_horizontal = not c.maximized_horizontal
c:raise()
end ,
{description = "(un)maximize horizontally", group = "client"})
)
-- Bind all key numbers to tags.
-- Be careful: we use keycodes to make it work on any keyboard layout.
-- This should map on the top row of your keyboard, usually 1 to 9.
for i = 1, 9 do
globalkeys = gears.table.join(globalkeys,
-- View tag only.
awful.key({ modkey }, "#" .. i + 9,
function ()
local screen = awful.screen.focused()
local tag = screen.tags[i]
if tag then
tag:view_only()
end
end,
{description = "view tag #"..i, group = "tag"}),
-- Toggle tag display.
awful.key({ modkey, "Control" }, "#" .. i + 9,
function ()
local screen = awful.screen.focused()
local tag = screen.tags[i]
if tag then
awful.tag.viewtoggle(tag)
end
end,
{description = "toggle tag #" .. i, group = "tag"}),
-- Move client to tag.
awful.key({ modkey, "Shift" }, "#" .. i + 9,
function ()
if client.focus then
local tag = client.focus.screen.tags[i]
if tag then
client.focus:move_to_tag(tag)
end
end
end,
{description = "move focused client to tag #"..i, group = "tag"}),
-- Toggle tag on focused client.
awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
function ()
if client.focus then
local tag = client.focus.screen.tags[i]
if tag then
client.focus:toggle_tag(tag)
end
end
end,
{description = "toggle focused client on tag #" .. i, group = "tag"})
)
end
clientbuttons = gears.table.join(
awful.button({ }, 1, function (c)
c:emit_signal("request::activate", "mouse_click", {raise = true})
end),
awful.button({ modkey }, 1, function (c)
c:emit_signal("request::activate", "mouse_click", {raise = true})
awful.mouse.client.move(c)
end),
awful.button({ modkey }, 3, function (c)
c:emit_signal("request::activate", "mouse_click", {raise = true})
awful.mouse.client.resize(c)
end)
)
-- Set keys
root.keys(globalkeys)
-- }}}
-- {{{ Rules
-- Rules to apply to new clients (through the "manage" signal).
awful.rules.rules = {
-- All clients will match this rule.
{ rule = { },
properties = { border_width = beautiful.border_width,
border_color = beautiful.border_normal,
focus = awful.client.focus.filter,
raise = true,
keys = clientkeys,
buttons = clientbuttons,
screen = awful.screen.preferred,
placement = awful.placement.no_overlap+awful.placement.no_offscreen
}
},
-- Floating clients.
{ rule_any = {
instance = {
"DTA", -- Firefox addon DownThemAll.
"copyq", -- Includes session name in class.
"pinentry",
},
class = {
"Arandr",
"Blueman-manager",
"Gpick",
"Kruler",
"MessageWin", -- kalarm.
"Sxiv",
"Tor Browser", -- Needs a fixed window size to avoid fingerprinting by screen size.
"Wpa_gui",
"veromix",
"xtightvncviewer"},
-- Note that the name property shown in xprop might be set slightly after creation of the client
-- and the name shown there might not match defined rules here.
name = {
"Event Tester", -- xev.
},
role = {
"AlarmWindow", -- Thunderbird's calendar.
"ConfigManager", -- Thunderbird's about:config.
"pop-up", -- e.g. Google Chrome's (detached) Developer Tools.
}
}, properties = { floating = true }},
-- Add titlebars to normal clients and dialogs
{ rule_any = {type = { "normal", "dialog" }
}, properties = { titlebars_enabled = true }
},
-- Set Firefox to always map on the tag named "2" on screen 1.
-- { rule = { class = "Firefox" },
-- properties = { screen = 1, tag = "2" } },
}
-- }}}
-- {{{ Signals
-- Signal function to execute when a new client appears.
client.connect_signal("manage", function (c)
-- Set the windows at the slave,
-- i.e. put it at the end of others instead of setting it master.
-- if not awesome.startup then awful.client.setslave(c) end
if awesome.startup
and not c.size_hints.user_position
and not c.size_hints.program_position then
-- Prevent clients from being unreachable after screen count changes.
awful.placement.no_offscreen(c)
end
end)
-- Add a titlebar if titlebars_enabled is set to true in the rules.
client.connect_signal("request::titlebars", function(c)
-- buttons for the titlebar
local buttons = gears.table.join(
awful.button({ }, 1, function()
c:emit_signal("request::activate", "titlebar", {raise = true})
awful.mouse.client.move(c)
end),
awful.button({ }, 3, function()
c:emit_signal("request::activate", "titlebar", {raise = true})
awful.mouse.client.resize(c)
end)
)
awful.titlebar(c) : setup {
{ -- Left
awful.titlebar.widget.iconwidget(c),
buttons = buttons,
layout = wibox.layout.fixed.horizontal
},
{ -- Middle
{ -- Title
align = "center",
widget = awful.titlebar.widget.titlewidget(c)
},
buttons = buttons,
layout = wibox.layout.flex.horizontal
},
{ -- Right
awful.titlebar.widget.floatingbutton (c),
awful.titlebar.widget.maximizedbutton(c),
awful.titlebar.widget.stickybutton (c),
awful.titlebar.widget.ontopbutton (c),
awful.titlebar.widget.closebutton (c),
layout = wibox.layout.fixed.horizontal()
},
layout = wibox.layout.align.horizontal
}
end)
-- Enable sloppy focus, so that focus follows mouse.
client.connect_signal("mouse::enter", function(c)
c:emit_signal("request::activate", "mouse_enter", {raise = false})
end)
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
-- }}}

View file

@ -0,0 +1,2 @@
alias clear="printf '\033[2J\033[3J\033[1;1H'"
bass source ~/.bashrc

View file

@ -22,9 +22,24 @@ while s:i < 10
let s:i += 1
endwhile
set clipboard=unnamedplus
set clipboard+=unnamedplus
colorscheme tokyonight-night
if system('uname -a') =~ '\<WSL2\>'
let g:clipboard = {
\ 'name': 'WslClipboard',
\ 'copy': {
\ '+': '/mnt/c/Windows/system32/clip.exe',
\ '*': '/mnt/c/Windows/system32/clip.exe',
\ },
\ 'paste': {
\ '+': ['/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe', '-NoLogo', '-NoProfile', '-c', '[Console]::Out.Write($(Get-Clipboard\ -Raw).tostring().replace("`r",""))'],
\ '*': ['/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe', '-NoLogo', '-NoProfile', '-c', '[Console]::Out.Write($(Get-Clipboard\ -Raw).tostring().replace("`r",""))'],
\ },
\ 'cache_enabled': 0,
\ }
endif
" colorscheme tokyonight-night
if exists(':GuiRenderLigatures')
GuiRenderLigatures 1
endif
@ -33,43 +48,47 @@ if exists(':GuiFont')
GuiFont FiraCode\ Nerd\ Font
endif
if exists(':NERDTreeToggle')
map <F3> :NERDTreeToggle<CR>
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
endif
function s:post_load()
if exists(':NERDTreeToggle')
map <F3> :NERDTreeToggle<CR>
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
endif
if exists(':BufferGoto')
let s:i = 1
while s:i < 10
execute printf('nmap <Leader>%i :BufferGoto %i<CR>', s:i, s:i)
let s:i += 1
endwhile
if exists(':BufferGoto')
let s:i = 1
while s:i < 10
execute printf('nmap <Leader>%i :BufferGoto %i<CR>', s:i, s:i)
let s:i += 1
endwhile
nmap <C-Right> :BufferNext<CR>
nmap <C-Left> :BufferPrevious<CR>
nmap <C-q> :BufferClose<CR>
endif
nmap <C-Right> :BufferNext<CR>
nmap <C-Left> :BufferPrevious<CR>
nmap <C-q> :BufferClose<CR>
endif
if exists(':DetectIndent')
autocmd BufRead * DetectIndent
endif
if exists(':DetectIndent')
autocmd BufRead * DetectIndent
endif
if exists(':CocInfo')
inoremap <silent><expr> <c-space> coc#refresh()
inoremap <silent><expr> <TAB>
\ coc#pum#visible() ? coc#pum#confirm() : "\<Tab>"
nmap <silent> <Space>ld <Plug>(coc-definition)
nmap <silent> <Space>lt <Plug>(coc-type-definition)
nmap <silent> <Space>li <Plug>(coc-implementation)
nmap <silent> <Space>lr <Plug>(coc-references)
endif
if exists(':CocInfo')
inoremap <silent><expr> <c-space> coc#refresh()
inoremap <silent><expr> <TAB>
\ coc#pum#visible() ? coc#pum#confirm() : "\<Tab>"
nmap <silent> <Space>ld <Plug>(coc-definition)
nmap <silent> <Space>lt <Plug>(coc-type-definition)
nmap <silent> <Space>li <Plug>(coc-implementation)
nmap <silent> <Space>lr <Plug>(coc-references)
endif
if exists(':LeaderGuide')
nnoremap <silent> <leader> :<c-u>LeaderGuide '\'<CR>
nnoremap <silent> <Space> :<c-u>LeaderGuide '<Space>'<CR>
let g:smap = get(g:, 'smap', {})
" let g:smap['<Space>'] = get(g:smap, '<Space>', {})
" let g:smap['<Space>'].l = 'language'
let g:smap.l = {'name' : 'language'}
call leaderGuide#register_prefix_descriptions("<Space>", "g:smap")
endif
if exists(':LeaderGuide')
nnoremap <silent> <leader> :<c-u>LeaderGuide '\'<CR>
nnoremap <silent> <Space> :<c-u>LeaderGuide '<Space>'<CR>
let g:smap = get(g:, 'smap', {})
" let g:smap['<Space>'] = get(g:smap, '<Space>', {})
" let g:smap['<Space>'].l = 'language'
let g:smap.l = {'name' : 'language'}
call leaderGuide#register_prefix_descriptions("<Space>", "g:smap")
endif
endfunction
:au VimEnter * call s:post_load()

View file

@ -0,0 +1,145 @@
{
"roots": {
"bookmark_bar": {
"children": [
{
"date_added": "13382315232730631",
"date_last_used": "0",
"guid": "1598d860-692c-4ad0-8372-e362856c2cb9",
"id": "22",
"name": "gmail",
"type": "url",
"url": "https://mail.google.com/"
},
{
"date_added": "13382315299830860",
"date_last_used": "13382315307606822",
"guid": "e6733286-2943-4b56-9be9-085abc66d27f",
"id": "25",
"name": "youtube",
"type": "url",
"url": "https://youtube.com/"
},
{
"date_added": "13382315356314154",
"date_last_used": "13382315366258681",
"guid": "d40d53df-a1d5-4abd-a9ff-3524271a0e6f",
"id": "26",
"name": "github",
"type": "url",
"url": "https://github.com/"
},
{
"children": [],
"date_added": "13382315243355113",
"date_last_used": "0",
"date_modified": "13382315243355113",
"guid": "e902d4c5-1f97-4d36-8e4c-93b96c7b22d0",
"id": "23",
"name": "personal",
"type": "folder"
},
{
"children": [],
"date_added": "13382315250302370",
"date_last_used": "0",
"date_modified": "13382315250302370",
"guid": "f551a13a-aef2-4667-95fb-25c1a83500bb",
"id": "24",
"name": "work",
"type": "folder"
}
],
"date_added": "13382314101547094",
"date_last_used": "0",
"date_modified": "13382315358826147",
"guid": "0bc5d13f-2cba-5d74-951f-3f233fe6c908",
"id": "1",
"name": "Bookmarks bar",
"type": "folder"
},
"custom_root": {
"pinboard": {
"children": [],
"date_added": "13382314101547668",
"date_last_used": "0",
"date_modified": "0",
"guid": "00000000-0000-4000-a000-000000000907",
"id": "7",
"name": "Pinboard",
"type": "folder"
},
"speedDial": {
"children": [],
"date_added": "13382314101547657",
"date_last_used": "0",
"date_modified": "0",
"guid": "00000000-0000-4000-a000-000000000904",
"id": "6",
"name": "Speed Dials",
"type": "folder"
},
"trash": {
"children": [],
"date_added": "13382314101547690",
"date_last_used": "0",
"date_modified": "0",
"guid": "00000000-0000-4000-a000-000000000905",
"id": "9",
"name": "Trash",
"type": "folder"
},
"unsorted": {
"children": [],
"date_added": "13382314101547644",
"date_last_used": "0",
"date_modified": "0",
"guid": "00000000-0000-4000-a000-000000000901",
"id": "4",
"name": "Unsorted bookmarks",
"type": "folder"
},
"unsyncedPinboard": {
"children": [],
"date_added": "13382314101547673",
"date_last_used": "0",
"date_modified": "0",
"guid": "00000000-0000-4000-a000-000000000908",
"id": "8",
"name": "Unsynchronized Pinboard",
"type": "folder"
},
"userRoot": {
"children": [],
"date_added": "13382314101547651",
"date_last_used": "0",
"date_modified": "0",
"guid": "00000000-0000-4000-a000-000000000902",
"id": "5",
"name": "Other bookmarks",
"type": "folder"
}
},
"other": {
"children": [],
"date_added": "13382314101547100",
"date_last_used": "0",
"date_modified": "0",
"guid": "82b081ec-3dd3-529c-8475-ab6c344590dd",
"id": "2",
"name": "Imported bookmarks",
"type": "folder"
},
"synced": {
"children": [],
"date_added": "13382314101547121",
"date_last_used": "0",
"date_modified": "0",
"guid": "4cf2e351-0e85-532b-bb37-df045d8f8d0f",
"id": "3",
"name": "Mobile bookmarks",
"type": "folder"
}
},
"version": 1
}

File diff suppressed because it is too large Load diff

View file

@ -6,6 +6,8 @@
users.mutableUsers = false;
console.keyMap = "us";
nix.gc = {
automatic = true;
dates = "weekly";

28
nix/hardware/common.nix Normal file
View file

@ -0,0 +1,28 @@
{ pkgs
, inputs
, lib
, ...
}:
{
hardware.enableRedistributableFirmware = true;
boot = {
loader.grub = {
enable = true;
devices = [ "nodev" ];
efiSupport = true;
useOSProber = true;
};
loader.efi.canTouchEfiVariables = true;
initrd.availableKernelModules = [ "nvme" "xhci_pci" "usb_storage" "sd_mod" "sdhci_pci" ];
initrd.kernelModules = [ ];
extraModulePackages = [ ];
};
networking = {
networkmanager.enable = true;
useDHCP = lib.mkDefault true;
};
}

42
nix/hardware/ideapad.nix Normal file
View file

@ -0,0 +1,42 @@
{ pkgs
, inputs
, lib
, ...
}:
{
imports = [ ./common.nix ];
fileSystems."/" = {
device = "/dev/disk/by-uuid/cad54483-783b-4210-9722-7355184866c3";
fsType = "ext4";
};
fileSystems."/steam" = {
device = "/dev/disk/by-uuid/7a3a64c3-66ae-4a11-962c-e5a831a17d91";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/0BBD-231D";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
swapDevices = [ { device = "/dev/disk/by-uuid/3231b9fd-4afe-41cf-a3ee-e71ceb774c1b"; } ];
boot.kernelModules = [ "kvm-amd" ];
hardware.cpu.amd.updateMicrocode = true;
hardware = {
graphics = {
enable = true;
enable32Bit = true;
};
amdgpu.amdvlk = {
enable = true;
support32Bit.enable = true;
};
};
}

View file

@ -1,29 +0,0 @@
{ pkgs
, inputs
, ...
}@args:
{
imports = [
inputs.home-manager.nixosModules.home-manager
];
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.kp2pml30 = import ./personal/home.nix args;
users.users.kp2pml30 = import ./personal/user.nix args;
programs = {
fish.enable = true;
tmux.enable = true;
};
environment.systemPackages = with pkgs; [
fish
fishPlugins.grc
grc
fira-code
nerd-fonts.fira-code
];
}

76
nix/personal/default.nix Normal file
View file

@ -0,0 +1,76 @@
{ config
, pkgs
, inputs
, lib
, ...
}@args:
let
cfg = config.kp2pml30;
in {
options.kp2pml30 = {
username = lib.mkOption {
type = lib.types.string;
default = "kp2pml30";
};
xserver = lib.mkEnableOption "";
vscode = lib.mkEnableOption "";
kitty = lib.mkEnableOption "";
opera = lib.mkEnableOption "";
steam = lib.mkEnableOption "";
};
imports = [
./graphical
./home.nix
./user.nix
./neovim.nix
];
config = {
boot.supportedFilesystems = [ "zfs" ];
boot.zfs.forceImportRoot = false;
services.logind.extraConfig = ''
HandlePowerKey=poweroff
HandleLidSwitch=hibernate
'';
i18n.supportedLocales = [
"C.UTF-8/UTF-8"
"en_US.UTF-8/UTF-8"
"ru_RU.UTF-8/UTF-8"
];
programs = {
fish.enable = true;
tmux.enable = true;
yazi.enable = true;
};
environment.systemPackages = with pkgs; [
fish
fishPlugins.grc
fishPlugins.bass
grc
fira-code
fira-code-nerdfont
#nerd-fonts.fira-code
];
nixpkgs.config.allowUnfreePredicate = pkg:
builtins.elem (pkgs.lib.getName pkg) [
"vscode"
"steam"
"steam-run"
"steam-original"
"steam-unwrapped"
"nvidia-x11"
"nvidia-settings"
"nvidia-persistenced"
"opera"
];
};
}

View file

@ -0,0 +1,17 @@
{ pkgs
, lib
, config
, ...
}:
let
cfg = config.kp2pml30;
in {
imports = [
./x.nix
./kitty.nix
./vscode.nix
./opera.nix
./steam.nix
];
}

View file

@ -0,0 +1,14 @@
{ pkgs
, lib
, rootPath
, config
, ...
}:
let
cfg = config.kp2pml30;
in lib.mkIf cfg.kitty {
home-manager.users.${cfg.username}.programs.kitty = {
enable = true;
extraConfig = builtins.readFile (rootPath + "/home/.config/kitty/kitty.conf");
};
}

View file

@ -0,0 +1,18 @@
{ pkgs
, lib
, rootPath
, config
, ...
}:
let
cfg = config.kp2pml30;
in lib.mkIf cfg.opera {
home-manager.users.${cfg.username}.home = {
packages = with pkgs; [
(opera.override { proprietaryCodecs = true; })
];
file.".config/opera/Default/Preferences" = { source = rootPath + "/home/.config/opera/Default/Preferences"; };
file.".config/opera/Default/Bookmarks" = { source = rootPath + "/home/.config/opera/Default/Bookmarks"; };
};
}

View file

@ -0,0 +1,16 @@
{ pkgs
, lib
, rootPath
, config
, ...
}:
let
cfg = config.kp2pml30;
in lib.mkIf cfg.steam {
programs.steam = {
enable = true;
remotePlay.openFirewall = false;
dedicatedServer.openFirewall = false;
localNetworkGameTransfers.openFirewall = false;
};
}

View file

@ -0,0 +1,47 @@
{ pkgs
, lib
, rootPath
, config
, ...
}:
let
cfg = config.kp2pml30;
in lib.mkIf cfg.vscode {
home-manager.users.${cfg.username} = {
programs.vscode = {
enable = true;
package = pkgs.vscode;
mutableExtensionsDir = false;
userSettings = lib.importJSON("${rootPath}/vscode/settings.json");
extensions = [
pkgs.vscode-extensions.eamodio.gitlens
pkgs.vscode-extensions.streetsidesoftware.code-spell-checker
(pkgs.vscode-utils.buildVscodeMarketplaceExtension {
mktplcRef = {
name = "code-spell-checker-russian";
publisher = "streetsidesoftware";
version = "0.2.2";
sha256 = "a3b00c76a4aafecb962d6c292a3b9240a27d84b17de2119bb8007d0ad90ab443";
};
meta = {
license = lib.licenses.mit;
};
})
(pkgs.vscode-utils.buildVscodeMarketplaceExtension {
mktplcRef = {
name = "vscode-lldb";
publisher = "vadimcn";
version = "1.11.1";
sha256 = "urWkXVwD6Ad7DFVURc6sLQhhc6iKCgY89IovIWByz9U=";
};
meta = {
license = lib.licenses.mit;
};
})
];
};
};
}

View file

@ -0,0 +1,42 @@
{ pkgs
, config
, lib
, rootPath
, ...
}:
let
cfg = config.kp2pml30;
in lib.mkIf cfg.xserver {
services.displayManager.ly.enable = true;
services.libinput.enable = true;
services.xserver = {
enable = true;
displayManager.startx.enable = true;
xkb = {
layout = "us,ru";
variant = ",";
options = "grp:win_space_toggle";
};
windowManager.awesome = {
enable = true;
luaModules = with pkgs.luaPackages; [
luarocks
luadbi-mysql
];
};
excludePackages = lib.optionals (!cfg.kitty) [
pkgs.xterm
];
};
environment.systemPackages = with pkgs; [
xclip
];
home-manager.users.${cfg.username} = {
home.file.".config/awesome/rc.lua" = { source = rootPath + "/home/.config/awesome/rc.lua"; };
programs.rofi = {
enable = true;
};
};
}

View file

@ -1,50 +1,67 @@
{ pkgs
, config
, lib
, inputs
, rootPath
, ...
}@args:
{
home.stateVersion = "24.05";
}:
let
cfg = config.kp2pml30;
in {
imports = [
inputs.home-manager.nixosModules.home-manager
];
home = {
username = "kp2pml30";
homeDirectory = "/home/kp2pml30";
packages = with pkgs; [
starship
jq
];
};
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.backupFileExtension = "bak";
nix.gc = {
automatic = true;
frequency = "weekly";
};
home-manager.users.${cfg.username} = {
home = {
stateVersion = "24.05";
username = cfg.username;
homeDirectory = "/home/${cfg.username}";
packages = with pkgs; [
jq
];
programs = {
git = {
enable = true;
userName = "kp2pml30";
userEmail = "kp2pml30@gmail.com";
lfs.enable = true;
extraConfig = {
init.defaultBranch = "main";
sessionVariables = {
TERMINAL = "kitty";
};
};
fish = {
enable = true;
nix.gc = {
automatic = true;
frequency = "weekly";
};
starship = {
enable = true;
settings = {
add_newline = false;
format = "$cmd_duration$username$hostname$git_branch$git_commit$git_state$git_status$directory$status\n$character";
hostname.ssh_only = true;
cmd_duration.format = "took [$duration]($style)\n";
programs = {
git = {
enable = true;
userName = cfg.username;
userEmail = "kp2pml30@gmail.com";
lfs.enable = true;
extraConfig = {
init.defaultBranch = "main";
};
};
fish = {
enable = true;
shellInitLast = builtins.readFile (rootPath + "/home/.config/fish/minimal.fish");
};
starship = {
enable = true;
settings = {
add_newline = false;
format = "$cmd_duration$username$hostname$git_branch$git_commit$git_state$git_status$directory$status\n$character";
hostname.ssh_only = true;
cmd_duration.format = "took [$duration]($style)\n";
};
};
home-manager.enable = true;
};
home-manager.enable = true;
neovim = import ./neovim.nix args;
};
}

View file

@ -1,9 +1,11 @@
{ pkgs
, lib
, rootPath
, config
, ...
}:
let
cfg = config.kp2pml30;
fromGitHub = rev: repo: pkgs.vimUtils.buildVimPlugin {
pname = "${lib.strings.sanitizeDerivationName repo}";
version = rev;
@ -15,19 +17,21 @@ let
nvimConfig = builtins.readFile (rootPath + "/home/.config/nvim/base.vim");
in
{
enable = true;
defaultEditor = true;
plugins = with pkgs.vimPlugins; [
nvim-treesitter.withAllGrammars
nvim-autopairs
nerdtree
tokyonight-nvim
barbar-nvim
feline-nvim
(fromGitHub "d63c811337b2f75de52f16efee176695f31e7fbc" "timakro/vim-yadi")
(fromGitHub "aafa5c187a15701a7299a392b907ec15d9a7075f" "nvim-tree/nvim-web-devicons")
];
home-manager.users.${cfg.username}.programs.neovim = {
enable = true;
defaultEditor = true;
extraConfig = nvimConfig;
plugins = with pkgs.vimPlugins; [
nvim-treesitter.withAllGrammars
nvim-autopairs
nerdtree
tokyonight-nvim
barbar-nvim
feline-nvim
(fromGitHub "d63c811337b2f75de52f16efee176695f31e7fbc" "timakro/vim-yadi")
(fromGitHub "aafa5c187a15701a7299a392b907ec15d9a7075f" "nvim-tree/nvim-web-devicons")
];
extraConfig = nvimConfig;
};
}

View file

@ -1,7 +1,16 @@
{ pkgs, ... }:
{
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" ];
shell = pkgs.fish;
hashedPassword = "$6$UK6oHr2gPRYD4Rak$lgF.mYReC0jahNuI4kt0j/CsrajVzMprvp3HgjKwwsjYHU6/Ur9jfROXZbKhhpyCLRmnlCpWeRCbHEYO/jhIv/";
{ pkgs
, config
, lib
, inputs
, ...
}:
let
cfg = config.kp2pml30;
in {
users.users.${cfg.username} = {
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" ];
shell = pkgs.fish;
hashedPassword = "$6$UK6oHr2gPRYD4Rak$lgF.mYReC0jahNuI4kt0j/CsrajVzMprvp3HgjKwwsjYHU6/Ur9jfROXZbKhhpyCLRmnlCpWeRCbHEYO/jhIv/";
};
}

View file

@ -1,14 +1,23 @@
{ pkgs
, inputs
, rootPath
, ...
}:
{
imports = [
inputs.nixos-wsl.nixosModules.default
#inputs.vscode-server.nixosModules.default
];
wsl = {
enable = true;
defaultUser = "kp2pml30";
wslConf.interop.appendWindowsPath = false;
};
#services.vscode-server.enable = true;
#home-manager.users.kp2pml30.home.file.".vscode-server/server-env-setup" = {
# enable = false;
# executable = true;
# text = builtins.readFile("${rootPath}/nix/wsl/vscode-patch.sh");
#};
}

38
nix/wsl/vscode-patch.sh Normal file
View file

@ -0,0 +1,38 @@
# inspired by https://github.com/sonowz/vscode-remote-wsl-nixos
# This shell script is run before checking for vscode version updates.
# If a newer version is downloaded, this script won't patch that version,
# resulting in error. Therefore retry is required to patch it.
echo "== '~/.vscode-server/server-env-setup' SCRIPT START =="
# Make sure that basic commands are available
PATH=$PATH:/run/current-system/sw/bin/
# This shell script uses nixpkgs branch from OS version.
# If you want to change this behavior, change environment variable below.
# e.g. NIXOS_VERSION=unstable
NIXOS_VERSION=$(nixos-version | cut -d "." -f1,2)
echo "NIXOS_VERSION detected as \"$NIXOS_VERSION\""
NIXPKGS_BRANCH=nixos-$NIXOS_VERSION
PKGS_EXPRESSION=nixpkgs/$NIXPKGS_BRANCH#pkgs
# Get directory where this shell script is located
VSCODE_SERVER_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
echo "Got vscode directory : $VSCODE_SERVER_DIR"
echo "If the directory is incorrect, you can hardcode it on the script."
echo "Patching nodejs binaries..."
nix shell $PKGS_EXPRESSION.patchelf $PKGS_EXPRESSION.stdenv.cc -c bash -c "
for f in \$(find \"$VSCODE_SERVER_DIR/bin/\" -type f -executable)
do
if file \"\$f\" | grep -Pi 'elf.*executable' > /dev/null
then
patchelf --set-interpreter \"\$(cat \$(nix eval --raw $PKGS_EXPRESSION.stdenv.cc)/nix-support/dynamic-linker)\" --set-rpath \"\$(nix eval --raw $PKGS_EXPRESSION.stdenv.cc.cc.lib)/lib/\" \"\$f\"
fi
done
"
echo "== '~/.vscode-server/server-env-setup' SCRIPT END =="

View file

@ -16,5 +16,6 @@
"git.openRepositoryInParentFolders": "always",
"cmake.preferredGenerators": [
"Ninja"
]
],
"cSpell.language": "en,ru"
}