Compare commits

..

10 Commits

Author SHA1 Message Date
alex 7b54a09af6 reenable k3s 2024-01-26 15:04:31 -05:00
alex 31e46376c4 add ursa-major 2024-01-26 14:58:38 -05:00
alex 4b28d96832 disable earlyoom 2024-01-23 00:04:54 -05:00
alex f268bd7b83 enable earlyoom 2024-01-21 01:30:12 -05:00
alex 9d8cff5698 ursa-minor: install libraspberrypi 2024-01-21 00:33:03 -05:00
alex 0162e528fb telegraf inputs 2024-01-21 00:01:29 -05:00
alex f02f006062 install htop 2024-01-20 20:31:48 -05:00
alex 282d70d3b6 update 2024-01-20 16:11:34 -05:00
alex db2c2ef500 install telegraf 2024-01-20 11:57:24 -05:00
alex bf31effc0d eeee 2024-01-20 09:17:45 -05:00
9 changed files with 310 additions and 35 deletions

View File

@ -29,32 +29,31 @@
]
},
"locked": {
"lastModified": 1686693375,
"narHash": "sha256-1Smjo0E8WI9PeVGmmCjpQWRX04aQvz5gAGXfdanIjgw=",
"lastModified": 1705708511,
"narHash": "sha256-3f4BkRY70Fj7yvuo87c4QQPAjnt571g2wJ50jY7hnYc=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "61e5d1c38ef04ba30a9119825b159bce9c6010be",
"rev": "ce4b88c465d928f4f8b75d0920f1788d5b65ca94",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-23.05",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1686921029,
"narHash": "sha256-J1bX9plPCFhTSh6E3TWn9XSxggBh/zDD4xigyaIQBy8=",
"lastModified": 1705496572,
"narHash": "sha256-rPIe9G5EBLXdBdn9ilGc0nq082lzQd0xGGe092R/5QE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c7ff1b9b95620ce8728c0d7bd501c458e6da9e04",
"rev": "842d9d80cfd4560648c785f8a4e6f3b096790e19",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.05",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}

View File

@ -2,35 +2,35 @@
description = "Alex's super mega awesome nixos config";
inputs = {
nixpkgs.url = github:NixOS/nixpkgs/nixos-23.05;
nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
# unstable.url = "nixpkgs/nixos-unstable";
atau-nixpkgs.url = "git+https://git.atauno.com/atau/atau-nixpkgs?ref=main&rev=1e72f4b1e9b7a2991e3ccdebbe75d312f016da3b";
atau-nixpkgs.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager/release-23.05";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{ self, nixpkgs, atau-nixpkgs, home-manager, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [ atau-nixpkgs.overlays.default ];
};
in
outputs = { self, nixpkgs, home-manager, ... }@attrs:
# let
# # system = "x86_64-linux";
# # pkgs = import nixpkgs {
# # # inherit system;
# # config.allowUnfree = true;
# # overlays = [ atau-nixpkgs.overlays.default ];
# # };
# in
{
nixosConfigurations.nixos76 = nixpkgs.lib.nixosSystem {
inherit pkgs;
inherit system;
system = "x86_64-linux";
modules = [
./system/configuration.nix
./nixos76/system/configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.alex = import ./alex/home.nix;
home-manager.users.alex = import ./nixos76/alex/home.nix;
# Optionally, use home-manager.extraSpecialArgs to pass
# arguments to home.nix
}
@ -38,11 +38,17 @@
};
nixosConfigurations.ursa-minor = nixpkgs.lib.nixosSystem
{
inherit pkgs;
inherit system;
system = "aarch64-linux";
modules = [
./ursa-minor/configuration.nix
];
};
nixosConfigurations.ursa-major = nixpkgs.lib.nixosSystem
{
system = "aarch64-linux";
modules = [
./ursa-major/configuration.nix
];
};
};
}

View File

@ -62,9 +62,10 @@
};
kitty = {
enable = true;
# TODO figure out how to get atau-nixpkgs working from the flake with different systems
# background_image ${atau-nixpkgs.atau-wallpapers}/share/backgrounds/atau-wallpapers/aos1.png
extraConfig = ''
background_tint 0.2
background_image ${pkgs.atau-wallpapers}/share/backgrounds/atau-wallpapers/aos1.png
background_image_layout centered
modify_font cell_width 110%

View File

@ -145,14 +145,14 @@
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
atau-wallpapers
# atau-wallpapers
blueman
dxvk
envsubst
font-manager
gparted
lshw
mesa_22_3
mesa
nodejs_20
pavucontrol
unzip
@ -167,7 +167,7 @@
services.avahi = {
enable = true;
nssmdns = true;
nssmdns4 = true;
openFirewall = true;
};

View File

@ -0,0 +1,171 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ config, lib, pkgs, ... }:
{
imports =
[
# Include the results of the hardware scan.
./hardware-configuration.nix
];
nix.settings.experimental-features = [ "nix-command" "flakes" ];
nixpkgs.config.allowUnfree = true;
# Use the extlinux boot loader. (NixOS wants to enable GRUB by default)
boot.loader.grub.enable = false;
# Enables the generation of /boot/extlinux/extlinux.conf
boot.loader.generic-extlinux-compatible.enable = true;
# For k3s
boot.kernel.sysctl = { "net.ipv4.ip_forward" = 1; };
boot.kernelParams = [
"cgroup_enable=cpuset"
"cgroup_memory=1"
"cgroup_enable=memory"
];
networking.hostName = "ursa-major"; # Define your hostname.
# Pick only one of the below networking options.
networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
# Set your time zone.
time.timeZone = "America/New_York";
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# services.earlyoom.enable = true;
services.k3s.enable = true;
services.k3s.role = "server";
services.k3s.extraFlags = toString [
# "--kubelet-arg=v=4" # Optionally add additional args to k3s
];
environment.variables = {
KUBECONFIG = "/home/nixos/.kube/config";
};
services.influxdb.enable = true;
services.telegraf.enable = true;
services.telegraf.extraConfig = {
outputs.influxdb = {
urls = [ "http://127.0.0.1:8086" ];
database = "telegraf";
};
inputs.net = { };
inputs.netstat = { };
inputs.file = {
files = [ "/sys/class/thermal/thermal_zone0/temp" ];
name_override = "cpu_temperature";
data_format = "value";
data_type = "integer";
};
inputs.exec = {
commands = [ "${pkgs.libraspberrypi}/bin/vcgencmd measure_temp" ];
name_override = "gpu_temperature";
data_format = "grok";
grok_patterns = [ "%{NUMBER:value:float}" ];
};
inputs.cpu = {
## Whether to report per-cpu stats or not
percpu = true;
## Whether to report total system cpu stats or not
totalcpu = true;
## Comment this line if you want the raw CPU time metrics
fielddrop = [ "time_*" ];
};
inputs.disk = {
## By default, telegraf gather stats for all mountpoints.
## Setting mountpoints will restrict the stats to the specified mountpoints.
# mount_points = ["/"]
## Ignore some mountpoints by filesystem type. For example (dev)tmpfs (usually
## present on /run, /var/run, /dev/shm or /dev).
ignore_fs = [ "tmpfs" "devtmpfs" ];
};
inputs.diskio = {
## By default, telegraf will gather stats for all devices including
## disk partitions.
## Setting devices will restrict the stats to the specified devices.
# devices = ["sda", "sdb"]
## Uncomment the following line if you need disk serial numbers.
# skip_serial_number = false
};
inputs.kernel = { };
inputs.mem = { };
inputs.processes = { };
inputs.swap = { };
inputs.system = { };
inputs.interrupts = { };
inputs.linux_sysctl_fs = { };
};
# Define a user account. Don't forget to set a password with passwd.
users.users.nixos = {
isNormalUser = true;
extraGroups = [ "wheel" ]; # Enable sudo for the user.
packages = with pkgs; [ ];
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
git
htop
libraspberrypi
slirp4netns # required by k3s
vim
];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
networking.firewall.enable = false;
# 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;
# This option defines the first version of NixOS you have installed on this particular machine,
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
#
# Most users should NEVER change this value after the initial install, for any reason,
# even if you've upgraded your system to a new NixOS release.
#
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
# so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
# to actually do that.
#
# This value being lower than the current NixOS release does NOT mean your system is
# out of date, out of support, or vulnerable.
#
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
# and migrated your data accordingly.
#
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "24.05"; # Did you read the comment?
}

View File

@ -0,0 +1,38 @@
# 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")
];
boot.initrd.availableKernelModules = [ ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{
device = "/dev/disk/by-uuid/44444444-4444-4444-8888-888888888888";
fsType = "ext4";
};
swapDevices = [{
device = "/var/lib/swapfile";
size = 16 * 1024;
}];
# 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.enu1u1.useDHCP = lib.mkDefault true;
# networking.interfaces.wlan0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux";
}

View File

@ -1,3 +1,8 @@
currently this just contains a copy of the rpi nixos config, not tied to `../quick-switch.sh` which is for the system76 galago laptop.
eventually find a way to modularize and reuse config chunks across both systems!
other node hostname ideas:
- cepheus
- delphinus

View File

@ -39,6 +39,8 @@
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# services.earlyoom.enable = true;
services.k3s.enable = true;
services.k3s.role = "server";
services.k3s.extraFlags = toString [
@ -49,6 +51,63 @@
KUBECONFIG = "/home/nixos/.kube/config";
};
services.influxdb.enable = true;
services.telegraf.enable = true;
services.telegraf.extraConfig = {
outputs.influxdb = {
urls = [ "http://127.0.0.1:8086" ];
database = "telegraf";
};
inputs.net = { };
inputs.netstat = { };
inputs.file = {
files = [ "/sys/class/thermal/thermal_zone0/temp" ];
name_override = "cpu_temperature";
data_format = "value";
data_type = "integer";
};
inputs.exec = {
commands = [ "${pkgs.libraspberrypi}/bin/vcgencmd measure_temp" ];
name_override = "gpu_temperature";
data_format = "grok";
grok_patterns = [ "%{NUMBER:value:float}" ];
};
inputs.cpu = {
## Whether to report per-cpu stats or not
percpu = true;
## Whether to report total system cpu stats or not
totalcpu = true;
## Comment this line if you want the raw CPU time metrics
fielddrop = [ "time_*" ];
};
inputs.disk = {
## By default, telegraf gather stats for all mountpoints.
## Setting mountpoints will restrict the stats to the specified mountpoints.
# mount_points = ["/"]
## Ignore some mountpoints by filesystem type. For example (dev)tmpfs (usually
## present on /run, /var/run, /dev/shm or /dev).
ignore_fs = [ "tmpfs" "devtmpfs" ];
};
inputs.diskio = {
## By default, telegraf will gather stats for all devices including
## disk partitions.
## Setting devices will restrict the stats to the specified devices.
# devices = ["sda", "sdb"]
## Uncomment the following line if you need disk serial numbers.
# skip_serial_number = false
};
inputs.kernel = { };
inputs.mem = { };
inputs.processes = { };
inputs.swap = { };
inputs.system = { };
inputs.interrupts = { };
inputs.linux_sysctl_fs = { };
};
# Define a user account. Don't forget to set a password with passwd.
users.users.nixos = {
isNormalUser = true;
@ -59,13 +118,9 @@
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
docker
git
k3s
nodejs_21
nodePackages.pnpm
pulumi
pulumiPackages.pulumi-language-nodejs
htop
libraspberrypi
slirp4netns # required by k3s
vim
];