diff options
author | polwex <polwex@sortug.com> | 2024-07-21 01:09:48 +0700 |
---|---|---|
committer | polwex <polwex@sortug.com> | 2024-07-21 01:09:48 +0700 |
commit | 78907aa98c1af8624a62ca123d088c6c16424f41 (patch) | |
tree | 477fe923810522acc211b7514e4931af80f33ed7 /hosts/headless |
init
Diffstat (limited to 'hosts/headless')
-rw-r--r-- | hosts/headless/bcn.nix | 70 | ||||
-rw-r--r-- | hosts/headless/configuration.nix | 76 | ||||
-rw-r--r-- | hosts/headless/flake.lock | 82 | ||||
-rw-r--r-- | hosts/headless/flake.nix | 41 | ||||
-rw-r--r-- | hosts/headless/hardware-configuration.nix | 20 | ||||
-rw-r--r-- | hosts/headless/headless.nix | 4 |
6 files changed, 293 insertions, 0 deletions
diff --git a/hosts/headless/bcn.nix b/hosts/headless/bcn.nix new file mode 100644 index 0000000..2cbf960 --- /dev/null +++ b/hosts/headless/bcn.nix @@ -0,0 +1,70 @@ +# 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’). + +{ pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ../base.nix + ../linux.nix + ./headless.nix + ]; + + + + nix = { + autoOptimiseStore = true; + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 30d"; + }; + # Free up to 1GiB whenever there is less than 100MiB left. + extraOptions = '' + min-free = ${toString (100 * 1024 * 1024)} + max-free = ${toString (1024 * 1024 * 1024)} + ''; + }; + boot = { + loader = { + systemd-boot.consoleMode = "max"; + grub.enable = false; + generic-extlinux-compatible.enable = true; # settings don't get saved without this!! + #raspberryPi.enable = true; + raspberryPi.version = 4; + raspberryPi.firmwareConfig = '' + dtparam=audio=on + dtoverlay=vc4-kms-3d + ''; + }; + kernelPackages = pkgs.linuxPackages_rpi4; # Mainline doesn't work yet + extraModprobeConfig = '' + options snd_bcm2835 enable_headphones=1 + ''; + }; + + + networking = { + hostName = "yn-bcn"; # Define your hostname. + }; + + + + # Set your time zone. + time.timeZone = "Europe/Madrid"; + + + # 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? + +} + diff --git a/hosts/headless/configuration.nix b/hosts/headless/configuration.nix new file mode 100644 index 0000000..1d18dc5 --- /dev/null +++ b/hosts/headless/configuration.nix @@ -0,0 +1,76 @@ +# 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’). + +{ ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ../base.nix + ../linux.nix + ./headless.nix + ]; + + + + nix = { + package = pkgs.nixUnstable; + autoOptimiseStore = true; + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 30d"; + }; + # Free up to 1GiB whenever there is less than 100MiB left. + extraOptions = '' + min-free = ${toString (100 * 1024 * 1024)} + max-free = ${toString (1024 * 1024 * 1024)} + ''; + }; + boot = { + loader = { + systemd-boot.consoleMode = "max"; + grub.enable = false; + generic-extlinux-compatible.enable = true; # settings don't get saved without this!! + #raspberryPi.enable = true; + raspberryPi.version = 4; + raspberryPi.firmwareConfig = '' + dtparam=audio=on + dtoverlay=vc4-kms-3d + ''; + }; + kernelPackages = pkgs.linuxPackages_rpi4; # Mainline doesn't work yet + extraModprobeConfig = '' + options snd_bcm2835 enable_headphones=1 + ''; + }; + hardware.raspberry-pi."4" = { + fkms-3d.enable = true; + audio.enable = true; + dwc2.enable = true; + }; + + + networking = { + hostName = "yfs"; # Define your hostname. + }; + + + + # Set your time zone. + time.timeZone = "Asia/Bangkok"; + + + # 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 = "22.11"; # Did you read the comment? + +} + diff --git a/hosts/headless/flake.lock b/hosts/headless/flake.lock new file mode 100644 index 0000000..595d2ff --- /dev/null +++ b/hosts/headless/flake.lock @@ -0,0 +1,82 @@ +{ + "nodes": { + "nixos-hardware": { + "locked": { + "lastModified": 1702453208, + "narHash": "sha256-0wRi9SposfE2wHqjuKt8WO2izKB/ASDOV91URunIqgo=", + "owner": "NixOS", + "repo": "nixos-hardware", + "rev": "7763c6fd1f299cb9361ff2abf755ed9619ef01d6", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "master", + "repo": "nixos-hardware", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1703068421, + "narHash": "sha256-WSw5Faqlw75McIflnl5v7qVD/B3S2sLh+968bpOGrWA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d65bceaee0fb1e64363f7871bc43dc1c6ecad99f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixos-hardware": "nixos-hardware", + "nixpkgs": "nixpkgs", + "unfree": "unfree", + "unstable": "unstable" + } + }, + "unfree": { + "inputs": { + "nixpkgs": [ + "unstable" + ] + }, + "locked": { + "lastModified": 1701957584, + "narHash": "sha256-xEpFaRdrneHl3Xdyzp3emd4QVxML7AR3GC91wuWi0Ok=", + "owner": "numtide", + "repo": "nixpkgs-unfree", + "rev": "127b9b18583de04c6207c2a0e674abf64fc4a3b1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nixpkgs-unfree", + "type": "github" + } + }, + "unstable": { + "locked": { + "lastModified": 1703255338, + "narHash": "sha256-Z6wfYJQKmDN9xciTwU3cOiOk+NElxdZwy/FiHctCzjU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6df37dc6a77654682fe9f071c62b4242b5342e04", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/hosts/headless/flake.nix b/hosts/headless/flake.nix new file mode 100644 index 0000000..d4f58cd --- /dev/null +++ b/hosts/headless/flake.nix @@ -0,0 +1,41 @@ +# my flake!! + +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; + unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; + unfree = { + url = "github:numtide/nixpkgs-unfree"; + inputs.nixpkgs.follows = "unstable"; + }; + nixos-hardware.url = "github:NixOS/nixos-hardware/master"; + #inputs.cachix.url = "github:cachix/cachix/master"; + #inputs.devenv.url = "github:cachix/devenv/latest"; + }; + + outputs = inputs: + { + nixosConfigurations."yn-bcn" = inputs.nixpkgs.lib.nixosSystem rec { + system = "aarch64-linux"; + specialArgs = { + stablepkgs = inputs.nixpkgs.legacyPackages.${system}; + unstablePkgs = inputs.unstable.legacyPackages.${system}; + unfreePkgs = inputs.unfree.legacyPackages.${system}; + }; + modules = [ + ./bcn.nix + ]; + }; + nixosConfigurations."yfs" = inputs.nixpkgs.lib.nixosSystem rec { + system = "aarch64-linux"; + specialArgs = { + stablepkgs = inputs.nixpkgs.legacyPackages.${system}; + unstablePkgs = inputs.unstable.legacyPackages.${system}; + unfreePkgs = inputs.unfree.legacyPackages.${system}; + }; + modules = [ + ./configuration.nix + ]; + }; + }; +} diff --git a/hosts/headless/hardware-configuration.nix b/hosts/headless/hardware-configuration.nix new file mode 100644 index 0000000..51f1a8f --- /dev/null +++ b/hosts/headless/hardware-configuration.nix @@ -0,0 +1,20 @@ +# 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-label/NIXOS_SD"; + fsType = "ext4"; + }; + + swapDevices = [ ]; + + powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; +} diff --git a/hosts/headless/headless.nix b/hosts/headless/headless.nix new file mode 100644 index 0000000..8c4a2f7 --- /dev/null +++ b/hosts/headless/headless.nix @@ -0,0 +1,4 @@ +{...}: +{ + services.mingetty.autologinUser = "y"; +} |