commit c09b5d4043e6be58c6967e78862791184d0cba4e Author: kenny Date: Sun Jun 29 14:43:56 2025 +0300 Initial commit of flake-based NixOS config for the whole haus diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..503074f --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +# Ignore build artifacts +/result +/result-* + +# Ignore temporary files +*.swp +*~ diff --git a/README.md b/README.md new file mode 100644 index 0000000..96bd0e1 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Puter's NixOS Config + +This is the config. diff --git a/current b/current new file mode 100644 index 0000000..7072f5f --- /dev/null +++ b/current @@ -0,0 +1,570 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1751011381, + "narHash": "sha256-krGXKxvkBhnrSC/kGBmg5MyupUUT5R6IBCLEzx9jhMM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "30e2e2857ba47844aa71991daa6ed1fc678bcbb7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} +{ + description = "My modular NixOS configuration"; + + inputs = { + # nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + # unstable.url = "github:NixOS/nixpkgs/nixos-unstable" + # Add other flake inputs if needed + }; + + outputs = { self, nixpkgs, ... }@inputs: { + nixosConfigurations = { + puter = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ ./hosts/puter/default.nix ]; + specialArgs = { inherit inputs; }; + }; + }; + }; +} +update-config: + alejandra . + nix flake update + git add . + git commit + sudo nixos-rebuild switch --upgrade --flake ~/flakescfg + git push + +update: + nix flake update + git add . + git commit -m "nix flake update" + sudo nixos-rebuild switch --upgrade --flake ~/flakescfg + git push + +update-and-reboot: + nix flake update + git add . + git commit -m "nix flake update" + sudo nixos-rebuild boot --upgrade --flake ~/flakescfg + git push + +update-config-and-reboot: + alejandra . + nix flake update + git add . + git commit + sudo nixos-rebuild boot --upgrade --flake ~/flakescfg + git push + +upgrade: + sudo nixos-rebuild switch --upgrade --flake ~/flakescfg +# Puter's NixOS Config + +This is the config. +{ + config, + pkgs, + ... +}: { + systemd.timers."kondo" = { + wantedBy = ["timers.target"]; + timerConfig = { + #OnBootSec = "5m"; + #OnUnitActiveSec = "5m"; + Unit = "kondo.service"; + OnCalendar = "weekly"; + Persistent = true; + }; + }; + + systemd.services."kondo" = { + script = '' + kondo --all --ignored-dirs dev/current + ''; + serviceConfig = { + Type = "oneshot"; + User = "root"; + }; + }; +} +{ + config, + pkgs, + ... +}: { + imports = [ + ./hardware-configuration.nix + ./cronjobs.nix + ./syncthing.nix + ./packages.nix + ./de/default.nix + ../../modules/common/nix.nix + ../../modules/common/networking.nix + ../../modules/common/shell.nix + ../../modules/common/utils.nix + ]; + networking.hostName = "puter"; + # This will be overridden by system/default.nix + system.stateVersion = "24.05"; +} +# 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 = ["xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-intel" "wl"]; + boot.extraModulePackages = [config.boot.kernelPackages.broadcom_sta]; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/19a0aa4c-8d49-4545-9ed6-cd4a952f9353"; + fsType = "ext4"; + }; + + boot.initrd.luks.devices."luks-08992355-1404-44dc-9bb4-fd32f1d0b62d".device = "/dev/disk/by-uuid/08992355-1404-44dc-9bb4-fd32f1d0b62d"; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/F54E-7011"; + fsType = "vfat"; + options = ["fmask=0022" "dmask=0022"]; + }; + + swapDevices = [{device = "/dev/disk/by-uuid/c9b7b195-d072-4574-8e39-a5e4f90ca84d";}]; + + # 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..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.ens9.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = + lib.mkDefault config.hardware.enableRedistributableFirmware; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.initrd.luks.devices."luks-d27fc6c5-7edd-4c18-ab70-3ca02a28abcc".device = "/dev/disk/by-uuid/d27fc6c5-7edd-4c18-ab70-3ca02a28abcc"; + + nixpkgs.config.packageOverrides = pkgs: { + intel-vaapi-driver = + pkgs.intel-vaapi-driver.override {enableHybridCodec = true;}; + }; + + hardware.opengl = { + enable = true; + extraPackages = with pkgs; [ + intel-media-driver + intel-vaapi-driver + libvdpau-va-gl + ]; + }; + + environment.sessionVariables = {LIBVA_DRIVER_NAME = "iHD";}; + + hardware.facetimehd = { + enable = true; + withCalibration = true; + }; + + services.logind = { + # lidSwitch = "ignore"; + # lidSwitchDocked = "ignore"; + # lidSwitchExternalPower = "ignore"; + extraConfig = '' + HandlePowerKey=ignore + HandleSuspendKey=ignore + ''; + # This goes in the extraConfig section IdleAction=ignore + }; + environment.systemPackages = with pkgs; [ + mbpfan + thermald + ]; + + boot.kernelModules = ["wl"]; + boot.blacklistedKernelModules = ["b43" "ssb" "brcmfmac" "brcmsmac" "bcma"]; + boot.extraModulePackages = [config.boot.kernelPackages.broadcom_sta]; +} +{ + config, + pkgs, + ... +}: { + users.users.user = { + isNormalUser = true; + description = "user"; + extraGroups = ["networkmanager" "wheel" "video" "libvirtd"]; + nixpkgs.config = {chromium = {enableWideVine = true;};}; + packages = with pkgs; [ + # stuff needed by neovim + fzf + lazygit + tree-sitter + neovim + mcfly + luajitPackages.luarocks-nix + + # Dev stuff, most of it might be replaced by devenvs later on + ghostty + tealdeer + vscodium + gcc + python + alejandra + starship + devenv + nodejs + mermaid-cli + rustup + delta + just + kondo + + # Productivity apps + obsidian + onlyoffice-desktopeditors + keepassxc + evolution + signal-desktop + anki-bin + pomodoro-gtk + ticker + newsboat + + # web browsers + ungoogled-chromium + tor-browser-bundle-bin + transmission_4-gtk + + # multimedia + vlc + mpv + yt-dlp + freetube + ]; + }; + #ciscoPacketTracer8 + #parallel-disk-usage +} +{ + config, + pkgs, + ... +}: { + services.syncthing = { + enable = true; + openDefaultPorts = true; + dataDir = "/home/user/Documents/syncthing/"; + configDir = "/home/user/.config/syncthing"; + user = "user"; + # Optional: GUI credentials (can be set in the browser instead if you don't want plaintext credentials in your configuration.nix file) + # or the password hash can be generated with "syncthing generate --config --gui-password=" + settings.gui = { + user = "user"; + password = "user"; + }; + settings = { + devices = { + "phone" = { + id = "N3RII7R-4YOKJ46-HY6NSTD-TPE7SW4-N66CWVQ-J2JVW7E-NARRMBF-JG27YQ7"; + }; + }; + folders = { + "brain_zero" = { + # Name of folder in Syncthing, also the folder ID + path = "/home/user/brain_zero/"; # Which folder to add to Syncthing + devices = ["phone"]; # Which devices to share the folder with + }; + }; + }; + }; +} +{ + config, + pkgs, + ... +}: { + # Enable with systemctl --user enable --now docker + virtualisation.docker = { + enable = true; + rootless = { + enable = true; + setSocketVariable = true; + }; + }; +} +{ + config, + pkgs, + ... +}: { + virtualisation.libvirtd = { + enable = true; + qemu = { + package = pkgs.qemu_kvm; + runAsRoot = true; + swtpm.enable = true; + ovmf = { + enable = true; + packages = [ + (pkgs.OVMF.override { + secureBoot = true; + tpmSupport = true; + }).fd + ]; + }; + }; + }; + + environment.systemPackages = with pkgs; [ + virt-manager + qemu_kvm + ]; +} +{ + config, + pkgs, + ... +}: { + networking.networkmanager.enable = true; + time.timeZone = "Europe/Bucharest"; + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "ro_RO.UTF-8"; + LC_IDENTIFICATION = "ro_RO.UTF-8"; + LC_MEASUREMENT = "ro_RO.UTF-8"; + LC_MONETARY = "ro_RO.UTF-8"; + LC_NAME = "ro_RO.UTF-8"; + LC_NUMERIC = "ro_RO.UTF-8"; + LC_PAPER = "ro_RO.UTF-8"; + LC_TELEPHONE = "ro_RO.UTF-8"; + LC_TIME = "ro_RO.UTF-8"; + }; + + environment.systemPackages = with pkgs; [ + torsocks + ]; + + # 9050,9063,8118(HTTP) + services.tor = { + enable = true; + client.enable = true; + openFirewall = true; + settings = {ControlPort = 9051;}; + }; +} +{ + config, + pkgs, + ... +}: { + nixpkgs.config.allowUnfree = true; + nix.settings.experimental-features = ["nix-command" "flakes"]; + nix.extraOptions = '' + trusted-users = root user + ''; +} +{ + config, + pkgs, + ... +}: { + environment.systemPackages = with pkgs; [ + lynis + ]; +} +{ + config, + pkgs, + lib, + ... +}: { + environment.variables.EDITOR = "nvim"; + + users.users.user.shell = pkgs.bash; + environment.shells = with pkgs; [bash]; + programs.bash = { + interactiveShellInit = '' + if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]] + then + shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION="" + exec ${pkgs.fish}/bin/fish $LOGIN_OPTION + fi + ''; + }; + programs.fish.enable = true; + programs.starship = { + enable = true; + settings = { + add_newline = true; + command_timeout = 1300; + scan_timeout = 50; + format = '' + $all$nix_shell$nodejs$lua$golang$rust$php$git_branch$git_commit$git_state$git_status + $username$hostname$directory''; + character = { + success_symbol = "[](bold green) "; + error_symbol = "[✗](bold red) "; + }; + }; + }; + #programs.zsh = { + # enable = true; + # enableCompletion = true; + # autosuggestions.enable = true; + # syntaxHighlighting.enable = true; + # + # shellAliases = { + # update = "sudo nixos-rebuild switch"; + # upgrade = "sudo nixos-rebuild switch --upgrade"; + # proxy-grabber = + # "if [ $# -eq 0 ]; then torsocks curl -sL https://cdn.jsdelivr.net/gh/proxifly/free-proxy-list@main/proxies/all/data.txt else countrycode=$(echo $1 | tr '[:lower:]' '[:upper:]') torsocks curl -sL https://cdn.jsdelivr.net/gh/proxifly/free-proxy-list@main/proxies/countries/$countrycode/data.txt fi"; + # usbdiff = + # "lsblk > diff1 && echo 'SLEEPING 5...' && sleep 5 && lsblk > diff2 && diff diff1 diff2 && rm diff1 diff2"; + # }; + # + # oh-my-zsh = { + # enable = true; + # plugins = [ "git" ]; + # theme = "clean"; + # }; + #}; +} +{ + config, + pkgs, + ... +}: { + programs.neovim = {defaultEditor = true;}; + environment.systemPackages = with pkgs; [ + pciutils + btop + nload + htop + nethogs + uutils-coreutils-noprefix + nvim + git + curl + bat + eza + dua + ripgrep + dig + fd + proxychains-ng + unzip + wget + ]; +} +{ + config, + pkgs, + ... +}: { + imports = [./gnome.nix ./sway.nix]; + + services.xserver = { + enable = true; + displayManager.gdm.enable = true; + layout = "us"; + xkbVariant = ""; + }; + + # Enable sound with pipewire. + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + # If you want to use JACK applications, uncomment this + #jack.enable = true; + + # use the example session manager (no others are packaged yet so this is en> + # no need to redefine it in your config for now) + #media-session.enable = true; + }; +} +{ + config, + pkgs, + ... +}: { + services.xserver.desktopManager.gnome.enable = true; + programs.kdeconnect.enable = true; + + environment.systemPackages = with pkgs; [ + gnome-tweaks + # GNOME-specific packages + bustle + collision + commit + dialect + fretboard + #gaphor + hieroglyphic + junction + keypunch + letterpress + gnome-obfuscate + shortwave + solanum + wike + commit + wl-clipboard + gnomeExtensions.gsconnect + gnomeExtensions.astra-monitor + lm_sensors + iotop + gtop + wirelesstools + ]; +} +{ + config, + pkgs, + ... +}: { + programs.sway = { + enable = true; + wrapperFeatures.gtk = true; + }; + + environment.systemPackages = with pkgs; [ + mako # Notification daemon for Sway + playerctl + # Other Sway-specific packages + ]; + programs.light.enable = true; # For brightness control +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..7345cb3 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1751011381, + "narHash": "sha256-krGXKxvkBhnrSC/kGBmg5MyupUUT5R6IBCLEzx9jhMM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "30e2e2857ba47844aa71991daa6ed1fc678bcbb7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..470a1b4 --- /dev/null +++ b/flake.nix @@ -0,0 +1,20 @@ +{ + description = "My modular NixOS configuration"; + + inputs = { + # nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + # unstable.url = "github:NixOS/nixpkgs/nixos-unstable" + # Add other flake inputs if needed + }; + + outputs = { self, nixpkgs, ... }@inputs: { + nixosConfigurations = { + puter = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ ./hosts/puter/default.nix ]; + specialArgs = { inherit inputs; }; + }; + }; + }; +} diff --git a/hosts/puter/cronjobs.nix b/hosts/puter/cronjobs.nix new file mode 100644 index 0000000..6bcbed7 --- /dev/null +++ b/hosts/puter/cronjobs.nix @@ -0,0 +1,26 @@ +{ + config, + pkgs, + ... +}: { + systemd.timers."kondo" = { + wantedBy = ["timers.target"]; + timerConfig = { + #OnBootSec = "5m"; + #OnUnitActiveSec = "5m"; + Unit = "kondo.service"; + OnCalendar = "weekly"; + Persistent = true; + }; + }; + + systemd.services."kondo" = { + script = '' + kondo --all --ignored-dirs dev/current + ''; + serviceConfig = { + Type = "oneshot"; + User = "root"; + }; + }; +} diff --git a/hosts/puter/de/default.nix b/hosts/puter/de/default.nix new file mode 100644 index 0000000..fcc60bb --- /dev/null +++ b/hosts/puter/de/default.nix @@ -0,0 +1,30 @@ +{ + config, + pkgs, + ... +}: { + imports = [./gnome.nix ./sway.nix]; + + services.xserver = { + enable = true; + displayManager.gdm.enable = true; + layout = "us"; + xkbVariant = ""; + }; + + # Enable sound with pipewire. + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + # If you want to use JACK applications, uncomment this + #jack.enable = true; + + # use the example session manager (no others are packaged yet so this is en> + # no need to redefine it in your config for now) + #media-session.enable = true; + }; +} diff --git a/hosts/puter/de/gnome.nix b/hosts/puter/de/gnome.nix new file mode 100644 index 0000000..d72f2a4 --- /dev/null +++ b/hosts/puter/de/gnome.nix @@ -0,0 +1,35 @@ +{ + config, + pkgs, + ... +}: { + services.xserver.desktopManager.gnome.enable = true; + programs.kdeconnect.enable = true; + + environment.systemPackages = with pkgs; [ + gnome-tweaks + # GNOME-specific packages + bustle + collision + commit + dialect + fretboard + #gaphor + hieroglyphic + junction + keypunch + letterpress + gnome-obfuscate + shortwave + solanum + wike + commit + wl-clipboard + gnomeExtensions.gsconnect + gnomeExtensions.astra-monitor + lm_sensors + iotop + gtop + wirelesstools + ]; +} diff --git a/hosts/puter/de/sway.nix b/hosts/puter/de/sway.nix new file mode 100644 index 0000000..ba3e669 --- /dev/null +++ b/hosts/puter/de/sway.nix @@ -0,0 +1,17 @@ +{ + config, + pkgs, + ... +}: { + programs.sway = { + enable = true; + wrapperFeatures.gtk = true; + }; + + environment.systemPackages = with pkgs; [ + mako # Notification daemon for Sway + playerctl + # Other Sway-specific packages + ]; + programs.light.enable = true; # For brightness control +} diff --git a/hosts/puter/default.nix b/hosts/puter/default.nix new file mode 100644 index 0000000..ce8c0d6 --- /dev/null +++ b/hosts/puter/default.nix @@ -0,0 +1,21 @@ +{ + config, + pkgs, + ... +}: { + imports = [ + ./hardware-configuration.nix + ./cronjobs.nix + ./syncthing.nix + ./packages.nix + ./de/default.nix + ../../modules/common/nix.nix + ../../modules/common/networking.nix + ../../modules/common/shell.nix + ../../modules/common/utils.nix + ../../modules/common/security.nix + ]; + networking.hostName = "puter"; + # This will be overridden by system/default.nix + system.stateVersion = "24.05"; +} diff --git a/hosts/puter/hardware-configuration.nix b/hosts/puter/hardware-configuration.nix new file mode 100644 index 0000000..500d413 --- /dev/null +++ b/hosts/puter/hardware-configuration.nix @@ -0,0 +1,87 @@ +# 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 = ["xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-intel" "wl"]; + boot.extraModulePackages = [config.boot.kernelPackages.broadcom_sta]; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/19a0aa4c-8d49-4545-9ed6-cd4a952f9353"; + fsType = "ext4"; + }; + + boot.initrd.luks.devices."luks-08992355-1404-44dc-9bb4-fd32f1d0b62d".device = "/dev/disk/by-uuid/08992355-1404-44dc-9bb4-fd32f1d0b62d"; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/F54E-7011"; + fsType = "vfat"; + options = ["fmask=0022" "dmask=0022"]; + }; + + swapDevices = [{device = "/dev/disk/by-uuid/c9b7b195-d072-4574-8e39-a5e4f90ca84d";}]; + + # 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..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.ens9.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = + lib.mkDefault config.hardware.enableRedistributableFirmware; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.initrd.luks.devices."luks-d27fc6c5-7edd-4c18-ab70-3ca02a28abcc".device = "/dev/disk/by-uuid/d27fc6c5-7edd-4c18-ab70-3ca02a28abcc"; + + nixpkgs.config.packageOverrides = pkgs: { + intel-vaapi-driver = + pkgs.intel-vaapi-driver.override {enableHybridCodec = true;}; + }; + + hardware.opengl = { + enable = true; + extraPackages = with pkgs; [ + intel-media-driver + intel-vaapi-driver + libvdpau-va-gl + ]; + }; + + environment.sessionVariables = {LIBVA_DRIVER_NAME = "iHD";}; + + hardware.facetimehd = { + enable = true; + withCalibration = true; + }; + + services.logind = { + # lidSwitch = "ignore"; + # lidSwitchDocked = "ignore"; + # lidSwitchExternalPower = "ignore"; + extraConfig = '' + HandlePowerKey=ignore + HandleSuspendKey=ignore + ''; + # This goes in the extraConfig section IdleAction=ignore + }; + environment.systemPackages = with pkgs; [ + mbpfan + thermald + ]; + + boot.kernelModules = ["wl"]; + boot.blacklistedKernelModules = ["b43" "ssb" "brcmfmac" "brcmsmac" "bcma"]; + boot.extraModulePackages = [config.boot.kernelPackages.broadcom_sta]; +} diff --git a/hosts/puter/packages.nix b/hosts/puter/packages.nix new file mode 100644 index 0000000..62029e0 --- /dev/null +++ b/hosts/puter/packages.nix @@ -0,0 +1,61 @@ +{ + config, + pkgs, + ... +}: { + users.users.user = { + isNormalUser = true; + description = "user"; + extraGroups = ["networkmanager" "wheel" "video" "libvirtd"]; + nixpkgs.config = {chromium = {enableWideVine = true;};}; + packages = with pkgs; [ + # stuff needed by neovim + fzf + lazygit + tree-sitter + neovim + mcfly + luajitPackages.luarocks-nix + + # Dev stuff, most of it might be replaced by devenvs later on + ghostty + tealdeer + vscodium + gcc + python + alejandra + starship + devenv + nodejs + mermaid-cli + rustup + delta + just + kondo + + # Productivity apps + obsidian + onlyoffice-desktopeditors + keepassxc + evolution + signal-desktop + anki-bin + pomodoro-gtk + ticker + newsboat + + # web browsers + ungoogled-chromium + tor-browser-bundle-bin + transmission_4-gtk + + # multimedia + vlc + mpv + yt-dlp + freetube + ]; + }; + #ciscoPacketTracer8 + #parallel-disk-usage +} diff --git a/hosts/puter/syncthing.nix b/hosts/puter/syncthing.nix new file mode 100644 index 0000000..3e86939 --- /dev/null +++ b/hosts/puter/syncthing.nix @@ -0,0 +1,33 @@ +{ + config, + pkgs, + ... +}: { + services.syncthing = { + enable = true; + openDefaultPorts = true; + dataDir = "/home/user/Documents/syncthing/"; + configDir = "/home/user/.config/syncthing"; + user = "user"; + # Optional: GUI credentials (can be set in the browser instead if you don't want plaintext credentials in your configuration.nix file) + # or the password hash can be generated with "syncthing generate --config --gui-password=" + settings.gui = { + user = "user"; + password = "user"; + }; + settings = { + devices = { + "phone" = { + id = "N3RII7R-4YOKJ46-HY6NSTD-TPE7SW4-N66CWVQ-J2JVW7E-NARRMBF-JG27YQ7"; + }; + }; + folders = { + "brain_zero" = { + # Name of folder in Syncthing, also the folder ID + path = "/home/user/brain_zero/"; # Which folder to add to Syncthing + devices = ["phone"]; # Which devices to share the folder with + }; + }; + }; + }; +} diff --git a/justfile b/justfile new file mode 100644 index 0000000..0c8a0cf --- /dev/null +++ b/justfile @@ -0,0 +1,32 @@ +update-config: + alejandra . + nix flake update + git add . + git commit + sudo nixos-rebuild switch --upgrade --flake ~/flakescfg + git push + +update: + nix flake update + git add . + git commit -m "nix flake update" + sudo nixos-rebuild switch --upgrade --flake ~/flakescfg + git push + +update-and-reboot: + nix flake update + git add . + git commit -m "nix flake update" + sudo nixos-rebuild boot --upgrade --flake ~/flakescfg + git push + +update-config-and-reboot: + alejandra . + nix flake update + git add . + git commit + sudo nixos-rebuild boot --upgrade --flake ~/flakescfg + git push + +upgrade: + sudo nixos-rebuild switch --upgrade --flake ~/flakescfg diff --git a/modules/common/docker.nix b/modules/common/docker.nix new file mode 100644 index 0000000..31a7bb3 --- /dev/null +++ b/modules/common/docker.nix @@ -0,0 +1,14 @@ +{ + config, + pkgs, + ... +}: { + # Enable with systemctl --user enable --now docker + virtualisation.docker = { + enable = true; + rootless = { + enable = true; + setSocketVariable = true; + }; + }; +} diff --git a/modules/common/libvirt.nix b/modules/common/libvirt.nix new file mode 100644 index 0000000..4dee951 --- /dev/null +++ b/modules/common/libvirt.nix @@ -0,0 +1,28 @@ +{ + config, + pkgs, + ... +}: { + virtualisation.libvirtd = { + enable = true; + qemu = { + package = pkgs.qemu_kvm; + runAsRoot = true; + swtpm.enable = true; + ovmf = { + enable = true; + packages = [ + (pkgs.OVMF.override { + secureBoot = true; + tpmSupport = true; + }).fd + ]; + }; + }; + }; + + environment.systemPackages = with pkgs; [ + virt-manager + qemu_kvm + ]; +} diff --git a/modules/common/networking.nix b/modules/common/networking.nix new file mode 100644 index 0000000..f8b8c64 --- /dev/null +++ b/modules/common/networking.nix @@ -0,0 +1,33 @@ +{ + config, + pkgs, + ... +}: { + networking.networkmanager.enable = true; + time.timeZone = "Europe/Bucharest"; + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "ro_RO.UTF-8"; + LC_IDENTIFICATION = "ro_RO.UTF-8"; + LC_MEASUREMENT = "ro_RO.UTF-8"; + LC_MONETARY = "ro_RO.UTF-8"; + LC_NAME = "ro_RO.UTF-8"; + LC_NUMERIC = "ro_RO.UTF-8"; + LC_PAPER = "ro_RO.UTF-8"; + LC_TELEPHONE = "ro_RO.UTF-8"; + LC_TIME = "ro_RO.UTF-8"; + }; + + environment.systemPackages = with pkgs; [ + torsocks + ]; + + # 9050,9063,8118(HTTP) + services.tor = { + enable = true; + client.enable = true; + openFirewall = true; + settings = {ControlPort = 9051;}; + }; +} diff --git a/modules/common/nix.nix b/modules/common/nix.nix new file mode 100644 index 0000000..8d82b36 --- /dev/null +++ b/modules/common/nix.nix @@ -0,0 +1,11 @@ +{ + config, + pkgs, + ... +}: { + nixpkgs.config.allowUnfree = true; + nix.settings.experimental-features = ["nix-command" "flakes"]; + nix.extraOptions = '' + trusted-users = root user + ''; +} diff --git a/modules/common/security.nix b/modules/common/security.nix new file mode 100644 index 0000000..7441491 --- /dev/null +++ b/modules/common/security.nix @@ -0,0 +1,9 @@ +{ + config, + pkgs, + ... +}: { + environment.systemPackages = with pkgs; [ + lynis + ]; +} diff --git a/modules/common/shell.nix b/modules/common/shell.nix new file mode 100644 index 0000000..d96f41a --- /dev/null +++ b/modules/common/shell.nix @@ -0,0 +1,57 @@ +{ + config, + pkgs, + lib, + ... +}: { + environment.variables.EDITOR = "nvim"; + + users.users.user.shell = pkgs.bash; + environment.shells = with pkgs; [bash]; + programs.bash = { + interactiveShellInit = '' + if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]] + then + shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION="" + exec ${pkgs.fish}/bin/fish $LOGIN_OPTION + fi + ''; + }; + programs.fish.enable = true; + programs.starship = { + enable = true; + settings = { + add_newline = true; + command_timeout = 1300; + scan_timeout = 50; + format = '' + $all$nix_shell$nodejs$lua$golang$rust$php$git_branch$git_commit$git_state$git_status + $username$hostname$directory''; + character = { + success_symbol = "[](bold green) "; + error_symbol = "[✗](bold red) "; + }; + }; + }; + #programs.zsh = { + # enable = true; + # enableCompletion = true; + # autosuggestions.enable = true; + # syntaxHighlighting.enable = true; + # + # shellAliases = { + # update = "sudo nixos-rebuild switch"; + # upgrade = "sudo nixos-rebuild switch --upgrade"; + # proxy-grabber = + # "if [ $# -eq 0 ]; then torsocks curl -sL https://cdn.jsdelivr.net/gh/proxifly/free-proxy-list@main/proxies/all/data.txt else countrycode=$(echo $1 | tr '[:lower:]' '[:upper:]') torsocks curl -sL https://cdn.jsdelivr.net/gh/proxifly/free-proxy-list@main/proxies/countries/$countrycode/data.txt fi"; + # usbdiff = + # "lsblk > diff1 && echo 'SLEEPING 5...' && sleep 5 && lsblk > diff2 && diff diff1 diff2 && rm diff1 diff2"; + # }; + # + # oh-my-zsh = { + # enable = true; + # plugins = [ "git" ]; + # theme = "clean"; + # }; + #}; +} diff --git a/modules/common/utils.nix b/modules/common/utils.nix new file mode 100644 index 0000000..dc4fcea --- /dev/null +++ b/modules/common/utils.nix @@ -0,0 +1,27 @@ +{ + config, + pkgs, + ... +}: { + programs.neovim = {defaultEditor = true;}; + environment.systemPackages = with pkgs; [ + pciutils + btop + nload + htop + nethogs + uutils-coreutils-noprefix + nvim + git + curl + bat + eza + dua + ripgrep + dig + fd + proxychains-ng + unzip + wget + ]; +}