From 480a7c2bfcfe33c59af1744e7bb9185ef3a73fe2 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 19 Jan 2024 18:37:46 -0500 Subject: [PATCH] rename raspberry pi hostname and switch to flake --- flake.nix | 8 +++ {nixos-rpi => ursa-minor}/README.md | 0 {nixos-rpi => ursa-minor}/configuration.nix | 65 +------------------ .../hardware-configuration.nix | 0 {nixos-rpi => ursa-minor}/update-config.sh | 0 5 files changed, 10 insertions(+), 63 deletions(-) rename {nixos-rpi => ursa-minor}/README.md (100%) rename {nixos-rpi => ursa-minor}/configuration.nix (63%) rename {nixos-rpi => ursa-minor}/hardware-configuration.nix (100%) rename {nixos-rpi => ursa-minor}/update-config.sh (100%) diff --git a/flake.nix b/flake.nix index ac225c4..62a14e4 100644 --- a/flake.nix +++ b/flake.nix @@ -36,5 +36,13 @@ } ]; }; + nixosConfigurations.ursa-minor = nixpkgs.lib.nixosSystem + { + inherit pkgs; + inherit system; + modules = [ + ./ursa-minor/configuration.nix + ]; + }; }; } diff --git a/nixos-rpi/README.md b/ursa-minor/README.md similarity index 100% rename from nixos-rpi/README.md rename to ursa-minor/README.md diff --git a/nixos-rpi/configuration.nix b/ursa-minor/configuration.nix similarity index 63% rename from nixos-rpi/configuration.nix rename to ursa-minor/configuration.nix index b71bbcb..2307d32 100644 --- a/nixos-rpi/configuration.nix +++ b/ursa-minor/configuration.nix @@ -27,7 +27,7 @@ "cgroup_enable=memory" ]; - networking.hostName = "nixos-rpi"; # Define your hostname. + networking.hostName = "ursa-minor"; # 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. @@ -39,67 +39,6 @@ # networking.proxy.default = "http://user:password@proxy:port/"; # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - # [Unit] - # Description=Lightweight Kubernetes - # Documentation=https://k3s.io - # Wants=network-online.target - # After=network-online.target - - # [Install] - # WantedBy=multi-user.target - - # [Service] - # Type=${SYSTEMD_TYPE} - # EnvironmentFile=-/etc/default/%N - # EnvironmentFile=-/etc/sysconfig/%N - # EnvironmentFile=-${FILE_K3S_ENV} - # KillMode=process - # Delegate=yes - # # Having non-zero Limit*s causes performance problems due to accounting overhead - # # in the kernel. We recommend using cgroups to do container-local accounting. - # LimitNOFILE=1048576 - # LimitNPROC=infinity - # LimitCORE=infinity - # TasksMax=infinity - # TimeoutStartSec=0 - # Restart=always - # RestartSec=5s - # ExecStartPre=/bin/sh -xc '! /usr/bin/systemctl is-enabled --quiet nm-cloud-setup.service 2>/dev/null' - # ExecStartPre=-/sbin/modprobe br_netfilter - # ExecStartPre=-/sbin/modprobe overlay - # ExecStart=${BIN_DIR}/k3s \\ - # ${CMD_K3S_EXEC} - - # Adapted from https://get.k3s.io/ - # systemd.services.k3s = { - # description = "Lightweight Kubernetes"; - # documentation = [ "https://k3s.io" ]; - # serviceConfig = { - # Type = "notify"; - # # EnvironmentFile = "-/etc/default/%N"; - # # EnvironmentFile = "-/etc/sysconfig/%N"; - # # EnvironmentFile = -${FILE_K3S_ENV}; - # KillMode = "process"; - # Delegate = "yes"; - # # Having non-zero Limit*s causes performance problems due to accounting overhead - # # in the kernel. We recommend using cgroups to do container-local accounting. - # LimitNOFILE = 1048576; - # LimitNPROC = "infinity"; - # LimitCORE = "infinity"; - # TasksMax = "infinity"; - # TimeoutStartSec = 0; - # Restart = "always"; - # RestartSec = "5 s"; - # # ExecStartPre = /bin/sh - xc '! /usr/bin/systemctl is-enabled --quiet nm-cloud-setup.service 2>/dev/null'; - # # ExecStartPre = -/sbin/modprobe br_netfilter; - # # ExecStartPre = -/sbin/modprobe overlay; - # ExecStart = "${pkgs.k3s}/bin/k3s server --write-kubeconfig-mode=644"; - # }; - # after = [ "network-online.target" ]; - # wants = [ "network-online.target" ]; - # wantedBy = [ "multi-user.target" ]; - # }; - services.k3s.enable = true; services.k3s.role = "server"; services.k3s.extraFlags = toString [ @@ -107,7 +46,7 @@ ]; environment.variables = { - KUBECONFIG = "/home/nixos/.kube/k3s.yaml"; + KUBECONFIG = "/home/nixos/.kube/config"; }; # Define a user account. Don't forget to set a password with ‘passwd’. diff --git a/nixos-rpi/hardware-configuration.nix b/ursa-minor/hardware-configuration.nix similarity index 100% rename from nixos-rpi/hardware-configuration.nix rename to ursa-minor/hardware-configuration.nix diff --git a/nixos-rpi/update-config.sh b/ursa-minor/update-config.sh similarity index 100% rename from nixos-rpi/update-config.sh rename to ursa-minor/update-config.sh