Compare commits

..

12 commits

Author SHA1 Message Date
caandt 3ad9e0f87a mkhost 2024-12-22 23:48:27 -05:00
caandt f28d3ea99d add options 2024-12-22 23:46:42 -05:00
caandt c7d8dcbdf6 refactor to lib 2024-12-20 23:32:08 -05:00
caandt aff6ef3d99 formatting 2024-12-20 21:25:22 -05:00
caandt 39f2ca010f rename home.nix to packages.nix 2024-12-20 21:13:24 -05:00
caandt 26093e6884 fhs 2024-12-20 13:16:18 -05:00
caandt 27ff41dff0 snixembed 2024-12-20 13:15:22 -05:00
caandt d51a0936ab nvim conf 2024-12-20 13:15:08 -05:00
caandt 553fb15efa version bump 2024-12-17 19:15:32 -05:00
caandt 0d34be0529 rl 2024-12-17 19:09:40 -05:00
caandt b95a4366a4 refactor 2024-12-17 19:09:12 -05:00
caandt c272eaf158 init hebesu 2024-12-17 00:16:21 -05:00
33 changed files with 615 additions and 174 deletions

40
bin/mkhost Executable file
View file

@ -0,0 +1,40 @@
#!/bin/sh
if [ $# -ne 1 ]; then
echo "usage: ${0##*/} <name>"
exit 1
fi
DIR="$(dirname "$0")"
HOST="$(realpath "$DIR/../hosts/$1")"
USER="ahnwuoa"
if [ -e "$HOST" ]; then
echo "$1 already exists"
exit 2
fi
mkdir "$HOST"
nixos-generate-config --show-hardware-config > "$HOST/hardware-configuration.nix"
cat << EOF > "$HOST/default.nix"
{...}: {
imports = [
../../system
./hardware-configuration.nix
];
networking.hostName = "$1";
time.timeZone = "America/Chicago";
users.users.$USER = {
isNormalUser = true;
extraGroups = ["wheel" "podman"];
};
}
EOF
mkdir -p "$HOST/users/$USER"
cat << EOF > "$HOST/users/$USER/default.nix"
{...}: {
imports = [
../../../../user
];
home.username = "$USER";
}
EOF

View file

@ -5,11 +5,11 @@
"nixpkgs-lib": "nixpkgs-lib" "nixpkgs-lib": "nixpkgs-lib"
}, },
"locked": { "locked": {
"lastModified": 1730504689, "lastModified": 1733312601,
"narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=", "narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "506278e768c2a08bec68eb62932193e341f55c90", "rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -26,11 +26,11 @@
"utils": "utils" "utils": "utils"
}, },
"locked": { "locked": {
"lastModified": 1732539262, "lastModified": 1734395804,
"narHash": "sha256-FdVYqG37TYGC/oiXpFt8VVHTv7lCyjc3UxPaZIxvWCI=", "narHash": "sha256-m75doN+grfAo8pO2s2wwnsUwSxZGElY/Fcpo3RZ80D4=",
"owner": "wamserma", "owner": "wamserma",
"repo": "flake-programs-sqlite", "repo": "flake-programs-sqlite",
"rev": "9355bb57fbc60103e933e081e36f9712e3b3bc66", "rev": "42f6a8859142dc7dcb05502015913106fc77251f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -46,11 +46,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1732482255, "lastModified": 1734344598,
"narHash": "sha256-GUffLwzawz5WRVfWaWCg78n/HrBJrOG7QadFY6rtV8A=", "narHash": "sha256-wNX3hsScqDdqKWOO87wETUEi7a/QlPVgpC/Lh5rFOuA=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "a9953635d7f34e7358d5189751110f87e3ac17da", "rev": "83ecd50915a09dca928971139d3a102377a8d242",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -68,11 +68,11 @@
"umu": "umu" "umu": "umu"
}, },
"locked": { "locked": {
"lastModified": 1732543374, "lastModified": 1734313951,
"narHash": "sha256-suhk41NhdsnN3aa7gpsr8KnYJtbaLeZBJMB2vqWbkzA=", "narHash": "sha256-DCjhmX5dVn11J8Ss+5Py4yMh8k7a63HakMENccGZBr4=",
"owner": "fufexan", "owner": "fufexan",
"repo": "nix-gaming", "repo": "nix-gaming",
"rev": "18b8f0796f3e9dd8b9d9f262a56f2914a0586a22", "rev": "a5f8dee3f7e6864da0d69a227bc8a90a3cbf9d0f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -83,11 +83,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1732014248, "lastModified": 1734119587,
"narHash": "sha256-y/MEyuJ5oBWrWAic/14LaIr/u5E0wRVzyYsouYY3W6w=", "narHash": "sha256-AKU6qqskl0yf2+JdRdD0cfxX4b9x3KKV5RqA6wijmPM=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "23e89b7da85c3640bbc2173fe04f4bd114342367", "rev": "3566ab7246670a43abd2ffa913cc62dad9cdf7d5",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -99,28 +99,28 @@
}, },
"nixpkgs-lib": { "nixpkgs-lib": {
"locked": { "locked": {
"lastModified": 1730504152, "lastModified": 1733096140,
"narHash": "sha256-lXvH/vOfb4aGYyvFmZK/HlsNsr/0CVWlwYvo2rxJk3s=", "narHash": "sha256-1qRH7uAUsyQI7R1Uwl4T+XvdNv778H0Nb5njNrqvylY=",
"type": "tarball", "type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz" "url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz"
}, },
"original": { "original": {
"type": "tarball", "type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz" "url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz"
} }
}, },
"nixpkgs-stable": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1731797254, "lastModified": 1734083684,
"narHash": "sha256-df3dJApLPhd11AlueuoN0Q4fHo/hagP75LlM5K1sz9g=", "narHash": "sha256-5fNndbndxSx5d+C/D0p/VF32xDiJCJzyOqorOYW4JEo=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "e8c38b73aeb218e27163376a2d617e61a2ad9b59", "rev": "314e12ba369ccdb9b352a4db26ff419f7c49fa84",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-24.05", "ref": "nixos-24.11",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
@ -143,11 +143,11 @@
}, },
"locked": { "locked": {
"dir": "packaging/nix", "dir": "packaging/nix",
"lastModified": 1732337089, "lastModified": 1734207213,
"narHash": "sha256-dwFza03ETqrcmVGSCdgDDKTWKRgckpQ3vXkZRCYtM9g=", "narHash": "sha256-5CZPAeKm24Y1BKnN8Md3HUViCMCs7AVghRC+05Bdlkk=",
"ref": "refs/heads/main", "ref": "refs/heads/main",
"rev": "f6a6af3191f5497d95d8f8aaa08826a45da199c4", "rev": "6189d0d9fd062e89a375db20aeae1d1c009e9833",
"revCount": 842, "revCount": 869,
"submodules": true, "submodules": true,
"type": "git", "type": "git",
"url": "https://github.com/Open-Wine-Components/umu-launcher/?dir=packaging/nix" "url": "https://github.com/Open-Wine-Components/umu-launcher/?dir=packaging/nix"

View file

@ -3,7 +3,7 @@
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05"; nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.11";
home-manager = { home-manager = {
url = "github:nix-community/home-manager"; url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";

21
hosts/hebesu/default.nix Normal file
View file

@ -0,0 +1,21 @@
{...}: {
imports = [
../../system
./hardware-configuration.nix
];
networking.hostName = "hebesu";
services.tzupdate.enable = true;
services.xserver = {
videoDrivers = ["modesetting"];
deviceSection = ''
Option "DRI" "2"
Option "TearFree" "true"
'';
xkb.options = "ctrl:nocaps";
};
users.users.ahnwuoa = {
isNormalUser = true;
extraGroups = ["wheel" "podman"];
};
}

View file

@ -0,0 +1,52 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{
config,
lib,
pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "usbhid"];
boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-amd"];
boot.extraModulePackages = [];
fileSystems."/" = {
device = "/dev/disk/by-uuid/e9de5286-c8b1-4629-be01-f052c34b4062";
fsType = "ext4";
};
fileSystems."/home" = {
device = "/dev/disk/by-uuid/aa592b0f-13bd-4ae6-af3f-68a8f76f65ae";
fsType = "ext4";
};
boot.initrd.luks.devices."drive".device = "/dev/disk/by-uuid/60d5cc58-4381-4869-a1b5-d4e2bf1afdfd";
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/F0F5-744F";
fsType = "vfat";
options = ["fmask=0022" "dmask=0022"];
};
swapDevices = [
{device = "/dev/disk/by-uuid/2d015dcd-81a0-4d81-b530-5ea96aa0d953";}
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp1s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlo1.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -0,0 +1,12 @@
{
config,
pkgs,
...
}: {
imports = [
../../../../user
];
home.username = "ahnwuoa";
xresources.properties."Xft.dpi" = 120;
}

View file

@ -1,4 +1,9 @@
{...}: { {
config,
lib,
...
}:
lib.mkIf config.u.has.graphical {
services.pipewire = { services.pipewire = {
enable = true; enable = true;
alsa.enable = true; alsa.enable = true;

View file

@ -12,14 +12,13 @@
environment.pathsToLink = ["/libexec"]; environment.pathsToLink = ["/libexec"];
environment.localBinInPath = true; environment.localBinInPath = true;
services.globalprotect.enable = true;
boot.tmp.useTmpfs = true; boot.tmp.useTmpfs = true;
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
neovim (neovim.override {withRuby = false;})
wget wget
tree tree
tmux tmux
@ -33,9 +32,10 @@
documentation.dev.enable = true; documentation.dev.enable = true;
xdg.terminal-exec = { xdg.terminal-exec = {
enable = true; enable = config.u.has.graphical;
settings.default = ["Alacritty.desktop"]; settings.default = ["Alacritty.desktop"];
}; };
services.globalprotect.enable = config.u.has.graphical;
environment.etc."ssh/ssh_config".text = lib.mkAfter "Include /home/*/.local/ssh/config"; environment.etc."ssh/ssh_config".text = lib.mkAfter "Include /home/*/.local/ssh/config";

View file

@ -1,4 +1,4 @@
{...}: { {lib, ...}: {
imports = [ imports = [
./audio.nix ./audio.nix
./bash.nix ./bash.nix
@ -10,4 +10,28 @@
./security.nix ./security.nix
./virt.nix ./virt.nix
]; ];
options.u = {
has = {
graphical = lib.mkOption {
type = lib.types.bool;
description = "enable graphical settings";
default = true;
};
wine = lib.mkOption {
type = lib.types.bool;
description = "enable wine settings";
default = true;
};
virt = lib.mkOption {
type = lib.types.bool;
description = "enable virt settings";
default = true;
};
container = lib.mkOption {
type = lib.types.bool;
description = "enable container settings";
default = true;
};
};
};
} }

View file

@ -1,4 +1,10 @@
{pkgs, ...}: { {
config,
lib,
pkgs,
...
}:
lib.mkIf config.u.has.graphical {
services.xserver = { services.xserver = {
enable = true; enable = true;
autorun = false; autorun = false;

View file

@ -1,10 +1,15 @@
{pkgs, ...}: { {
config,
lib,
pkgs,
...
}: {
i18n.defaultLocale = "en_US.UTF-8"; i18n.defaultLocale = "en_US.UTF-8";
i18n.supportedLocales = [ i18n.supportedLocales = [
"en_US.UTF-8/UTF-8" "en_US.UTF-8/UTF-8"
"ja_JP.UTF-8/UTF-8" "ja_JP.UTF-8/UTF-8"
]; ];
i18n.inputMethod = { i18n.inputMethod = lib.mkIf config.u.has.graphical {
enable = true; enable = true;
type = "fcitx5"; type = "fcitx5";
fcitx5.addons = with pkgs; [ fcitx5.addons = with pkgs; [
@ -12,11 +17,12 @@
fcitx5-gtk fcitx5-gtk
]; ];
}; };
fonts.packages = with pkgs; [ fonts.packages = with pkgs;
noto-fonts lib.optionals config.u.has.graphical [
noto-fonts-cjk-sans noto-fonts
source-han-sans noto-fonts-cjk-sans
source-han-serif source-han-sans
(nerdfonts.override {fonts = ["JetBrainsMono"];}) source-han-serif
]; nerd-fonts.jetbrains-mono
];
} }

View file

@ -1,4 +1,10 @@
{pkgs, ...}: { {
config,
lib,
pkgs,
...
}:
lib.mkIf config.u.has.graphical {
programs.partition-manager = { programs.partition-manager = {
enable = true; enable = true;
package = pkgs.libsForQt5.partitionmanager; package = pkgs.libsForQt5.partitionmanager;

View file

@ -1,14 +1,14 @@
{...}: { {config, ...}: {
virtualisation.containers.enable = true; virtualisation.containers.enable = config.u.has.container;
virtualisation = { virtualisation = {
podman = { podman = {
enable = true; enable = config.u.has.container;
dockerCompat = true; dockerCompat = true;
defaultNetwork.settings.dns_enabled = true; defaultNetwork.settings.dns_enabled = true;
}; };
}; };
virtualisation.libvirtd.enable = true; virtualisation.libvirtd.enable = config.u.has.virt;
programs.virt-manager.enable = true; programs.virt-manager.enable = config.u.has.graphical && config.u.has.virt;
programs.nix-ld.enable = true; programs.nix-ld.enable = true;
hardware.graphics.enable32Bit = true; hardware.graphics.enable32Bit = config.u.has.graphical && config.u.has.wine;
} }

View file

@ -1,4 +1,11 @@
{pkgs, pkgs-stable, ...}: { {
config,
lib,
pkgs,
pkgs-stable,
...
}:
lib.mkIf config.u.has.graphical {
systemd.user.targets.autostart = { systemd.user.targets.autostart = {
Unit = { Unit = {
Wants = [ Wants = [
@ -10,6 +17,7 @@
"fcitx5.service" "fcitx5.service"
"picom.service" "picom.service"
"safeeyes.service" "safeeyes.service"
"snixembed.service"
]; ];
}; };
}; };
@ -18,5 +26,6 @@
fcitx5.Service.ExecStart = ["/run/current-system/sw/bin/fcitx5"]; fcitx5.Service.ExecStart = ["/run/current-system/sw/bin/fcitx5"];
picom.Service.ExecStart = ["${pkgs.picom}/bin/picom"]; picom.Service.ExecStart = ["${pkgs.picom}/bin/picom"];
safeeyes.Service.ExecStart = ["${pkgs-stable.safeeyes}/bin/safeeyes"]; safeeyes.Service.ExecStart = ["${pkgs-stable.safeeyes}/bin/safeeyes"];
snixembed.Service.ExecStart = ["${pkgs.snixembed}/bin/snixembed"];
}; };
} }

View file

@ -8,13 +8,13 @@
#nsxiv-rifle = [pkgs.nsxiv]; #nsxiv-rifle = [pkgs.nsxiv];
#screenshot = [pkgs.maim pkgs.xclip]; #screenshot = [pkgs.maim pkgs.xclip];
}; };
mkln = x: config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.local/nixos/user/bin/${x}"; ln = config.u.lib.ln "${config.u.confPath}/user/bin";
in { in {
home.file = builtins.listToAttrs ( home.file = builtins.listToAttrs (
map map
(x: { (x: {
name = ".local/bin/${x}"; name = ".local/bin/${x}";
value = {source = mkln x;}; value = {source = ln x;};
}) })
( (
builtins.filter builtins.filter

View file

@ -30,3 +30,13 @@ function goto() {
local real="$(realpath "$path")" local real="$(realpath "$path")"
cd "${real%/*}" cd "${real%/*}"
} }
function rl() {
local l="$1"
local i=50
while [[ -L "$l" && $((i--)) > 0 ]]; do
local n="$(readlink "$l")"
echo "$l -> $n"
l="$n"
done
[[ -e "$l" ]] && echo "$l" || echo "~nonexistent~"
}

View file

@ -4,22 +4,21 @@
lib, lib,
... ...
}: let }: let
mkln = x: config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.local/nixos/user/config/${x}"; ln = config.u.lib.ln "${config.u.confPath}/user/config";
tmuxConfig = config.u.tmux.extraConfig + lib.strings.concatMapStrings (x: "\nrun ${x.rtp}") config.u.tmux.plugins;
in { in {
imports = [./kde]; imports = [
./kde
u.tmux.plugins = with pkgs.tmuxPlugins; [ ./tmux
vim-tmux-navigator ./nvim
sessionist
]; ];
fonts.fontconfig.enable = false; fonts.fontconfig.enable = false;
gtk.gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; gtk.gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc";
xresources.path = "${config.xdg.configHome}/Xresources"; xresources.path = "${config.xdg.configHome}/Xresources";
xdg.configFile.alacritty.source = mkln "alacritty"; xdg.configFile.alacritty.source = ln "alacritty";
xdg.configFile.awesome.source = mkln "awesome"; xdg.configFile.awesome.source = ln "awesome";
xdg.configFile.bash.source = mkln "bash"; xdg.configFile.bash.source = ln "bash";
xdg.configFile.fcitx5.source = ./fcitx5; xdg.configFile.fcitx5.source = ./fcitx5;
xdg.configFile.fontconfig.source = ./fontconfig; xdg.configFile.fontconfig.source = ./fontconfig;
xdg.configFile."gdb/gdbinit.py".source = gdb/gdbinit.py; xdg.configFile."gdb/gdbinit.py".source = gdb/gdbinit.py;
@ -35,6 +34,5 @@ in {
xdg.configFile.qt5ct.source = ./qt5ct; xdg.configFile.qt5ct.source = ./qt5ct;
xdg.configFile.readline.source = ./readline; xdg.configFile.readline.source = ./readline;
xdg.configFile."starship.toml".source = ./starship.toml; xdg.configFile."starship.toml".source = ./starship.toml;
xdg.configFile.sx.source = mkln "sx"; xdg.configFile.sx.source = ln "sx";
xdg.configFile."tmux/tmux.conf".text = (builtins.readFile tmux/tmux.conf) + tmuxConfig;
} }

View file

@ -0,0 +1,32 @@
{
config,
pkgs,
...
}: {
programs.neovim = {
enable = true;
plugins = with pkgs.vimPlugins; [
vim-tmux-navigator
which-key-nvim
telescope-nvim
nvim-treesitter.withAllGrammars
nvim-lspconfig
fidget-nvim
nvim-cmp
luasnip
cmp_luasnip
cmp-nvim-lsp
mini-nvim
vim-sleuth
catppuccin-nvim
tokyonight-nvim
];
extraPackages = with pkgs; [
basedpyright
clang-tools
];
withRuby = false;
};
xdg.configFile."nvim/init.lua".text = "require('init')";
xdg.configFile."nvim/lua".source = config.u.lib.lnn "user/config/nvim/lua";
}

View file

@ -0,0 +1,4 @@
require('u.bindings')
require('u.options')
require('u.lsp')
require('u.cmp')

View file

@ -0,0 +1,4 @@
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
require('mini.move').setup()
require('mini.ai').setup()

View file

@ -0,0 +1,39 @@
local cmp = require('cmp')
local luasnip = require('luasnip')
luasnip.config.setup()
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert {
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-y>'] = cmp.mapping.confirm { select = true },
['<C-Space>'] = cmp.mapping.complete {},
['<C-l>'] = cmp.mapping(function()
if luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
end
end, { 'i', 's' }),
['<C-h>'] = cmp.mapping(function()
if luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
end
end, { 'i', 's' }),
},
completion = { completeopt = 'menu,menuone,noinsert' },
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'path' },
},
})

View file

@ -0,0 +1,16 @@
local lspconfig = require('lspconfig')
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
lspconfig.clangd.setup({
cmd = {
"clangd",
"--background-index",
"--clang-tidy",
"--completion-style=bundled",
"--cross-file-rename",
"--header-insertion=iwyu",
},
capabilities=capabilities
})
lspconfig.basedpyright.setup{}

View file

@ -0,0 +1,59 @@
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
vim.g.have_nerd_font = true
vim.opt.number = true
vim.opt.mouse = 'a'
vim.opt.showmode = false
vim.schedule(function()
vim.opt.clipboard = 'unnamedplus'
end)
vim.opt.shiftwidth = 2
vim.opt.tabstop = 2
vim.opt.smartindent = true
vim.opt.expandtab = true
vim.opt.breakindent = true
vim.opt.undofile = true
vim.opt.ignorecase = true
vim.opt.smartcase = true
vim.opt.signcolumn = 'yes'
vim.opt.updatetime = 250
vim.opt.timeoutlen = 300
vim.opt.splitright = true
vim.opt.splitbelow = true
vim.opt.list = true
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '' }
vim.opt.inccommand = 'split'
vim.opt.cursorline = true
vim.opt.scrolloff = 8
vim.api.nvim_create_autocmd('TextYankPost', {
desc = 'Highlight when yanking (copying) text',
group = vim.api.nvim_create_augroup('highlight-yank', { clear = true }),
callback = function()
vim.highlight.on_yank()
end,
})
local statusline = require('mini.statusline')
statusline.setup()
statusline.section_location = function()
return '%2l:%-2v'
end
vim.cmd.colorscheme 'tokyonight-storm'

View file

@ -0,0 +1,14 @@
{
config,
pkgs,
lib,
...
}: let
tmuxConfig = config.u.tmux.extraConfig + lib.strings.concatMapStrings (x: "\nrun ${x.rtp}") config.u.tmux.plugins;
in {
u.tmux.plugins = with pkgs.tmuxPlugins; [
vim-tmux-navigator
sessionist
];
xdg.configFile."tmux/tmux.conf".text = (builtins.readFile ./tmux.conf) + tmuxConfig;
}

View file

@ -1,12 +1,20 @@
{...}: { {
config,
lib,
...
}: {
imports = [ imports = [
./autostart.nix ./autostart.nix
./bin ./bin
./config ./config
./home.nix ./fhs.nix
./options.nix ./options.nix
./packages.nix
./prog.nix
./share ./share
./theme.nix ./theme.nix
./xdg.nix ./xdg.nix
]; ];
home.homeDirectory = lib.mkDefault "/home/${config.home.username}";
home.stateVersion = "24.05";
} }

18
user/fhs.nix Normal file
View file

@ -0,0 +1,18 @@
{pkgs, ...}: let
base = pkgs.appimageTools.defaultFhsEnvArgs;
fhs = {
name = "fhs";
targetPkgs = pkgs:
(base.targetPkgs pkgs)
++ [
pkgs.pkg-config
pkgs.ncurses
];
profile = "export FHS=1";
runScript = "bash";
extraOutputsToInstall = ["dev"];
};
fhsenv = pkgs.buildFHSUserEnv (base // fhs);
in {
home.packages = [fhsenv];
}

View file

@ -1,97 +0,0 @@
{
config,
lib,
pkgs,
pkgs-stable,
...
}: {
home.homeDirectory = lib.mkDefault "/home/${config.home.username}";
home.packages = with pkgs; [
(pkgs.symlinkJoin {
name = "firefox";
paths = [pkgs.firefox-bin];
buildInputs = [pkgs.makeWrapper];
postBuild = ''
wrapProgram $out/bin/firefox \
--set HOME "${config.home.homeDirectory}/.local/home"
'';
})
alacritty
mpv
(nsxiv.overrideAttrs {
buildInputs = pkgs.nsxiv.buildInputs ++ [pkgs.xorg.libXcursor];
env.NIX_LDFLAGS = "-lXcursor";
})
rofi
sct
(maim.overrideAttrs {
buildInputs = pkgs.maim.buildInputs ++ [pkgs.xorg.libXcursor];
env.NIX_LDFLAGS = "-lXcursor";
})
xclip
copyq
picom
obs-studio
screenkey
pkgs-stable.safeeyes
libsForQt5.kolourpaint
libsForQt5.filelight
papirus-icon-theme
lightly-boehs
pavucontrol
qpwgraph
qbittorrent
xournalpp
adwaita-icon-theme
lsd
bat
zoxide
fd
ripgrep
fzf
trash-cli
tlrc
speedtest-cli
bluetuith
unixtools.xxd
starship
killall
file
nix-tree
alejandra
ffmpeg
ffsubsync
(python312.withPackages (python-pkgs: [
python-pkgs.pwntools
python-pkgs.requests
python-pkgs.pyjwt
python-pkgs.flask
]))
nodejs
deno
gnumake
coq
coqPackages.coqide
gcc
sqlitebrowser
globalprotect-openconnect
tmuxPlugins.vim-tmux-navigator
tmuxPlugins.sessionist
wine
winetricks
cage
gdb
pwndbg
(pkgs-stable.cutter.withPlugins (ps: with ps; [jsdec rz-ghidra sigdb]))
ghidra-bin
pwninit
patchelf
];
home.stateVersion = "24.05";
}

View file

@ -1,5 +1,15 @@
{lib, ...}: { {
config,
lib,
pkgs,
...
}: {
options.u = { options.u = {
confPath = lib.mkOption {
type = lib.types.path;
description = "path to nixos config";
default = "${config.home.homeDirectory}/.local/nixos";
};
tmux = { tmux = {
plugins = lib.mkOption { plugins = lib.mkOption {
type = lib.types.listOf lib.types.package; type = lib.types.listOf lib.types.package;
@ -33,5 +43,46 @@
}); });
description = "list of file manager bookmarks"; description = "list of file manager bookmarks";
}; };
has = {
graphical = lib.mkOption {
type = lib.types.bool;
description = "enable graphical settings";
default = true;
};
wine = lib.mkOption {
type = lib.types.bool;
description = "enable wine settings";
default = true;
};
prog = lib.mkOption {
type = lib.types.bool;
description = "enable prog settings";
default = true;
};
};
lib = lib.mkOption {
type = lib.types.attrs;
description = "library";
};
};
config.u.lib = rec {
ln = base: x: config.lib.file.mkOutOfStoreSymlink "${base}/${x}";
lnh = ln "${config.home.homeDirectory}";
lnn = ln "${config.u.confPath}";
fixXcursor = pkg:
pkg.overrideAttrs {
buildInputs = pkg.buildInputs ++ [pkgs.xorg.libXcursor];
env.NIX_LDFLAGS = "-lXcursor";
};
localHome = pkg: name: bin:
pkgs.symlinkJoin {
name = name;
paths = [pkg];
buildInputs = [pkgs.makeWrapper];
postBuild = ''
wrapProgram $out/${bin} \
--set HOME "${config.home.homeDirectory}/.local/home"
'';
};
}; };
} }

63
user/packages.nix Normal file
View file

@ -0,0 +1,63 @@
{
config,
lib,
pkgs,
pkgs-stable,
...
}: {
home.packages = with pkgs;
[
lsd
bat
zoxide
fd
ripgrep
fzf
trash-cli
tlrc
speedtest-cli
unixtools.xxd
starship
killall
file
nix-tree
alejandra
ffmpeg
ffsubsync
unzip
unar
tmuxPlugins.vim-tmux-navigator
tmuxPlugins.sessionist
]
++ lib.optionals config.u.has.graphical [
(config.u.lib.localHome pkgs.firefox-bin "firefox" "bin/firefox")
alacritty
mpv
(config.u.lib.fixXcursor nsxiv)
rofi
sct
(config.u.lib.fixXcursor maim)
xclip
copyq
picom
obs-studio
screenkey
pkgs-stable.safeeyes
snixembed
libsForQt5.kolourpaint
libsForQt5.filelight
papirus-icon-theme
lightly-boehs
pavucontrol
qpwgraph
qbittorrent
xournalpp
adwaita-icon-theme
bluetuith
globalprotect-openconnect
]
++ lib.optionals config.u.has.wine [
wine
winetricks
];
}

32
user/prog.nix Normal file
View file

@ -0,0 +1,32 @@
{
config,
lib,
pkgs,
...
}:
lib.mkIf config.u.has.prog {
home.packages = with pkgs;
[
(python312.withPackages (python-pkgs: [
python-pkgs.pwntools
python-pkgs.requests
python-pkgs.pyjwt
python-pkgs.flask
]))
nodejs
deno
gnumake
coq
coqPackages.coqide
gcc
gdb
pwndbg
pwninit
patchelf
]
++ lib.optionals config.u.has.graphical [
(cutter.withPlugins (ps: with ps; [jsdec rz-ghidra sigdb]))
ghidra-bin
sqlitebrowser
];
}

View file

@ -1,4 +1,9 @@
{...}: { {
config,
lib,
...
}:
lib.mkIf config.u.has.graphical {
xdg.desktopEntries."nsxiv-rifle" = { xdg.desktopEntries."nsxiv-rifle" = {
exec = "nsxiv-rifle %F"; exec = "nsxiv-rifle %F";
icon = "nsxiv"; icon = "nsxiv";

View file

@ -1,8 +1,10 @@
{ {
config, config,
lib,
pkgs, pkgs,
... ...
}: { }:
lib.mkIf config.u.has.graphical {
qt = { qt = {
enable = true; enable = true;
platformTheme.name = "qtct"; platformTheme.name = "qtct";

View file

@ -1,8 +1,10 @@
{ {
config, config,
lib,
pkgs, pkgs,
... ...
}: { }:
lib.mkIf config.u.has.graphical {
xdg.mimeApps.enable = true; xdg.mimeApps.enable = true;
xdg.mimeApps.defaultApplications = let xdg.mimeApps.defaultApplications = let
image = "nsxiv-rifle.desktop"; image = "nsxiv-rifle.desktop";
@ -34,12 +36,12 @@
config.common.default = "kde"; config.common.default = "kde";
}; };
home.file = let home.file = let
mkln = x: config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/${x}"; ln = config.u.lib.lnh;
in { in {
".local/home/.cache".source = mkln ".cache"; ".local/home/.cache".source = ln ".cache";
".local/home/.config".source = mkln ".config"; ".local/home/.config".source = ln ".config";
".local/home/.local".source = mkln ".local"; ".local/home/.local".source = ln ".local";
".local/home/Desktop".source = mkln "Desktop"; ".local/home/Desktop".source = ln "Desktop";
".local/home/Downloads".source = mkln "Downloads"; ".local/home/Downloads".source = ln "Downloads";
}; };
} }