diff --git a/common/default.nix b/common/default.nix index 2fdf524..31c6593 100644 --- a/common/default.nix +++ b/common/default.nix @@ -48,7 +48,7 @@ in programs.adb.enable = true; - # programs.mtr.enable = true; + programs.mtr.enable = true; # programs.gnupg.agent = { enable = true; enableSSHSupport = true; }; # List services that you want to enable: diff --git a/flake.lock b/flake.lock index 3ba28eb..fe01484 100644 --- a/flake.lock +++ b/flake.lock @@ -77,9 +77,10 @@ "locked": { "lastModified": 1701680307, "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", - "path": "/nix/store/pgid9c9xfcrbqx2giry0an0bi0df7s5c-source", + "owner": "numtide", + "repo": "flake-utils", "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", - "type": "path" + "type": "github" }, "original": { "id": "flake-utils", @@ -222,11 +223,11 @@ }, "nixos-unstable": { "locked": { - "lastModified": 1704538339, - "narHash": "sha256-1734d3mQuux9ySvwf6axRWZRBhtcZA9Q8eftD6EZg6U=", + "lastModified": 1704722960, + "narHash": "sha256-mKGJ3sPsT6//s+Knglai5YflJUF2DGj7Ai6Ynopz0kI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "46ae0210ce163b3cba6c7da08840c1d63de9c701", + "rev": "317484b1ead87b9c1b8ac5261a8d2dd748a0492d", "type": "github" }, "original": { @@ -270,11 +271,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1704420045, - "narHash": "sha256-C36QmoJd5tdQ5R9MC1jM7fBkZW9zBUqbUCsgwS6j4QU=", + "lastModified": 1704874635, + "narHash": "sha256-YWuCrtsty5vVZvu+7BchAxmcYzTMfolSPP5io8+WYCg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c1be43e8e837b8dbee2b3665a007e761680f0c3d", + "rev": "3dc440faeee9e889fe2d1b4d25ad0f430d449356", "type": "github" }, "original": { @@ -286,11 +287,11 @@ }, "nur": { "locked": { - "lastModified": 1704840324, - "narHash": "sha256-Bt16Bq+o/HgBi4T9bvvFGvQ6IxAZ+w0LD5gQwm5vPnA=", + "lastModified": 1704926790, + "narHash": "sha256-cvIgvBUvwD4pVQQ0n30b9v52+L27zldSBZzPY5dL2tw=", "owner": "nix-community", "repo": "NUR", - "rev": "4657978e02a45a3f90dcba0f5a878d8d4ff439a5", + "rev": "45a706bce225239a923b84019d693ba3d656c8ee", "type": "github" }, "original": { diff --git a/hosts/framenix/default.nix b/hosts/framenix/default.nix new file mode 100644 index 0000000..bde4c32 --- /dev/null +++ b/hosts/framenix/default.nix @@ -0,0 +1,36 @@ +{ config, lib, pkgs, inputs, ...}: +{ + imports = [ + ../../common + + ./hardware-configuration.nix + ./storage.nix + ./swap.nix + ]; + + networking.hostName = "framenix"; # Define your hostname. + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # This option defines the first version of NixOS you have installed on this particular machine, + # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions. + # + # Most users should NEVER change this value after the initial install, for any reason, + # even if you've upgraded your system to a new NixOS release. + # + # This value does NOT affect the Nixpkgs version your packages and OS are pulled from, + # so changing it will NOT upgrade your system. + # + # This value being lower than the current NixOS release does NOT mean your system is + # out of date, out of support, or vulnerable. + # + # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration, + # and migrated your data accordingly. + # + # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . + system.stateVersion = "23.11"; # Did you read the comment? + + hardware.enableRedistributableFirmware = true; +} + diff --git a/hosts/framenix/hardware-configuration.nix b/hosts/framenix/hardware-configuration.nix new file mode 100644 index 0000000..a731402 --- /dev/null +++ b/hosts/framenix/hardware-configuration.nix @@ -0,0 +1,26 @@ +# 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" "thunderbolt" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + + # 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.enp193s0f3u1c2.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp1s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/framenix/storage.nix b/hosts/framenix/storage.nix new file mode 100644 index 0000000..3efa655 --- /dev/null +++ b/hosts/framenix/storage.nix @@ -0,0 +1,44 @@ +{ config, lib, pkgs, ... }: +let + fsOptions = [ "noatime" "ssd" "compress=zstd" ]; +in +{ + boot.initrd.luks = { + devices = + # allow discards on all devices + builtins.mapAttrs (name: val: val // {allowDiscards = true;}) + { + "system".device = "/dev/disk/by-uuid/1838cdc5-9b0b-4c46-9f23-9465549eeb92"; + "cryptswap".device = "/dev/disk/by-uuid/ded7d649-ab3a-42ee-ae4a-f8c4ba029e9c"; + }; + reusePassphrases = true; + }; + + fileSystems = { + "/" = { + device = "/dev/disk/by-uuid/22388786-4285-403b-9994-e9aae1f11172"; + fsType = "btrfs"; + options = fsOptions ++ [ "subvol=nixos_root" ]; + }; + + "/home" = { + device = "/dev/disk/by-uuid/22388786-4285-403b-9994-e9aae1f11172"; + fsType = "btrfs"; + options = fsOptions ++ [ "subvol=home" ]; + }; + + "/boot" = { + device = "/dev/disk/by-uuid/AF8E-E9E6"; + fsType = "vfat"; + options = [ "discard" ]; + }; + }; + + services.fstrim.enable = true; + services.btrfs.autoScrub = { + enable = true; + fileSystems = [ "/" "/home" ]; + }; + + boot.tmp.useTmpfs = true; +} diff --git a/hosts/framenix/swap.nix b/hosts/framenix/swap.nix new file mode 100644 index 0000000..262809c --- /dev/null +++ b/hosts/framenix/swap.nix @@ -0,0 +1,12 @@ +{ + swapDevices = + [ { device = "/dev/disk/by-uuid/24c47f3d-0d3e-4575-92a2-174b5a6b6086"; } + ]; + + zramSwap = { + enable = true; + memoryPercent = 20; + }; + + boot.kernel.sysctl."vm.swappiness" = 9; +}