From 10d1e4917c15c4cb7953acc9b1ed6c111340779e Mon Sep 17 00:00:00 2001 From: "Casper V. Kristensen" Date: Sat, 7 Oct 2023 02:18:22 +0200 Subject: [PATCH] mu --- flake.nix | 6 ++++++ hosts/mu/default.nix | 36 ++++++++++++++++++++++++++++++++++++ hosts/mu/hardware.nix | 41 +++++++++++++++++++++++++++++++++++++++++ hosts/mu/sway.nix | 15 +++++++++++++++ 4 files changed, 98 insertions(+) create mode 100644 hosts/mu/default.nix create mode 100644 hosts/mu/hardware.nix create mode 100644 hosts/mu/sway.nix diff --git a/flake.nix b/flake.nix index dc79a79..9f75ece 100644 --- a/flake.nix +++ b/flake.nix @@ -42,6 +42,12 @@ specialArgs = inputs; # pass flake inputs to modules modules = [ ./hosts/zeta ]; }; + # Work laptop + mu = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = inputs; # pass flake inputs to modules + modules = [ ./hosts/mu ]; + }; # Tor relay tor = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; diff --git a/hosts/mu/default.nix b/hosts/mu/default.nix new file mode 100644 index 0000000..3dadd68 --- /dev/null +++ b/hosts/mu/default.nix @@ -0,0 +1,36 @@ +{ ... }: { + imports = [ + ./hardware.nix + ./sway.nix + ../../overlays + ../../modules/base + ../../modules/desktop + ]; + + networking.hostName = "mu"; + + 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/mu/hardware.nix b/hosts/mu/hardware.nix new file mode 100644 index 0000000..e3ffb27 --- /dev/null +++ b/hosts/mu/hardware.nix @@ -0,0 +1,41 @@ +{ config, lib, pkgs, modulesPath, ... }: { + imports = + [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" "sdhci_pci" ]; + 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 = 32 * 1024; # 32 GiB + } + ]; + + # Enables DHCP on all ethernet and wireless LAN interfaces. + networking.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; +} diff --git a/hosts/mu/sway.nix b/hosts/mu/sway.nix new file mode 100644 index 0000000..e35c4d3 --- /dev/null +++ b/hosts/mu/sway.nix @@ -0,0 +1,15 @@ +{ home-manager, ... }: { + home-manager.users.caspervk = { + wayland.windowManager.sway = { + config = { + # swaymsg -t get_outputs + output = { + "AU Optronics 0xE48D Unknown" = { + mode = "1920x1080@60.052Hz"; + position = "0,0"; + }; + }; + }; + }; + }; +}