diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..941d5cf --- /dev/null +++ b/build.sh @@ -0,0 +1 @@ +sudo nixos-rebuild switch --flake . --impure diff --git a/common.nix b/common.nix index 43dd72b..3cd000d 100644 --- a/common.nix +++ b/common.nix @@ -96,7 +96,7 @@ with builtins; environment.systemPackages = with pkgs; [ neovim wget git neofetch pciutils pavucontrol font-manager zip unzip gnutar iw btop xdotool xorg.xwininfo nodejs gparted networkmanagerapplet - mailspring betterdiscordctl fluffychat pulseaudioFull speedtest-cli + mailspring betterdiscordctl pulseaudioFull speedtest-cli librewolf polymc jdk8 jdk11 jdk vlc xfce.thunar xfce.tumbler xfce.thunar-archive-plugin gnome.file-roller uhk-agent spotify spotify-tray spotify-tui cool-retro-term lutris libsecret gh xorg.xhost helvum @@ -107,6 +107,7 @@ with builtins; # python39Packages.pip python39Packages.setuptools python39Packages.ipykernel fzf openrgb krita gimp inkscape blender virglrenderer ddccontrol-db glab firebird-emu + discord ]; environment.pathsToLink = [ @@ -141,7 +142,8 @@ with builtins; # accidentally delete configuration.nix. # system.copySystemConfiguration = true; - # networking.firewall.allowedTCPPorts = [ 4713 ]; + networking.firewall.allowedTCPPorts = [ 8384 22000 ]; + networking.firewall.allowedUDPPorts = [ 8080 22000 21027 ]; systemd.services."NetworkManager-wait-online".enable = false; # release channel diff --git a/monosodium-glutamate-g/flake.lock b/flake.lock similarity index 82% rename from monosodium-glutamate-g/flake.lock rename to flake.lock index 6489036..12f0417 100644 --- a/monosodium-glutamate-g/flake.lock +++ b/flake.lock @@ -6,11 +6,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1660252108, - "narHash": "sha256-fpY8X+eJmClJyVnMQJ7bpsNgn/CxPE9+UkkJ0FRIKQ8=", + "lastModified": 1660574517, + "narHash": "sha256-Lp5D2pAPrM3iAc1eeR0iGwz5rM+SYOWzVxI3p17nlrU=", "owner": "nix-community", "repo": "home-manager", - "rev": "324fedcf9f1c475e2f522d03af029528e65969bc", + "rev": "688e5c85b7537f308b82167c8eb4ecfb70a49861", "type": "github" }, "original": { @@ -37,11 +37,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1660275424, - "narHash": "sha256-OVjapp+VIt3a/qQm5oSwNuoDbvIRbMk8tbbzWJb2zVc=", + "lastModified": 1660540332, + "narHash": "sha256-ZlTlrculh/qAzeZOq4laTRGZ7Da8pMyncHTOVVt3M1M=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d977d658816cb84d3a38065846e3f2d7e96dccb2", + "rev": "29136a94b92f2c0959abcb099d40cc87869b8a1f", "type": "github" }, "original": { diff --git a/monosodium-glutamate-g/flake.nix b/flake.nix similarity index 55% rename from monosodium-glutamate-g/flake.nix rename to flake.nix index 96079d5..a934c08 100644 --- a/monosodium-glutamate-g/flake.nix +++ b/flake.nix @@ -7,6 +7,7 @@ url = "github:nix-community/home-manager"; inputs.nixpks.follows = "nixpkgs"; }; + nixos-hardware.url = github:kekrby/nixos-hardware; }; outputs = { self, nixpkgs, home-manager, ... }: { @@ -14,8 +15,7 @@ monosodium-glutamate-g = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ - # ./host/myhost/configuration.nix - ./configuration.nix + ./monosodium-glutamate-g/configuration.nix home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; @@ -26,6 +26,21 @@ } ]; }; + potatobook-g = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./potatobook-g/configuration.nix + home-manager.nixosModules.home-manager { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.jade = { nixosConfig, pkgs, ... }: { + home.sessionVariables.TZ = nixosConfig.time.timeZone; + home.stateVersion = "${nixosConfig.system.stateVersion}"; + }; + } + nixos-hardware.nixosModules.apple-t2 + ]; + }; }; }; } diff --git a/modules/desktop.nix b/modules/desktop.nix index 887a3c4..dcac476 100644 --- a/modules/desktop.nix +++ b/modules/desktop.nix @@ -188,7 +188,7 @@ in with lib; { gaps = { inner = 15; outer = 0; - smartGaps = true; + smartGaps = false; }; colors = { background = "#1d2021"; diff --git a/monosodium-glutamate-g/configuration.nix b/monosodium-glutamate-g/configuration.nix index c04cd9a..c3d467e 100644 --- a/monosodium-glutamate-g/configuration.nix +++ b/monosodium-glutamate-g/configuration.nix @@ -40,6 +40,13 @@ "/share/nix-direnv" ]; + services.syncthing = rec { + enable = true; + user = "jade"; + dataDir = "/home/${user}/Documents"; + configDir = "/home/${user}/Documents/.config/syncthing"; + }; + services.blueman.enable = true; services.gnome.gnome-keyring.enable = true; diff --git a/potatobook-g/configuration.nix b/potatobook-g/configuration.nix new file mode 100644 index 0000000..c124f99 --- /dev/null +++ b/potatobook-g/configuration.nix @@ -0,0 +1,61 @@ +{ config, pkgs, ... }: +{ + imports = [ + + + # ./t2.nix + ../common.nix + ]; + + # boot.supportedFilesystems = pkgs.lib.mkForce [ "ext4" "btrfs" "squashfs" ]; + # networking.wireless.enable = pkgs.lib.mkForce false; + + # services.xserver.displayManager.autoLogin.user = pkgs.lib.mkForce "jade"; + # users.users.jade = pkgs.lib.mkForce { + # isNormalUser = true; + # extraGroups = [ "wheel" "input" "uinput" "libvirtd" ]; + # packages = with pkgs; [ + # ]; + # }; + + jade = { + desktop.enable = true; + desktop.compositing = true; + }; + + + networking.hostName = "potatobook-g"; + + services.xserver.layout = "us"; + services.xserver.xkbVariant = "altgr-intl"; + + hardware.bluetooth.enable = true; + hardware.keyboard.uhk.enable = true; + + # missing: menu-qalc picom-jonaburg + environment.systemPackages = with pkgs; [ + # TODO: clean up. + ]; + + environment.pathsToLink = [ + "/share/nix-direnv" + ]; + + services.blueman.enable = true; + + services.gnome.gnome-keyring.enable = true; + programs.seahorse.enable = true; + security.pam.services.jade.enableGnomeKeyring = true; + + # Copy the NixOS configuration file and link it from the resulting system + # (/run/current-system/configuration.nix). This is useful in case you + # accidentally delete configuration.nix. + # system.copySystemConfiguration = true; + + # networking.firewall.allowedTCPPorts = [ 4713 ]; + systemd.services."NetworkManager-wait-online".enable = false; + + # release channel + system.stateVersion = "22.05"; # Did you read the comment? +} + diff --git a/potatobook-g/firmware-source.tar b/potatobook-g/firmware-source.tar new file mode 100644 index 0000000..b23e4ce Binary files /dev/null and b/potatobook-g/firmware-source.tar differ diff --git a/potatobook-g/iso.nix b/potatobook-g/iso.nix new file mode 100644 index 0000000..cc81080 --- /dev/null +++ b/potatobook-g/iso.nix @@ -0,0 +1,9 @@ +{config, pkgs, ...}: +{ + imports = [ + + + ./configuration.nix + ]; +} + diff --git a/potatobook-g/packages/apple-bce/default.nix b/potatobook-g/packages/apple-bce/default.nix new file mode 100644 index 0000000..172bb72 --- /dev/null +++ b/potatobook-g/packages/apple-bce/default.nix @@ -0,0 +1,23 @@ +{ stdenv, lib, fetchFromGitHub, kernel, kmod }: + +stdenv.mkDerivation rec { + name = "apple-bce-${version}-${kernel.version}"; + gitCommit = "f93c6566f98b3c95677de8010f7445fa19f75091"; + version = "${gitCommit}"; + + src = fetchFromGitHub { + owner = "t2linux"; + repo = "apple-bce-drv"; + rev = "${gitCommit}"; + sha256 = "sha256-5jvfDSa7tHp6z+E+RKIalNiLpsku1RNnKoJV2Ps8288="; + }; + + hardeningDisable = [ "pic" "format" ]; + nativeBuildInputs = kernel.moduleBuildDependencies; + + makeFlags = [ + "KERNELRELEASE=${kernel.modDirVersion}" + "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" + "INSTALL_MOD_PATH=$(out)" + ]; +} diff --git a/potatobook-g/packages/apple-ib-drv/default.nix b/potatobook-g/packages/apple-ib-drv/default.nix new file mode 100644 index 0000000..944ce34 --- /dev/null +++ b/potatobook-g/packages/apple-ib-drv/default.nix @@ -0,0 +1,23 @@ +{ stdenv, lib, fetchFromGitHub, kernel, kmod }: + +stdenv.mkDerivation rec { + name = "apple-ib-drv-${version}-${kernel.version}"; + gitCommit = "d8411ad1d87db8491e53887e36c3d37f445203eb"; + version = "${gitCommit}"; + + src = fetchFromGitHub { + owner = "t2linux"; + repo = "apple-ib-drv"; + rev = "${gitCommit}"; + sha256 = "sha256-mPx9Y4488pcxnJ5iyeNRuWvnyluHXmOOBnRNw+GAC2k="; + }; + + hardeningDisable = [ "pic" "format" ]; + nativeBuildInputs = kernel.moduleBuildDependencies; + + makeFlags = [ + "KERNELRELEASE=${kernel.modDirVersion}" + "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" + "INSTALL_MOD_PATH=$(out)" + ]; +} diff --git a/potatobook-g/packages/linux-mbp/default.nix b/potatobook-g/packages/linux-mbp/default.nix new file mode 100644 index 0000000..94474a9 --- /dev/null +++ b/potatobook-g/packages/linux-mbp/default.nix @@ -0,0 +1,42 @@ +{ pkgs, stdenv, lib, buildLinux, ... } @ args: + +with lib; +let + kernelVersion = "5.18.16"; + patches = pkgs.fetchFromGitHub { + owner = "Redecorating"; + repo = "linux-t2-arch"; + rev = "2222222222222222222222222222222222222222222222222222"; + sha256 = "sha256-/gxnq0Gz/N1u6m/oes7a6NlJQ7CoMwnFNxztQhDt46Q="; + }; +in +buildLinux (args // rec { + version = "${kernelVersion}-mbp"; + modDirVersion = kernelVersion; + extraMeta.branch = versions.majorMinor version; + + src = pkgs.fetchurl { + url = "mirror://kernel/linux/kernel/v5.x/linux-${kernelVersion}.tar.xz"; + sha256 = "sha256-8fWGJR5j3hTIbl+VuWvrFaBDTx5uId94jRI1ZK8NEc4="; + }; + + kernelPatches = [ + #rec { name = "0001-arch-additions"; patch = "${patches}/${name}.patch"; } + #rec { name = "1001-Put-apple-bce-and-apple-ibridge-in-drivers-staging"; patch = "${patches}/${name}.patch"; } + #rec { name = "1002-add-modalias-to-apple-bce"; patch = "${patches}/${name}.patch"; } + rec { name = "2001-fix-acpica-for-zero-arguments-acpi-calls"; patch = "${patches}/${name}.patch"; } + rec { name = "2002-efi-Correct-Macmini-capitalisation-in-uefi-cert-quir"; patch = "${patches}/${name}.patch"; } + rec { name = "3001-applesmc-convert-static-structures-to-drvdata"; patch = "${patches}/${name}.patch"; } + rec { name = "3002-applesmc-make-io-port-base-addr-dynamic"; patch = "${patches}/${name}.patch"; } + rec { name = "3003-applesmc-switch-to-acpi_device-from-platform"; patch = "${patches}/${name}.patch"; } + rec { name = "3004-applesmc-key-interface-wrappers"; patch = "${patches}/${name}.patch"; } + rec { name = "3005-applesmc-basic-mmio-interface-implementation"; patch = "${patches}/${name}.patch"; } + rec { name = "3006-applesmc-fan-support-on-T2-Macs"; patch = "${patches}/${name}.patch"; } + rec { name = "3007-applesmc-Add-iMacPro-to-applesmc_whitelist"; patch = "${patches}/${name}.patch"; } + rec { name = "4001-Input-bcm5974-Add-support-for-the-T2-Macs"; patch = "${patches}/${name}.patch"; } + rec { name = "5001-Fix-for-touchbar"; patch = "${patches}/${name}.patch"; } + rec { name = "7001-drm-i915-fbdev-Discard-BIOS-framebuffers-exceeding-h"; patch = "${patches}/${name}.patch"; } + rec { name = "8001-asahilinux-wifi-patchset"; patch = "${patches}/${name}.patch"; } + rec { name = "8002-asahilinux-hci_bcm4377-patchset"; patch = "${patches}/${name}.patch"; } + ]; +} // (args.argsOverride or { })) diff --git a/potatobook-g/t2.nix b/potatobook-g/t2.nix new file mode 100644 index 0000000..3518fd2 --- /dev/null +++ b/potatobook-g/t2.nix @@ -0,0 +1,33 @@ +{ pkgs, ... }: +let +in { + # from https://github.com/tpwrules/nixos-m1/blob/main/nix/m1-support/firmware/default.nix + nixpkgs.overlays = [ (self: super: { + linux-mbp = super.callPackage ./packages/linux-mbp { }; + apple-bce = super.callPackage ./packages/apple-bce { kernel = self.linux-mbp; }; + apple-ib-drv = super.callPackage ./packages/apple-ib-drv { kernel = self.linux-mbp; }; + }) ]; + + hardware.firmware = [ + (pkgs.stdenvNoCC.mkDerivation { + name = "firmware"; + buildCommand = '' + mkdir -p $out/lib/firmware + FIRMWARE=`echo ${./.}/*firmware*.tar` + if [ -e "$FIRMWARE" ]; then + tar xf "$FIRMWARE" -C $out/lib/firmware + # move firmware for my specific device + mv $out/lib/firmware/C-4377__s-B3/* $out/lib/firmware + find $out/lib/firmware -depth -type d -empty -delete + else + # stop nixos infra from breaking when it doesn't have any firmware + touch $out/lib/firmware/.dummy + fi + ''; + }) + ]; + + boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux-mbp; + boot.extraModulePackages = [ pkgs.apple-bce pkgs.apple-ib-drv ]; + boot.initrd.kernelModules = [ "apple_bce" "apple-ibridge" "apple-ib-tb" ]; +} diff --git a/scripts/desktop/window_screenshot.nix b/scripts/desktop/window_screenshot.nix new file mode 100644 index 0000000..d59b422 --- /dev/null +++ b/scripts/desktop/window_screenshot.nix @@ -0,0 +1 @@ +with import {};