nixos-dots

nixos dots
git clone git://popovic.xyz/nixos-dots.git
Log | Files | Refs

commit 644ca90cbd95693216e394f2986f84091022d42f
Author: Milutin Popovic <milutin@popovic.xyz>
Date:   Thu,  1 Jan 2026 01:29:41 +0000

sops

Diffstat:
A.gitignore | 2++
A.sops.yaml | 7+++++++
ATODO.md | 5+++++
Aflake.lock | 227+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aflake.nix | 131+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ajustfile | 28++++++++++++++++++++++++++++
Alib/dotfiles.nix | 7+++++++
Amodules/firefox.nix | 48++++++++++++++++++++++++++++++++++++++++++++++++
Amodules/mbsync_timer.nix | 36++++++++++++++++++++++++++++++++++++
Amodules/nix_settings.nix | 15+++++++++++++++
Amodules/nm.nix | 193+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Amodules/packages.nix | 174+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Amodules/theme.nix | 24++++++++++++++++++++++++
Amodules/xdg.nix | 20++++++++++++++++++++
Asecrets.yaml | 22++++++++++++++++++++++
Asystem/disk/disk-vm.nix | 40++++++++++++++++++++++++++++++++++++++++
Asystem/hardware/hardware-frame.nix | 37+++++++++++++++++++++++++++++++++++++
Asystem/hardware/hardware-vm.nix | 16++++++++++++++++
Asystem/host/host-frame.nix | 156+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asystem/host/host-server.nix | 129+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ausers/mika.nix | 73+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ausers/r2d2.nix | 51+++++++++++++++++++++++++++++++++++++++++++++++++++
Ausers/root.nix | 47+++++++++++++++++++++++++++++++++++++++++++++++
23 files changed, 1488 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -0,0 +1,2 @@ +*qcow2 +result diff --git a/.sops.yaml b/.sops.yaml @@ -0,0 +1,7 @@ +keys: + - &primary age1u0qxd3jqhmmq0r0n6n8xgwmxcvlh2tptjcwdznw2vfxcje006s7s07w6jq +creation_rules: + - path_regex: secrets.yaml$ + key_groups: + - age: + - *primary diff --git a/TODO.md b/TODO.md @@ -0,0 +1,5 @@ +# NixOs config + + - automatic nm profiles with sops + - encrypted / and swap paritions + diff --git a/flake.lock b/flake.lock @@ -0,0 +1,227 @@ +{ + "nodes": { + "betterfox": { + "inputs": { + "flake-parts": "flake-parts", + "import-tree": "import-tree", + "nixpkgs": "nixpkgs", + "systems": "systems" + }, + "locked": { + "lastModified": 1765765778, + "narHash": "sha256-w7nVSCFHEcTcrbQEzVdx5MaE+7iTaAtLHjV2jfOTSCI=", + "owner": "HeitorAugustoLN", + "repo": "betterfox-nix", + "rev": "b3dae410c6f9e632955c67d77791ae231a7dd3c3", + "type": "github" + }, + "original": { + "owner": "HeitorAugustoLN", + "repo": "betterfox-nix", + "type": "github" + } + }, + "disko": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1766150702, + "narHash": "sha256-P0kM+5o+DKnB6raXgFEk3azw8Wqg5FL6wyl9jD+G5a4=", + "owner": "nix-community", + "repo": "disko", + "rev": "916506443ecd0d0b4a0f4cf9d40a3c22ce39b378", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "betterfox", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1763759067, + "narHash": "sha256-LlLt2Jo/gMNYAwOgdRQBrsRoOz7BPRkzvNaI/fzXi2Q=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "2cccadc7357c0ba201788ae99c4dfa90728ef5e0", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1766553861, + "narHash": "sha256-ZbnG01yA3O8Yr1vUm3+NQ2qk9iRhS5bloAnuXHHy7+c=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "0999ed8f965bbbd991437ad9c5ed3434cecbc30e", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-25.11", + "repo": "home-manager", + "type": "github" + } + }, + "import-tree": { + "locked": { + "lastModified": 1763762820, + "narHash": "sha256-ZvYKbFib3AEwiNMLsejb/CWs/OL/srFQ8AogkebEPF0=", + "owner": "vic", + "repo": "import-tree", + "rev": "3c23749d8013ec6daa1d7255057590e9ca726646", + "type": "github" + }, + "original": { + "owner": "vic", + "repo": "import-tree", + "type": "github" + } + }, + "nixos-facter-modules": { + "locked": { + "lastModified": 1766558141, + "narHash": "sha256-Ud9v49ZPsoDBFuyJSQ2Mpw1ZgAH/aMwUwwzrVoetNus=", + "owner": "numtide", + "repo": "nixos-facter-modules", + "rev": "e796d536e3d83de74267069e179dc620a608ed7d", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nixos-facter-modules", + "type": "github" + } + }, + "nixos-hardware": { + "locked": { + "lastModified": 1766568855, + "narHash": "sha256-UXVtN77D7pzKmzOotFTStgZBqpOcf8cO95FcupWp4Zo=", + "owner": "NixOS", + "repo": "nixos-hardware", + "rev": "c5db9569ac9cc70929c268ac461f4003e3e5ca80", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixos-hardware", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1763806073, + "narHash": "sha256-FHsEKDvfWpzdADWj99z7vBk4D716Ujdyveo5+A048aI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "878e468e02bfabeda08c79250f7ad583037f2227", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1766473571, + "narHash": "sha256-5G1NDO2PulBx1RoaA6U1YoUDX0qZslpPxv+n5GX6Qto=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "76701a179d3a98b07653e2b0409847499b2a07d3", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-25.11", + "type": "indirect" + } + }, + "nixpkgs_unstable": { + "locked": { + "lastModified": 1766651565, + "narHash": "sha256-QEhk0eXgyIqTpJ/ehZKg9IKS7EtlWxF3N7DXy42zPfU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3e2499d5539c16d0d173ba53552a4ff8547f4539", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" + } + }, + "root": { + "inputs": { + "betterfox": "betterfox", + "disko": "disko", + "home-manager": "home-manager", + "nixos-facter-modules": "nixos-facter-modules", + "nixos-hardware": "nixos-hardware", + "nixpkgs": "nixpkgs_2", + "nixpkgs_unstable": "nixpkgs_unstable", + "sops-nix": "sops-nix" + } + }, + "sops-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1766894905, + "narHash": "sha256-pn8AxxfajqyR/Dmr1wnZYdUXHgM3u6z9x0Z1Ijmz2UQ=", + "owner": "Mic92", + "repo": "sops-nix", + "rev": "61b39c7b657081c2adc91b75dd3ad8a91d6f07a7", + "type": "github" + }, + "original": { + "owner": "Mic92", + "repo": "sops-nix", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix @@ -0,0 +1,131 @@ +{ + description = "NixOS"; + + inputs = { + nixpkgs.url = "nixpkgs/nixos-25.11"; + nixpkgs_unstable.url = "nixpkgs/nixos-unstable"; + nixos-facter-modules.url = "github:numtide/nixos-facter-modules"; + nixos-hardware.url = "github:NixOS/nixos-hardware"; + betterfox.url = "github:HeitorAugustoLN/betterfox-nix"; + sops-nix = { + url = "github:Mic92/sops-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + home-manager = { + url = "github:nix-community/home-manager/release-25.11"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + disko = { + url = "github:nix-community/disko"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + outputs = { + self, + nixpkgs, + disko, + home-manager, + nixos-hardware, + sops-nix, + betterfox, + ... + } @inputs: let + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; + in { + nixosConfigurations = { + nixos-frame = let + hostName = "nixos-frame"; + in nixpkgs.lib.nixosSystem { + inherit system; + specialArgs = { + inherit inputs; + inherit hostName; + }; + modules = [ + nixos-hardware.nixosModules.framework-13-7040-amd + home-manager.nixosModules.home-manager + sops-nix.nixosModules.sops + ./system/host/host-frame.nix + ./system/hardware/hardware-frame.nix + { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + extraSpecialArgs = { + inherit system; + inherit inputs; + standalone = false; + }; + users.mika = import ./users/mika.nix; + }; + } + ]; + }; + nixos-vm = let + hostName = "nixos-vm"; + in nixpkgs.lib.nixosSystem { + inherit system; + specialArgs = { + inherit inputs; + inherit hostName; + }; + modules = [ + home-manager.nixosModules.home-manager + ./system/host/host-frame.nix + ./system/hardware/hardware-vm.nix + { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + extraSpecialArgs = { + inherit system; + inherit inputs; + standalone = false; + }; + users.mika = import ./users/mika.nix; + }; + } + ]; + }; + nixos-server = let + hostName = "nixos-server"; + in nixpkgs.lib.nixosSystem { + inherit system; + specialArgs = { + inherit inputs; + inherit hostName; + }; + modules = [ + home-manager.nixosModules.home-manager + ./system/host/host-server.nix + ./system/hardware/hardware-vm.nix + { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + extraSpecialArgs = { + inherit system; + inherit inputs; + standalone = false; + }; + users.r2d2 = import ./users/r2d2.nix; + }; + } + ]; + }; + }; + homeConfigurations = { + mika = home-manager.lib.homeManagerConfiguration { + inherit pkgs; + modules = [ ./users/mika.nix ]; + extraSpecialArgs = { + inherit system; + inherit inputs; + standalone = true; + }; + }; + }; + + }; +} diff --git a/justfile b/justfile @@ -0,0 +1,28 @@ +hostname := `hostname` +user := `whoami` + +os: + sudo nixos-rebuild switch --flake ./#{{hostname}} --impure + +hm: + home-manager switch -b backup --flake ./#{{user}} + +gc: + sudo nix-collect-garbage --delete-older-than 7d + nix-collect-garbage --delete-older-than 7d + +ls-nixos-packages: + @nix-store --query --requisites /run/current-system | cut -d- -f2- | sort | uniq + +ls-hm-packages: + @home-manager packages | sort | uniq + +vm machine: + sudo nix --experimental-features "nix-command flakes" run nixpkgs#nixos-rebuild -- build-vm --flake .#{{machine}} --impure + +anywhere machine target: + sudo nix --experimental-features "nix-command flakes" run github:nix-community/nixos-anywhere -- --generate-hardware-config nixos-generate-config ./hardware-configuration.nix --flake ./#{{machine}} --target-host {{target}} + +clean: + rm -r ./result + rm *qcow2 diff --git a/lib/dotfiles.nix b/lib/dotfiles.nix @@ -0,0 +1,7 @@ +{ + dotfiles = builtins.fetchGit { + url = "git://popovic.xyz/dots.git"; + ref = "master"; + rev = "bc6a6b7316a52034890fe0fa8985f2af82de3bfd"; + }; +} diff --git a/modules/firefox.nix b/modules/firefox.nix @@ -0,0 +1,48 @@ +{ inputs, ... }: +{ + imports = [ inputs.betterfox.homeModules.betterfox ]; + + programs.firefox = { + enable = true; + betterfox = { + enable = true; + profiles.frame = { + settings = { + fastfox.enable = true; + peskyfox.enable = true; + }; + }; + profiles.mulmon = { + settings = { + fastfox.enable = true; + peskyfox.enable = true; + }; + }; + }; + profiles = { + frame = { + id = 0; + name = "frame"; + isDefault = false; + settings = { + "browser.toolbars.bookmarks.visibility" = "always"; + "browser.download.start_downloads_in_tmp_dir" = false; + "browser.download.lastDir" = "/home/mika"; + }; + }; + mulmon = { + id = 1; + name = "mulmon"; + isDefault = true; + settings = { + "layout.css.devPixelsPerPx" = 0.9; + "browser.toolbars.bookmarks.visibility" = "always"; + "browser.download.useDownloadDir" = true; + "browser.download.start_downloads_in_tmp_dir" = false; + "browser.download.lastDir" = "/home/mika"; + }; + }; + }; + }; +} + diff --git a/modules/mbsync_timer.nix b/modules/mbsync_timer.nix @@ -0,0 +1,36 @@ +{ pkgs , ... }: +{ + systemd.user = { + startServices = "sd-switch"; + services.mbsync = { + Unit = { + Description = "Mailbox sync service"; + RefuseManualStart = "no"; + RefuseManualStop = "yes"; + }; + Service = { + Type = "oneshot"; + ExecStart = "${pkgs.isync}/bin/mbsync -c %h/.config/isync/mbsyncrc -a -q"; + }; + Install = { + wantedBy = [ "default.target" ]; + }; + }; + timers.mbsync = { + Unit = { + Description = "Mailbox sync timer"; + RefuseManualStop = "no"; + RefuseManualStart = "no"; + }; + Timer = { + Persistent = false; + OnBootSec = "0.3m"; + OnUnitActiveSec = "0.5m"; + Unit = "mbsync.service"; + }; + Install = { + WantedBy = [ "timers.target" ]; + }; + }; + }; +} diff --git a/modules/nix_settings.nix b/modules/nix_settings.nix @@ -0,0 +1,15 @@ +{ + pkgs, + ... +}: +{ + nix = { + enable = true; + package = pkgs.nix; + settings = { + use-xdg-base-directories = true; + experimental-features = [ "nix-command" "flakes" ]; + trusted-users = [ "mika" "root" ]; + }; + }; +} diff --git a/modules/nm.nix b/modules/nm.nix @@ -0,0 +1,193 @@ +{ pkgs, config, ... }: +{ + sops = { + secrets = { + "networking/gajba" = {}; + "networking/wg0-ponnect_prv" = {}; + "networking/wg0-ponnect_pre" = {}; + "networking/wg0-router_prv" = {}; + "networking/wg0-server_prv" = {}; + "networking/wg0-server_pre" = {}; + }; + templates.wifi = { + content = '' + Gajba=${config.sops.placeholder."networking/gajba"} + wg0-ponnect_prv=${config.sops.placeholder."networking/wg0-ponnect_prv"} + wg0-ponnect_pre=${config.sops.placeholder."networking/wg0-ponnect_pre"} + wg0-router_prv=${config.sops.placeholder."networking/wg0-router_prv"} + wg0-server_prv=${config.sops.placeholder."networking/wg0-server_prv"} + wg0-server_pre=${config.sops.placeholder."networking/wg0-server_pre"} + ''; + }; + }; + + networking.networkmanager = { + enable = true; + dispatcherScripts = [ + { + source = pkgs.writeShellScriptBin "09-timezone" '' + #!/bin/sh + INTERFACE="$1" + ACTION="$2" + + case "$2" in + up) + if [[ $INTERFACE == "wlan0" ]]; then + timedatectl set-timezone "$(curl --fail https://ipapi.co/timezone)" + fi + ;; + down) + if [[ $INTERFACE == "wlan0" ]]; then + ./home/mika/.local/bin/scripts/vpn stop + fi + ;; + esac + ''; + } + ]; + ensureProfiles = { + environmentFiles = [ config.sops.templates.wifi.path ]; + profiles = { + Gajba = { + connection = { + id = "Gajba"; + interface-name = "wlan0"; + type = "wifi"; + uuid = "34880767-ea49-4b44-8f7f-22d0d3fc8cc1"; + }; + ipv4 = { + method = "auto"; + }; + ipv6 = { + addr-gen-mode = "default"; + method = "auto"; + }; + proxy = { }; + wifi = { + mode = "infrastructure"; + ssid = "Gajba"; + }; + wifi-security = { + auth-alg = "open"; + key-mgmt = "wpa-psk"; + psk = "$Gajba"; + }; + }; + Gajba_5G = { + connection = { + id = "Gajba_5G"; + interface-name = "wlan0"; + timestamp = "1765067220"; + type = "wifi"; + uuid = "3fffdcbb-a859-4eb9-bd3e-55cd74403267"; + }; + ipv4 = { + method = "auto"; + }; + ipv6 = { + addr-gen-mode = "default"; + method = "auto"; + }; + proxy = { }; + wifi = { + mode = "infrastructure"; + ssid = "Gajba_5G"; + }; + wifi-security = { + auth-alg = "open"; + key-mgmt = "wpa-psk"; + psk = "$Gajba"; + }; + }; + wg0-ponnect = { + connection = { + autoconnect = "false"; + id = "wg0-ponnect"; + interface-name = "wg0-ponnect"; + type = "wireguard"; + uuid = "b60f69f7-8e2a-4e7f-93ec-027d5a1a1f96"; + }; + ipv4 = { + address1 = "10.0.0.2/32"; + dns = "8.8.4.4;8.8.8.8;"; + dns-search = "~;"; + method = "manual"; + }; + ipv6 = { + addr-gen-mode = "default"; + address1 = "fd42:42:42::2/128"; + method = "manual"; + }; + proxy = { }; + wireguard = { + private-key = "$wg0-ponnect_prv"; + }; + "wireguard-peer.vadaAF6n58daN9sqQ7o2yUjy8CmKXbXSWzIrzVqHUCs=" = { + allowed-ips = "0.0.0.0/0;::/0;"; + endpoint = "ponnect.rs:1194"; + persistent-keepalive = "25"; + preshared-key = "$wg0-ponnect_pre"; + preshared-key-flags = "0"; + }; + }; + wg0-router = { + connection = { + autoconnect = "false"; + id = "wg0-router"; + interface-name = "wg0-router"; + timestamp = "1765706206"; + type = "wireguard"; + uuid = "62cc1ad0-18b9-4405-afec-ae086652510e"; + }; + ipv4 = { + address1 = "10.0.0.2/32"; + method = "manual"; + }; + ipv6 = { + addr-gen-mode = "default"; + address1 = "fd42:42:42::2/128"; + method = "manual"; + }; + proxy = { }; + wireguard = { + private-key = "$wg0-router_prv"; + }; + "wireguard-peer.M1KoNQqQ3zK4hYnblqwJw34x8R46jAJaJlXJKOKxg2g=" = { + allowed-ips = "0.0.0.0/0;::/0;"; + endpoint = "gajbapt.duckdns.org:51820"; + persistent-keepalive = "25"; + }; + }; + wg0-server = { + connection = { + autoconnect = "false"; + id = "wg0-server"; + interface-name = "wg0-server"; + timestamp = "1765706207"; + type = "wireguard"; + uuid = "45a4463f-a008-4c40-be45-5585452959ee"; + }; + ipv4 = { + address1 = "10.8.0.6/32"; + method = "manual"; + }; + ipv6 = { + addr-gen-mode = "default"; + address1 = "fd42:42:42::6/128"; + method = "manual"; + }; + proxy = { }; + wireguard = { + private-key = "$wg0-server_prv"; + }; + "wireguard-peer.HLNNBQypzLWhWE4UFB2zd7bk9pmAC4iWM8qpDeDGwDw=" = { + allowed-ips = "0.0.0.0/0;::/0;"; + endpoint = "213.136.71.18:1194"; + preshared-key = "$wg0-server_pre"; + preshared-key-flags = "0"; + }; + }; + }; + }; + }; +} diff --git a/modules/packages.nix b/modules/packages.nix @@ -0,0 +1,174 @@ +{ pkgs }: +let + fetchSucklessRepo = repo: hash: pkgs.fetchgit { + url = "git://popovic.xyz/${repo}.git"; + inherit hash; + }; + + suckless = with pkgs; { + dwm = dwm.overrideAttrs (old: { + src = fetchSucklessRepo "dwm" "sha256-wG5rs6XnRqsTCmEjPOO4hnrbvnDFVFmZexCwmUu/2ZQ="; + buildInputs = old.buildInputs ++ [ xorg.libxcb ]; + }); + + st = st.overrideAttrs (old: { + src = fetchSucklessRepo "st" "sha256-7vQRrfH8QFIgbD8Grcw2hXBezCboraYUXdMv8CbkK00="; + }); + + dmenu = dmenu.overrideAttrs (old: { + src = fetchSucklessRepo "dmenu" "sha256-6/XItNSFcgnd4QH87l04TKNm22wcgLLleJEqwB12dJ4="; + }); + + slock = slock.overrideAttrs (old: { + src = fetchSucklessRepo "slock" "sha256-i13Aq3xQTML+UVWBTzIL2/sFbRn00GocMgH1sHKeN+Q="; + buildInputs = old.buildInputs ++ (with xorg; [ libXinerama imlib2 libxft ]); + }); + + dwmblocks = dwmblocks.overrideAttrs (old: { + src = fetchSucklessRepo "dwmblocks" "sha256-knhSzTcRadCC1ZFJBE/lnyuDO6L2iW3QSk3sIude4Ik="; + }); + }; +in +with pkgs; { + system = [ + home-manager + nix + just + htop + ]; + + shell = [ + zsh + zsh-fast-syntax-highlighting + zsh-system-clipboard + tmux + neovim + ]; + + cli = [ + pass + ripgrep + fzf + wget + curl + tree + fd + zip + unzip + rsync + bzip2 + killall + zbar + pstree + ]; + + network = [ + whois + nmap + wireguard-tools + nextcloud-client + tigervnc + ]; + + xorg = [ + dunst + libnotify + xclip + feh + redshift + xidlehook + xcompmgr + xdotool + xkblayout-state + devour + power-profiles-daemon + pavucontrol + pamixer + + #fonts + noto-fonts-color-emoji + font-awesome + noto-fonts + ] ++ (with suckless; [ dwm st dmenu slock dwmblocks ]); + + media = [ + mpv + vlc + spotify + gimp + sxiv + inkscape + imagemagick + mediainfo + transmission_4 + ]; + + communication = [ + discord + telegram-desktop + ]; + + fileManagement = [ + nautilus + lf + file + poppler-utils + gnome-epub-thumbnailer + atool + odt2txt + djvulibre + ueberzugpp + zathura + zathuraPkgs.zathura_ps + zathuraPkgs.zathura_cb + zathuraPkgs.zathura_djvu + zathuraPkgs.zathura_pdf_mupdf + ]; + + office = [ + groff + libreoffice-fresh + ]; + + email = [ + neomutt + msmtp + isync + abook + lynx + ]; + + development = [ + # tools + gh + tree-sitter + python313Packages.tiktoken + luajitPackages.jsregexp + + # Debuggers and tools + gdb + + # Language servers + nil + marksman + + # Build tools + cmake + gnumake + gcc + + # Languages and runtimes + nodejs + luarocks + javaPackages.compiler.openjdk25 + lua5_1 + go + ruby + gem + php + julia + python3 + python313Packages.pip + rustup + ]; +} diff --git a/modules/theme.nix b/modules/theme.nix @@ -0,0 +1,24 @@ +{ pkgs, ... }: +{ + dconf.settings."org/gnome/desktop/interface" = { + color-scheme = "prefer-dark"; + gtk-theme = "Adwaita-dark"; + }; + + gtk = { + enable = true; + theme = { + name = "Adwaita-dark"; + package = pkgs.gnome-themes-extra; + }; + gtk2.enable = false; + gtk3.extraConfig.gtk-application-prefer-dark-theme = 1; + gtk4.extraConfig.gtk-application-prefer-dark-theme = 1; + }; + + qt = { + enable = true; + platformTheme.name = "gtk"; + style.name = "adwaita-dark"; + }; +} diff --git a/modules/xdg.nix b/modules/xdg.nix @@ -0,0 +1,20 @@ +{pkgs, ...}: +{ + home.sessionVariables = { + EDITOR = "nvim"; + BROWSER = "firefox"; + TERMINAL = "st"; + FILE_BROWSER = "lf"; + XDG_SESSION_TYPE = "x11"; + XDG_DESKTOP_DIR ="$HOME/desktop"; + XDG_DOWNLOAD_DIR = "$HOME/downloads"; + XDG_PUBLICSHARE_DIR = "$HOME/cloud"; + }; + xdg.enable = true; + + xdg.portal = { + enable = true; + extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + config.common.default = "*"; + }; +} diff --git a/secrets.yaml b/secrets.yaml @@ -0,0 +1,22 @@ +networking: + gajba: ENC[AES256_GCM,data:H4K2HIZ/j3N0HHBc0X9g7paNKotXhzxPP14=,iv:uYCw2kMp1skUfeDKXNN0pfhZ/OpWt2igEmrZ8zgdDVs=,tag:l8u+XGCYnCfPazqopbciZA==,type:str] + wg0-router_prv: ENC[AES256_GCM,data:n1MebQ4/cLAJ2wHfRwG/khYodJguzsMwSq5/Z1GKIf2JlvzpibWem4ugM/g=,iv:vsylHrGJJN81Izj8s5tMz36yKlI7Ir5ky1yGzPIGavk=,tag:l0Ep3Y3VHvHomTgOHo66yw==,type:str] + wg0-ponnect_prv: ENC[AES256_GCM,data:qRZOCzRM5aLF930Q9wMG4A+OQfHtypzWOWeC7r/OBNd7N+M7pzBOvJb0iLk=,iv:mKbXHRMVgdSPVBIXULAf4Xx1s0GfDFs547dj0xRS3Ho=,tag:VvKzHyBqmKFK4rCdT5QrqQ==,type:str] + wg0-ponnect_pre: ENC[AES256_GCM,data:HCdXc4nin8ixFoHeRmQ/05hDLSE7NhVbLC1ggwWPxry8bEwWhlxZ26jJaT0=,iv:C+1t2AKMKuTX371qWh6WNCdoLVDRYnAJ2MHqE0syysw=,tag:U09X1B2PDrbQ9pFKubsSGg==,type:str] + wg0-server_prv: ENC[AES256_GCM,data:5BWcK3IsMGOxcQ3gQO6zDZk4ZFXt9c1E+3bQ4WlS+62HF4RLAsW13ODuJIg=,iv:Qzie7d6J+zwW7xR4OsS8wG4fjoB7LmmP0qxJMHHdI3k=,tag:3T03q41F9GaGexphS+tFsQ==,type:str] + wg0-server_pre: ENC[AES256_GCM,data:fhnKaLxt/yV64wPa+nML+Fa6FZ8c0iqirSUbXe/FyyTE8ZBCimzvXanizEc=,iv:mY1rJcpy6aG5zm4gUhtvw/h4KHVL3YlOCOPIbJHr4zY=,tag:8+KY5hkwored7TGRJn3fZA==,type:str] +sops: + age: + - recipient: age1u0qxd3jqhmmq0r0n6n8xgwmxcvlh2tptjcwdznw2vfxcje006s7s07w6jq + enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA4c1BkSFVaajVmenlVQVgz + RFZBT3V4NTJqR1Q3TXJ0VGpzVUpwcHZaNEJ3CjlNOWVJWjYvcHcraW9ZQlpGQlJZ + QUFLVTdIRUNkNDNnWjM2SmR2T3lZeUEKLS0tIG9NRXh5R2xtVXc1WkNwbXJMaVpP + azBYbXd6R2tnSDZxckNVUDN4K1FhS2MKIAJUtmMR8w/2SqT42byp0bN6Dcn0g18P + FUgHv4/BhRooHFj0k8yok6yW63inJ7D0bTMaq7QxO/m6mojOgCIsJw== + -----END AGE ENCRYPTED FILE----- + lastmodified: "2026-01-01T01:28:57Z" + mac: ENC[AES256_GCM,data:TIAxjsmU0f1PvBtHXcPylLp6VJ1VEvvfHoinFVcsogzYJ0EcQ8DYMbThVp1umFgIIQtmDrJqWbI7LKYeKL1fwjw6u4ZNZWAdTPupb1d/E+lPU1svFPVrU3UbF0akzeoM9U6yAUQjZUKZaO3ByR/dAOQCWaXe7fG/8OzkjE1FFpQ=,iv:sqcIdPcaEnLbEh4goDnvl2qt4VLeN3B1XcW35+4ATZc=,tag:3GL7dPik0XpCZ6MLA2ZvmA==,type:str] + unencrypted_suffix: _unencrypted + version: 3.11.0 diff --git a/system/disk/disk-vm.nix b/system/disk/disk-vm.nix @@ -0,0 +1,40 @@ +{ + disko.devices = { + disk = { + my-disk = { + device = "/dev/vda"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + ESP = { + type = "EF00"; + size = "512M"; + content = { + mountpoint = "/boot"; + type = "filesystem"; + format = "vfat"; + mountOptions = [ "umask=0077" ]; + }; + }; + swap = { + size = "8G"; + content = { + type ="swap"; + resumeDevice = true; + }; + }; + root = { + size = "100%"; + content = { + mountpoint = "/"; + type = "filesystem"; + format = "ext4"; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/system/hardware/hardware-frame.nix b/system/hardware/hardware-frame.nix @@ -0,0 +1,37 @@ +# 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" "thunderbolt" "usbhid" "usb_storage" ]; + boot.initrd.kernelModules = [ "dm-snapshot" ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { + device = "/dev/disk/by-uuid/69e780cc-9ee1-4987-99eb-6c452ae66855"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { + device = "/dev/disk/by-uuid/7000-6EA2"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = + [ + { device = "/dev/disk/by-uuid/fb532c05-67d1-4983-a518-e2616369b6ae"; } + ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/system/hardware/hardware-vm.nix b/system/hardware/hardware-vm.nix @@ -0,0 +1,16 @@ +# 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 + "/profiles/qemu-guest.nix") ]; + + boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sr_mod" "virtio_blk" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/system/host/host-frame.nix b/system/host/host-frame.nix @@ -0,0 +1,156 @@ +{ + pkgs, + hostName, + ... +} : +{ + imports = + [ + ../../users/root.nix + ../../modules/nix_settings.nix + ../../modules/nm.nix + ]; + + sops.defaultSopsFile = ../../secrets.yaml; + sops.defaultSopsFormat = "yaml"; + sops.age.keyFile = "/home/mika/.config/sops/age/keys.txt"; + + system.stateVersion = "25.11"; + + # vm + virtualisation.vmVariant = { + virtualisation = { + diskSize = 50 * 1028; # 50 GB + memorySize = 16 * 1028; # 16 GB + cores = 6; + resolution = { + x = 1600; + y = 900; + }; + qemu.options = [ + "-enable-kvm" + "-cpu host" + "-display gtk,zoom-to-fit=false" + "-vga virtio" + ]; + }; + }; + + # boot + boot = { + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + kernelPackages = pkgs.linuxPackages_latest; + kernelParams = [ + "loglevel=3" + "nowatchdog" + "migrations=auto" + "amd_iommu=on" + "iommu=pt" + "rtc_cmos.use_acpi_alarm=1" + ]; + }; + + # netowrk + networking.hostName = "${hostName}"; + + # time/locale + time.timeZone = "Europe/Lisbon"; + i18n.defaultLocale = "en_US.UTF-8"; + + # programs + programs = { + zsh = { + enable = true; + enableCompletion = false; + }; + dconf.enable = true; + gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + }; + + # users + users = { + users = { + mika = { + isNormalUser = true; + extraGroups = [ "wheel" ]; + initialPassword = "123"; + shell = pkgs.zsh; + }; + root = { + shell = pkgs.zsh; + }; + }; + }; + security.sudo.wheelNeedsPassword = false; + + # services + services = { + upower.enable = true; + fwupd.enable = true; + openssh.enable = true; + power-profiles-daemon.enable = true; + + pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + xserver = { + enable = true; + displayManager.startx = { + enable = true; + }; + }; + + getty.autologinUser = "mika"; + + logind.settings.Login = { + SleepOperation = "suspend-then-hibernate"; + HandlePowerKey = "suspend-then-hibernate"; + HandleLidSwitch = "suspend-then-hibernate"; + HandlePowerKeyLongPress = "poweroff"; + }; + + }; + systemd.sleep.extraConfig = '' + HibernateDelaySec=20m + ''; + + # hardware + hardware.bluetooth.enable = true; + security.rtkit.enable = true; + + # packages + nixpkgs.config.allowUnfree = true; + environment.systemPackages = with pkgs; [ + neovim + wget + git + curl + tree + coreutils + stdenv + dbus-broker + pciutils + util-linux + pstree + + upower + lm_sensors + acpilight + ]; + + # fonts + fonts.packages = with pkgs; [ + terminus_font + ]; +} + diff --git a/system/host/host-server.nix b/system/host/host-server.nix @@ -0,0 +1,129 @@ +{ + pkgs, + hostName, + ... +} : +{ + imports = + [ + ../../users/root.nix + ../../modules/nix_settings.nix + ]; + + system.stateVersion = "25.11"; + + # vm + virtualisation.vmVariant = { + virtualisation = { + diskSize = 50 * 1028; # 50 GB + memorySize = 16 * 1028; # 16 GB + cores = 6; + resolution = { + x = 1600; + y = 900; + }; + qemu.options = [ + "-enable-kvm" + "-cpu host" + "-display gtk,zoom-to-fit=false" + "-vga virtio" + ]; + forwardPorts = [ + { from = "host"; host.port = 2222; guest.port = 61745; } + ]; + }; + }; + + # boot + boot = { + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + kernelPackages = pkgs.linuxPackages_latest; + kernelParams = [ + "loglevel=3" + "nowatchdog" + "migrations=auto" + ]; + }; + + # netowrk + networking = { + hostName = "${hostName}"; + networkmanager.enable = true; + }; + + # time/locale + i18n.defaultLocale = "en_US.UTF-8"; + + # users + users.users = { + r2d2 = { + isNormalUser = true; + extraGroups = [ "wheel" ]; + initialPassword = "123"; + shell = pkgs.zsh; + ignoreShellProgramCheck = true; + openssh.authorizedKeys.keys = [ + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCjUjMsWMlPY0YNtSPMdmCIBnNHzT8PdN7Gc0a+RuQg2slRe7Gh1HgRPAX0pg3CIh0oNTDfuOGrOTcl/SdX+WdhChZJkcoKiDKPB98TCioJnYF9k1vouhx0P3soN/Bd4gQEd2Vx0+XTQzmK9VhFtBoNQt9Eh90ZGCrBtsfPB9odDuymotI9FPXSboUPAe3WttzzUeTpY3JurInHW2rCQsYIvti0ZGwdm6EwVjN+6aZ300uT6olrAc+6csyOZrdQQXm1G35x6MLKpYoyFoGQYkS/4vvHMbzj9F9zp8Y+aUZ0+iQvK2owhS7auzELuO2/nqwODCHXLxn8Sg15r0XJn4tVvgAxqvtG+i0SIeqjfrzsu+fg1n2tJGCAq96nyOCruYHcmLOQ0Z9d+hf04Y1thS4GCtNmqT/RGdboDI1xEmg3PaUUPgaL7pCiG+6OtTC/4F0/f/m6neRn219UAPshI7LZKT1aRsBCqKRnEmbUSKWa0ilDntCDsST2VcHwKk0Tjnb+UIvjoHJ2qQQao7i1dmzZ8oUu/9wpyt5aaNxxvcm6qfjht1TGw/1RBHyhOsPNrlHpzUtzbvDdVwHfO0/6eksb73kJ7WMqU+FutbF5ekogcUzkYMo6G7O6hDMFb+w405ontM5syg6OcYWTq2+kllbKiGETxQpizzuWKERCExpHWQ== mika@frame" + ]; + }; + root = { + shell = pkgs.zsh; + ignoreShellProgramCheck = true; + }; + }; + security.sudo.wheelNeedsPassword = false; + + # services + services = { + fwupd.enable = true; + automatic-timezoned.enable = true; + openssh = { + enable = true; + ports = [ 61745 ]; + settings = { + PermitRootLogin = "no"; + PasswordAuthentication = false; + }; + }; + }; + + # programs + programs = { + zsh.enable = false; + dconf.enable = true; + gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + }; + + # packages + nixpkgs.config.allowUnfree = true; + environment.systemPackages = with pkgs; [ + neovim + wget + zsh + git + curl + tree + coreutils + stdenv + dbus-broker + pciutils + util-linux + pstree + + upower + xsensors + acpilight + ]; + + # fonts + fonts.packages = with pkgs; [ + terminus_font + ]; +} + diff --git a/users/mika.nix b/users/mika.nix @@ -0,0 +1,73 @@ +{ + config, + pkgs, + lib, + standalone, + + ... +}: +let + packageSets = import ../modules/packages.nix { inherit pkgs; }; + + link = config.lib.file.mkOutOfStoreSymlink; + inherit (import ../lib/dotfiles.nix) dotfiles; + configDirs = builtins.attrNames (builtins.readDir "${dotfiles}/.config"); +in +{ + home = { + username = "mika"; + homeDirectory = "/home/mika"; + stateVersion = "25.11"; + }; + + + imports = if standalone + then + [ + ../modules/xdg.nix + ../modules/nix_settings.nix + ../modules/mbsync_timer.nix + ../modules/theme.nix + ../modules/firefox.nix + ] + else + [ + ../modules/mbsync_timer.nix + ../modules/theme.nix + ../modules/firefox.nix + ]; + + nixpkgs.config.allowUnfree = true; + home.packages = with packageSets; lib.flatten [ + system + shell + cli + xorg + media + fileManagement + network + office + email + development + ]; + + home.file = { + ".zshenv".source = link "${dotfiles}/.zshenv"; + ".local" = { + source = link "${dotfiles}/.local"; + recursive = true; + }; + ".config/nix-zsh-plugins.zsh".text = '' + source ${pkgs.zsh-fast-syntax-highlighting}/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh + source ${pkgs.zsh-system-clipboard}/share/zsh/zsh-system-clipboard/zsh-system-clipboard.zsh + ''; + }; + + xdg.configFile = lib.genAttrs configDirs (dir: { + source = link "${dotfiles}/.config/${dir}"; + recursive = true; + }); + +} + + diff --git a/users/r2d2.nix b/users/r2d2.nix @@ -0,0 +1,51 @@ +{ + config, + pkgs, + lib, + + ... +}: +let + packageSets = import ../modules/packages.nix { inherit pkgs; }; + + link = config.lib.file.mkOutOfStoreSymlink; + inherit (import ../lib/dotfiles.nix) dotfiles; + configDirs = builtins.attrNames (builtins.readDir "${dotfiles}/.config"); +in +{ + home = { + username = "r2d2"; + homeDirectory = "/home/r2d2"; + stateVersion = "25.11"; + }; + + nixpkgs.config.allowUnfree = true; + home.packages = (with packageSets; lib.flatten [ + system + shell + cli + network + development + ]) ++ [ pkgs.lf ]; + + + home.file = let + mkDotfileLink = path: { + source = config.lib.file.mkOutOfStoreSymlink "${dotfiles}/${path}"; + recursive = true; + }; + in { + ".zshenv" = mkDotfileLink ".zshenv"; + ".config/zsh/.zshrc" = mkDotfileLink ".config/zsh/.zshrc"; + ".config/shell" = mkDotfileLink ".config/shell"; + ".config/git" = mkDotfileLink ".config/git"; + ".config/nvim" = mkDotfileLink ".config/nvim"; + ".config/nix-zsh-plugins.zsh".text = '' + source ${pkgs.zsh-fast-syntax-highlighting}/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh + source ${pkgs.zsh-system-clipboard}/share/zsh/zsh-system-clipboard/zsh-system-clipboard.zsh + ''; + ".local" = mkDotfileLink ".local"; + }; +} + + diff --git a/users/root.nix b/users/root.nix @@ -0,0 +1,47 @@ +{ + ... +}: let + inherit ( import ../lib/dotfiles.nix ) dotfiles; +in { + environment.pathsToLink = [ + "/share/applications" + "/share/xdg-desktop-portal" + ]; + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + + + users.root = { pkgs, config, ... }: { + home.username = "root"; + home.homeDirectory = "/root"; + home.stateVersion = "25.11"; + + imports = [ + ../modules/xdg.nix + ]; + + home.file = let + mkDotfileLink = path: { + source = config.lib.file.mkOutOfStoreSymlink "${dotfiles}/${path}"; + recursive = true; + }; + in { + # zsh no plugins + ".zshenv" = mkDotfileLink ".zshenv"; + ".config/zsh/.zshrc" = mkDotfileLink ".config/zsh/.zshrc"; + ".config/shell/bindings" = mkDotfileLink ".config/shell/bindings"; + ".config/shell/profile" = mkDotfileLink ".config/shell/profile"; + ".config/shell/aliases" = mkDotfileLink ".config/shell/aliases"; + ".config/git" = mkDotfileLink ".config/git"; + + ".local/bin/.keep".text = ""; + + # nvim no plugins + ".config/nvim/init.lua" = mkDotfileLink ".config/nvim/init.lua"; + ".config/nvim/after" = mkDotfileLink ".config/nvim/after"; + ".config/nvim/lua/config" = mkDotfileLink ".config/nvim/lua/config"; + }; + }; + }; +}