From 6829b4d7fb5c59e2e02e475ff5fe47f7a6f54a67 Mon Sep 17 00:00:00 2001 From: aloslider <53711835+aloslider@users.noreply.github.com> Date: Thu, 5 Mar 2026 00:01:03 +0000 Subject: [PATCH] Init --- configuration.nix | 51 ++++++++++++++++++++++++++++++++++++++ flake.lock | 27 ++++++++++++++++++++ flake.nix | 16 ++++++++++++ hardware-configuration.nix | 37 +++++++++++++++++++++++++++ home-manager.nix | 21 ++++++++++++++++ 5 files changed, 152 insertions(+) create mode 100644 configuration.nix create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 hardware-configuration.nix create mode 100644 home-manager.nix diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..0d2d463 --- /dev/null +++ b/configuration.nix @@ -0,0 +1,51 @@ +{ config, lib, pkgs, ... }: +{ + imports = [ + ./home-manager.nix + ./hardware-configuration.nix + ]; + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + boot.loader = { + limine = { + enable = true; + }; + efi.canTouchEfiVariables = true; + }; + + networking.hostName = "benq-serv"; + networking.networkmanager.enable = true; + + time.timeZone = "Europe/Moscow"; + + i18n = { + defaultLocale = "en_US.UTF-8"; + extraLocaleSettings = { + LC_TIME = "en_GB.UTF-8"; + }; + }; + + services.xserver.xkb = { + layout = "us,ru"; + options = "eurosign:e,caps:escape"; + }; + + services.pipewire = { + enable = true; + pulse.enable = true; + }; + + environment.systemPackages = with pkgs; [ + git + vim + ]; + + services.openssh.enable = true; + + networking.firewall.allowedTCPPorts = [ 22 80 443 ]; + networking.firewall.allowedUDPPorts = []; + + system.stateVersion = "25.05"; +} + diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..efdc944 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1772542754, + "narHash": "sha256-WGV2hy+VIeQsYXpsLjdr4GvHv5eECMISX1zKLTedhdg=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "8c809a146a140c5c8806f13399592dbcb1bb5dc4", + "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..135f9c5 --- /dev/null +++ b/flake.nix @@ -0,0 +1,16 @@ +{ + description = "Homelab server flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + }; + + outputs = { self, nixpkgs }@inputs: { + nixosConfigurations.default = nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs; }; + modules = [ + ./configuration.nix + ]; + }; + }; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..52c6a02 --- /dev/null +++ b/hardware-configuration.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 + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/8d38919d-4aab-4d2d-a757-72bc6499e377"; + fsType = "btrfs"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/AAE3-A089"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + 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.enp1s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/home-manager.nix b/home-manager.nix new file mode 100644 index 0000000..921f85c --- /dev/null +++ b/home-manager.nix @@ -0,0 +1,21 @@ +{ config, pkgs, lib, ... }: +let + home-manager = builtins.fetchTarball https://github.com/nix-community/home-manager/archive/release-25.05.tar.gz; +in +{ + imports = [ + (import "${home-manager}/nixos") + ]; + + users.users.benq.isNormalUser = true; + + home-manager = { + useGlobalPkgs = true; + users.benq = { pkgs, ... }: { + home.packages = with pkgs; [ + + ]; + home.stateVersion = "25.05"; + }; + }; +}