From e6a8a664321c991a5ae8764771f2e89de51a5251 Mon Sep 17 00:00:00 2001 From: Fabian Montero Date: Mon, 2 Dec 2024 21:36:26 -0600 Subject: [PATCH] add t14 sys platform --- home/platforms/fabian@t14/default.nix | 71 +++++++++++++++++++ home/platforms/fabian@t14/isolation.nix | 22 ++++++ home/platforms/fabian@t14/shenvs/c.nix | 13 ++++ home/platforms/fabian@t14/shenvs/python.nix | 11 +++ home/platforms/fabian@t14/systemd/default.nix | 10 +++ sys/platforms/posixlycorrect/default.nix | 5 +- sys/platforms/t14/default.nix | 68 ++++++++++++++++++ sys/platforms/t14/hardware-configuration.nix | 62 ++++++++++++++++ 8 files changed, 260 insertions(+), 2 deletions(-) create mode 100644 home/platforms/fabian@t14/default.nix create mode 100644 home/platforms/fabian@t14/isolation.nix create mode 100644 home/platforms/fabian@t14/shenvs/c.nix create mode 100644 home/platforms/fabian@t14/shenvs/python.nix create mode 100644 home/platforms/fabian@t14/systemd/default.nix create mode 100644 sys/platforms/t14/default.nix create mode 100644 sys/platforms/t14/hardware-configuration.nix diff --git a/home/platforms/fabian@t14/default.nix b/home/platforms/fabian@t14/default.nix new file mode 100644 index 0000000..c3565e8 --- /dev/null +++ b/home/platforms/fabian@t14/default.nix @@ -0,0 +1,71 @@ +{ + flakes, + config, + pkgs, + lib, + ... +}: { + imports = [ + ./systemd + ./isolation.nix + ]; + + nix.registry = { + "system".to = { + type = "path"; + path = "/home/fabian/nix"; + }; + + "nixpkgs".flake = flakes.nixpkgs; + "unstable".flake = flakes.unstable; + }; + + local = { + baseline.enable = true; + + services = { + zsh = { + enable = true; + prompt = "%B[%~] \${vcs_info_msg_0_}%b"; + }; + accounts.enable = true; + gpg = { + enable = true; + defaultKey = "7206D8EE2474F3DF18EA876F0EC1691FF8C1A81F"; + }; + }; + + apps = { + terminal.enable = true; + neovim.enable = true; + gaming.enable = true; + yubikey.enable = true; + browsers.enable = true; + defaultDesktopPack.enable = true; + }; + + gui = { + enable = true; + monitors = { + eDP-1 = { + primary = true; + position = "0x0"; + mode = "1920x1080"; + rate = "60.00"; + fingerprint = "00ffffffffffff000dae0a1400000000291d0104a51f11780328659759548e271e505400000001010101010101010101010101010101363680a0703820403020a60035ad10000018000000fe004e3134304843412d4541450a20000000fe00434d4e0a202020202020202020000000fe004e3134304843412d4541450a200002"; + initialI3Workspace = 1; + }; + }; + }; + }; + + home = { + packages = with pkgs; [ + ]; + + username = "fabian"; + homeDirectory = "/home/fabian"; + }; + + programs.home-manager.enable = true; +} diff --git a/home/platforms/fabian@t14/isolation.nix b/home/platforms/fabian@t14/isolation.nix new file mode 100644 index 0000000..6a79337 --- /dev/null +++ b/home/platforms/fabian@t14/isolation.nix @@ -0,0 +1,22 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; { + home.isolation = { + enable = true; + btrfsSupport = true; + defaults = { + static = true; + bindHome = "home/"; + persist = { + base = "shenvs"; + btrfs = true; + }; + }; + + modulesUnder = ./shenvs; + }; +} diff --git a/home/platforms/fabian@t14/shenvs/c.nix b/home/platforms/fabian@t14/shenvs/c.nix new file mode 100644 index 0000000..0ce5ad7 --- /dev/null +++ b/home/platforms/fabian@t14/shenvs/c.nix @@ -0,0 +1,13 @@ +{pkgs, ...}: { + static = true; + + packages = with pkgs; [ + binutils + cmake + curl + gdb + gnumake + rustup + valgrind + ]; +} diff --git a/home/platforms/fabian@t14/shenvs/python.nix b/home/platforms/fabian@t14/shenvs/python.nix new file mode 100644 index 0000000..4818ea5 --- /dev/null +++ b/home/platforms/fabian@t14/shenvs/python.nix @@ -0,0 +1,11 @@ +{pkgs, ...}: { + static = true; + + packages = with pkgs; [ + pipenv + (python310.withPackages (packages: + with packages; [ + setuptools + ])) + ]; +} diff --git a/home/platforms/fabian@t14/systemd/default.nix b/home/platforms/fabian@t14/systemd/default.nix new file mode 100644 index 0000000..83d75a8 --- /dev/null +++ b/home/platforms/fabian@t14/systemd/default.nix @@ -0,0 +1,10 @@ +{ + lib, + pkgs, + ... +}: +with lib; { + systemd.user.tmpfiles.rules = [ + "d %t/tmp 0700 fabian fabian 24h" + ]; +} diff --git a/sys/platforms/posixlycorrect/default.nix b/sys/platforms/posixlycorrect/default.nix index af7015a..23409ac 100644 --- a/sys/platforms/posixlycorrect/default.nix +++ b/sys/platforms/posixlycorrect/default.nix @@ -19,6 +19,7 @@ graphics.enable = true; virtualisation.enable = true; androidSupport.enable = true; + users = { fabian = { enable = true; @@ -47,7 +48,7 @@ }; # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; + i18n.defaultLocale = "en_US.UTF-8"; #todo: move to baseline? - time.timeZone = "America/Costa_Rica"; + time.timeZone = "America/Costa_Rica"; #todo: move to baseline? } diff --git a/sys/platforms/t14/default.nix b/sys/platforms/t14/default.nix new file mode 100644 index 0000000..7fc9ec2 --- /dev/null +++ b/sys/platforms/t14/default.nix @@ -0,0 +1,68 @@ +{ + config, + pkgs, + lib, + flakes, + ... +}: { + imports = [ + flakes.home-manager.nixosModules.home-manager + flakes.impermanence.nixosModule + ./hardware-configuration.nix + ]; + + local.sys = { + baseline.enable = true; + + yubikey.enable = true; + audio.enable = true; + graphics.enable = true; + androidSupport.enable = true; + bluetooth.enable = true; + + users = { + fabian = { + enable = true; + unixId = 1002; + }; + vanessa.enable = true; + }; + }; + + networking = { + hostName = "t14"; + networkmanager.enable = true; + + useDHCP = false; # The global useDHCP flag is deprecated, therefore explicitly set to false here. + interfaces.enp7s0.useDHCP = true; # Per-interface useDHCP will be mandatory in the future, so this generated config + interfaces.wlp6s0.useDHCP = true; # replicates the default behaviour. + }; + + boot = { + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + tmp.useTmpfs = true; + kernelPackages = pkgs.linuxPackages_latest; + }; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; #todo: move to baseline? + + time.timeZone = "America/Costa_Rica"; #todo: move to baseline? + + ###### MODULARIZE AFTER THIS + + services = { + fwupd.enable = true; + thinkfan.enable = true; + tlp.enable = true; + tp-auto-kbbl.enable = true; + pcscd.enable = true; + }; + + hardware.acpilight.enable = true; + + services.fprintd.enable = true; +} diff --git a/sys/platforms/t14/hardware-configuration.nix b/sys/platforms/t14/hardware-configuration.nix new file mode 100644 index 0000000..ca3370e --- /dev/null +++ b/sys/platforms/t14/hardware-configuration.nix @@ -0,0 +1,62 @@ +{ + config, + lib, + pkgs, + flakes, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + services.xserver.videoDrivers = ["i915" "modesetting" "fbdev"]; + + boot = { + initrd = { + availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "sdhci_pci"]; + kernelModules = ["dm-snapshot"]; + luks.devices."tomb" = { + device = "/dev/disk/by-uuid/0b2b9aec-c239-4cce-948d-4411d9300c1d"; + preLVM = true; + }; + }; + kernelModules = ["kvm-intel"]; + extraModulePackages = []; + }; + + fileSystems = { + "/" = { + device = "/dev/disk/by-uuid/2774158f-8ec5-4ba1-a4fb-a37f55b8bb38"; + fsType = "btrfs"; + options = ["subvol=root"]; + }; + + "/boot" = { + device = "/dev/disk/by-uuid/A7E5-EEAB"; + fsType = "vfat"; + }; + + "/nix" = { + device = "/dev/disk/by-uuid/2774158f-8ec5-4ba1-a4fb-a37f55b8bb38"; + fsType = "btrfs"; + options = ["subvol=nix"]; + }; + + "/home" = { + device = "/dev/disk/by-uuid/2774158f-8ec5-4ba1-a4fb-a37f55b8bb38"; + fsType = "btrfs"; + options = ["subvol=home"]; + }; + + "/toplevel" = { + device = "/dev/disk/by-uuid/2774158f-8ec5-4ba1-a4fb-a37f55b8bb38"; + fsType = "btrfs"; + }; + }; + + swapDevices = []; + + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}