From 6e5f6c1a5979fad03f19d248dcac1f33b830ab46 Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Sun, 2 Mar 2025 21:17:17 +0100 Subject: [PATCH] flake: update configuration for tower --- flake.lock | 18 +++++++++++++++++- flake.nix | 14 ++++++++++++-- hosts/tower/filesystem/default.nix | 22 ++++++++++------------ hosts/tower/hardware-configuration.nix | 15 +++++++-------- modules/services/ssh.nix | 1 + 5 files changed, 47 insertions(+), 23 deletions(-) diff --git a/flake.lock b/flake.lock index 501a6e5..dd6178e 100644 --- a/flake.lock +++ b/flake.lock @@ -34,7 +34,23 @@ "root": { "inputs": { "impermanence": "impermanence", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "systems": "systems" + } + }, + "systems": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index fcfee49..fe7c607 100644 --- a/flake.nix +++ b/flake.nix @@ -3,14 +3,22 @@ outputs = inputs: let pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux; user = import ./modules/user {inherit pkgs;}; + eachSystem = inputs.nixpkgs.lib.genAttrs (import inputs.systems); + pkgsFor = inputs.nixpkgs.legacyPackages; in { nixosConfigurations = import ./hosts inputs; devShells.x86_64-linux.default = pkgs.callPackage ./shell.nix {}; formatter.x86_64-linux = pkgs.alejandra; - packages.x86_64-linux = user.packages; - packages.aarch64-linux = user.packages; + + packages = eachSystem ( + system: let + user = import ./modules/user {pkgs = pkgsFor.${system};}; + in { + inherit (user) packages; + } + ); apps.x86_64-linux = { default = { @@ -30,6 +38,8 @@ # Unstable nixpkgs baby! nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + systems.url = "github:nix-systems/default-linux"; + impermanence.url = "github:nix-community/impermanence"; }; } diff --git a/hosts/tower/filesystem/default.nix b/hosts/tower/filesystem/default.nix index f77f11e..088b3c7 100644 --- a/hosts/tower/filesystem/default.nix +++ b/hosts/tower/filesystem/default.nix @@ -1,16 +1,14 @@ { - config = { - fileSystems = { - "/boot" = { - device = "/dev/disk/by-uuid/3480-C94B"; - fsType = "vfat"; - }; - # root on tmpfs - "/" = { - device = "/dev/disk/by-uuid/3dde50ca-440d-4d46-974e-efc623e53703"; - fsType = "btrfs"; - options = ["compress=zstd" "noatime"]; - }; + config.fileSystems = { + "/boot" = { + device = "/dev/disk/by-uuid/3480-C94B"; + fsType = "vfat"; + }; + + "/" = { + device = "/dev/disk/by-uuid/3a781f2e-290a-4609-9035-a93374459def"; + fsType = "ext4"; + options = ["noatime" "compress=zstd"]; }; }; } diff --git a/hosts/tower/hardware-configuration.nix b/hosts/tower/hardware-configuration.nix index e30e94e..2b2927f 100644 --- a/hosts/tower/hardware-configuration.nix +++ b/hosts/tower/hardware-configuration.nix @@ -1,24 +1,23 @@ { - config, lib, modulesPath, ... }: { - imports = [(modulesPath + "/installer/scan/not-detected.nix")]; + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + ]; - boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "sd_mod"]; + boot.initrd.availableKernelModules = ["xhci_pci" "virtio_scsi" "sr_mod"]; boot.initrd.kernelModules = []; boot.kernelModules = []; boot.extraModulePackages = []; + 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.enp4s0.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.intel.updateMicrocode = - lib.mkDefault config.hardware.enableRedistributableFirmware; + # networking.interfaces.enp7s0.useDHCP = lib.mkDefault true; } diff --git a/modules/services/ssh.nix b/modules/services/ssh.nix index 46410ea..28795a9 100644 --- a/modules/services/ssh.nix +++ b/modules/services/ssh.nix @@ -6,6 +6,7 @@ in { programs.ssh.startAgent = true; services.openssh = { enable = true; + ports = [8997]; settings = { PasswordAuthentication = false; PermitRootLogin = "no";