diff --git a/config/base.nix b/config/base.nix index 54822e5..c8d7313 100644 --- a/config/base.nix +++ b/config/base.nix @@ -14,6 +14,7 @@ ./network.nix ./programs.nix ./system.nix + ./sway.nix ]; nixpkgs = { overlays = [ @@ -49,9 +50,20 @@ auto-optimise-store = true; }; - virtualisation.docker = { - enable = true; - liveRestore = false; + virtualisation = { + podman = { + enable = true; + + # Create a `docker` alias for podman, to use it as a drop-in replacement + dockerCompat = true; + + # Required for containers under podman-compose to be able to talk to each other. + defaultNetwork.settings.dns_enabled = true; + }; + docker = { + enable = true; + liveRestore = false; + }; }; services.pulseaudio.enable = false; @@ -120,6 +132,7 @@ console.keyMap = "sv-latin1"; environment.systemPackages = with pkgs; [ + waypipe (st.overrideAttrs (oldAttrs: rec { src = builtins.fetchGit { url = "https://github.com/fwastring/st"; @@ -160,19 +173,19 @@ "ipsec.d/ipsec.nm-l2tp.secrets" ]; }; - xserver = { - displayManager = { - startx.enable = true; - }; - enable = true; - xkb = { - layout = "se"; - variant = ""; - }; - windowManager.dwm = { - enable = true; - }; - }; + # xserver = { + # displayManager = { + # startx.enable = true; + # }; + # enable = true; + # xkb = { + # layout = "se"; + # variant = ""; + # }; + # windowManager.dwm = { + # enable = true; + # }; + # }; blueman = { enable = true; }; diff --git a/config/dev.nix b/config/dev.nix index 05ad4ab..dafbc5c 100644 --- a/config/dev.nix +++ b/config/dev.nix @@ -30,13 +30,17 @@ in yq skopeo umoci + velero + podman-tui azure-cli - dotnetCorePackages.sdk_8_0_3xx + dotnetCorePackages.dotnet_9.sdk google-cloud-sdk jira-cli-go gh allure + kubectx + python314 awscli unstable.minio-client diff --git a/config/k3s.nix b/config/k3s.nix new file mode 100644 index 0000000..a18b564 --- /dev/null +++ b/config/k3s.nix @@ -0,0 +1,46 @@ +{ + inputs, + lib, + config, + pkgs, + myhostname, + ... +}: +let +in +{ + networking.firewall.allowedTCPPorts = [ + 6443 + 5173 + 8080 + 3000 + ]; + services.k3s = { + enable = true; + role = "server"; + extraFlags = toString ([ + "--write-kubeconfig-mode \"0644\"" + "--cluster-init" + "--disable servicelb" + "--disable traefik" + "--disable local-storage" + ]); + clusterInit = true; + }; + + systemd.tmpfiles.rules = [ + "L+ /usr/local/bin - - - - /run/current-system/sw/bin/" + ]; + + services.openiscsi = { + enable = true; + name = "iqn.2016-04.com.open-iscsi:${myhostname}"; + }; + + environment.systemPackages = with pkgs; [ + k3s + cifs-utils + nfs-utils + git + ]; +} diff --git a/config/lsp.nix b/config/lsp.nix index 2600a4a..fbd9b66 100644 --- a/config/lsp.nix +++ b/config/lsp.nix @@ -26,5 +26,6 @@ typescript typescript-language-server lua-language-server + marksman ]; } diff --git a/config/system.nix b/config/system.nix index 0570621..f487947 100644 --- a/config/system.nix +++ b/config/system.nix @@ -63,6 +63,10 @@ ])) lazygit chawan + go-passbolt-cli + waypipe + wl-clipboard + smartmontools # Typesetting typst diff --git a/maskiner/work-desktop/configuration.nix b/maskiner/work-desktop/configuration.nix index 199f70b..f053f2c 100644 --- a/maskiner/work-desktop/configuration.nix +++ b/maskiner/work-desktop/configuration.nix @@ -18,6 +18,7 @@ ../../config/lsp.nix ../../config/network.nix ../../config/system.nix + ../../config/k3s.nix ]; nixpkgs = { overlays = [ @@ -53,9 +54,23 @@ auto-optimise-store = true; }; - virtualisation.docker = { - enable = true; - liveRestore = false; + + + # virtualisation.containers.enable = true; + virtualisation = { + # podman = { + # enable = true; + # + # # Create a `docker` alias for podman, to use it as a drop-in replacement + # dockerCompat = true; + # + # # Required for containers under podman-compose to be able to talk to each other. + # defaultNetwork.settings.dns_enabled = true; + # }; + docker = { + enable = true; + liveRestore = false; + }; }; networking.networkmanager.enable = true; diff --git a/shared/fish.nix b/shared/fish.nix index c70c0b1..698d91c 100644 --- a/shared/fish.nix +++ b/shared/fish.nix @@ -34,21 +34,19 @@ } ]; shellAbbrs = { - ls = "eza -l --no-time --no-permissions --no-user"; - k = "kubectl"; + ls = "eza -l"; ka = "kubectl apply -f"; - e = "nvim"; t = "timew"; + todo = "jira issue list -a 'Fredrik Wastring' -s ~Done -s ~Closed -s ~Released --plain"; cam = "jira issue create && jira issue assign && jira issue move"; - latest = "git log | head -1 | awk '{print $2;}' | xsel -ib"; - vpnup = "nmcli con up 'iFacts VPN'"; + e = "kubectx"; s = { setCursor = "%"; expansion = "cha https://search.wastring.com/search?q=%"; }; - vpndown = { + c = { setCursor = "%"; - expansion = "nmcli con down 'iFacts VPN'"; + expansion = "ssh 'fw:%@gateway.internalifacts.se' -p 2222"; }; dl = { setCursor = "&"; @@ -65,6 +63,8 @@ set -Ux FZF_TMUX_OPTS "-p" set -e GOROOT set -e GOPATH + gh completion -s fish > ~/.config/fish/completions/gh.fish + set -gx PATH $PATH $HOME/.krew/bin # Mocha set -Ux FZF_DEFAULT_OPTS "\ diff --git a/uninstal.sh b/uninstal.sh new file mode 100755 index 0000000..acf6b2e --- /dev/null +++ b/uninstal.sh @@ -0,0 +1,23 @@ +#!/bin/sh +set -x +systemctl stop k3s +systemctl disable k3s +systemctl daemon-reload +rm -f /etc/systemd/system/k3s.service +rm -f /usr/local/bin/k3s +if [ -L /usr/local/bin/kubectl ]; then + rm -f /usr/local/bin/kubectl +fi +if [ -L /usr/local/bin/crictl ]; then + rm -f /usr/local/bin/crictl +fi +if [ -e /sys/fs/cgroup/systemd/system.slice/k3s.service/cgroup.procs ]; then + kill -9 `cat /sys/fs/cgroup/systemd/system.slice/k3s.service/cgroup.procs` +fi +umount `cat /proc/self/mounts | awk '{print $2}' | grep '^/run/k3s'` +umount `cat /proc/self/mounts | awk '{print $2}' | grep '^/var/lib/rancher/k3s'` + +rm -rf /var/lib/rancher/k3s +rm -rf /etc/rancher/k3s + +rm -f /usr/local/bin/k3s-uninstall.sh