diff --git a/flake.nix b/flake.nix index d5ef5c7..e6aa1ef 100644 --- a/flake.nix +++ b/flake.nix @@ -69,6 +69,7 @@ }; in { + nixosConfigurations."anemone" = mkSystem nixpkgs "anemone" "x86_64-linux" true []; nixosConfigurations."blossom" = mkSystem nixpkgs "blossom" "x86_64-linux" true []; nixosConfigurations."hyacinth" = mkSystem nixpkgs "hyacinth" "x86_64-linux" true []; diff --git a/hosts/anemone/default.nix b/hosts/anemone/default.nix new file mode 100644 index 0000000..8ae4d4c --- /dev/null +++ b/hosts/anemone/default.nix @@ -0,0 +1,44 @@ +{ config, inputs, modules, overlays, pkgs, ... }: { + networking.hostName = "anemone"; + system.stateVersion = "23.11"; + time.timeZone = "Asia/Phnom_Penh"; + + nixpkgs.overlays = [ inputs.neovim-nightly.overlay ]; + age.secrets = { + passwd.file = ../../secrets/passwd.age; + }; + + imports = with modules.system; [ + inputs.home-manager.nixosModule + home-manager + + audio + base + bluetooth + ccache + corectrl + flatpak + greetd + gui + input + kernel + nix + packages + printing + security + snapper + + ./filesystem.nix + ./kernel.nix + ./networking.nix + + ../../users/rin + ]; + + programs.hyprland.enable = true; + + # For steam fhs-env + nixpkgs.config.permittedInsecurePackages = [ + "openssl-1.1.1w" + ]; +} diff --git a/hosts/anemone/filesystem.nix b/hosts/anemone/filesystem.nix new file mode 100644 index 0000000..1c984e8 --- /dev/null +++ b/hosts/anemone/filesystem.nix @@ -0,0 +1,36 @@ +{ config, lib, ... }: +let + mkLabelMount = label: type: lazy: { + device = "/dev/disk/by-label/${label}"; + fsType = type; + options = [ "defaults" "relatime" ] ++ lib.optionals lazy [ "nofail" ]; + }; + mkBtrfsMount = name: subvol: atime: mkLabelMount name "btrfs" false // { + options = [ "autodefrag" "compress=zstd:3" "defaults" "discard=async" "space_cache=v2" "ssd" "subvol=${subvol}" (if atime then "relatime" else "noatime") ]; + }; + submount = mkBtrfsMount "Anemone"; +in +{ + fileSystems = { + "/" = { + device = "rootfs"; + fsType = "tmpfs"; + options = [ "defaults" "size=8G" "mode=755" ]; + }; + "/boot" = mkLabelMount "SYSTEM" "vfat" true; + + "/mnt/butter" = submount "/" true; + "/nix" = submount "/current/snow" false; + "/home" = submount "/current/home" true; + "/home/.snapshots" = submount "/snapshot/home" false; + "/root" = submount "/current/root" false; + "/var" = submount "/current/var" false; + "/persist" = { + depends = [ "/var" ]; + device = "/var/persist"; + fsType = "none"; + options = [ "bind" ]; + neededForBoot = true; + }; + }; +} diff --git a/hosts/anemone/kernel.nix b/hosts/anemone/kernel.nix new file mode 100644 index 0000000..a8d8cad --- /dev/null +++ b/hosts/anemone/kernel.nix @@ -0,0 +1,47 @@ +{ config, lib, pkgs, ... }: { + boot = { + consoleLogLevel = 0; + loader = { + efi.canTouchEfiVariables = true; + systemd-boot.enable = true; + }; + initrd = { + availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + verbose = false; + }; + kernelModules = [ "kvm-amd" ]; + kernelPackages = lib.mkForce (pkgs.linuxPackagesFor pkgs.me.linux-lava); + kernelParams = [ + "quiet" + "console=tty2" + "systemd.show_status=0" + "rd.systemd.show_status=0" + "rd.udev.log_level=3" + "udev.log_level=3" + "udev.log_priority=3" + ]; + }; + + hardware.cpu.amd.updateMicrocode = true; + + hardware.firmware = let + fw = "${pkgs.linux-firmware}/lib/firmware/cirrus/"; + in [( + pkgs.runCommandNoCC "cs35l41-10431683" { } '' + mkdir -p $out/lib/firmware/cirrus + cd $out/lib/firmware/cirrus + cp ${fw}/cs35l41-dsp1-spk-cali-10431e12-spkid0-l0.bin cs35l41-dsp1-spk-cali-10431683-spkid0-l0.bin + cp ${fw}/cs35l41-dsp1-spk-cali-10431e12-spkid0-l0.bin cs35l41-dsp1-spk-cali-10431683-spkid0-r0.bin + cp ${fw}/cs35l41-dsp1-spk-cali-10431e12-spkid0-l0.bin cs35l41-dsp1-spk-cali-10431683-spkid1-l0.bin + cp ${fw}/cs35l41-dsp1-spk-cali-10431e12-spkid0-l0.bin cs35l41-dsp1-spk-cali-10431683-spkid1-r0.bin + + cp ${fw}/cs35l41-dsp1-spk-prot-10431e12-spkid0-l0.bin cs35l41-dsp1-spk-prot-10431683-spkid0-l0.bin + cp ${fw}/cs35l41-dsp1-spk-prot-10431e12-spkid0-l0.bin cs35l41-dsp1-spk-prot-10431683-spkid0-r0.bin + cp ${fw}/cs35l41-dsp1-spk-prot-10431e12-spkid0-l0.bin cs35l41-dsp1-spk-prot-10431683-spkid1-l0.bin + cp ${fw}/cs35l41-dsp1-spk-prot-10431e12-spkid0-l0.bin cs35l41-dsp1-spk-prot-10431683-spkid1-r0.bin + + cp ${fw}/cs35l41-dsp1-spk-cali-10431e12.wmfw cs35l41-dsp1-spk-cali-10431683.wmfw + cp ${fw}/cs35l41-dsp1-spk-prot-10431e12.wmfw cs35l41-dsp1-spk-prot-10431683.wmfw + '' + )]; +} diff --git a/hosts/anemone/networking.nix b/hosts/anemone/networking.nix new file mode 100644 index 0000000..0431249 --- /dev/null +++ b/hosts/anemone/networking.nix @@ -0,0 +1,15 @@ +{ config, ... }: { + networking = { + nameservers = [ "1.1.1.1" "8.8.8.8" ]; + wireless.iwd.enable = true; + + networkmanager = { + enable = true; + wifi.backend = "iwd"; + }; + + extraHosts = '' + 192.168.100.16 hyacinth + ''; + }; +}