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": { "locked": {
"lastModified": 1686693375, "lastModified": 1705708511,
"narHash": "sha256-1Smjo0E8WI9PeVGmmCjpQWRX04aQvz5gAGXfdanIjgw=", "narHash": "sha256-3f4BkRY70Fj7yvuo87c4QQPAjnt571g2wJ50jY7hnYc=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "61e5d1c38ef04ba30a9119825b159bce9c6010be", "rev": "ce4b88c465d928f4f8b75d0920f1788d5b65ca94",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-community", "owner": "nix-community",
"ref": "release-23.05",
"repo": "home-manager", "repo": "home-manager",
"type": "github" "type": "github"
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1686921029, "lastModified": 1705496572,
"narHash": "sha256-J1bX9plPCFhTSh6E3TWn9XSxggBh/zDD4xigyaIQBy8=", "narHash": "sha256-rPIe9G5EBLXdBdn9ilGc0nq082lzQd0xGGe092R/5QE=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "c7ff1b9b95620ce8728c0d7bd501c458e6da9e04", "rev": "842d9d80cfd4560648c785f8a4e6f3b096790e19",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-23.05", "ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }

View File

@ -2,35 +2,35 @@
description = "Alex's super mega awesome nixos config"; description = "Alex's super mega awesome nixos config";
inputs = { 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.url = "git+https://git.atauno.com/atau/atau-nixpkgs?ref=main&rev=1e72f4b1e9b7a2991e3ccdebbe75d312f016da3b";
atau-nixpkgs.inputs.nixpkgs.follows = "nixpkgs"; 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"; home-manager.inputs.nixpkgs.follows = "nixpkgs";
}; };
outputs = inputs@{ self, nixpkgs, atau-nixpkgs, home-manager, ... }: outputs = { self, nixpkgs, home-manager, ... }@attrs:
let # let
system = "x86_64-linux"; # # system = "x86_64-linux";
pkgs = import nixpkgs { # # pkgs = import nixpkgs {
inherit system; # # # inherit system;
config.allowUnfree = true; # # config.allowUnfree = true;
overlays = [ atau-nixpkgs.overlays.default ]; # # overlays = [ atau-nixpkgs.overlays.default ];
}; # # };
in # in
{ {
nixosConfigurations.nixos76 = nixpkgs.lib.nixosSystem { nixosConfigurations.nixos76 = nixpkgs.lib.nixosSystem {
inherit pkgs; system = "x86_64-linux";
inherit system;
modules = [ modules = [
./system/configuration.nix ./nixos76/system/configuration.nix
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
{ {
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = 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 # Optionally, use home-manager.extraSpecialArgs to pass
# arguments to home.nix # arguments to home.nix
} }
@ -38,11 +38,17 @@
}; };
nixosConfigurations.ursa-minor = nixpkgs.lib.nixosSystem nixosConfigurations.ursa-minor = nixpkgs.lib.nixosSystem
{ {
inherit pkgs; system = "aarch64-linux";
inherit system;
modules = [ modules = [
./ursa-minor/configuration.nix ./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 = { kitty = {
enable = true; 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 = '' extraConfig = ''
background_tint 0.2 background_tint 0.2
background_image ${pkgs.atau-wallpapers}/share/backgrounds/atau-wallpapers/aos1.png
background_image_layout centered background_image_layout centered
modify_font cell_width 110% modify_font cell_width 110%

View File

@ -145,14 +145,14 @@
# List packages installed in system profile. To search, run: # List packages installed in system profile. To search, run:
# $ nix search wget # $ nix search wget
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
atau-wallpapers # atau-wallpapers
blueman blueman
dxvk dxvk
envsubst envsubst
font-manager font-manager
gparted gparted
lshw lshw
mesa_22_3 mesa
nodejs_20 nodejs_20
pavucontrol pavucontrol
unzip unzip
@ -167,7 +167,7 @@
services.avahi = { services.avahi = {
enable = true; enable = true;
nssmdns = true; nssmdns4 = true;
openFirewall = 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. 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! 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.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# services.earlyoom.enable = true;
services.k3s.enable = true; services.k3s.enable = true;
services.k3s.role = "server"; services.k3s.role = "server";
services.k3s.extraFlags = toString [ services.k3s.extraFlags = toString [
@ -49,6 +51,63 @@
KUBECONFIG = "/home/nixos/.kube/config"; 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. # Define a user account. Don't forget to set a password with passwd.
users.users.nixos = { users.users.nixos = {
isNormalUser = true; isNormalUser = true;
@ -59,13 +118,9 @@
# List packages installed in system profile. To search, run: # List packages installed in system profile. To search, run:
# $ nix search wget # $ nix search wget
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
docker
git git
k3s htop
nodejs_21 libraspberrypi
nodePackages.pnpm
pulumi
pulumiPackages.pulumi-language-nodejs
slirp4netns # required by k3s slirp4netns # required by k3s
vim vim
]; ];