-
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
871 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{pkgs, ...}: | ||
pkgs.stdenvNoCC.mkDerivation { | ||
name = "brcm-firmware"; | ||
nativeBuildInputs = with pkgs; [gnutar xz]; | ||
buildCommand = '' | ||
dir="$out/lib/" | ||
mkdir -p "$dir" | ||
tar -axvf ${./firmware.tar.xz} -C "$dir" | ||
''; | ||
} |
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
# a flake for testing | ||
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11"; | ||
outputs = {nixpkgs, ...}: let | ||
system = "x86_64-linux"; | ||
pkgs = import nixpkgs {inherit system;}; | ||
in { | ||
packages."${system}".default = pkgs.callPackage ./default.nix {}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
pkgs, | ||
nixos-hardware, | ||
... | ||
} @ args: | ||
############################################################# | ||
# | ||
# Shoukei - NixOS running on Macbook Pro 2020 I5 16G | ||
# https://github.com/NixOS/nixos-hardware/tree/master/apple/t2 | ||
# | ||
############################################################# | ||
{ | ||
imports = [ | ||
nixos-hardware.nixosModules.apple-t2 | ||
{hardware.apple-t2.enableAppleSetOsLoader = true;} | ||
|
||
./hardware-configuration.nix | ||
./impermanence.nix | ||
]; | ||
|
||
networking = { | ||
hostName = "shoukei"; # Define your hostname. | ||
# configures the network interface(include wireless) via `nmcli` & `nmtui` | ||
networkmanager.enable = true; | ||
|
||
# Configure network proxy if necessary | ||
# proxy.default = "http://user:password@proxy:port/"; | ||
# proxy.noProxy = "127.0.0.1,localhost,internal.domain"; | ||
|
||
# Configure network proxy if necessary | ||
# proxy.default = "http://user:password@proxy:port/"; | ||
# proxy.noProxy = "127.0.0.1,localhost,internal.domain"; | ||
|
||
defaultGateway = "192.168.5.201"; | ||
nameservers = [ | ||
"119.29.29.29" # DNSPod | ||
"223.5.5.5" # AliDNS | ||
]; | ||
}; | ||
|
||
# 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 = "23.11"; # Did you read the comment? | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
# 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, | ||
pkgs, | ||
modulesPath, | ||
... | ||
}: { | ||
imports = [ | ||
(modulesPath + "/installer/scan/not-detected.nix") | ||
]; | ||
|
||
hardware.firmware = [ | ||
(import ./brcm-firmware { inherit pkgs;}) | ||
]; | ||
|
||
boot.initrd.availableKernelModules = ["xhci_pci" "nvme" "usbhid" "usb_storage" "sd_mod"]; | ||
boot.initrd.kernelModules = []; | ||
boot.kernelModules = ["kvm-intel"]; | ||
boot.extraModulePackages = []; | ||
|
||
# Use the EFI boot loader. | ||
boot.loader.efi.canTouchEfiVariables = true; | ||
# depending on how you configured your disk mounts, change this to /boot or /boot/efi. | ||
boot.loader.efi.efiSysMountPoint = "/boot"; | ||
boot.loader.systemd-boot.enable = true; | ||
|
||
# Enable binfmt emulation of aarch64-linux, this is required for cross compilation. | ||
boot.binfmt.emulatedSystems = ["aarch64-linux" "riscv64-linux"]; | ||
# supported fil systems, so we can mount any removable disks with these filesystems | ||
boot.supportedFilesystems = lib.mkForce [ | ||
"ext4" | ||
"btrfs" | ||
"xfs" | ||
"ntfs" | ||
"fat" | ||
"vfat" | ||
"cifs" # mount windows share | ||
]; | ||
|
||
# clear /tmp on boot to get a stateless /tmp directory. | ||
boot.tmp.cleanOnBoot = true; | ||
boot.initrd = { | ||
# unlocked luks devices via a keyfile or prompt a passphrase. | ||
luks.devices."crypted-nixos" = { | ||
device = "/dev/nvme0n1p4"; | ||
# the keyfile(or device partition) that should be used as the decryption key for the encrypted device. | ||
# if not specified, you will be prompted for a passphrase instead. | ||
#keyFile = "/root-part.key"; | ||
|
||
# whether to allow TRIM requests to the underlying device. | ||
# it's less secure, but faster. | ||
allowDiscards = true; | ||
}; | ||
}; | ||
|
||
# equal to `mount -t tmpfs tmpfs /` | ||
fileSystems."/" = { | ||
device = "tmpfs"; | ||
fsType = "tmpfs"; | ||
# set mode to 755, otherwise systemd will set it to 777, which cause problems. | ||
# relatime: Update inode access times relative to modify or change time. | ||
options = ["relatime" "mode=755"]; | ||
}; | ||
|
||
fileSystems."/boot" = { | ||
device = "/dev/nvme0n1p1"; | ||
fsType = "vfat"; | ||
}; | ||
|
||
fileSystems."/nix" = { | ||
device = "/dev/disk/by-uuid/2f4db246-e65d-4808-8ab4-5365f9dea1ef"; | ||
fsType = "btrfs"; | ||
options = ["subvol=@nix" "noatime" "compress-force=zstd:1"]; | ||
}; | ||
|
||
fileSystems."/tmp" = { | ||
device = "/dev/disk/by-uuid/2f4db246-e65d-4808-8ab4-5365f9dea1ef"; | ||
fsType = "btrfs"; | ||
options = ["subvol=@tmp" "noatime" "compress-force=zstd:1"]; | ||
}; | ||
|
||
fileSystems."/persistent" = { | ||
device = "/dev/disk/by-uuid/2f4db246-e65d-4808-8ab4-5365f9dea1ef"; | ||
fsType = "btrfs"; | ||
options = ["subvol=@persistent" "noatime" "compress-force=zstd:1"]; | ||
# impermanence's data is required for booting. | ||
neededForBoot = true; | ||
}; | ||
|
||
fileSystems."/snapshots" = { | ||
device = "/dev/disk/by-uuid/2f4db246-e65d-4808-8ab4-5365f9dea1ef"; | ||
fsType = "btrfs"; | ||
options = ["subvol=@snapshots" "noatime" "compress-force=zstd:1"]; | ||
}; | ||
|
||
# mount swap subvolume in readonly mode. | ||
fileSystems."/swap" = { | ||
device = "/dev/disk/by-uuid/2f4db246-e65d-4808-8ab4-5365f9dea1ef"; | ||
fsType = "btrfs"; | ||
options = ["subvol=@swap" "ro"]; | ||
}; | ||
|
||
# remount swapfile in read-write mode | ||
fileSystems."/swap/swapfile" = { | ||
# the swapfile is located in /swap subvolume, so we need to mount /swap first. | ||
depends = ["/swap"]; | ||
|
||
device = "/swap/swapfile"; | ||
fsType = "none"; | ||
options = ["bind" "rw"]; | ||
}; | ||
|
||
swapDevices = [ | ||
{device = "/swap/swapfile";} | ||
]; | ||
|
||
# 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.enp230s0f1u1.useDHCP = lib.mkDefault true; | ||
# networking.interfaces.wlp229s0.useDHCP = lib.mkDefault true; | ||
|
||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; | ||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; | ||
} |
Oops, something went wrong.