diff --git a/.gitignore b/.gitignore index 8580356..19d94c8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,2 @@ nixos/result - -# -- Vim -- -# swap -[._]*.s[a-w][a-z] -[._]s[a-w][a-z] -# session -Session.vim -# temporary -.netrwhist -*~ -# auto-generated tag files -tags - +pw diff --git a/flake.nix b/flake.nix index fbe1b76..ac44b6f 100644 --- a/flake.nix +++ b/flake.nix @@ -12,6 +12,15 @@ outputs = { self, nixpkgs, ... }@attrs: let user = "user"; # Select user from `./users` directory in { + nixosConfigurations.homeserver = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = attrs; + modules = [ + ./users/${user}.nix + ./systems/homeserver.nix + ]; + }; + # Debugging VM configuration nixosConfigurations.qemu-vm = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; diff --git a/packages/vim/package.nix b/packages/vim/package.nix index 53f15b5..6736793 100644 --- a/packages/vim/package.nix +++ b/packages/vim/package.nix @@ -24,7 +24,6 @@ set number set relativenumber set nobackup - set undofile set scrolloff=8 set sidescrolloff=8 set fileencoding='utf-8' diff --git a/systems/hardware/homeserver.nix b/systems/hardware/homeserver.nix new file mode 100644 index 0000000..ae36bf3 --- /dev/null +++ b/systems/hardware/homeserver.nix @@ -0,0 +1,44 @@ +{ config, lib, modulesPath, ... }: + +{ + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "ums_realtek" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + boot.initrd.postDeviceCommands = lib.mkAfter '' + zfs rollback -r local/root@blank + ''; + + fileSystems."/" = { + device = "local/root"; + fsType = "zfs"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/5C0E-1600"; + fsType = "vfat"; + }; + + fileSystems."/nix" = { + device = "local/nix"; + fsType = "zfs"; + }; + + 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.eno1.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/systems/homeserver.nix b/systems/homeserver.nix new file mode 100644 index 0000000..fc4f368 --- /dev/null +++ b/systems/homeserver.nix @@ -0,0 +1,38 @@ +{ ... }: + +{ + imports = [ + ./common.nix + ./hardware/homeserver.nix + ./persist/homeserver.nix + ../sets/meta/sysadmin.nix + ../packages/vim/package.nix + ]; + + boot.loader = { + efi = { + canTouchEfiVariables = true; + }; + grub = { + enable = true; + efiSupport = true; + device = "nodev"; + }; + }; + + networking = { + hostId = "95f846dc"; + interfaces = { + eno1.ipv4.addresses = [{ + address = "192.168.2.69"; + prefixLength = 24; + }]; + }; + }; + + time.timeZone = "Europe/Berlin"; + + console = { + keyMap = "uk"; + }; +} diff --git a/systems/persist/common.nix b/systems/persist/common.nix index 62d5674..12c5c4f 100644 --- a/systems/persist/common.nix +++ b/systems/persist/common.nix @@ -13,7 +13,6 @@ files = [ "/etc/machine-id" - "/etc/shadow" ]; }; } diff --git a/systems/persist/homeserver.nix b/systems/persist/homeserver.nix new file mode 100644 index 0000000..27f4abc --- /dev/null +++ b/systems/persist/homeserver.nix @@ -0,0 +1,7 @@ +{ ... }: + +{ + imports = [ + ./common.nix + ]; +} diff --git a/users/user.nix b/users/user.nix index da135ab..2968bdd 100644 --- a/users/user.nix +++ b/users/user.nix @@ -1,9 +1,9 @@ -{ config, pkgs, ... }: +{ ... }: { users.users.user = { isNormalUser = true; - initialPassword = "ReplaceMe"; + passwordFile = "/nix/config/pw"; # mkpasswd in config dir description = "user"; extraGroups = [ "wheel"