Skip to content

Commit

Permalink
Add host mai
Browse files Browse the repository at this point in the history
  • Loading branch information
yousiki committed Jun 5, 2024
1 parent 9021aff commit fa97b70
Show file tree
Hide file tree
Showing 4 changed files with 179 additions and 1 deletion.
16 changes: 16 additions & 0 deletions cells/nixos/hosts/mai/configuration.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{
config,
lib,
pkgs,
...
}: {
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;

boot.kernelPackages = pkgs.linuxPackages_latest;

networking.hostName = "mai";
}
66 changes: 66 additions & 0 deletions cells/nixos/hosts/mai/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
inputs,
cell,
}: {
_module.specialArgs = {
inherit inputs;
};

imports = [
./configuration.nix
./hardware-configuration.nix

inputs.nixos-hardware.nixosModules.common-cpu-intel-cpu-only
inputs.nixos-hardware.nixosModules.common-pc-hdd
inputs.nixos-hardware.nixosModules.common-pc-ssd

inputs.cells.nixos.nixosModules.bcachefs

inputs.cells.nixos.nixosProfiles.core
inputs.cells.nixos.nixosProfiles.desktop
inputs.cells.nixos.nixosProfiles.proxy
inputs.cells.nixos.nixosProfiles.secrets
inputs.cells.nixos.nixosProfiles.server

inputs.cells.home.homeProfiles.base

{
home-manager.users.yousiki = {
imports = [
inputs.catppuccin.homeManagerModules.catppuccin

inputs.cells.home.homeProfiles.core
inputs.cells.home.homeProfiles.languages
inputs.cells.home.homeProfiles.shell
inputs.cells.home.homeProfiles.ssh
];

bee.home-languages = [
"c"
"latex"
"nix"
"node"
"python"
"rust"
];
};
}
];

bee = rec {
system = "x86_64-linux";
home = inputs.home-manager;
pkgs = import inputs.nixpkgs-nixos {
inherit system;
config = {
allowUnfree = true;
};
overlays = [
inputs.agenix.overlays.default
inputs.colmena.overlays.default
inputs.fenix.overlays.default
inputs.nvfetcher.overlays.default
];
};
};
}
96 changes: 96 additions & 0 deletions cells/nixos/hosts/mai/hardware-configuration.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# 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,
modulesPath,
...
}: let
credentials = config.age.secrets.nas-credentials.path;

mkCifs = device: {
device = device;
fsType = "cifs";
options = [
"noauto"
"x-systemd.automount"
"x-systemd.idle-timeout=60"
"x-systemd.device-timeout=5s"
"x-systemd.mount-timeout=5s"
"noperm"
"credentials=${credentials}"
];
};

mkNfs = device: {
device = device;
fsType = "nfs";
options = [
"noauto"
"x-systemd.automount"
"x-systemd.idle-timeout=600"
"x-systemd.device-timeout=5s"
"x-systemd.mount-timeout=5s"
];
};
in {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];

boot.initrd.availableKernelModules = ["vmd" "xhci_pci" "ahci" "nvme" "usbhid" "uas" "sd_mod"];
boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = [];
boot.supportedFilesystems = ["bcachefs"];

fileSystems."/" = {
device = "/dev/disk/by-uuid/8fecfd43-b3ee-4917-8fba-62fcbdf0ade5";
fsType = "btrfs";
options = ["subvol=root" "noatime" "compress=zstd"];
};

fileSystems."/home" = {
device = "/dev/disk/by-uuid/8fecfd43-b3ee-4917-8fba-62fcbdf0ade5";
fsType = "btrfs";
options = ["subvol=home" "noatime" "compress=zstd"];
};

fileSystems."/nix" = {
device = "/dev/disk/by-uuid/8fecfd43-b3ee-4917-8fba-62fcbdf0ade5";
fsType = "btrfs";
options = ["subvol=nix" "noatime" "compress=zstd"];
};

fileSystems."/boot" = {
device = "/dev/disk/by-uuid/BDB7-F23F";
fsType = "vfat";
};

swapDevices = [
{device = "/dev/disk/by-uuid/aa708a45-8575-4503-a234-f18888887989";}
{device = "/dev/disk/by-uuid/30968767-7ddc-42ac-ae92-436db93a0631";}
];

fileSystems."/mnt/nas-yyp-home" = mkCifs "//nas.ybh1998.space/home";
fileSystems."/mnt/nas-yyp-share" = mkCifs "//nas.ybh1998.space/share";
fileSystems."/mnt/nas-mck-home" = mkCifs "//nas-changping.ybh1998.space/home";
fileSystems."/mnt/nas-mck-share" = mkCifs "//nas-changping.ybh1998.space/share";

fileSystems."/mnt/nas-satoshi-bangumi" = mkNfs "satoshi.mck.cn.yousiki.top:/share/Bangumi";
fileSystems."/mnt/nas-satoshi-downloads" = mkNfs "satoshi.mck.cn.yousiki.top:/share/Downloads";
fileSystems."/mnt/nas-satoshi-movie" = mkNfs "satoshi.mck.cn.yousiki.top:/share/Movie";
fileSystems."/mnt/nas-satoshi-research" = mkNfs "satoshi.mck.cn.yousiki.top:/share/Research";

# 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.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp2s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlo1.useDHCP = lib.mkDefault true;

nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,14 @@
"https://colmena.cachix.org?priority=40"
"https://cuda-maintainers.cachix.org?priority=40"
"https://hyprland.cachix.org?priority=40"
"https://mirror.sjtu.edu.cn/nix-channels/store?priority=25"
"https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store?priority=25"
"https://mirrors.ustc.edu.cn/nix-channels/store?priority=35"
"https://nichijou.cachix.org?priority=40"
"https://nix-community.cachix.org?priority=40"
"https://nixpkgs-wayland.cachix.org?priority=40"
"https://numtide.cachix.org?priority=40"
# "https://cache.garnix.io?priority=50"
# "https://mirror.sjtu.edu.cn/nix-channels/store?priority=25"
# "https://mirrors.cqupt.edu.cn/nix-channels/store?priority=35"
];
trusted-substituters = substituters;
Expand Down

0 comments on commit fa97b70

Please sign in to comment.