|
| 1 | +# Edit this configuration file to define what should be installed on |
| 2 | +# your system. Help is available in the configuration.nix(5) man page, on |
| 3 | +# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). |
| 4 | + |
| 5 | +{ config, lib, pkgs, ... }: |
| 6 | + |
| 7 | +{ |
| 8 | + imports = |
| 9 | + [ |
| 10 | + ./hardware-configuration.nix |
| 11 | + ./sysctl.nix |
| 12 | + ./locale.nix |
| 13 | + ./vm3.systemPackages.nix |
| 14 | + <home-manager/nixos> |
| 15 | + ./home-manager.nix |
| 16 | + # https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/virtualisation/qemu-vm.nix <nixpkgs/nixos/modules/virtualisation/qemu-vm.nix> |
| 17 | + #<nixpkgs/nixos/modules/profiles/qemu-guest.nix> |
| 18 | + #<nixpkgs/nixos/modules/virtualisation/qemu-vm.nix> |
| 19 | + ]; |
| 20 | + |
| 21 | + boot.loader.systemd-boot.enable = true; |
| 22 | + boot.loader.efi.canTouchEfiVariables = true; |
| 23 | + |
| 24 | + # https://www.kernel.org/releases.html |
| 25 | + #boot.kernelPackages = pkgs.linuxPackages_4_19; # 4.19.319 |
| 26 | + #boot.kernelPackages = pkgs.linuxPackages_5_4; # 5.4.281 |
| 27 | + #boot.kernelPackages = pkgs.linuxPackages_5_15; # 5.15.164 |
| 28 | + #boot.kernelPackages = pkgs.linuxPackages_6_1; # 6.1.103 |
| 29 | + #boot.kernelPackages = pkgs.linuxPackages_6_8; # 6.8 |
| 30 | + boot.kernelPackages = pkgs.linuxPackages_6_10; # 6.10 |
| 31 | + |
| 32 | + # boot.kernelPackages = pkgs.linuxPackagesFor (pkgs.linux_4_19.override { |
| 33 | + # argsOverride = rec { |
| 34 | + # src = pkgs.fetchurl { |
| 35 | + # url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz"; |
| 36 | + # sha256 = "0ibayrvrnw2lw7si78vdqnr20mm1d3z0g6a0ykndvgn5vdax5x9a"; |
| 37 | + # }; |
| 38 | + # version = "4.19.60"; |
| 39 | + # modDirVersion = "4.19.60"; |
| 40 | + # }; |
| 41 | + # }); |
| 42 | + |
| 43 | + # nix = { |
| 44 | + # gc = { |
| 45 | + # automatic = true; # Enable automatic execution of the task |
| 46 | + # dates = "weekly"; # Schedule the task to run weekly |
| 47 | + # options = "--delete-older-than 10d"; # Specify options for the task: delete files older than 10 days |
| 48 | + # randomizedDelaySec = "14m"; # Introduce a randomized delay of up to 14 minutes before executing the task |
| 49 | + # }; |
| 50 | + # settings = { |
| 51 | + # auto-optimise-store = true; |
| 52 | + # experimental-features = [ "nix-command" "flakes" ]; |
| 53 | + # }; |
| 54 | + # }; |
| 55 | + |
| 56 | + # https://nixos.wiki/wiki/Networking |
| 57 | + networking.hostName = "vm3"; |
| 58 | + |
| 59 | + # networking.hostName = "nixos"; # Define your hostname. |
| 60 | + # Pick only one of the below networking options. |
| 61 | + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. |
| 62 | + # networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. |
| 63 | + |
| 64 | + # Set your time zone. |
| 65 | + # time.timeZone = "Europe/Amsterdam"; |
| 66 | + |
| 67 | + users.users.root.initialHashedPassword = "$6$7KZXYg2OjRBy/KiC$T22ywYwqDQjqBTHXAnuVZ1Bl9a8osbttmRMpu2DHcRfR1BTl/Xza3WkSn7zij8pkPk5bye1u93gmJgTSeZgBY."; |
| 68 | + |
| 69 | + # Allow unfree packages |
| 70 | + nixpkgs.config.allowUnfree = true; |
| 71 | + |
| 72 | + # List packages installed in system profile. To search, run: |
| 73 | + # $ nix search wget |
| 74 | + environment.systemPackages = with pkgs; [ |
| 75 | + # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. |
| 76 | + # wget |
| 77 | + vim |
| 78 | + curl |
| 79 | + wget |
| 80 | + tcpdump |
| 81 | + iproute2 |
| 82 | + htop |
| 83 | + ]; |
| 84 | + |
| 85 | + users.users.das = { |
| 86 | + isNormalUser = true; |
| 87 | + extraGroups = [ "wheel" "docker" ]; |
| 88 | + #initialPassword = "test"; |
| 89 | + # mkpasswd -m sha-512 |
| 90 | + initialHashedPassword = "$6$Cj2ptTRUdahPwOIP$ftQnDDtv.vppfuHFc0V7tsbG5w4wqR04GHRjFUJ48F9stu199iN69xwl/Sm9lGKG50Ieq4uzbA3g/tIEKj9UJ."; |
| 91 | + # https://nixos.wiki/wiki/SSH_public_key_authentication |
| 92 | + openssh.authorizedKeys.keys = [ |
| 93 | + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGMCFUMSCFJX95eLfm7P9r72NBp9I1FiXwNwJ+x/HGPV das@t" |
| 94 | + ]; |
| 95 | + }; |
| 96 | + |
| 97 | + # List packages installed in system profile. To search, run: |
| 98 | + # $ nix search wget |
| 99 | + # environment.systemPackages = with pkgs; [ |
| 100 | + # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. |
| 101 | + # wget |
| 102 | + # ]; |
| 103 | + |
| 104 | + services.timesyncd.enable = lib.mkDefault true; |
| 105 | + |
| 106 | + services.openssh.enable = true; |
| 107 | + |
| 108 | + # Open ports in the firewall. |
| 109 | + networking.firewall.allowedTCPPorts = [ 22 ]; |
| 110 | + # networking.firewall.allowedTCPPorts = [ ... ]; |
| 111 | + # networking.firewall.allowedUDPPorts = [ ... ]; |
| 112 | + # Or disable the firewall altogether. |
| 113 | + # networking.firewall.enable = false; |
| 114 | + |
| 115 | + # https://nixos.wiki/wiki/Docker |
| 116 | + # https://medium.com/thelinux/how-to-install-the-docker-in-nixos-with-simple-steps-226a7e9ef260 |
| 117 | + virtualisation.docker.enable = true; |
| 118 | + virtualisation.docker.rootless = { |
| 119 | + enable = true; |
| 120 | + setSocketVariable = true; |
| 121 | + }; |
| 122 | + virtualisation.docker.storageDriver = "btrfs"; |
| 123 | + # https://www.qemu.org/docs/master/system/i386/microvm.html |
| 124 | + #imports = [ <nixpkgs/nixos/modules/virtualisation/qemu-vm.nix> ]; |
| 125 | + #virtualisation.qemu.options = [ "-M microvm,accel=kvm:tcg,acpi=on,mem-merge=on,pcie=on,pic=off,pit=off,usb=off" ]; |
| 126 | + #virtualisation.qemu.options = [ "-M microvm,accel=kvm:tcg,acpi=on,mem-merge=on,pcie=on,pic=off,pit=off" ]; |
| 127 | + |
| 128 | + |
| 129 | + virtualisation.vmVariant = { |
| 130 | + virtualisation = { |
| 131 | + memorySize = 2048; |
| 132 | + cores = 2; |
| 133 | + diskSize = 8192; |
| 134 | + }; |
| 135 | + }; |
| 136 | + # https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/virtualisation/qemu-vm.nix#L240 |
| 137 | + |
| 138 | + # virtualisation.forwardPorts = [ |
| 139 | + # { from = "host"; host.port = 8122; guest.port = 22; } |
| 140 | + # #{ from = "host"; host.port = 8180; guest.port = 80; } |
| 141 | + # ]; |
| 142 | + |
| 143 | + services.qemuGuest.enable = true; |
| 144 | + |
| 145 | + # https://releases.nixos.org/?prefix=nixos/ |
| 146 | + system.stateVersion = "25.05"; |
| 147 | + |
| 148 | +} |
| 149 | + |
0 commit comments