diff --git a/README.md b/README.md index 5e42b6bd..68bb805c 100644 --- a/README.md +++ b/README.md @@ -43,8 +43,8 @@ nix develop -c /etc/nixos/git/docs/setup.sh * [ ] Security hardening * [ ] Edit the hosts file * [ ] home-manager/common/software/cli/bash.nix - Break this out for theming -- Currently statically set to 'gruvbox' -* [ ] cronjobs - * [ ] Change wallpaper at a certain time of day +* [x] cronjobs + * [x] Change wallpaper at a certain time of day * [x] Automatic git pull of this repo * [ ] emacs * [ ] Add bracket auto-completion diff --git a/nixos/hosts/piaware-rpi4/default.nix b/nixos/hosts/piaware-rpi4/default.nix index 14e0ff86..d1292221 100644 --- a/nixos/hosts/piaware-rpi4/default.nix +++ b/nixos/hosts/piaware-rpi4/default.nix @@ -5,7 +5,7 @@ imports = [ inputs.nixos-hardware.nixosModules.raspberry-pi-4 (modulesPath + "/installer/scan/not-detected.nix") - ./docker.nix + ./podman.nix ]; # Enable distributed Builds nix.distributedBuilds = true; diff --git a/nixos/hosts/piaware-rpi4/docker.nix b/nixos/hosts/piaware-rpi4/docker.nix index ff3fc351..5fc089ef 100644 --- a/nixos/hosts/piaware-rpi4/docker.nix +++ b/nixos/hosts/piaware-rpi4/docker.nix @@ -12,37 +12,7 @@ liveRestore = true; }; - environment.systemPackages = with pkgs; [ - docker-compose - ctop - ]; networking.firewall.allowedTCPPorts = [ 8080 30003 30005 ]; -} - - -# Docker Compose file for PiAware: -# version: '3' -# -#services: -# piaware: -# image: ghcr.io/sdr-enthusiasts/docker-piaware:latest -# tty: true -# container_name: piaware -# restart: always -# devices: -# - /dev/bus/usb:/dev/bus/usb -# ports: -# - 8080:80 -# - 30003:30003 -# - 30005:30005 -# environment: -# - TZ="Asia/Tokyo" -# - LAT=35.6837777585358 -# - LONG=135.02715404216545 -# - FEEDER_ID=cdca89ee-6612-4707-b0bb-ffb78d156c47 -# - RECEIVER_TYPE=rtlsdr -# tmpfs: -# - /run:exec,size=64M -# - /var/log \ No newline at end of file +} \ No newline at end of file diff --git a/nixos/hosts/piaware-rpi4/podman.nix b/nixos/hosts/piaware-rpi4/podman.nix new file mode 100644 index 00000000..2ecb7205 --- /dev/null +++ b/nixos/hosts/piaware-rpi4/podman.nix @@ -0,0 +1,7 @@ +{ lib, pkgs, ... }: { + imports = [ + ./podman/piaware.nix + ]; + + environment.systemPackages = with pkgs; [ ctop ]; +} \ No newline at end of file diff --git a/nixos/hosts/piaware-rpi4/podman/piaware.nix b/nixos/hosts/piaware-rpi4/podman/piaware.nix new file mode 100644 index 00000000..91156cde --- /dev/null +++ b/nixos/hosts/piaware-rpi4/podman/piaware.nix @@ -0,0 +1,81 @@ +# Auto-generated using compose2nix v0.1.6. +{ pkgs, lib, ... }: + +{ + # Runtime + virtualisation.podman = { + enable = true; + autoPrune.enable = true; + dockerCompat = true; + defaultNetwork.settings = { + # Required for container networking to be able to use names. + dns_enabled = true; + }; + }; + virtualisation.oci-containers.backend = "podman"; + + # Containers + virtualisation.oci-containers.containers."piaware" = { + image = "ghcr.io/sdr-enthusiasts/docker-piaware:latest"; + environment = { + FEEDER_ID = "cdca89ee-6612-4707-b0bb-ffb78d156c47"; + LAT = "35.6837777585358"; + LONG = "135.02715404216545"; + RECEIVER_TYPE = "rtlsdr"; + TZ = ""Asia/Tokyo""; + }; + ports = [ + "8080:80/tcp" + "30003:30003/tcp" + "30005:30005/tcp" + ]; + log-driver = "journald"; + extraOptions = [ + "--device=/dev/bus/usb:/dev/bus/usb" + "--network-alias=piaware" + "--network=piaware-default" + ]; + }; + systemd.services."podman-piaware" = { + serviceConfig = { + Restart = lib.mkOverride 500 "always"; + }; + after = [ + "podman-network-piaware-default.service" + ]; + requires = [ + "podman-network-piaware-default.service" + ]; + partOf = [ + "podman-compose-piaware-root.target" + ]; + wantedBy = [ + "podman-compose-piaware-root.target" + ]; + }; + + # Networks + systemd.services."podman-network-piaware-default" = { + path = [ pkgs.podman ]; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + ExecStop = "${pkgs.podman}/bin/podman network rm -f piaware-default"; + }; + script = '' + podman network inspect piaware-default || podman network create piaware-default --opt isolate=true + ''; + partOf = [ "podman-compose-piaware-root.target" ]; + wantedBy = [ "podman-compose-piaware-root.target" ]; + }; + + # Root service + # When started, this will automatically create all resources and start + # the containers. When stopped, this will teardown all resources. + systemd.targets."podman-compose-piaware-root" = { + unitConfig = { + Description = "Root target generated by compose2nix."; + }; + wantedBy = [ "multi-user.target" ]; + }; +} \ No newline at end of file