Switch to a multihost/home-manager setup

This commit is contained in:
2026-07-07 06:45:07 +01:00
parent 2d21314705
commit f8a8083a07
19 changed files with 388 additions and 390 deletions
-56
View File
@@ -1,56 +0,0 @@
alias .="cd ."
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ......="cd ../../../../../.."
alias py="python3"
alias ls="eza -TlL 2 --git --no-permissions --no-user --no-time --icons=always --group-directories-first"
alias lss="eza -TlL 1 --git --no-permissions --no-user --no-time --icons=always --group-directories-first"
alias lsa="eza -TlaL 1 --git --no-permissions --no-user --no-time --icons=always --group-directories-first"
alias sls="sudo eza -TlL 2 --git --no-permissions --no-user --no-time --icons=always --group-directories-first"
alias s="python3 -m http.server 8080"
alias pipes.sh="pipes-rs -d 1 -r 0 -b true -p 1 -t 0.5"
alias vi="nvim"
alias vim="nvim"
alias stow="stow --dotfiles"
alias :q="exit"
alias :qa="exit"
alias :Q="exit"
set fish_greeting
set -Ux EDITOR nvim
set -Ux VISUAL nvim
function a
for arg in $argv
if string match -q '*/' $arg
mkdir -p $arg
else
mkdir -p (dirname $arg)
touch $arg
end
end
end
function y
set tmp (mktemp -t "yazi-cwd.XXXXXX")
yazi $argv --cwd-file="$tmp"
if set cwd (command cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
builtin cd -- "$cwd"
end
end
function g
gitui
end
function editor
set pos (cat ~/dotfiles/.pos)
y $pos
if test -e ./p.vim
nvim -S ./p.vim
end
echo $PWD > ~/dotfiles/.pos
end
# Created by `pipx` on 2025-07-15 19:25:29
set PATH $PATH /home/syed/.local/bin
+39
View File
@@ -0,0 +1,39 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
home-manager = {
url = "github:nix-community/home-manager/release-26.05";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, ... }:
let
system = "x86_64-linux";
in {
nixosConfigurations = {
syedm = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
./hosts/common
./hosts/syedm
home-manager.nixosModules.home-manager
{ home-manager.users.me = import ./home; }
];
};
tardis = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
./hosts/common
./hosts/tardis
home-manager.nixosModules.home-manager
{ home-manager.users.me = import ./home; }
];
};
};
};
}
+13
View File
@@ -0,0 +1,13 @@
{ ... }:
{
imports = [
./fish
./nvim
];
home.username = "me";
home.homeDirectory = "/home/me";
home.stateVersion = "26.05";
}
+29
View File
@@ -0,0 +1,29 @@
set -gx fish_greeting
function a
for arg in $argv
if string match -q '*/' $arg
mkdir -p $arg
else
mkdir -p (dirname $arg)
touch $arg
end
end
end
function y
set tmp (mktemp -t "yazi-cwd.XXXXXX")
yazi $argv --cwd-file="$tmp"
if set cwd (command cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
builtin cd -- "$cwd"
end
end
function editor
set pos (cat ~/dotfiles/.pos)
y $pos
if test -e ./p.vim
nvim -S ./p.vim
else
nvim
end
echo $PWD > ~/dotfiles/.pos
end
+20
View File
@@ -0,0 +1,20 @@
{ ... }:
{
programs.fish = {
enable = true;
shellAliases = {
ls = "eza -TlL 2 --git --no-permissions --no-user --no-time --icons=always --group-directories-first";
lss = "eza -TlL 1 --git --no-permissions --no-user --no-time --icons=always --group-directories-first";
lsa = "eza -TlaL 1 --git --no-permissions --no-user --no-time --icons=always --group-directories-first";
sls = "sudo eza -TlL 2 --git --no-permissions --no-user --no-time --icons=always --group-directories-first";
s = "python3 -m http.server 8080";
vi = "nvim";
vim = "nvim";
g = "gitui"
};
interactiveShellInit = builtins.readFile ./config.fish;
};
}
+53
View File
@@ -0,0 +1,53 @@
{ pkgs, ... }:
{
programs.neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
plugins = with pkgs.vimPlugins; [
nvim-notify
gitsigns-nvim
mini-pairs
rainbow-delimiters-nvim
neo-tree-nvim
lualine-nvim
nvim-treesitter.withPlugins (p: [
p.lua
p.c
p.cpp
p.nix
p.ruby
p.fish
])
nvim-cursorline
conform-nvim
nvim-cmp
neoscroll-nvim
nvim-web-devicons
plenary-nvim
nui-nvim
tokyonight-nvim
cmp-nvim-lsp
nvim-lspconfig
(pkgs.vimUtils.buildVimPlugin {
name = "PicVim";
src = builtins.fetchGit {
url = "https://github.com/SyedM-dev/PicVim";
rev = "5114853ed8f24661e48b726135bf78860d9339d5";
};
})
];
extraPackages = with pkgs; [
lua-language-server
clang-tools
stylua
];
extraLuaConfig = builtins.readFile ./init.lua;
};
}
@@ -1,15 +1,3 @@
local vim = vim or {}
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
local repo = "https://github.com/folke/lazy.nvim.git"
vim.fn.system({ "git", "clone", "--filter=blob:none", repo, "--branch=stable", lazypath })
end
vim.opt.rtp:prepend(lazypath)
-- Options
local o = vim.opt
vim.g.mapleader = " "
@@ -25,7 +13,6 @@ o.completeopt = { "menuone", "noselect", "noinsert" }
o.updatetime = 100
o.timeoutlen = 300
o.clipboard = "unnamedplus"
o.shell = "/usr/bin/fish"
o.foldenable = false
o.list = true
o.listchars = {
@@ -83,103 +70,40 @@ vim.diagnostic.config({
severity_sort = true,
})
-- Plugin List
require("lazy").setup({
{ "rcarriga/nvim-notify", lazy = false },
{ "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" },
{ "neovim/nvim-lspconfig", lazy = false },
{
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
dependencies = {
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
"nvim-tree/nvim-web-devicons",
-- LSP config
local capabilities = require("cmp_nvim_lsp").default_capabilities()
require("lspconfig").lua_ls.setup({
capabilities = capabilities,
})
require("lspconfig").clangd.setup({
capabilities = capabilities,
})
-- Plugins
require("picvim").setup({})
require("notify").setup({})
require("gitsigns").setup({})
require("mini.pairs").setup({})
require("rainbow-delimiters.setup").setup({})
require("neo-tree").setup({
filesystem = {
filtered_items = {
visible = true,
},
lazy = false,
opts = {
filesystem = {
filtered_items = { visible = true },
},
},
},
{
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
},
{
"folke/tokyonight.nvim",
lazy = false,
priority = 1000,
},
{ "HiPhish/rainbow-delimiters.nvim" },
{ "ya2s/nvim-cursorline" },
{
"williamboman/mason.nvim",
config = function()
require("mason").setup()
end,
},
{
"williamboman/mason-lspconfig.nvim",
dependencies = {
"williamboman/mason.nvim",
"neovim/nvim-lspconfig",
},
config = function()
require("mason-lspconfig").setup({
ensure_installed = {
"lua_ls",
"clangd",
},
})
end,
},
{
"stevearc/conform.nvim",
config = function()
require("conform").setup({
formatters_by_ft = {
lua = { "stylua" },
},
format_on_save = {
timeout_ms = 500,
lsp_fallback = true,
},
})
end,
},
{
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
},
},
{ "karb94/neoscroll.nvim" },
{
"SyedM-dev/PicVim",
lazy = false,
config = function()
require("picvim").setup()
end,
},
{
"lewis6991/gitsigns.nvim",
config = function()
require("gitsigns").setup()
end,
},
{
"echasnovski/mini.pairs",
config = function()
require("mini.pairs").setup({})
end,
},
})
-- Plugin's setup
require("lualine").setup({
options = { theme = "auto" },
options = {
theme = "auto",
},
sections = {
lualine_b = {
{ "branch" },
@@ -193,13 +117,19 @@ require("lualine").setup({
diff_color = {
added = { fg = "#a6e3a1" },
modified = { fg = "#f9e2af" },
removed = { fg = "#f38ba8" },
removed = { fg = "#f38ca8" },
},
},
},
},
})
require("nvim-treesitter.configs").setup({
highlight = {
enable = true,
},
})
require("nvim-cursorline").setup({
cursorline = {
enable = true,
@@ -209,7 +139,47 @@ require("nvim-cursorline").setup({
cursorword = {
enable = true,
min_length = 1,
hl = { underline = true },
hl = {
underline = true,
},
},
})
require("conform").setup({
formatters_by_ft = {
lua = { "stylua" },
},
format_on_save = {
timeout_ms = 500,
lsp_fallback = true,
},
})
local cmp = require("cmp")
cmp.setup({
window = {
completion = cmp.config.window.bordered({
border = "rounded",
}),
documentation = cmp.config.window.bordered({
border = "rounded",
}),
},
mapping = cmp.mapping.preset.insert({
["<CR>"] = cmp.mapping.confirm({
select = true,
}),
["<Tab>"] = cmp.mapping.select_next_item(),
["<S-Tab>"] = cmp.mapping.select_prev_item(),
}),
sources = {
{
name = "nvim_lsp",
},
{
name = "clangd",
},
},
})
@@ -228,29 +198,6 @@ neoscroll.setup({
},
})
local cmp = require("cmp")
cmp.setup({
window = {
completion = cmp.config.window.bordered({
border = "rounded",
}),
documentation = cmp.config.window.bordered({
border = "rounded",
}),
},
mapping = cmp.mapping.preset.insert({
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping.select_next_item(),
["<S-Tab>"] = cmp.mapping.select_prev_item(),
}),
sources = {
{ name = "nvim_lsp" },
{ name = "clangd" },
},
})
-- Keymaps
local map = vim.keymap.set
map({ "n", "i", "v" }, "<C-s>", "<cmd>w<CR>")
@@ -317,4 +264,3 @@ autocmd("CursorHold", {
})
end,
})
+56
View File
@@ -0,0 +1,56 @@
{ config, lib, pkgs, ... }:
{
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
networking.networkmanager.enable = true;
programs.fish.enable = true;
programs.tmux.enable = true;
programs.neovim = {
enable = true;
defaultEditor = true;
};
time.timeZone = "Europe/London";
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
useXkbConfig = true;
};
users.users.me = {
isNormalUser = true;
shell = pkgs.fish;
extraGroups = [ "wheel" ];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJFUwk54CNtSLUyXSTLsIs5KXgEsjOgE4HGlA4FacKjV me@tardis # msi laptop"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILMeU7L0yQ4+O1GME4D4UM4f6nqua+pWt/zdsMvyHV94 u0_a309@localhost # mobile"
];
packages = with pkgs; [];
};
environment.systemPackages = with pkgs; [
nodejs
age
eza
yazi
gitui
bind
wget
curl
stow
unzip
git
];
# DO NOT CHNAGE, EVER!
system.stateVersion = "26.05";
}
+35
View File
@@ -0,0 +1,35 @@
{ config, lib, pkgs, ... }:
{
imports =
[
./hardware-configuration.nix
../../modules/cloudflare-ddns
../../modules/gitea
../../modules/msjd
];
networking.hostName = "syedm";
services.openssh.enable = true;
services.caddy = {
enable = true;
virtualHosts."syedm.dev".extraConfig = ''
respond "Hello, world!"
'';
virtualHosts."git.syedm.dev".extraConfig = ''
reverse_proxy localhost:3000
'';
virtualHosts."acs.syedm.dev".extraConfig = ''
reverse_proxy localhost:3709
'';
};
networking.firewall.allowedTCPPorts = [ 22 80 443 ];
networking.firewall.allowedUDPPorts = [];
# DO NOT CHNAGE, EVER!
system.stateVersion = "26.05";
}
+17
View File
@@ -0,0 +1,17 @@
{ config, lib, pkgs, ... }:
{
imports =
[
./hardware-configuration.nix
];
environment.systemPackages = with pkgs; [
firefox
];
networking.hostName = "tardis";
# DO NOT CHNAGE, EVER!
system.stateVersion = "26.05";
}
@@ -1,7 +1,7 @@
{ config, pkgs, ... }:
let
script = pkgs.replaceVars ../../scripts/cloudflare-ddns.sh {
script = pkgs.replaceVars ./ddns.sh {
bash = pkgs.bash;
curl = pkgs.curl;
jq = pkgs.jq;
+25
View File
@@ -0,0 +1,25 @@
{ ... }:
{
services.gitea = {
enable = true;
appName = "My personal projects.";
database.type = "sqlite3";
settings = {
server = {
DOMAIN = "git.syedm.dev";
ROOT_URL = "https://git.syedm.dev/";
HTTP_ADDR = "0.0.0.0";
HTTP_PORT = 3000;
SSH_DOMAIN = "git.syedm.dev";
SSH_PORT = 22;
};
service = {
DISABLE_REGISTRATION = true;
REQUIRE_SIGNIN_VIEW = false;
};
session.COOKIE_SECURE = true;
log.LEVEL = "Info";
};
};
}
+23
View File
@@ -0,0 +1,23 @@
{ ... }:
{
systemd.services.msjd = {
description = "Msjd";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
WorkingDirectory = "/home/me/main/msjd";
ExecStart = "${pkgs.nodejs}/bin/node index.mjs";
User = "me";
Restart = "always";
RestartSec = 3;
Environment = [
"NODE_ENV=production"
"PORT=3709"
];
};
};
}
-133
View File
@@ -1,133 +0,0 @@
{ config, lib, pkgs, ... }:
{
imports =
[
./hardware-configuration.nix
];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "syedm";
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
# Configure network connections interactively with nmcli or nmtui.
networking.networkmanager.enable = true;
programs.fish.enable = true;
programs.tmux.enable = true;
programs.neovim = {
enable = true;
defaultEditor = true;
};
# Set your time zone.
time.timeZone = "Europe/London";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
useXkbConfig = true;
};
# Define a user account. Don't forget to set a password with 'passwd'.
users.users.me = {
isNormalUser = true;
shell = pkgs.fish;
extraGroups = [ "wheel" ];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJFUwk54CNtSLUyXSTLsIs5KXgEsjOgE4HGlA4FacKjV syed@tardis # msi laptop"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILMeU7L0yQ4+O1GME4D4UM4f6nqua+pWt/zdsMvyHV94 u0_a309@localhost # mobile"
];
packages = with pkgs; [];
};
# List packages installed in system profile.
# You can use https://search.nixos.org/ to find more packages (and options).
environment.systemPackages = with pkgs; [
nodejs
age
eza
yazi
gitui
bind
wget
curl
stow
unzip
git
];
# Enable the OpenSSH daemon.
services.openssh.enable = true;
services.caddy = {
enable = true;
virtualHosts."syedm.dev".extraConfig = ''
respond "Hello, world!"
'';
virtualHosts."git.syedm.dev".extraConfig = ''
reverse_proxy localhost:3000
'';
virtualHosts."acs.syedm.dev".extraConfig = ''
reverse_proxy localhost:3709
'';
};
services.gitea = {
enable = true;
appName = "My personal projects.";
database.type = "sqlite3";
settings = {
server = {
DOMAIN = "git.syedm.dev";
ROOT_URL = "https://git.syedm.dev/";
HTTP_ADDR = "0.0.0.0";
HTTP_PORT = 3000;
SSH_DOMAIN = "git.syedm.dev";
SSH_PORT = 22;
};
service = {
DISABLE_REGISTRATION = true;
REQUIRE_SIGNIN_VIEW = false;
};
session.COOKIE_SECURE = true;
log.LEVEL = "Info";
};
};
systemd.services.msjd = {
description = "Msjd";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
WorkingDirectory = "/home/me/main/msjd";
ExecStart = "${pkgs.nodejs}/bin/node index.mjs";
User = "me";
Restart = "always";
RestartSec = 3;
Environment = [
"NODE_ENV=production"
"PORT=3709"
];
};
};
# Open ports in the firewall.
networking.firewall.allowedTCPPorts = [ 22 80 443 ];
networking.firewall.allowedUDPPorts = [];
# DO NOT CHNAGE, EVER!
system.stateVersion = "26.05";
}
-27
View File
@@ -1,27 +0,0 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1782847225,
"narHash": "sha256-JC9PjqKYG9ve5U8aDOLQipp3+KLANBHUvGdLZlxzdKI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "95ca1e203c0750115fd4a6f17d5a245dfe6b1edd",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-26.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
-19
View File
@@ -1,19 +0,0 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
};
outputs = inputs@{ self, nixpkgs, ... }:
let
system = "x86_64-linux";
in {
nixosConfigurations.syedm = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
./configuration.nix
# ./flakes/cloudflare-ddns.nix ! to be readded when fixed secret management
];
};
};
}
-23
View File
@@ -1,23 +0,0 @@
{
"PicVim": { "branch": "main", "commit": "5114853ed8f24661e48b726135bf78860d9339d5" },
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
"conform.nvim": { "branch": "master", "commit": "619363c30309d29ffa631e67c8183f2a72caa373" },
"gitsigns.nvim": { "branch": "main", "commit": "eb60cc7b94c46005237fd34170d76f3a089a90aa" },
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
"lualine.nvim": { "branch": "master", "commit": "221ce6b2d999187044529f49da6554a92f740a96" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "47059d71b42d74b0a1e9f61c1d99d301039c3b5b" },
"mason.nvim": { "branch": "main", "commit": "2a6940af80375532e5e9e7c1f2fc6319a1b7a69d" },
"mini.pairs": { "branch": "main", "commit": "db0fac0a25884183650352ccf92b362a41ed2e9c" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "ebd66767191714e008ce73b769518a763ff31bdc" },
"neoscroll.nvim": { "branch": "master", "commit": "c8d29979cb0cb3a2437a8e0ae683fd82f340d3b8" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-cmp": { "branch": "main", "commit": "a1d504892f2bc56c2e79b65c6faded2fd21f3eca" },
"nvim-cursorline": { "branch": "main", "commit": "d4425a9ba73a66fca8a34fda9254eb8949b1784d" },
"nvim-lspconfig": { "branch": "master", "commit": "292f44408498103c47996ff5c18fd366293840d8" },
"nvim-notify": { "branch": "master", "commit": "8701bece920b38ea289b457f902e2ad184131a5d" },
"nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" },
"nvim-web-devicons": { "branch": "master", "commit": "dad71387de386a946b123079d0e53f23028f3abd" },
"plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" },
"rainbow-delimiters.nvim": { "branch": "master", "commit": "a798325b7f36acc62741d1029930a7b96d4dd4bf" },
"tokyonight.nvim": { "branch": "main", "commit": "cdc07ac78467a233fd62c493de29a17e0cf2b2b6" }
}