From 4f2db0b1e56db1dc0850f4e6d7056604b89ac7be Mon Sep 17 00:00:00 2001 From: alejandro-angulo Date: Sat, 11 Apr 2026 23:02:07 -0700 Subject: [PATCH] Initial framework setup --- flake.lock | 61 +++++----- flake.nix | 1 + .../alejandro@framework/default.nix | 37 ++++++ modules/home/services/swaync/default.nix | 2 +- systems/x86_64-linux/framework/default.nix | 114 ++++++++++++++++++ .../framework/hardware-configuration.nix | 42 +++++++ 6 files changed, 226 insertions(+), 31 deletions(-) create mode 100644 homes/x86_64-linux/alejandro@framework/default.nix create mode 100644 systems/x86_64-linux/framework/default.nix create mode 100644 systems/x86_64-linux/framework/hardware-configuration.nix diff --git a/flake.lock b/flake.lock index 6ef3c66..b9490b9 100644 --- a/flake.lock +++ b/flake.lock @@ -121,11 +121,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1774098279, - "narHash": "sha256-OoQRoQmwCuBBXObi82F6C+eYV1lYCt5Va5k/VckJ6vo=", + "lastModified": 1775994227, + "narHash": "sha256-4VKeWtl9dEubrgpy9fSXkXbjBZlNXPNlQQM5l1ppHv4=", "owner": "catppuccin", "repo": "nix", - "rev": "cb374516af3ccc3aa0c6ef518292bf4ae417a60e", + "rev": "d0a9a21ed8e235956a768fc624242ec9a3e15575", "type": "github" }, "original": { @@ -170,16 +170,17 @@ "pre-commit-hooks": "pre-commit-hooks_2" }, "locked": { - "lastModified": 1773440526, - "narHash": "sha256-OcX1MYqUdoalY3/vU67PEx8m6RvqGxX0LwKonjzXn7I=", - "owner": "nix-community", + "lastModified": 1772186516, + "narHash": "sha256-8s28pzmQ6TOIUzznwFibtW1CMieMUl1rYJIxoQYor58=", + "owner": "rossng", "repo": "crate2nix", - "rev": "e697d3049c909580128caa856ab8eb709556a97b", + "rev": "ba5dd398e31ee422fbe021767eb83b0650303a6e", "type": "github" }, "original": { - "owner": "nix-community", + "owner": "rossng", "repo": "crate2nix", + "rev": "ba5dd398e31ee422fbe021767eb83b0650303a6e", "type": "github" } }, @@ -250,11 +251,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1774123099, - "narHash": "sha256-nkSq47+H4V4Z1CKHa3Hm6xYkRbjDLEptwOfOuAnUsnE=", + "lastModified": 1775997427, + "narHash": "sha256-JUXHTRFoHQanKoAKvHTM4Z0YdbCnmZUGqgMPw95KxUw=", "owner": "cachix", "repo": "devenv", - "rev": "c39977739dc6685541b552353a3b37259a85ad33", + "rev": "88ac631cf8b6582ed372b8b22e3bd12240c61f64", "type": "github" }, "original": { @@ -740,11 +741,11 @@ ] }, "locked": { - "lastModified": 1774007980, - "narHash": "sha256-FOnZjElEI8pqqCvB6K/1JRHTE8o4rer8driivTpq2uo=", + "lastModified": 1776030105, + "narHash": "sha256-b4cNpWPDSH+/CTTiw8++yGh1UYG2kQNrbIehV2iGoeo=", "owner": "nix-community", "repo": "home-manager", - "rev": "9670de2921812bc4e0452f6e3efd8c859696c183", + "rev": "49088dc2e7a876e338e510c5f5f60f659819c650", "type": "github" }, "original": { @@ -780,16 +781,16 @@ ] }, "locked": { - "lastModified": 1774103430, - "narHash": "sha256-MRNVInSmvhKIg3y0UdogQJXe+omvKijGszFtYpd5r9k=", + "lastModified": 1775984952, + "narHash": "sha256-FciKF0weMXVirN+ZBSniR4wpKx168cBa9IXhuaLOkkU=", "owner": "cachix", "repo": "nix", - "rev": "e127c1c94cefe02d8ca4cca79ef66be4c527510e", + "rev": "e671135fc5b783798c444e4ece101f6b15ff0c46", "type": "github" }, "original": { "owner": "cachix", - "ref": "devenv-2.32", + "ref": "devenv-2.34", "repo": "nix", "type": "github" } @@ -890,11 +891,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1774018263, - "narHash": "sha256-HHYEwK1A22aSaxv2ibhMMkKvrDGKGlA/qObG4smrSqc=", + "lastModified": 1775490113, + "narHash": "sha256-2ZBhDNZZwYkRmefK5XLOusCJHnoeKkoN95hoSGgMxWM=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "2d4b4717b2534fad5c715968c1cece04a172b365", + "rev": "c775c2772ba56e906cbeb4e0b2db19079ef11ff7", "type": "github" }, "original": { @@ -906,11 +907,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1773821835, - "narHash": "sha256-TJ3lSQtW0E2JrznGVm8hOQGVpXjJyXY2guAxku2O9A4=", + "lastModified": 1775423009, + "narHash": "sha256-vPKLpjhIVWdDrfiUM8atW6YkIggCEKdSAlJPzzhkQlw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b40629efe5d6ec48dd1efba650c797ddbd39ace0", + "rev": "68d8aa3d661f0e6bd5862291b5bb263b2a6595c9", "type": "github" }, "original": { @@ -937,11 +938,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1773964973, - "narHash": "sha256-NV/J+tTER0P5iJhUDL/8HO5MDjDceLQPRUYgdmy5wXw=", + "lastModified": 1775811116, + "narHash": "sha256-t+HZK42pB6N+i5RGbuy7Xluez/VvWbembBdvzsc23Ss=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "812b3986fd1568f7a858f97fcf425ad996ba7d25", + "rev": "54170c54449ea4d6725efd30d719c5e505f1c10e", "type": "github" }, "original": { @@ -1017,11 +1018,11 @@ }, "nixpkgs_6": { "locked": { - "lastModified": 1773821835, - "narHash": "sha256-TJ3lSQtW0E2JrznGVm8hOQGVpXjJyXY2guAxku2O9A4=", + "lastModified": 1775710090, + "narHash": "sha256-ar3rofg+awPB8QXDaFJhJ2jJhu+KqN/PRCXeyuXR76E=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b40629efe5d6ec48dd1efba650c797ddbd39ace0", + "rev": "4c1018dae018162ec878d42fec712642d214fdfa", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index ec75400..5eea5ad 100644 --- a/flake.nix +++ b/flake.nix @@ -25,6 +25,7 @@ agenix.inputs.darwin.follows = ""; nixos-hardware.url = "github:NixOS/nixos-hardware/master"; + nixos-hardware.inputs.nixpkgs.follows = "nixpkgs"; nixvim.url = "git+https://git.alejandr0angul0.dev/alejandro-angulo/nixvim-config?ref=main"; # nixvim.inputs.nixpkgs.follows = "nixpkgs"; diff --git a/homes/x86_64-linux/alejandro@framework/default.nix b/homes/x86_64-linux/alejandro@framework/default.nix new file mode 100644 index 0000000..a0ec750 --- /dev/null +++ b/homes/x86_64-linux/alejandro@framework/default.nix @@ -0,0 +1,37 @@ +{ lib, pkgs, ... }: +let + + internal_display_settings = "eDP-1,preferred,auto,2"; + clamshell_script = pkgs.writeShellScriptBin "clamshell" '' + if ${pkgs.hyprland}/bin/hyprctl monitors | ${pkgs.ripgrep}/bin/rg -q '\sDP-'; then + if [[ "$1" == "open" ]]; then + ${pkgs.hyprland}/bin/hyprctl keyword monitor ${internal_display_settings} + else + ${pkgs.hyprland}/bin/hyprctl keyword monitor "eDP-1,disable" + fi + fi + ''; +in +{ + aa.isHeadless = false; + aa.windowManagers.sway.clamshell.enable = true; + aa.programs.opencode.enable = true; + aa.windowManagers.hyprland = { + enable = true; + monitor = [ + internal_display_settings + "desc:Dell Inc. DELL U4025QW BH2F734,preferred,auto,1" + ",preferred,auto,1" + ]; + }; + aa.services.hypridle.suspendInhibitWhenPluggedIn = true; + aa.windowManagers.sway.enable = lib.mkForce false; + + wayland.windowManager.hyprland.settings.bindl = [ + ", switch:off:Lid Switch, exec, ${clamshell_script}/bin/clamshell open" + ", switch:on:Lid Switch, exec, ${clamshell_script}/bin/clamshell close" + ]; + + catppuccin.zathura.enable = true; + programs.zathura.enable = true; +} diff --git a/modules/home/services/swaync/default.nix b/modules/home/services/swaync/default.nix index 49b84c2..ea8ba62 100644 --- a/modules/home/services/swaync/default.nix +++ b/modules/home/services/swaync/default.nix @@ -30,6 +30,6 @@ in }; }; - xdg.configFile."swaync/style.css".source = "${pkgs.aa.catppuccin-swaync}/catppuccin.css"; +# xdg.configFile."swaync/style.css".source = "${pkgs.aa.catppuccin-swaync}/catppuccin.css"; }; } diff --git a/systems/x86_64-linux/framework/default.nix b/systems/x86_64-linux/framework/default.nix new file mode 100644 index 0000000..64c9fc0 --- /dev/null +++ b/systems/x86_64-linux/framework/default.nix @@ -0,0 +1,114 @@ +{ + inputs, + pkgs, + lib, + ... +}: +{ + imports = [ + # Include the results of the hardware scan. + # ./hardware-configuration-zfs.nix + # ./zfs.nix + ./hardware-configuration.nix + inputs.nixos-hardware.nixosModules.framework-13-7040-amd + ]; + + aa = { + nix = { + enable = true; + useSelfhostedCache = true; + remoteBuilder.client.enable = false; + }; + + archetypes.workstation.enable = true; + + # services.printing.enable = true; + services.tailscale = { + enable = true; + configureClientRouting = true; + }; + + hardware.audio.enable = true; + hardware.bluetooth.enable = true; + + # system.zfs.enable = true; + apps.yubikey.enable = true; + + user.extraGroups = [ + "dialout" + "video" + ]; + }; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.kernelPackages = pkgs.linuxPackages_latest; + + services.fwupd.enable = true; + + virtualisation = { + docker = { + enable = true; + storageDriver = "overlay2"; + rootless = { + enable = true; + setSocketVariable = true; + }; + }; + }; + + networking = { + hostName = "framework"; + networkmanager.enable = true; # Enables wireless support via wpa_supplicant. + }; + + # This service is problematic + # See: https://github.com/NixOS/nixpkgs/issues/180175 + systemd.services.NetworkManager-wait-online.enable = false; + + # services.tlp.settings = { + # USB_DENYLIST = "0000:1111 2222:3333 4444:5555"; + # }; + # Still need to run `nix run nixpkgs#bolt -- enroll DEVICE_UUID` + services.hardware.bolt.enable = true; + + services.power-profiles-daemon.enable = lib.mkForce false; + + time.timeZone = "America/Los_Angeles"; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + pavucontrol + # android-tools + # sanoid + # # Below 3 installed for sanoid + # pv + # lzop + # mbuffer + + # wireguard-tools + + chromium + # prusa-slicer + traceroute + gnumake + hugo + nixos-generators + vlc + signal-desktop + # zoom-us + ]; + environment.pathsToLink = [ + "/share/applications" + "/share/xdg-desktop-portal" + ]; + + # 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 = "25.11"; # Did you read the comment? +} diff --git a/systems/x86_64-linux/framework/hardware-configuration.nix b/systems/x86_64-linux/framework/hardware-configuration.nix new file mode 100644 index 0000000..4400243 --- /dev/null +++ b/systems/x86_64-linux/framework/hardware-configuration.nix @@ -0,0 +1,42 @@ +{ + config, + lib, + modulesPath, + ... +}: + +{ + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "thunderbolt" + "usb_storage" + "sd_mod" + ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = { + device = "UUID=00a14ad6-5635-4b54-b7e2-a35943639bb8"; + fsType = "bcachefs"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/66E9-291D"; + fsType = "vfat"; + options = [ + "fmask=0077" + "dmask=0077" + ]; + }; + + swapDevices = [ { device = "/dev/disk/by-label/SWAP"; } ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}