From 07bbb62d2c351651f6377a3e4214161b53c8cfac Mon Sep 17 00:00:00 2001 From: "Casper V. Kristensen" Date: Tue, 1 Aug 2023 16:31:44 +0200 Subject: [PATCH] Zeta --- flake.lock | 21 +++++++++++++++++++ flake.nix | 8 ++++++++ hosts/zeta/default.nix | 36 +++++++++++++++++++++++++++++++++ hosts/zeta/hardware.nix | 45 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 110 insertions(+) create mode 100644 hosts/zeta/default.nix create mode 100644 hosts/zeta/hardware.nix diff --git a/flake.lock b/flake.lock index d8fe028..90e6033 100644 --- a/flake.lock +++ b/flake.lock @@ -36,6 +36,26 @@ "type": "github" } }, + "nix-index-database": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1690687539, + "narHash": "sha256-Lnwz9XKtshm+5OeWqCbj/3tKuKK+DL5tUTdKSRrKBlY=", + "owner": "nix-community", + "repo": "nix-index-database", + "rev": "d74b8171153ae35d7d323a9b1ad6c4cf7a995591", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-index-database", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1690630041, @@ -56,6 +76,7 @@ "inputs": { "home-manager": "home-manager", "impermanence": "impermanence", + "nix-index-database": "nix-index-database", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index 882a56e..dee2023 100644 --- a/flake.nix +++ b/flake.nix @@ -28,6 +28,14 @@ ./hosts/omega ]; }; + # Laptop + zeta = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = inputs; # pass flake inputs to modules + modules = [ + ./hosts/zeta + ]; + }; }; }; } diff --git a/hosts/zeta/default.nix b/hosts/zeta/default.nix new file mode 100644 index 0000000..6ba470b --- /dev/null +++ b/hosts/zeta/default.nix @@ -0,0 +1,36 @@ +{ ... }: + +{ + imports = [ + ./hardware.nix + ../../modules/base + ../../modules/desktop + ]; + + networking.hostName = "zeta"; + + boot = { + loader = { + efi.canTouchEfiVariables = true; + systemd-boot.enable = true; + }; + initrd.luks.devices.crypted.device = "/dev/disk/by-label/crypted"; + }; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It's perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "23.05"; # Did you read the comment? + + # This value determines the Home Manager release that your + # configuration is compatible with. This helps avoid breakage + # when a new Home Manager release introduces backwards + # incompatible changes. + # You can update Home Manager without changing this value. See + # the Home Manager release notes for a list of state version + # changes in each release. + home-manager.users.caspervk.home.stateVersion = "23.05"; # Did you read the comment? +} diff --git a/hosts/zeta/hardware.nix b/hosts/zeta/hardware.nix new file mode 100644 index 0000000..a43bcb5 --- /dev/null +++ b/hosts/zeta/hardware.nix @@ -0,0 +1,45 @@ +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ "dm-snapshot" ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + # https://elis.nu/blog/2020/05/nixos-tmpfs-as-root/ + fileSystems."/" = { + device = "none"; + fsType = "tmpfs"; + options = [ "defaults" "size=2G" "mode=755" ]; # mode=755 so only root can write to those files + }; + fileSystems."/boot" = { + device = "/dev/disk/by-label/BOOT"; + fsType = "vfat"; + }; + fileSystems."/nix" = { + device = "/dev/disk/by-label/nix"; + fsType = "ext4"; + }; + + swapDevices = [ + { + device = "/nix/persist/swapfile"; + size = 8*1024; # 8 GiB + } + ]; + + # 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.wlp2s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + powerManagement.cpuFreqGovernor = lib.mkDefault "performance"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}