diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..d94e5f7 --- /dev/null +++ b/flake.nix @@ -0,0 +1,67 @@ +{ + description = "NixOS configs"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + impermanence.url = "github:nix-community/impermanence"; + nixos-hardware.url = "github:NixOS/nixos-hardware/master"; + }; + + outputs = { self, nixpkgs, impermanence, nixos-hardware, ... }: + let + mkHost = system: modules: nixpkgs.lib.nixosSystem { + inherit system modules; + specialArgs = { inherit impermanence nixos-hardware; }; + }; + + mkPiImage = modules: (nixpkgs.lib.nixosSystem { + system = "aarch64-linux"; + specialArgs = { inherit impermanence nixos-hardware; }; + modules = [ + "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix" + impermanence.nixosModules.impermanence + nixos-hardware.nixosModules.raspberry-pi-4 + ] ++ modules; + }).config.system.build.sdImage; + in { + nixosConfigurations = { + "TheBlackBox" = mkHost "x86_64-linux" [ + ./modules/common.nix + ./modules/desktop-common.nix + ./hosts/desktop/configuration.nix + ]; + "T14" = mkHost "x86_64-linux" [ + ./modules/common.nix + ./modules/desktop-common.nix + ./hosts/laptop/configuration.nix + ]; + Pontiac-G5 = mkHost "aarch64-linux" [ + impermanence.nixosModules.impermanence + nixos-hardware.nixosModules.raspberry-pi-4 + ./modules/common.nix + ./modules/pi-common.nix + ./hosts/pi-car/configuration.nix + ]; + pi-htpc = mkHost "aarch64-linux" [ + nixos-hardware.nixosModules.raspberry-pi-4 + ./modules/common.nix + ./modules/pi-common.nix + ./hosts/pi-htpc/configuration.nix + ]; + }; + + # SD card images + images = { + pi-car = mkPiImage [ + ./modules/common.nix + ./modules/pi-common.nix + ./hosts/pi-car/configuration.nix + ]; + pi-htpc = mkPiImage [ + ./modules/common.nix + ./modules/pi-common.nix + ./hosts/pi-htpc/configuration.nix + ]; + }; + }; +} diff --git a/hosts/desktop/configuration.nix b/hosts/desktop/configuration.nix new file mode 100644 index 0000000..a5927db --- /dev/null +++ b/hosts/desktop/configuration.nix @@ -0,0 +1,26 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + services.beesd.filesystems = { + root = { + spec = "LABEL=NixOS"; + hashTableSizeMB = 512; + verbosity = "crit"; + extraOptions = [ "--loadavg-target" "8.0" ]; + }; + }; + + networking.hostName = "TheBlackBox"; # Define your hostname. + services.openssh.enable = true; + virtualisation.vmware.host.enable = true; + +} diff --git a/hosts/desktop/hardware-configuration.nix b/hosts/desktop/hardware-configuration.nix new file mode 100644 index 0000000..6c4f65f --- /dev/null +++ b/hosts/desktop/hardware-configuration.nix @@ -0,0 +1,35 @@ +# 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") + ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/0480bb3b-4e70-4166-af4d-253e8ed5b041"; + fsType = "btrfs"; + options = [ "subvol=@" ]; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/0480bb3b-4e70-4166-af4d-253e8ed5b041"; + fsType = "btrfs"; + options = [ "subvol=@home" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/86E7-92E1"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/fe32f9af-3382-4505-90e3-aaf1c41bf5d4"; } + ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/laptop/configuration.nix b/hosts/laptop/configuration.nix new file mode 100644 index 0000000..5700faf --- /dev/null +++ b/hosts/laptop/configuration.nix @@ -0,0 +1,26 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + services.beesd.filesystems = { + root = { + spec = "LABEL=NixOS"; + hashTableSizeMB = 256; + verbosity = "crit"; + extraOptions = [ "--loadavg-target" "1.5" ]; + }; + }; + + networking.hostName = "T14"; # Define your hostname. + services.openssh.enable = true; + virtualisation.vmware.host.enable = true; + +} diff --git a/hosts/pi-car/bashrc b/hosts/pi-car/bashrc new file mode 100644 index 0000000..65ba0e6 --- /dev/null +++ b/hosts/pi-car/bashrc @@ -0,0 +1,52 @@ +# Pontiac G5 Pi AUX Unit (i dont know wtf to name this thing) +clear +cat <