Compare commits
18 Commits
Author | SHA1 | Date |
---|---|---|
|
069a3b8333 | |
|
851f226518 | |
|
7b872f4596 | |
|
84ec0824e8 | |
|
8f2c473219 | |
|
475c21cbac | |
|
671578567a | |
|
f92ed39653 | |
|
91a1c7f6ca | |
|
fc7e346f1e | |
|
0da72e9513 | |
|
749bd75992 | |
|
54b228381d | |
|
ee62f092e5 | |
|
6007760092 | |
|
f8fddbba14 | |
|
f824649f85 | |
|
c4fe75a1b9 |
|
@ -3,3 +3,4 @@
|
||||||
result
|
result
|
||||||
result-*
|
result-*
|
||||||
|
|
||||||
|
nixos-efi-vars.fd
|
||||||
|
|
14
README.md
14
README.md
|
@ -1,3 +1,15 @@
|
||||||
# nixos
|
# 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
|
||||||
|
```
|
||||||
|
|
|
@ -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
|
||||||
|
}
|
46
flake.nix
46
flake.nix
|
@ -1,21 +1,35 @@
|
||||||
{
|
{
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-25.05";
|
nixpkgs = {
|
||||||
home-manager.url = "github:nix-community/home-manager/release-25.05";
|
url = "github:nixos/nixpkgs?ref=nixos-25.05";
|
||||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
};
|
||||||
};
|
home-manager = {
|
||||||
|
url = "github:nix-community/home-manager/release-25.05";
|
||||||
outputs = { self, nixpkgs, home-manager }: {
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
nixosConfigurations.vm = nixpkgs.lib.nixosSystem {
|
};
|
||||||
system = "x86_64-linux";
|
disko = {
|
||||||
modules = [
|
url = "github:nix-community/disko/latest";
|
||||||
./hosts/vm/configuration.nix
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
home-manager.nixosModules.home-manager {
|
|
||||||
home-manager.useGlobalPkgs = true;
|
|
||||||
home-manager.useUserPackages = true;
|
|
||||||
home-manager.users.h = ./hosts/vm/home.nix;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,30 +1,54 @@
|
||||||
{ pkgs, ... }:
|
{ ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
system.stateVersion = "25.05";
|
system.stateVersion = "25.05";
|
||||||
|
|
||||||
imports =
|
imports = [
|
||||||
[
|
./hard.nix
|
||||||
./hard.nix
|
./disk.nix
|
||||||
../../modules/bootloader.nix
|
../../modules/bootloader.nix
|
||||||
../../modules/networking.nix
|
../../modules/networking.nix
|
||||||
../../modules/users.nix
|
../../modules/users.nix
|
||||||
../../modules/audio.nix
|
../../modules/audio.nix
|
||||||
../../modules/printing.nix
|
../../modules/printing.nix
|
||||||
../../modules/localization.nix
|
../../modules/localization.nix
|
||||||
../../modules/x.nix
|
../../modules/x.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
nix.settings.experimental-features = [
|
||||||
|
"nix-command"
|
||||||
|
"flakes"
|
||||||
|
];
|
||||||
|
|
||||||
programs.git.enable = true;
|
disko = {
|
||||||
programs.firefox.enable = true;
|
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;
|
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.spice-vdagentd.enable = true;
|
||||||
|
|
||||||
services.openssh = {
|
services.openssh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
startWhenNeeded = true;
|
startWhenNeeded = true;
|
||||||
|
|
|
@ -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 = "/";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,27 +1,30 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||||
# and may be overwritten by future invocations. Please make changes
|
# and may be overwritten by future invocations. Please make changes
|
||||||
# to /etc/nixos/configuration.nix instead.
|
# to /etc/nixos/configuration.nix instead.
|
||||||
{ config, lib, pkgs, modulesPath, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
modulesPath,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports =
|
imports = [
|
||||||
[ (modulesPath + "/profiles/qemu-guest.nix")
|
(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.initrd.kernelModules = [ ];
|
||||||
boot.kernelModules = [ "kvm-intel" ];
|
boot.kernelModules = [ "kvm-intel" ];
|
||||||
boot.extraModulePackages = [ ];
|
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
|
# 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
|
# (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
|
# still possible to use this option, but it's recommended to use it in conjunction
|
||||||
|
|
|
@ -6,7 +6,81 @@
|
||||||
home.username = "h";
|
home.username = "h";
|
||||||
home.homeDirectory = "/home/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;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -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";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -2,7 +2,11 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
networking.hostName = "nixos";
|
networking.hostName = "nixos";
|
||||||
networking.wireless = { iwd = { enable = true; }; };
|
networking.wireless = {
|
||||||
|
iwd = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
networking.firewall = {
|
networking.firewall = {
|
||||||
enable = true;
|
enable = true;
|
||||||
allowedTCPPorts = [ 22 ];
|
allowedTCPPorts = [ 22 ];
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
services.xserver.windowManager.xmonad = {
|
services.xserver.windowManager.xmonad = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableContribAndExtras = true;
|
enableContribAndExtras = true;
|
||||||
config = builtins.readFile ../dots/.xmonad/xmonad.hs;
|
config = builtins.readFile ../dots/.xmonad/xmonad.hs;
|
||||||
};
|
};
|
||||||
|
|
||||||
services.xserver = {
|
services.xserver = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
Loading…
Reference in New Issue