20 Commits

Author SHA1 Message Date
9a4c8df398 Add neovim packages to 'nixCats' flake 2025-10-14 22:03:49 +02:00
7c36539033 Add minimal 'nixCats' flake template 2025-10-13 21:59:58 +02:00
b25fc9a2b8 Source relevant '.bashrc.d/*' files in NixOS home manager 2025-10-05 19:56:38 +02:00
7bbd0dd8a8 Simplify NixOS fzf configuration 2025-10-05 19:56:38 +02:00
07e4669bb8 Update disko virtual machine configuration 2025-10-05 19:56:38 +02:00
203665a051 Migrate 'dots/.bashrc' fzf config to NixOS home manager 2025-10-05 19:56:38 +02:00
431fa046be Add packages from 'dots/.bin/setup' 2025-10-05 19:56:38 +02:00
83464117ae Move packages into host's 'home.nix' 2025-10-05 19:56:38 +02:00
c8cf7aa5ca Refactor 2025-10-05 19:56:38 +02:00
0ad84eed45 Move home manager config into host's 'home.nix' 2025-10-05 19:56:38 +02:00
811388006f Format nix files using 'nixfmt' 2025-10-05 19:56:38 +02:00
fc7e346f1e Ignore 'nixos-efi-vars.fd' (output from building vm) 2025-10-05 13:39:16 +02:00
0da72e9513 Update NixOS readme 2025-10-05 13:39:16 +02:00
749bd75992 Use disko 'single-disk-ext4' template for vm host 2025-10-05 13:39:16 +02:00
54b228381d Add 'kitty' package 2025-10-05 12:31:24 +02:00
ee62f092e5 Update readme 2025-10-05 12:31:24 +02:00
6007760092 Add 'networking.hostId' (required for ZFS) 2025-10-05 12:31:24 +02:00
f8fddbba14 Fix ZFS issue with virtual disks (https://discourse.nixos.org/t/zfs-with-disko-faluire-to-import-zfs-pool/61988/3) 2025-10-05 12:31:24 +02:00
f824649f85 Fix inputrc path 2025-10-05 12:31:24 +02:00
c4fe75a1b9 Set up disko zfs encrypted root for 'vm' host 2025-10-05 12:31:24 +02:00
14 changed files with 752 additions and 55 deletions

1
.gitignore vendored
View File

@@ -3,3 +3,4 @@
result
result-*
nixos-efi-vars.fd

View File

@@ -1,3 +1,15 @@
# nixos
My NixOS config
## Set up virtual machine ([`disko`](https://github.com/nix-community/disko/blob/master/docs/interactive-vm.md))
1. Build the virtual machine
```
nix build -L '.#nixosConfigurations.vm.config.system.build.vmWithDisko'
```
2. Run the virtual machine
```
./result/bin/disko-vm
```

162
dots/.config/nvim/flake.lock generated Normal file
View File

@@ -0,0 +1,162 @@
{
"nodes": {
"nixCats": {
"locked": {
"lastModified": 1759730664,
"narHash": "sha256-boRlBQ/c4CaHsK/z04QL6+t81mcar37Io94HBX2GflY=",
"owner": "BirdeeHub",
"repo": "nixCats-nvim",
"rev": "77dffad8235eb77684fcb7599487c8e9f23d5b8f",
"type": "github"
},
"original": {
"owner": "BirdeeHub",
"repo": "nixCats-nvim",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1760256791,
"narHash": "sha256-uTpzDHRASEDeFUuToWSQ46Re8beXyG9dx4W36FQa0/c=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "832e3b6db48508ae436c2c7bfc0cf914eac6938e",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"plugins-beancount-nvim": {
"flake": false,
"locked": {
"lastModified": 1707748314,
"narHash": "sha256-LuACGVB3kiaiJqoGtvFy6kbPNtqoGliKLDeR+Z7Wzbw=",
"owner": "polarmutex",
"repo": "beancount.nvim",
"rev": "869564aba3087ee5df8f282aa37555e314aa2152",
"type": "github"
},
"original": {
"owner": "polarmutex",
"repo": "beancount.nvim",
"type": "github"
}
},
"plugins-crazy-node-movement": {
"flake": false,
"locked": {
"lastModified": 1693654676,
"narHash": "sha256-hQcQEp39zFN2zphMfcr97yRVcuHhBsSkzKO7XNloDpQ=",
"owner": "theHamsta",
"repo": "crazy-node-movement",
"rev": "d5cf01cc44c5715501d3d6fe439af7c8b7fa5df2",
"type": "github"
},
"original": {
"owner": "theHamsta",
"repo": "crazy-node-movement",
"type": "github"
}
},
"plugins-helm-ls-nvim": {
"flake": false,
"locked": {
"lastModified": 1757598429,
"narHash": "sha256-nzuJxAAaEmuVYg9k0B8OKslxsihhg6RKlhz6E7xJTQU=",
"owner": "qvalentin",
"repo": "helm-ls.nvim",
"rev": "f36ecbd3e7b0b2ac8358a9d6a3213888e29943db",
"type": "github"
},
"original": {
"owner": "qvalentin",
"repo": "helm-ls.nvim",
"type": "github"
}
},
"plugins-mcphub-nvim": {
"flake": false,
"locked": {
"lastModified": 1759035242,
"narHash": "sha256-I6EbgY/2sAdtrxtmH0qbAAQvMCHhOsfolJfblV0fXOk=",
"owner": "ravitemer",
"repo": "mcphub.nvim",
"rev": "8ff40b5edc649959bb7e89d25ae18e055554859a",
"type": "github"
},
"original": {
"owner": "ravitemer",
"repo": "mcphub.nvim",
"type": "github"
}
},
"plugins-nvimkit-nvim": {
"flake": false,
"locked": {
"lastModified": 1721393835,
"narHash": "sha256-MdmrhLHMxrn6upu1chjKyitPZ5WkCQtpI465AKJXDOA=",
"owner": "jamesblckwell",
"repo": "nvimkit.nvim",
"rev": "af363d22699760f66988e8d36539a5753039217a",
"type": "github"
},
"original": {
"owner": "jamesblckwell",
"repo": "nvimkit.nvim",
"type": "github"
}
},
"plugins-shipwright-nvim": {
"flake": false,
"locked": {
"lastModified": 1711725275,
"narHash": "sha256-xh/2m//Cno5gPucjOYih79wVZj3X1Di/U3/IQhKXjc0=",
"owner": "rktjmp",
"repo": "shipwright.nvim",
"rev": "e596ab48328c31873f4f4d2e070243bf9de16ff3",
"type": "github"
},
"original": {
"owner": "rktjmp",
"repo": "shipwright.nvim",
"type": "github"
}
},
"plugins-tailwind-fold-nvim": {
"flake": false,
"locked": {
"lastModified": 1752559116,
"narHash": "sha256-8uefZIVsn9USEd6FyiO3m3TRKAS/vigU4t9Tk5ijd3c=",
"owner": "razak17",
"repo": "tailwind-fold.nvim",
"rev": "d9e7ca11691d252b35795726dff087bf013b2ebf",
"type": "github"
},
"original": {
"owner": "razak17",
"repo": "tailwind-fold.nvim",
"type": "github"
}
},
"root": {
"inputs": {
"nixCats": "nixCats",
"nixpkgs": "nixpkgs",
"plugins-beancount-nvim": "plugins-beancount-nvim",
"plugins-crazy-node-movement": "plugins-crazy-node-movement",
"plugins-helm-ls-nvim": "plugins-helm-ls-nvim",
"plugins-mcphub-nvim": "plugins-mcphub-nvim",
"plugins-nvimkit-nvim": "plugins-nvimkit-nvim",
"plugins-shipwright-nvim": "plugins-shipwright-nvim",
"plugins-tailwind-fold-nvim": "plugins-tailwind-fold-nvim"
}
}
},
"root": "root",
"version": 7
}

215
dots/.config/nvim/flake.nix Normal file
View File

@@ -0,0 +1,215 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nixCats.url = "github:BirdeeHub/nixCats-nvim";
plugins-shipwright-nvim = {
url = "github:rktjmp/shipwright.nvim";
flake = false;
};
plugins-crazy-node-movement = {
url = "github:theHamsta/crazy-node-movement";
flake = false;
};
plugins-beancount-nvim = {
url = "github:polarmutex/beancount.nvim";
flake = false;
};
plugins-tailwind-fold-nvim = {
url = "github:razak17/tailwind-fold.nvim";
flake = false;
};
plugins-nvimkit-nvim = {
url = "github:jamesblckwell/nvimkit.nvim";
flake = false;
};
plugins-mcphub-nvim = {
url = "github:ravitemer/mcphub.nvim";
flake = false;
};
plugins-helm-ls-nvim = {
url = "github:qvalentin/helm-ls.nvim";
flake = false;
};
};
outputs =
{
self,
nixpkgs,
nixCats,
...
}@inputs:
let
inherit (nixCats) utils;
luaPath = ./.;
forEachSystem = utils.eachSystem nixpkgs.lib.platforms.all;
extra_pkg_config = { };
dependencyOverlays = [
(utils.standardPluginOverlay inputs)
];
categoryDefinitions =
{
pkgs,
...
}:
{
lspsAndRuntimeDeps = with pkgs; {
general = [
tree-sitter
];
};
startupPlugins = {
general = with pkgs.vimPlugins; [
lze
lzextras
eyeliner-nvim
fzf-lua
ltex_extra-nvim
nvim-lspconfig
lsp_lines-nvim
lsp-progress-nvim
neodev-nvim
SchemaStore-nvim
nvim-lint
conform-nvim
luasnip
cmp_luasnip
nvim-cmp
cmp-nvim-lsp
cmp-buffer
cmp-path
plenary-nvim
nui-nvim
trouble-nvim
pkgs.neovimPlugins.shipwright-nvim
lush-nvim
zenbones-nvim
pkgs.neovimPlugins.crazy-node-movement
nvim-treesitter.withAllGrammars
nvim-treesitter-textobjects
# nvim-treesitter-context
nvim-ts-context-commentstring
treesj
sniprun
gitsigns-nvim
nvim-highlight-colors
pkgs.neovimPlugins.tailwind-fold-nvim
auto-session
nvim-dbee
image-nvim
pkgs.neovimPlugins.beancount-nvim
pkgs.neovimPlugins.nvimkit-nvim
codecompanion-nvim
pkgs.neovimPlugins.mcphub-nvim
copilot-lua
copilot-cmp
pkgs.neovimPlugins.helm-ls-nvim
];
};
optionalPlugins = {
general = with pkgs.vimPlugins; [
];
};
sharedLibraries = {
general = [ ];
};
environmentVariables = { };
};
packageDefinitions = {
nvim =
{ ... }:
{
settings = {
suffix-path = true;
suffix-LD = true;
wrapRc = true;
aliases = [ "vim" ];
};
categories = {
general = true;
};
};
};
defaultPackageName = "nvim";
in
forEachSystem (
system:
let
nixCatsBuilder = utils.baseBuilder luaPath {
inherit
nixpkgs
system
dependencyOverlays
extra_pkg_config
;
} categoryDefinitions packageDefinitions;
defaultPackage = nixCatsBuilder defaultPackageName;
pkgs = import nixpkgs { inherit system; };
in
{
packages = utils.mkAllWithDefault defaultPackage;
devShells = {
default = pkgs.mkShell {
name = defaultPackageName;
packages = [ defaultPackage ];
inputsFrom = [ ];
shellHook = '''';
};
};
}
)
// (
let
nixosModule = utils.mkNixosModules {
moduleNamespace = [ defaultPackageName ];
inherit
defaultPackageName
dependencyOverlays
luaPath
categoryDefinitions
packageDefinitions
extra_pkg_config
nixpkgs
;
};
homeModule = utils.mkHomeModules {
moduleNamespace = [ defaultPackageName ];
inherit
defaultPackageName
dependencyOverlays
luaPath
categoryDefinitions
packageDefinitions
extra_pkg_config
nixpkgs
;
};
in
{
overlays = utils.makeOverlays luaPath {
inherit nixpkgs dependencyOverlays extra_pkg_config;
} categoryDefinitions packageDefinitions defaultPackageName;
nixosModules.default = nixosModule;
homeModules.default = homeModule;
inherit utils nixosModule homeModule;
inherit (utils) templates;
}
);
}

71
flake.lock generated Normal file
View File

@@ -0,0 +1,71 @@
{
"nodes": {
"disko": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1746728054,
"narHash": "sha256-eDoSOhxGEm2PykZFa/x9QG5eTH0MJdiJ9aR00VAofXE=",
"owner": "nix-community",
"repo": "disko",
"rev": "ff442f5d1425feb86344c028298548024f21256d",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "latest",
"repo": "disko",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1758463745,
"narHash": "sha256-uhzsV0Q0I9j2y/rfweWeGif5AWe0MGrgZ/3TjpDYdGA=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "3b955f5f0a942f9f60cdc9cacb7844335d0f21c3",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-25.05",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1759580034,
"narHash": "sha256-YWo57PL7mGZU7D4WeKFMiW4ex/O6ZolUS6UNBHTZfkI=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "3bcc93c5f7a4b30335d31f21e2f1281cba68c318",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-25.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"disko": "disko",
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

View File

@@ -1,21 +1,35 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-25.05";
home-manager.url = "github:nix-community/home-manager/release-25.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
nixpkgs = {
url = "github:nixos/nixpkgs?ref=nixos-25.05";
};
disko = {
url = "github:nix-community/disko/latest";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager/release-25.05";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, home-manager }: {
nixosConfigurations.vm = nixpkgs.lib.nixosSystem {
outputs =
{
self,
nixpkgs,
disko,
home-manager,
}:
{
nixosConfigurations = {
vm = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
disko.nixosModules.disko
home-manager.nixosModules.home-manager
./hosts/vm/configuration.nix
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.h = ./hosts/vm/home.nix;
}
];
};
};
};
}

View File

@@ -1,11 +1,11 @@
{ pkgs, ... }:
{ ... }:
{
system.stateVersion = "25.05";
imports =
[
imports = [
./hard.nix
./disk.nix
../../modules/bootloader.nix
../../modules/networking.nix
../../modules/users.nix
@@ -15,16 +15,40 @@
../../modules/x.nix
];
nix.settings.experimental-features = [ "nix-command" "flakes" ];
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
programs.git.enable = true;
programs.firefox.enable = true;
disko = {
devices.disk.main.device = "/dev/vda";
devices.disk.main.imageName = "nixos-vm";
devices.disk.main.imageSize = "32G";
};
virtualisation.vmVariantWithDisko = {
virtualisation = {
cores = 8;
memorySize = 16384;
qemu.options = [
"-enable-kvm"
"-cpu host"
"-nographic"
];
};
};
nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [ neovim ];
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.h = ./home.nix;
};
services.qemuGuest.enable = true;
services.spice-vdagentd.enable = true;
services.openssh = {
enable = true;
startWhenNeeded = true;

36
hosts/vm/disk.nix Normal file
View File

@@ -0,0 +1,36 @@
{
disko.devices = {
disk = {
main = {
type = "disk";
content = {
type = "gpt";
partitions = {
boot = {
size = "1M";
type = "EF02"; # for grub MBR
};
ESP = {
size = "1G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
root = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
};
};
};
};
};
}

View File

@@ -1,27 +1,30 @@
# 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, ... }:
{
config,
lib,
pkgs,
modulesPath,
...
}:
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ];
boot.initrd.availableKernelModules = [
"ahci"
"xhci_pci"
"virtio_pci"
"sr_mod"
"virtio_blk"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/7d406784-bf6b-420e-a956-134f719c8206";
fsType = "ext4";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/4cbaffdb-0ca2-4735-87d0-eefe994f0e18"; }
];
# 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

View File

@@ -6,7 +6,81 @@
home.username = "h";
home.homeDirectory = "/home/h";
home.file.".inputrc".source = ./dots/.inputrc;
programs = {
bash = {
enable = true;
enableCompletion = true;
initExtra = ''
for f in ${config.home.homeDirectory}/.bashrc.d/*; do
[ -f "$f" ] && source "$f"
done
'';
};
firefox.enable = true;
fzf = {
enable = true;
enableBashIntegration = true;
};
git.enable = true;
home-manager.enable = true;
};
programs.home-manager.enable = true;
home.packages = with pkgs; [
bash-completion
bash-language-server
bat
brightnessctl
entr
eslint_d
feh
firefox-devedition
fzf
git
haskell-language-server
haskellPackages.pandoc-crossref
haskellPackages.hadolint
htop
iosevka
jq
keepassxc
kitty
lua-language-server
neovim
nmap
nodejs_24
nodePackages.ts-node
nvimpager
ormolu
pandoc
parallel
pass
pnpm
ripgrep
silver-searcher
sshfs
stylelint
svelte-language-server
tailwindcss-language-server
taskwarrior3
tldr
tmux
tmuxp
tree
tree-sitter
typescript-language-server
unzip
vim-language-server
vimPlugins.vim-plug
vtsls
wget
xbanish
xclip
yaml-language-server
];
home.file = {
".inputrc".source = ../../dots/.inputrc;
".bashrc.d/prompt".source = ../../dots/.bashrc.d/prompt;
".bashrc.d/editor".source = ../../dots/.bashrc.d/editor;
};
}

View File

@@ -0,0 +1,81 @@
{
disko.devices = {
disk = {
root = {
type = "disk";
device = "/dev/vda";
content = {
type = "gpt";
partitions = {
ESP = {
size = "1G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "nofail" ];
};
};
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "zroot";
};
};
};
};
};
};
zpool = {
zroot = {
type = "zpool";
rootFsOptions = {
mountpoint = "none";
compression = "zstd";
acltype = "posixacl";
xattr = "sa";
"com.sun:auto-snapshot" = "true";
};
options.ashift = "12";
datasets = {
"root" = {
type = "zfs_fs";
options = {
encryption = "aes-256-gcm";
keyformat = "passphrase";
#keylocation = "file:///tmp/secret.key";
keylocation = "prompt";
};
mountpoint = "/";
};
"root/nix" = {
type = "zfs_fs";
options.mountpoint = "/nix";
mountpoint = "/nix";
};
# README MORE: https://wiki.archlinux.org/title/ZFS#Swap_volume
"root/swap" = {
type = "zfs_volume";
size = "10M";
content = {
type = "swap";
};
options = {
volblocksize = "4096";
compression = "zle";
logbias = "throughput";
sync = "always";
primarycache = "metadata";
secondarycache = "none";
"com.sun:auto-snapshot" = "false";
};
};
};
};
};
};
}

View File

@@ -2,7 +2,11 @@
{
networking.hostName = "nixos";
networking.wireless = { iwd = { enable = true; }; };
networking.wireless = {
iwd = {
enable = true;
};
};
networking.firewall = {
enable = true;
allowedTCPPorts = [ 22 ];