diff --git a/flake.lock b/flake.lock index 095e5e9..a66b312 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1720042602, - "narHash": "sha256-KyGlWXEi4xRntmcpDJe8je6MQX0D+HOIHJtvcGOVdIY=", + "lastModified": 1730837930, + "narHash": "sha256-0kZL4m+bKBJUBQse0HanewWO0g8hDdCvBhudzxgehqc=", "owner": "nix-community", "repo": "home-manager", - "rev": "58268b4d7745f6747be18033e6f10011466ce8d4", + "rev": "2f607e07f3ac7e53541120536708e824acccfaa8", "type": "github" }, "original": { @@ -23,16 +23,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1719848872, - "narHash": "sha256-H3+EC5cYuq+gQW8y0lSrrDZfH71LB4DAf+TDFyvwCNA=", + "lastModified": 1730741070, + "narHash": "sha256-edm8WG19kWozJ/GqyYx2VjW99EdhjKwbY3ZwdlPAAlo=", "owner": "nixos", "repo": "nixpkgs", - "rev": "00d80d13810dbfea8ab4ed1009b09100cca86ba8", + "rev": "d063c1dd113c91ab27959ba540c0d9753409edf3", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-unstable", + "ref": "nixos-24.05", "repo": "nixpkgs", "type": "github" } diff --git a/flake.lock.old b/flake.lock.old deleted file mode 100755 index 0efce7b..0000000 --- a/flake.lock.old +++ /dev/null @@ -1,64 +0,0 @@ -{ - "nodes": { - "home-manager": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ], - "utils": "utils" - }, - "locked": { - "lastModified": 1681127522, - "narHash": "sha256-Eo4dd0AmKshM+A6msQRMwT42QvWGNxa8RjmZ4tY7g9E=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "93f5cb2482dd20e57eb8ca6c819cdad9738f98a0", - "type": "github" - }, - "original": { - "owner": "nix-community", - "ref": "master", - "repo": "home-manager", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1681036984, - "narHash": "sha256-AbScJXshYzbeUKHh+Y3OICc3iAtr+NqJ3Xb81GW+ptU=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "fd531dee22c9a3d4336cc2da39e8dd905e8f3de4", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "ref": "nixos-unstable", - "type": "indirect" - } - }, - "root": { - "inputs": { - "home-manager": "home-manager", - "nixpkgs": "nixpkgs" - } - }, - "utils": { - "locked": { - "lastModified": 1678901627, - "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/flake.nix b/flake.nix index dd35d5e..8c84f4b 100755 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ description = "my nixos setup"; inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; home-manager.url = "github:nix-community/home-manager/master"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; }; @@ -38,16 +38,22 @@ ./system/vincents-hp/configuration.nix ]; }; - test-dell = lib.nixosSystem { + susans-hp = lib.nixosSystem { inherit system; modules = [ - ./system/test-dell/configuration.nix + ./system/susans-hp/configuration.nix ]; }; - nixos-vm = lib.nixosSystem { + vincents-vm = lib.nixosSystem { inherit system; modules = [ - ./system/vm/configuration.nix + ./system/vincents-vm/configuration.nix + ]; + }; + susans-vm = lib.nixosSystem { + inherit system; + modules = [ + ./system/susans-vm/configuration.nix ]; }; }; diff --git a/system/susans-hp/configuration.nix b/system/susans-hp/configuration.nix new file mode 100755 index 0000000..89ed665 --- /dev/null +++ b/system/susans-hp/configuration.nix @@ -0,0 +1,281 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, lib, ... }: + +let + unstableTarball = + fetchTarball + https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz; +in + + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + # legacy boot + #boot.loader.grub.enable = true; + #boot.loader.grub.device = "/dev/vda"; + #boot.loader.grub.useOSProber = true; + + # UEFI boot + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + #boot.loader.efi.efiSysMountPoint = "/boot/efi"; + + boot.binfmt.registrations.appimage = { + interpreter = "${pkgs.appimage-run}/bin/appimage-run"; + recognitionType = "magic"; + offset = 0; + mask = ''\xff\xff\xff\xff\x00\x00\x00\x00\xff\xff\xff''; + magicOrExtension = ''\x7fELF....AI\x02''; + }; + + # boot logo + boot.plymouth.enable = true; + + # ZRAM + zramSwap.enable = true; + zramSwap.memoryPercent = 50; + boot.kernel.sysctl = { + "vm.swappiness" = 10; + "vm.vsf_cache_pressure" = 50; + }; + + boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; + + #boot.kernelPackages = pkgs.linuxPackages_xanmod_stable; + boot.extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback ]; + + networking.hostName = "susans-hp"; # Define your hostname. + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "America/New_York"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + console = { + font = "Lat2-Terminus16"; + useXkbConfig = true; + }; + fonts.packages = [ pkgs.corefonts ]; + + # Enable the X11 windowing system. + services.xserver.enable = true; + + # displaylink + #services.xserver.videoDrivers = [ "displaylink" "modesetting" ]; + + # waydroid + virtualisation.waydroid.enable = true; + + # Enable the Cinnamon Desktop Environment. + services.displayManager.sddm.enable = true; + services.xserver.desktopManager.plasma5.enable = true; + programs.kdeconnect.enable = true; + + # Configure keymap in X11 + services.xserver = { + xkb.layout = "us"; + #xkb.variant = "colemak"; + #xkb.model = "chromebook"; + }; + services.xserver.xkb.options = "grp:win_space_toggle"; + + # Enable CUPS to print documents. + services.printing.enable = true; + services.avahi.enable = true; + services.avahi.nssmdns4 = true; + services.avahi.openFirewall = true; + services.printing.drivers = [ pkgs.hplip ]; + + # Enable sound with pipewire. + sound.enable = true; + 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) + wireplumber.enable = true; + }; + programs.noisetorch.enable = true; + + # Enable touchpad support (enabled default in most desktopManager). + services.libinput.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.susan = { + isNormalUser = true; + shell = pkgs.fish; + initialHashedPassword = "$y$j9T$0PPbSXGEwyGq6ZFvJMhmE/$D5ZlKOwR/4NCDD8eaxWiQiG1TTRSK4PfbQe/Tm60Id/"; + extraGroups = [ "wheel" "networkmanager" "lp" "audio" "video" "cdrom" "input" ]; + }; + programs.fish.enable = true; + + nix.extraOptions = ''experimental-features = nix-command flakes''; + + nixpkgs.config.permittedInsecurePackages = [ + "electron-12.2.3" + "electron-27.3.11" + ]; + + nixpkgs.config.allowUnfree = true; + + nixpkgs.config = { + packageOverrides = pkgs: with pkgs; { + unstable = import unstableTarball { + config = config.nixpkgs.config; + }; + }; + }; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment = { + systemPackages = with pkgs; [ + tailscale + bleachbit + btop + neofetch + clamtk + trayscale + topgrade + appimage-run + unstable.gearlever + # kde apps + libsForQt5.discover + libsForQt5.sddm-kcm + libsForQt5.ark + libsForQt5.qtmultimedia + # editors + libsForQt5.kate + nano + # office apps + libreoffice-qt + zoom-us + # package manager + wget + # web browser + firefox + ]; + }; + + # flatpak + xdg.portal.enable = true; + services.flatpak.enable = true; + systemd.services.configure-flathub-repo = { + wantedBy = ["multi-user.target"]; + path = [ pkgs.flatpak ]; + script = '' + flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + ''; + }; + + # bluetooth + hardware.bluetooth.enable = true; + + # dconf + programs.dconf.enable = true; + + # enable the tailscale service + services.tailscale.enable = true; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + programs.mtr.enable = true; + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + + # List services that you want to enable: + + # preload + services.preload.enable = true; + + # schedualer + services.system76-scheduler.enable = true; + + # Enable the OpenSSH daemon. + services.openssh.enable = false; + + # auto clean + nix.optimise.automatic = true; + nix.gc.automatic = true; + nix.gc.dates = "weekly"; + + # enable fwupd + services.fwupd.enable = true; + + # captive browser + programs.captive-browser.enable = true; + programs.captive-browser.bindInterface = false; + + + # auto update + system.autoUpgrade.enable = true; + system.autoUpgrade.allowReboot = true; + system.autoUpgrade.rebootWindow = { + lower = "01:00"; + upper = "05:00"; + }; + + #clamav + services.clamav.updater.enable = true; + services.clamav.daemon.enable = true; + + + # audit + security.auditd.enable = true; + security.audit.enable = true; + security.audit.rules = [ + "-a exit,always -F arch=b64 -S execve" + ]; + + + # Open ports in the firewall. + networking.firewall.allowedTCPPorts = [ + 22 + ]; + networking.firewall.allowedUDPPorts = [ + 22 + ]; + networking.firewall.allowedTCPPortRanges = [ + { + from = 1714; + to = 1764; + } + ]; + networking.firewall.allowedUDPPortRanges = [ + { + from = 1714; + to = 1764; + } + ]; + networking.firewall.rejectPackets = true; + # networking.firewall.allowedUDPPorts = [ 21116 ]; + # Or disable the firewall altogether. + networking.firewall.trustedInterfaces = [ "tailscale0" ]; + + services.fail2ban.enable = true; + networking.firewall.enable = true; + + # This value determines the NixOS release from which the default settings for stateful data, like file locations and database versions on your system were + # taken. It‘s perfectly fine and recommended to leave this value at the release version of the first install of this system. Before changing this value read + # the documentation for this option (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "24.05"; # Did you read the comment? + +} + diff --git a/system/test-dell/hardware-configuration.nix.old b/system/susans-hp/hardware-configuration.nix old mode 100755 new mode 100644 similarity index 63% rename from system/test-dell/hardware-configuration.nix.old rename to system/susans-hp/hardware-configuration.nix index a303fa7..d2ad42b --- a/system/test-dell/hardware-configuration.nix.old +++ b/system/susans-hp/hardware-configuration.nix @@ -8,19 +8,20 @@ [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "sr_mod" "sdhci_pci" ]; + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; + boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; fileSystems."/" = - { device = "/dev/disk/by-uuid/e9b875b1-eb63-4fbc-b9e5-3f1af9fbf58e"; + { device = "/dev/nvme0n1p2"; fsType = "ext4"; }; - fileSystems."/boot/efi" = - { device = "/dev/disk/by-uuid/E732-7951"; + fileSystems."/boot" = + { device = "/dev/nvme0n1p1"; fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; }; swapDevices = [ ]; @@ -30,9 +31,8 @@ # 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.enp12s0.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlo1.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/system/susans-vm/configuration.nix b/system/susans-vm/configuration.nix new file mode 100755 index 0000000..4c69466 --- /dev/null +++ b/system/susans-vm/configuration.nix @@ -0,0 +1,281 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, lib, ... }: + +let + unstableTarball = + fetchTarball + https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz; +in + + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + # legacy boot + #boot.loader.grub.enable = true; + #boot.loader.grub.device = "/dev/vda"; + #boot.loader.grub.useOSProber = true; + + # UEFI boot + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + #boot.loader.efi.efiSysMountPoint = "/boot/efi"; + + boot.binfmt.registrations.appimage = { + interpreter = "${pkgs.appimage-run}/bin/appimage-run"; + recognitionType = "magic"; + offset = 0; + mask = ''\xff\xff\xff\xff\x00\x00\x00\x00\xff\xff\xff''; + magicOrExtension = ''\x7fELF....AI\x02''; + }; + + # boot logo + boot.plymouth.enable = true; + + # ZRAM + zramSwap.enable = true; + zramSwap.memoryPercent = 50; + boot.kernel.sysctl = { + "vm.swappiness" = 10; + "vm.vsf_cache_pressure" = 50; + }; + + boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; + + #boot.kernelPackages = pkgs.linuxPackages_xanmod_stable; + boot.extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback ]; + + networking.hostName = "susans-vm"; # Define your hostname. + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "America/New_York"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + console = { + font = "Lat2-Terminus16"; + useXkbConfig = true; + }; + fonts.packages = [ pkgs.corefonts ]; + + # Enable the X11 windowing system. + services.xserver.enable = true; + + # displaylink + #services.xserver.videoDrivers = [ "displaylink" "modesetting" ]; + + # waydroid + virtualisation.waydroid.enable = true; + + # Enable the Cinnamon Desktop Environment. + services.displayManager.sddm.enable = true; + services.xserver.desktopManager.plasma5.enable = true; + programs.kdeconnect.enable = true; + + # Configure keymap in X11 + services.xserver = { + xkb.layout = "us"; + #xkb.variant = "colemak"; + #xkb.model = "chromebook"; + }; + services.xserver.xkb.options = "grp:win_space_toggle"; + + # Enable CUPS to print documents. + services.printing.enable = true; + services.avahi.enable = true; + services.avahi.nssmdns4 = true; + services.avahi.openFirewall = true; + services.printing.drivers = [ pkgs.hplip ]; + + # Enable sound with pipewire. + sound.enable = true; + 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) + wireplumber.enable = true; + }; + programs.noisetorch.enable = true; + + # Enable touchpad support (enabled default in most desktopManager). + services.libinput.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.susan = { + isNormalUser = true; + shell = pkgs.fish; + initialHashedPassword = "$y$j9T$0PPbSXGEwyGq6ZFvJMhmE/$D5ZlKOwR/4NCDD8eaxWiQiG1TTRSK4PfbQe/Tm60Id/"; + extraGroups = [ "wheel" "networkmanager" "lp" "audio" "video" "cdrom" "input" ]; + }; + programs.fish.enable = true; + + nix.extraOptions = ''experimental-features = nix-command flakes''; + + nixpkgs.config.permittedInsecurePackages = [ + "electron-12.2.3" + "electron-27.3.11" + ]; + + nixpkgs.config.allowUnfree = true; + + nixpkgs.config = { + packageOverrides = pkgs: with pkgs; { + unstable = import unstableTarball { + config = config.nixpkgs.config; + }; + }; + }; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment = { + systemPackages = with pkgs; [ + tailscale + bleachbit + btop + neofetch + clamtk + trayscale + topgrade + appimage-run + unstable.gearlever + # kde apps + libsForQt5.discover + libsForQt5.sddm-kcm + libsForQt5.ark + libsForQt5.qtmultimedia + # editors + libsForQt5.kate + nano + # office apps + libreoffice-qt + zoom-us + # package manager + wget + # web browser + firefox + ]; + }; + + # flatpak + xdg.portal.enable = true; + services.flatpak.enable = true; + systemd.services.configure-flathub-repo = { + wantedBy = ["multi-user.target"]; + path = [ pkgs.flatpak ]; + script = '' + flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + ''; + }; + + # bluetooth + hardware.bluetooth.enable = true; + + # dconf + programs.dconf.enable = true; + + # enable the tailscale service + services.tailscale.enable = true; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + programs.mtr.enable = true; + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + + # List services that you want to enable: + + # preload + services.preload.enable = true; + + # schedualer + services.system76-scheduler.enable = true; + + # Enable the OpenSSH daemon. + services.openssh.enable = false; + + # auto clean + nix.optimise.automatic = true; + nix.gc.automatic = true; + nix.gc.dates = "weekly"; + + # enable fwupd + services.fwupd.enable = true; + + # captive browser + programs.captive-browser.enable = true; + programs.captive-browser.bindInterface = false; + + + # auto update + system.autoUpgrade.enable = true; + system.autoUpgrade.allowReboot = true; + system.autoUpgrade.rebootWindow = { + lower = "01:00"; + upper = "05:00"; + }; + + #clamav + services.clamav.updater.enable = true; + services.clamav.daemon.enable = true; + + + # audit + security.auditd.enable = true; + security.audit.enable = true; + security.audit.rules = [ + "-a exit,always -F arch=b64 -S execve" + ]; + + + # Open ports in the firewall. + networking.firewall.allowedTCPPorts = [ + 22 + ]; + networking.firewall.allowedUDPPorts = [ + 22 + ]; + networking.firewall.allowedTCPPortRanges = [ + { + from = 1714; + to = 1764; + } + ]; + networking.firewall.allowedUDPPortRanges = [ + { + from = 1714; + to = 1764; + } + ]; + networking.firewall.rejectPackets = true; + # networking.firewall.allowedUDPPorts = [ 21116 ]; + # Or disable the firewall altogether. + networking.firewall.trustedInterfaces = [ "tailscale0" ]; + + services.fail2ban.enable = true; + networking.firewall.enable = true; + + # This value determines the NixOS release from which the default settings for stateful data, like file locations and database versions on your system were + # taken. It‘s perfectly fine and recommended to leave this value at the release version of the first install of this system. Before changing this value read + # the documentation for this option (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "24.05"; # Did you read the comment? + +} + diff --git a/system/vm/hardware-configuration.nix b/system/susans-vm/hardware-configuration.nix old mode 100755 new mode 100644 similarity index 70% rename from system/vm/hardware-configuration.nix rename to system/susans-vm/hardware-configuration.nix index efd1a91..c7ee088 --- a/system/vm/hardware-configuration.nix +++ b/system/susans-vm/hardware-configuration.nix @@ -8,9 +8,9 @@ [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "sr_mod" "sdhci_pci" ]; + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; + boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; fileSystems."/" = @@ -18,9 +18,10 @@ fsType = "ext4"; }; - fileSystems."/boot/efi" = + fileSystems."/boot" = { device = "/dev/vda1"; fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; }; swapDevices = [ ]; @@ -30,9 +31,8 @@ # 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.enp12s0.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlo1.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/system/test-dell/configuration.nix b/system/test-dell/configuration.nix deleted file mode 100755 index b8fa863..0000000 --- a/system/test-dell/configuration.nix +++ /dev/null @@ -1,314 +0,0 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). - -{ config, pkgs, lib, ... }: - -{ - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - ]; - # legacy boot - #boot.loader.grub.enable = true; - #boot.loader.grub.device = "/dev/sda"; - #boot.loader.grub.useOSProber = true; - - # UEFI boot - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - boot.loader.efi.efiSysMountPoint = "/boot/efi"; - - # secure boot - boot.bootspec.enable = true; - - # ZRAM - zramSwap.enable = true; - zramSwap.memoryPercent = 50; - - boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; - - boot.kernelPackages = pkgs.linuxPackages_xanmod_stable; - boot.extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback ]; - - networking.hostName = "test-dell"; # Define your hostname. - networking.networkmanager.enable = true; - - # Set your time zone. - time.timeZone = "America/New_York"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - console = { - font = "Lat2-Terminus16"; - keyMap = "us"; - }; - - # Enable the X11 windowing system. - services.xserver.enable = true; - - # opengl hardware - hardware.opengl.enable = true; - - # Enable the KDE Desktop Environment. - services.xserver.displayManager.sddm.enable = true; - services.xserver.desktopManager.plasma5.enable = true; - programs.kdeconnect.enable = true; - - # Configure keymap in X11 - services.xserver.layout = "us"; - #services.xserver.xkbVariant = "colemak,"; - #services.xserver.xkbOptions = "grp:win_space_toggle"; - - # Enable CUPS to print documents. - services.printing.enable = true; - services.avahi.enable = true; - services.avahi.nssmdns = true; - services.avahi.openFirewall = true; - services.printing.drivers = [ pkgs.hplip ]; - - # Enable sound with pipewire. - sound.enable = true; - 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; - }; - - # Enable touchpad support (enabled default in most desktopManager). - services.xserver.libinput.enable = true; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.vincent = { - isNormalUser = true; - initialHashedPassword = "$y$j9T$60d2ruHdjJT4EZAUcS3GW.$e1xmxQrRFTr2RUld3G2blpBUSALlG047ygAnkmk2JaA"; - extraGroups = [ "wheel" "networkmanager" "lp" "audio" "video" "cdrom" "libvirt" "kvm" "input" ]; - }; - - nix.extraOptions = ''experimental-features = nix-command flakes''; - - nixpkgs.config.permittedInsecurePackages = [ - "electron-12.2.3" - ]; - - nixpkgs.config.allowUnfree = true; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - xdg-desktop-portal-gtk - clamav - tailscale - linuxHeaders - steam-run - qgnomeplatform - open-dyslexic - glibc - cron - btop - neofetch - topgrade - # VM manager - gnome.gnome-boxes - OVMF - # remote access - sunshine - # backup - pika-backup - # kde apps - libsForQt5.discover - libsForQt5.sddm-kcm - libsForQt5.kaccounts-integration - libsForQt5.kaccounts-providers - libsForQt5.accounts-qt - libsForQt5.ark - # editors - libsForQt5.kate - nano - # office apps - onlyoffice-bin - trilium-desktop - celluloid - libsForQt5.elisa - # mirosoft font alitrnative - carlito - caladea - gelasio - comic-relief - noto-fonts - # battery saving packages - auto-cpufreq - tlp - # binary ELF interpreter - patchelf - binutils - # package manager - git - wget - flatpak - podman - distrobox - # web browser - librewolf - #captive browser - captive-browser - ]; - - # captive browser options - programs.captive-browser.enable = true; - programs.captive-browser.interface = "wlp2s0"; - - # sunshine udev rules - services.udev.extraRules = '' - Sunshine - KERNEL=="uinput", GROUP="input", MODE="0660", OPTIONS+="static_node=uinput" - ''; - # sunshine service - systemd.user.services.sunshine = { - description = "sunshine remote desktop"; - script = "/run/current-system/sw/bin/sunshine"; - wantedBy = [ "multi-user.target" ]; # starts after login - }; - systemd.user.services.sunshine.enable = true; - - # v4l2loopback - boot.kernelModules = [ "v4l2loopback" ]; - - # flatpak - xdg.portal.enable = true; - services.flatpak.enable = true; - - # packagekit - services.packagekit.enable = true; - - # enable libvirt and USB redirect - virtualisation.libvirtd.enable = true; - programs.dconf.enable = true; - virtualisation.spiceUSBRedirection.enable = true; - virtualisation.libvirtd.qemu.ovmf.enable = true; - - # enable podman - virtualisation.podman = { - enable = true; - - dockerCompat = true; - }; - - environment.shellInit = '' - [ -n "$DISPLAY" ] && xhost +si:localuser:$USER || true - ''; - - # iio screen rotation - hardware.sensor.iio.enable = true; - - # makemkv fix - boot.initrd.kernelModules = [ "sg" ]; - - # battery saving services enable - services.auto-cpufreq.enable = true; - services.tlp.enable = true; - services.power-profiles-daemon.enable = false; - # enable the tailscale service - services.tailscale.enable = true; - - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - programs.mtr.enable = true; - programs.gnupg.agent = { - enable = true; - enableSSHSupport = true; - }; - - # clamAV - services.clamav.updater.enable = true; - services.clamav.daemon.enable = true; - - # List services that you want to enable: - - # Enable the OpenSSH daemon. - services.openssh.enable = false; - - # auto clean - nix.optimise.automatic = true; - nix.gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 15d"; - }; - - # auto update - system.autoUpgrade.enable = true; - system.autoUpgrade.allowReboot = true; - system.autoUpgrade.rebootWindow = { - lower = "01:00"; - upper = "05:00"; - }; - - # Open ports in the firewall. - networking.firewall.allowedTCPPorts = [ - 22 - 8384 - 22000 - 24800 - 21116 - 7236 - 7250 - 47984 - 47989 - 47990 - 48010 - ]; - networking.firewall.allowedUDPPorts = [ - 22000 - 21027 - 24800 - 5353 - 5900 - 3689 - 5353 - 7236 - 47998 - 47999 - 48000 - 48002 - ]; - networking.firewall.allowedTCPPortRanges = [ - { - from = 1714; - to = 1764; - } - ]; - networking.firewall.allowedUDPPortRanges = [ - { - from = 1714; - to = 1764; - } - ]; - networking.firewall.rejectPackets = true; - # networking.firewall.allowedUDPPorts = [ 21116 ]; - # Or disable the firewall altogether. - networking.firewall.checkReversePath = "loose"; - - services.fail2ban.enable = true; - networking.firewall.enable = true; - - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "22.11"; # Did you read the comment? - -} - - diff --git a/system/vincents-hp/configuration.nix b/system/vincents-hp/configuration.nix index 5bfa092..a2d79a7 100755 --- a/system/vincents-hp/configuration.nix +++ b/system/vincents-hp/configuration.nix @@ -2,7 +2,14 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). -{ config, pkgs, lib, ... }: +{ config, pkgs, lib, ... }: + +let + unstableTarball = + fetchTarball + https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz; +in + { imports = @@ -14,7 +21,7 @@ #boot.loader.grub.enable = true; #boot.loader.grub.device = "/dev/vda"; #boot.loader.grub.useOSProber = true; - + # UEFI boot boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; @@ -34,22 +41,22 @@ # ZRAM zramSwap.enable = true; zramSwap.memoryPercent = 50; - boot.kernel.sysctl = { - "vm.swappiness" = 10; - "vm.vsf_cache_pressure" = 50; + boot.kernel.sysctl = { + "vm.swappiness" = 10; + "vm.vsf_cache_pressure" = 50; }; boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; - boot.kernelPackages = pkgs.linuxPackages_xanmod_stable; - #boot.extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback ]; + #boot.kernelPackages = pkgs.linuxPackages_xanmod_stable; + boot.extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback ]; - networking.hostName = "vincent-hp"; # Define your hostname. + networking.hostName = "vincents-hp"; # Define your hostname. networking.networkmanager.enable = true; # Set your time zone. time.timeZone = "America/New_York"; - + # Select internationalisation properties. i18n.defaultLocale = "en_US.UTF-8"; console = { @@ -62,7 +69,7 @@ services.xserver.enable = true; # displaylink - services.xserver.videoDrivers = [ "displaylink" "modesetting" ]; + #services.xserver.videoDrivers = [ "displaylink" "modesetting" ]; # waydroid #virtualisation.waydroid.enable = true; @@ -75,11 +82,11 @@ # Configure keymap in X11 services.xserver = { xkb.layout = "us"; - #xkb.variant = "colemak"; + xkb.variant = "colemak"; #xkb.model = "chromebook"; }; services.xserver.xkb.options = "grp:win_space_toggle"; - + # Enable CUPS to print documents. services.printing.enable = true; services.avahi.enable = true; @@ -98,7 +105,7 @@ 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) wireplumber.enable = true; @@ -112,8 +119,8 @@ users.users.vincent = { isNormalUser = true; shell = pkgs.fish; - initialHashedPassword = "$y$j9T$bNzCzml0kKQQxROnHJGee0$o7DvtXzBul58giMCwV9qFbuDBjdLiG7PoRTLUzT/jCB"; - extraGroups = [ "wheel" "networkmanager" "lp" "audio" "video" "cdrom" "input" "libvirtd" ]; + initialHashedPassword = "$y$j9T$0PPbSXGEwyGq6ZFvJMhmE/$D5ZlKOwR/4NCDD8eaxWiQiG1TTRSK4PfbQe/Tm60Id/"; + extraGroups = [ "wheel" "networkmanager" "lp" "audio" "video" "cdrom" "input" "libvirtd" "dialout" ]; }; programs.fish.enable = true; @@ -123,9 +130,17 @@ "electron-12.2.3" "electron-27.3.11" ]; - + nixpkgs.config.allowUnfree = true; + nixpkgs.config = { + packageOverrides = pkgs: with pkgs; { + unstable = import unstableTarball { + config = config.nixpkgs.config; + }; + }; + }; + # List packages installed in system profile. To search, run: # $ nix search wget environment = { @@ -137,10 +152,12 @@ clamtk trayscale topgrade - git + appimage-run + unstable.gearlever # kde apps kdePackages.discover kdePackages.sddm-kcm + kdePackages.kwayland kdePackages.ark kdePackages.qtmultimedia # editors @@ -149,20 +166,37 @@ # vm quickemu quickgui + # containers + podman + podman-compose + distrobox + boxbuddy # office apps bottles - rustdesk-flutter libreoffice-qt logseq - nextcloud-client + zoom-us orca-slicer + unstable.freecad-wayland + gpodder # package manager wget # web browser librewolf + ungoogled-chromium ]; }; + services = { + syncthing = { + enable = true; + user = "vincent"; + openDefaultPorts = true; + dataDir = "/home/vincent/logseq"; # Default folder for new synced folders + configDir = "/home/vincent/Documents/.config/syncthing"; # Folder for Syncthing's settings and keys + }; + }; + # flatpak xdg.portal.enable = true; services.flatpak.enable = true; @@ -174,12 +208,26 @@ ''; }; + # podman + virtualisation.containers.enable = true; + virtualisation = { + podman = { + enable = true; + + # Create a `docker` alias for podman, to use it as a drop-in replacement + dockerCompat = true; + + # Required for containers under podman-compose to be able to talk to each other. + defaultNetwork.settings.dns_enabled = true; + }; + }; + # bluetooth hardware.bluetooth.enable = true; # dconf programs.dconf.enable = true; - + # enable the tailscale service services.tailscale.enable = true; @@ -195,19 +243,24 @@ # preload services.preload.enable = true; - + # schedualer services.system76-scheduler.enable = true; # Enable the OpenSSH daemon. services.openssh.enable = false; - + # auto clean nix.optimise.automatic = true; # enable fwupd services.fwupd.enable = true; + # captive browser + programs.captive-browser.enable = true; + programs.captive-browser.bindInterface = false; + + # auto update system.autoUpgrade.enable = true; system.autoUpgrade.allowReboot = true; @@ -215,13 +268,22 @@ lower = "01:00"; upper = "05:00"; }; - + #clamav services.clamav.updater.enable = true; services.clamav.daemon.enable = true; - + + + # audit + security.auditd.enable = true; + security.audit.enable = true; + security.audit.rules = [ + "-a exit,always -F arch=b64 -S execve" + ]; + + # Open ports in the firewall. - networking.firewall.allowedTCPPorts = [ + networking.firewall.allowedTCPPorts = [ 22 8384 22000 @@ -248,13 +310,13 @@ 48000 48002 ]; - networking.firewall.allowedTCPPortRanges = [ + networking.firewall.allowedTCPPortRanges = [ { from = 1714; to = 1764; } ]; - networking.firewall.allowedUDPPortRanges = [ + networking.firewall.allowedUDPPortRanges = [ { from = 1714; to = 1764; @@ -263,13 +325,13 @@ networking.firewall.rejectPackets = true; # networking.firewall.allowedUDPPorts = [ 21116 ]; # Or disable the firewall altogether. - networking.firewall.checkReversePath = "loose"; + networking.firewall.trustedInterfaces = [ "tailscale0" ]; services.fail2ban.enable = true; networking.firewall.enable = true; - # This value determines the NixOS release from which the default settings for stateful data, like file locations and database versions on your system were - # taken. It‘s perfectly fine and recommended to leave this value at the release version of the first install of this system. Before changing this value read + # This value determines the NixOS release from which the default settings for stateful data, like file locations and database versions on your system were + # taken. It‘s perfectly fine and recommended to leave this value at the release version of the first install of this system. Before changing this value read # the documentation for this option (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). system.stateVersion = "24.05"; # Did you read the comment? diff --git a/system/vincents-hp/hardware-configuration.nix b/system/vincents-hp/hardware-configuration.nix index ddf9122..d2ad42b 100644 --- a/system/vincents-hp/hardware-configuration.nix +++ b/system/vincents-hp/hardware-configuration.nix @@ -8,20 +8,18 @@ [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; fileSystems."/" = - { device = "/dev/disk/by-uuid/1d5d7408-a9fc-4577-83c9-48626166b59a"; + { device = "/dev/nvme0n1p2"; fsType = "ext4"; }; - boot.initrd.luks.devices."luks-5bd845b2-9060-4aa4-9a12-463202623104".device = "/dev/disk/by-uuid/5bd845b2-9060-4aa4-9a12-463202623104"; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/9B16-C557"; + { device = "/dev/nvme0n1p1"; fsType = "vfat"; options = [ "fmask=0022" "dmask=0022" ]; }; diff --git a/system/vincents-vm/configuration.nix b/system/vincents-vm/configuration.nix new file mode 100755 index 0000000..7ea2a26 --- /dev/null +++ b/system/vincents-vm/configuration.nix @@ -0,0 +1,339 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, lib, ... }: + +let + unstableTarball = + fetchTarball + https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz; +in + + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + # legacy boot + #boot.loader.grub.enable = true; + #boot.loader.grub.device = "/dev/vda"; + #boot.loader.grub.useOSProber = true; + + # UEFI boot + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + #boot.loader.efi.efiSysMountPoint = "/boot/efi"; + + boot.binfmt.registrations.appimage = { + interpreter = "${pkgs.appimage-run}/bin/appimage-run"; + recognitionType = "magic"; + offset = 0; + mask = ''\xff\xff\xff\xff\x00\x00\x00\x00\xff\xff\xff''; + magicOrExtension = ''\x7fELF....AI\x02''; + }; + + # boot logo + boot.plymouth.enable = true; + + # ZRAM + zramSwap.enable = true; + zramSwap.memoryPercent = 50; + boot.kernel.sysctl = { + "vm.swappiness" = 10; + "vm.vsf_cache_pressure" = 50; + }; + + boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; + + #boot.kernelPackages = pkgs.linuxPackages_xanmod_stable; + boot.extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback ]; + + networking.hostName = "vincents-vm"; # Define your hostname. + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "America/New_York"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + console = { + font = "Lat2-Terminus16"; + useXkbConfig = true; + }; + fonts.packages = [ pkgs.corefonts ]; + + # Enable the X11 windowing system. + services.xserver.enable = true; + + # displaylink + #services.xserver.videoDrivers = [ "displaylink" "modesetting" ]; + + # waydroid + #virtualisation.waydroid.enable = true; + + # Enable the Cinnamon Desktop Environment. + services.displayManager.sddm.enable = true; + services.desktopManager.plasma6.enable = true; + programs.kdeconnect.enable = true; + + # Configure keymap in X11 + services.xserver = { + xkb.layout = "us"; + #xkb.variant = "colemak"; + #xkb.model = "chromebook"; + }; + services.xserver.xkb.options = "grp:win_space_toggle"; + + # Enable CUPS to print documents. + services.printing.enable = true; + services.avahi.enable = true; + services.avahi.nssmdns4 = true; + services.avahi.openFirewall = true; + services.printing.drivers = [ pkgs.hplip ]; + + # Enable sound with pipewire. + sound.enable = true; + 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) + wireplumber.enable = true; + }; + programs.noisetorch.enable = true; + + # Enable touchpad support (enabled default in most desktopManager). + services.libinput.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.vincent = { + isNormalUser = true; + shell = pkgs.fish; + initialHashedPassword = "$y$j9T$0PPbSXGEwyGq6ZFvJMhmE/$D5ZlKOwR/4NCDD8eaxWiQiG1TTRSK4PfbQe/Tm60Id/"; + extraGroups = [ "wheel" "networkmanager" "lp" "audio" "video" "cdrom" "input" "libvirtd" "dialout" ]; + }; + programs.fish.enable = true; + + nix.extraOptions = ''experimental-features = nix-command flakes''; + + nixpkgs.config.permittedInsecurePackages = [ + "electron-12.2.3" + "electron-27.3.11" + ]; + + nixpkgs.config.allowUnfree = true; + + nixpkgs.config = { + packageOverrides = pkgs: with pkgs; { + unstable = import unstableTarball { + config = config.nixpkgs.config; + }; + }; + }; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment = { + systemPackages = with pkgs; [ + tailscale + bleachbit + btop + neofetch + clamtk + trayscale + topgrade + appimage-run + unstable.gearlever + # kde apps + kdePackages.discover + kdePackages.sddm-kcm + kdePackages.kwayland + kdePackages.ark + kdePackages.qtmultimedia + # editors + kdePackages.kate + nano + # vm + quickemu + quickgui + # containers + podman + podman-compose + distrobox + boxbuddy + # office apps + bottles + libreoffice-qt + logseq + zoom-us + orca-slicer + unstable.freecad-wayland + gpodder + # package manager + wget + # web browser + librewolf + ungoogled-chromium + ]; + }; + + services = { + syncthing = { + enable = true; + user = "vincent"; + openDefaultPorts = true; + dataDir = "/home/vincent/logseq"; # Default folder for new synced folders + configDir = "/home/vincent/Documents/.config/syncthing"; # Folder for Syncthing's settings and keys + }; + }; + + # flatpak + xdg.portal.enable = true; + services.flatpak.enable = true; + systemd.services.configure-flathub-repo = { + wantedBy = ["multi-user.target"]; + path = [ pkgs.flatpak ]; + script = '' + flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + ''; + }; + + # podman + virtualisation.containers.enable = true; + virtualisation = { + podman = { + enable = true; + + # Create a `docker` alias for podman, to use it as a drop-in replacement + dockerCompat = true; + + # Required for containers under podman-compose to be able to talk to each other. + defaultNetwork.settings.dns_enabled = true; + }; + }; + + # bluetooth + hardware.bluetooth.enable = true; + + # dconf + programs.dconf.enable = true; + + # enable the tailscale service + services.tailscale.enable = true; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + programs.mtr.enable = true; + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + + # List services that you want to enable: + + # preload + services.preload.enable = true; + + # schedualer + services.system76-scheduler.enable = true; + + # Enable the OpenSSH daemon. + services.openssh.enable = false; + + # auto clean + nix.optimise.automatic = true; + + # enable fwupd + services.fwupd.enable = true; + + # captive browser + programs.captive-browser.enable = true; + programs.captive-browser.bindInterface = false; + + + # auto update + system.autoUpgrade.enable = true; + system.autoUpgrade.allowReboot = true; + system.autoUpgrade.rebootWindow = { + lower = "01:00"; + upper = "05:00"; + }; + + #clamav + services.clamav.updater.enable = true; + services.clamav.daemon.enable = true; + + + # audit + security.auditd.enable = true; + security.audit.enable = true; + security.audit.rules = [ + "-a exit,always -F arch=b64 -S execve" + ]; + + + # Open ports in the firewall. + networking.firewall.allowedTCPPorts = [ + 22 + 8384 + 22000 + 24800 + 21116 + 7236 + 7250 + 47984 + 47989 + 47990 + 48010 + ]; + networking.firewall.allowedUDPPorts = [ + 22000 + 21027 + 24800 + 5353 + 5900 + 3689 + 5353 + 7236 + 47998 + 47999 + 48000 + 48002 + ]; + networking.firewall.allowedTCPPortRanges = [ + { + from = 1714; + to = 1764; + } + ]; + networking.firewall.allowedUDPPortRanges = [ + { + from = 1714; + to = 1764; + } + ]; + networking.firewall.rejectPackets = true; + # networking.firewall.allowedUDPPorts = [ 21116 ]; + # Or disable the firewall altogether. + networking.firewall.trustedInterfaces = [ "tailscale0" ]; + + services.fail2ban.enable = true; + networking.firewall.enable = true; + + # This value determines the NixOS release from which the default settings for stateful data, like file locations and database versions on your system were + # taken. It‘s perfectly fine and recommended to leave this value at the release version of the first install of this system. Before changing this value read + # the documentation for this option (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "24.05"; # Did you read the comment? + +} + diff --git a/system/vincents-vm/hardware-configuration.nix b/system/vincents-vm/hardware-configuration.nix new file mode 100644 index 0000000..c7ee088 --- /dev/null +++ b/system/vincents-vm/hardware-configuration.nix @@ -0,0 +1,38 @@ +# 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" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/vda2"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/vda1"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = [ ]; + + # 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.wlo1.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/system/vm/configuration.nix b/system/vm/configuration.nix deleted file mode 100755 index 7f5c95d..0000000 --- a/system/vm/configuration.nix +++ /dev/null @@ -1,316 +0,0 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). - -{ config, pkgs, lib, ... }: - -{ - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - ]; - # legacy boot - #boot.loader.grub.enable = true; - #boot.loader.grub.device = "/dev/vda"; - #boot.loader.grub.useOSProber = true; - - # UEFI boot - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - boot.loader.efi.efiSysMountPoint = "/boot/efi"; - - # secure boot - #boot.bootspec.enable = true; - - # ZRAM - zramSwap.enable = true; - zramSwap.memoryPercent = 50; - - boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; - - boot.kernelPackages = pkgs.linuxPackages_xanmod_stable; - boot.extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback ]; - - networking.hostName = "nixos-vm"; # Define your hostname. - networking.networkmanager.enable = true; - - # Set your time zone. - time.timeZone = "America/New_York"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - console = { - font = "Lat2-Terminus16"; - keyMap = "us"; - }; - - # Enable the X11 windowing system. - services.xserver.enable = true; - - # opengl hardware - hardware.opengl.enable = true; - - # Enable the KDE Desktop Environment. - services.xserver.displayManager.gdm.enable = true; - services.xserver.desktopManager.gnome.enable = true; - programs.kdeconnect.package = pkgs.gnomeExtensions.gsconnect; - programs.kdeconnect.enable = true; - - # Configure keymap in X11 - services.xserver.layout = "us"; - #services.xserver.xkbVariant = "colemak,"; - #services.xserver.xkbOptions = "grp:win_space_toggle"; - - # Enable CUPS to print documents. - services.printing.enable = true; - services.avahi.enable = true; - services.avahi.nssmdns = true; - services.avahi.openFirewall = true; - services.printing.drivers = [ pkgs.hplip ]; - - # Enable sound with pipewire. - sound.enable = true; - 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; - }; - - # Enable touchpad support (enabled default in most desktopManager). - services.xserver.libinput.enable = true; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.vincent = { - isNormalUser = true; - initialHashedPassword = "$y$j9T$60d2ruHdjJT4EZAUcS3GW.$e1xmxQrRFTr2RUld3G2blpBUSALlG047ygAnkmk2JaA"; - extraGroups = [ "wheel" "networkmanager" "lp" "audio" "video" "cdrom" "libvirt" "kvm" "input" ]; - }; - - nix.extraOptions = ''experimental-features = nix-command flakes''; - - nixpkgs.config.permittedInsecurePackages = [ - "electron-12.2.3" - ]; - - nixpkgs.config.allowUnfree = true; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - xdg-desktop-portal-gtk - clamav - tailscale - linuxHeaders - steam-run - qgnomeplatform - open-dyslexic - glibc - cron - btop - neofetch - topgrade - papirus-icon-theme - # VM manager - virt-manager - OVMF - # remote access - sunshine - # backup - pika-backup - # gnome extensions - gnome.gnome-packagekit - gnomeExtensions.appindicator - gnomeExtensions.pop-shell - gnome.pomodoro - gnome.gnome-tweaks - # editors - libsForQt5.kate - nano - # office apps - onlyoffice-bin - trilium-desktop - celluloid - lollypop - # mirosoft font alitrnative - carlito - caladea - gelasio - comic-relief - noto-fonts - # battery saving packages - auto-cpufreq - tlp - # binary ELF interpreter - patchelf - binutils - # package manager - git - wget - flatpak - flatpak-builder - podman - distrobox - # web browser - librewolf - #captive browser - #captive-browser - ]; - - # captive browser options - #programs.captive-browser.enable = true; - #programs.captive-browser.interface = "wlp2s0"; - - # sunshine udev rules - services.udev.extraRules = '' - Sunshine - KERNEL=="uinput", GROUP="input", MODE="0660", OPTIONS+="static_node=uinput" - ''; - # sunshine service - systemd.user.services.sunshine = { - description = "sunshine remote desktop"; - script = "/run/current-system/sw/bin/sunshine"; - wantedBy = [ "multi-user.target" ]; # starts after login - }; - systemd.user.services.sunshine.enable = true; - - # v4l2loopback - boot.kernelModules = [ "v4l2loopback" ]; - - # flatpak - xdg.portal.enable = true; - services.flatpak.enable = true; - - # packagekit - services.packagekit.enable = true; - - # enable libvirt and USB redirect - virtualisation.libvirtd.enable = true; - programs.dconf.enable = true; - virtualisation.spiceUSBRedirection.enable = true; - virtualisation.libvirtd.qemu.ovmf.enable = true; - - # enable podman - virtualisation.podman = { - enable = true; - - dockerCompat = true; - }; - - environment.shellInit = '' - [ -n "$DISPLAY" ] && xhost +si:localuser:$USER || true - ''; - - # iio screen rotation - hardware.sensor.iio.enable = true; - - # makemkv fix - boot.initrd.kernelModules = [ "sg" ]; - - # battery saving services enable - services.auto-cpufreq.enable = true; - services.tlp.enable = true; - services.power-profiles-daemon.enable = false; - # enable the tailscale service - services.tailscale.enable = true; - - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - programs.mtr.enable = true; - programs.gnupg.agent = { - enable = true; - enableSSHSupport = true; - }; - - # clamAV - services.clamav.updater.enable = true; - services.clamav.daemon.enable = true; - - # List services that you want to enable: - - # Enable the OpenSSH daemon. - services.openssh.enable = false; - - # auto clean - nix.optimise.automatic = true; - nix.gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 15d"; - }; - - # auto update - system.autoUpgrade.enable = true; - system.autoUpgrade.allowReboot = true; - system.autoUpgrade.rebootWindow = { - lower = "01:00"; - upper = "05:00"; - }; - - # Open ports in the firewall. - networking.firewall.allowedTCPPorts = [ - 22 - 8384 - 22000 - 24800 - 21116 - 7236 - 7250 - 47984 - 47989 - 47990 - 48010 - ]; - networking.firewall.allowedUDPPorts = [ - 22000 - 21027 - 24800 - 5353 - 5900 - 3689 - 5353 - 7236 - 47998 - 47999 - 48000 - 48002 - ]; - networking.firewall.allowedTCPPortRanges = [ - { - from = 1714; - to = 1764; - } - ]; - networking.firewall.allowedUDPPortRanges = [ - { - from = 1714; - to = 1764; - } - ]; - networking.firewall.rejectPackets = true; - # networking.firewall.allowedUDPPorts = [ 21116 ]; - # Or disable the firewall altogether. - networking.firewall.checkReversePath = "loose"; - - services.fail2ban.enable = true; - networking.firewall.enable = true; - - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "22.11"; # Did you read the comment? - -} - -