Adds winbox system, cleans up nixos modules

This commit is contained in:
willemml 2023-11-08 15:30:36 -08:00
parent a7c69788b0
commit d5621f05ae
Signed by: willemml
GPG key ID: C3DE5DF6198DACBD
19 changed files with 273 additions and 173 deletions

View file

@ -37,6 +37,13 @@
home.sessionVariables.NIX_PATH = "nixpkgs=${inputs.nixpkgs}";
nix.registry.nixpkgs.flake = inputs.nixpkgs;
};
hyprland = {
imports = [
inputs.hyprland.homeManagerModules.default
{wayland.windowManager.hyprland.enable = true;}
];
};
}
// modules;
}

View file

@ -22,6 +22,8 @@
self.homeManagerModules.nixpkgs-useFlakeNixpkgs
];
programs.emacs.enableOrgTex = true;
home.homeDirectory = "/Users/willem";
};
@ -31,6 +33,8 @@
self.homeManagerModules.linux
];
programs.emacs.enableOrgTex = false;
home.homeDirectory = "/home/willem";
};
};
@ -51,6 +55,7 @@
inherit pkgs;
modules = [self.homeManagerModules."user-willem-${systemType}" {nix.package = pkgs.nix;}];
};
packages = let
activationPackages = builtins.mapAttrs (_: lib.getAttr "activationPackage") homeConfigurations;
in

View file

@ -9,12 +9,17 @@
../../nixos/profiles/common.nix
../../nixos/profiles/linux/base.nix
self.nixosModules.useFlakeNixpkgs
self.nixosModules.users-willem
];
nixpkgs.overlays = builtins.attrValues self.overlays;
nixpkgs.config.allowUnfree = true;
};
nixosModules.darwinArmVM = {...}: {
virtualisation.host.pkgs = inputs.nixpkgs.legacyPackages.aarch64-darwin;
};
nixosModules.willem-home = {...}: {
imports = [
inputs.home-manager.nixosModules.home-manager
@ -23,6 +28,14 @@
home-manager.users.willem = self.homeManagerModules.user-willem-linux;
};
nixosModules.willem-hyprland = {...}: {
imports = [
inputs.home-manager.nixosModules.home-manager
self.nixosModules.homeManagerIntegration
];
home-manager.users.willem = self.homeManagerModules.user-willem-linux // self.homeManagerModules.hyprland;
};
darwinModules.base = {...}: {
imports = [
../../nixos/profiles/common.nix
@ -34,33 +47,14 @@
nixpkgs.config.allowUnfree = true;
};
nixosConfigurations.zeusvm = inputs.nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
nixosConfigurations.winbox = inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
self.nixosModules.base
self.nixosModules.willem-home
../../nixos/hosts/zeus.utmvm.nix
];
};
nixosConfigurations.zeusasahi = inputs.nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
self.nixosModules.appleSilicon
self.nixosModules.base
self.nixosModules.willem-home
../../nixos/hosts/zeus.asahi.nix
];
};
nixosConfigurations.m1-installer-live = inputs.nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
self.nixosModules.appleSilicon
self.nixosModules.base
../../nixos/hosts/live.nix
../../nixos/hosts/asahi-live.nix
self.nixosModules.willem-hyprland
../../nixos/hosts/winbox.nix
];
specialArgs = {inherit inputs;};
};
nixosConfigurations.arm-live = inputs.nixpkgs.lib.nixosSystem {
@ -69,6 +63,18 @@
self.nixosModules.base
../../nixos/hosts/live.nix
];
specialArgs = {inherit inputs;};
};
nixosConfigurations.darwinArmMinimalVM = inputs.nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
self.nixosModules.users-willemVm
self.nixosModules.base
self.nixosModules.headlessVm
self.nixosModules.darwinArmVM
];
specialArgs = {inherit inputs;};
};
darwinConfigurations.zeus = inputs.darwin.lib.darwinSystem {
@ -79,5 +85,7 @@
];
specialArgs = {inherit inputs;};
};
packages.aarch64-darwin.minimalVM = self.nixosConfigurations.darwinArmMinimalVM.config.system.build.vm;
};
}

131
flake.lock generated
View file

@ -130,7 +130,7 @@
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
"systems": "systems_3"
},
"locked": {
"lastModified": 1685518550,
@ -187,6 +187,53 @@
"type": "github"
}
},
"hyprland": {
"inputs": {
"hyprland-protocols": "hyprland-protocols",
"nixpkgs": "nixpkgs_2",
"systems": "systems_2",
"wlroots": "wlroots",
"xdph": "xdph"
},
"locked": {
"lastModified": 1699296543,
"narHash": "sha256-9MYwT+vVmitFIjPZhzn5ZsKNCwgKGU98SW1gAX5bvXs=",
"owner": "hyprwm",
"repo": "Hyprland",
"rev": "29e0a7112ef5c412e4af640b9d80f80b81a26c94",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "Hyprland",
"type": "github"
}
},
"hyprland-protocols": {
"inputs": {
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1691753796,
"narHash": "sha256-zOEwiWoXk3j3+EoF3ySUJmberFewWlagvewDRuWYAso=",
"owner": "hyprwm",
"repo": "hyprland-protocols",
"rev": "0c2ce70625cb30aef199cb388f99e19a61a6ce03",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprland-protocols",
"type": "github"
}
},
"nixos-apple-silicon": {
"inputs": {
"flake-compat": "flake-compat",
@ -276,6 +323,22 @@
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1698134075,
"narHash": "sha256-foCD+nuKzfh49bIoiCBur4+Fx1nozo+4C/6k8BYk4sg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "8efd5d1e283604f75a808a20e6cde0ef313d07d4",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1699099776,
"narHash": "sha256-X09iKJ27mGsGambGfkKzqvw5esP1L/Rf8H3u3fCqIiU=",
@ -322,8 +385,9 @@
"fenix": "fenix",
"flake-parts": "flake-parts",
"home-manager": "home-manager",
"hyprland": "hyprland",
"nixos-apple-silicon": "nixos-apple-silicon",
"nixpkgs": "nixpkgs_2",
"nixpkgs": "nixpkgs_3",
"pre-commit-hooks": "pre-commit-hooks"
}
},
@ -376,6 +440,21 @@
}
},
"systems_2": {
"locked": {
"lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
"owner": "nix-systems",
"repo": "default-linux",
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default-linux",
"type": "github"
}
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
@ -389,6 +468,54 @@
"repo": "default",
"type": "github"
}
},
"wlroots": {
"flake": false,
"locked": {
"host": "gitlab.freedesktop.org",
"lastModified": 1697909146,
"narHash": "sha256-jU0I6FoCKnj4zIBL4daosFWh81U1fM719Z6cae8PxSY=",
"owner": "wlroots",
"repo": "wlroots",
"rev": "47bf87ade2bd32395615a385ebde1fefbcdf79a2",
"type": "gitlab"
},
"original": {
"host": "gitlab.freedesktop.org",
"owner": "wlroots",
"repo": "wlroots",
"rev": "47bf87ade2bd32395615a385ebde1fefbcdf79a2",
"type": "gitlab"
}
},
"xdph": {
"inputs": {
"hyprland-protocols": [
"hyprland",
"hyprland-protocols"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1697981233,
"narHash": "sha256-y8q4XUwx+gVK7i2eLjfR32lVo7TYvEslyzrmzYEaPZU=",
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"rev": "22e7a65ff9633e1dedfa5317fdffc49f68de2ff2",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"type": "github"
}
}
},
"root": "root",

View file

@ -11,6 +11,7 @@
flake-parts.url = "github:hercules-ci/flake-parts";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
hyprland.url = "github:hyprwm/Hyprland";
nixos-apple-silicon.url = "github:tpwrules/nixos-apple-silicon";
nixos-apple-silicon.inputs.nixpkgs.follows = "nixpkgs";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";

View file

@ -1,11 +0,0 @@
{
home.file = {
".config/nixpkgs/config.nix".text = ''
# -*-nix-*-
{
nixpkgs.config.allowUnfreePredicate = (_: true);
allowUnfree = true;
}
'';
};
}

View file

@ -34,11 +34,10 @@ in {
clang-tools
cmake
comma
coreutils-full
coreutils
curl
docker
docker-compose
elan
fd
fenix-rust
findutils
@ -46,10 +45,7 @@ in {
gnuplot
graphviz
htop
iaito
jq
lua_p
lua-language-server
mu
nix-zsh-completions
nixfmt
@ -61,23 +57,18 @@ in {
pass-git-helper
pinentry
plantuml
poppler
pv
python-wp
radare2
ripgrep
rnix-lsp
rsync
shellcheck
shfmt
spotify-tui
spotifyd
sqlite
stylua
texinfo
tldr
units
unp
unrar
unzip
wget

View file

@ -72,7 +72,7 @@
'';
localVariables = {
PROMPT = "\n%B%F{blue}%~\n%F{green}$ %f%b";
PROMPT = "\n%B%F{cyan}%m:%F{blue}%~\n%F{green}$ %f%b";
RPROMPT = "%B%F{red}%*%f%b";
};

View file

@ -1,43 +0,0 @@
{
pkgs,
config,
...
}: {
boot.postBootCommands = let
inherit (config.hardware.asahi.pkgs) asahi-fwextract;
in ''
for o in $(</proc/cmdline); do
case "$o" in
live.nixos.passwd=*)
set -- $(IFS==; echo $o)
echo "nixos:$2" | ${pkgs.shadow}/bin/chpasswd
;;
esac
done
echo Extracting Asahi firmware...
mkdir -p /tmp/.fwsetup/{esp,extracted}
mount /dev/disk/by-partuuid/`cat /proc/device-tree/chosen/asahi,efi-system-partition` /tmp/.fwsetup/esp
${asahi-fwextract}/bin/asahi-fwextract /tmp/.fwsetup/esp/asahi /tmp/.fwsetup/extracted
umount /tmp/.fwsetup/esp
pushd /tmp/.fwsetup/
cat /tmp/.fwsetup/extracted/firmware.cpio | ${pkgs.cpio}/bin/cpio -id --quiet --no-absolute-filenames
mkdir -p /lib/firmware
mv vendorfw/* /lib/firmware
popd
rm -rf /tmp/.fwsetup
'';
hardware.asahi.extractPeripheralFirmware = false;
isoImage.squashfsCompression = "zstd -Xcompression-level 6";
networking.wireless.enable = false;
networking.wireless.iwd = {
enable = true;
settings.General.EnableNetworkConfiguration = true;
};
}

View file

@ -12,8 +12,6 @@
];
networking.hostName = "nixos-live";
isoImage.makeEfiBootable = true;
environment.systemPackages = with pkgs; [
curl
ddrescue
@ -39,7 +37,6 @@
wget
w3m-nographics
zip
mesa
];
# Include support for various filesystems and tools to create / manipulate them.
@ -49,6 +46,11 @@
boot.enableContainers = false;
# get rid of mdadm warning
boot.swraid.mdadmConf = ''
PROGRAM ${pkgs.coreutils}/bin/true
'';
# Configure host id for ZFS to work
networking.hostId = lib.mkDefault "8425e349";
networking.hostId = lib.mkDefault "deadbeef";
}

40
nixos/hosts/winbox.nix Normal file
View file

@ -0,0 +1,40 @@
{
config,
lib,
pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod"];
boot.initrd.kernelModules = [];
boot.kernelModules = ["amdgpu"];
boot.extraModulePackages = [];
hardware.opengl.driSupport = true;
hardware.opengl.extraPackages = with pkgs; [
amdvlk
];
fileSystems."/" = {
device = "/dev/disk/by-uuid/9b616ca8-63fe-4d81-a13e-25c9a95a1a55";
fsType = "ext4";
};
fileSystems."/boot/efi" = {
device = "/dev/disk/by-uuid/4FEE-904E";
fsType = "vfat";
};
swapDevices = [];
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "performance";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -1,38 +0,0 @@
{
config,
inputs,
lib,
modulesPath,
pkgs,
...
}: {
imports = [../profiles/linux/gnome.nix];
boot.initrd.availableKernelModules = ["usb_storage" "sdhci_pci"];
boot.initrd.kernelModules = [];
boot.kernelModules = [];
boot.extraModulePackages = [];
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = false;
fileSystems."/" = {
device = "/dev/disk/by-uuid/47408b5a-efcf-47b7-abd6-591b890fb1f3";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/315C-14F5";
fsType = "vfat";
};
hardware.asahi.extractPeripheralFirmware = false;
swapDevices = [];
networking.useDHCP = lib.mkDefault true;
networking.hostName = "zeusasahi";
nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
}

View file

@ -1,28 +0,0 @@
{pkgs, ...}: {
boot.extraModulePackages = [];
boot.initrd.availableKernelModules = ["xhci_pci" "virtio_pci" "usbhid" "usb_storage" "sr_mod"];
boot.initrd.kernelModules = [];
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.efi.efiSysMountPoint = "/boot/efi";
environment.systemPackages = with pkgs; [mesa];
fileSystems."/" = {
device = "/dev/disk/by-label/nixos";
fsType = "ext4";
};
fileSystems."/boot/efi" = {
device = "/dev/disk/by-label/BOOT";
fsType = "vfat";
};
networking.hostName = "zeus-utmvm";
services.spice-vdagentd.enable = true;
swapDevices = [];
}

View file

@ -0,0 +1,5 @@
{...}: {
imports = [./vm.nix];
virtualisation.vmVariant.virtualisation.graphics = false;
virtualisation.graphics = false;
}

View file

@ -0,0 +1,5 @@
{...}: {
imports = [./willem.nix];
users.users.willem.hashedPassword = "";
services.getty.autologinUser = "willem";
}

View file

@ -0,0 +1,14 @@
{
lib,
pkgs,
...
}: {
users.users.willem = {
shell = lib.mkDefault pkgs.zsh;
isNormalUser = true;
extraGroups = ["networkmanager" "wheel" "video" "udev"];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBx1z962nl87rmOk/vw3EBSgqU/VlCqON8zTeLHQcSBp willem@zeus"
];
};
}

18
nixos/modules/vm.nix Normal file
View file

@ -0,0 +1,18 @@
{
modulesPath,
lib,
...
}: {
imports = [
"${modulesPath}/virtualisation/qemu-vm.nix"
];
system.stateVersion = lib.mkDefault "23.05";
console.keyMap = lib.mkDefault "colemak";
security.sudo.wheelNeedsPassword = false;
boot.initrd.kernelModules = ["virtio_balloon" "virtio_console" "virtio_rng"];
boot.initrd.availableKernelModules = ["virtio_net" "virtio_pci" "virtio_mmio" "virtio_blk" "virtio_scsi" "9p" "9pnet_virtio"];
}

View file

@ -1,7 +1,11 @@
{pkgs, ...}: {
{
pkgs,
lib,
...
}: {
environment.pathsToLink = ["/share/zsh"];
environment.shells = [pkgs.bashInteractive pkgs.zsh];
environment.systemPackages = [pkgs.coreutils-full pkgs.git];
environment.systemPackages = [pkgs.coreutils pkgs.git];
environment.variables.LANG = "en_US.UTF-8";
environment.variables.LANGUAGE = "en_US.UTF-8";
environment.variables.LC_ALL = "en_US.UTF-8";
@ -25,10 +29,11 @@
documentation.man.enable = true;
programs.zsh.enable = true;
programs.zsh.shellInit = lib.mkDefault "zsh-newuser-install() { :; }";
programs.zsh.enableBashCompletion = true;
programs.zsh.promptInit = ''
programs.zsh.promptInit = lib.mkDefault ''
autoload -U promptinit && promptinit
export PROMPT=$'\n'"%B%F{blue}%3~"$'\n'"%F{green}%(!.#.$) %f%b"
export PROMPT=$'\n'"%B%F{cyan}%m:%F{blue}%~"$'\n'"%F{green}%(!.#.$) %f%b"
export RPROMPT="%B%F{red}%*%f%b"
'';

View file

@ -19,12 +19,4 @@
services.udev.enable = true;
system.stateVersion = "23.11";
users.users.willem = {
isNormalUser = true;
extraGroups = ["networkmanager" "wheel" "video" "udev"];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBx1z962nl87rmOk/vw3EBSgqU/VlCqON8zTeLHQcSBp willem@zeus"
];
};
}