diff options
-rw-r--r-- | config/acme-sh.nix | 3 | ||||
-rw-r--r-- | config/borg-backup.nix | 77 | ||||
-rw-r--r-- | config/keycloak.nix | 17 | ||||
-rw-r--r-- | config/mail-server.nix | 82 | ||||
-rw-r--r-- | config/matrix.nix | 40 | ||||
-rw-r--r-- | config/minecraft.nix | 17 | ||||
-rw-r--r-- | config/mpd.nix | 31 | ||||
-rw-r--r-- | config/postgresql.nix | 1 | ||||
-rw-r--r-- | config/pxe.nix | 11 | ||||
-rw-r--r-- | config/stats.nix | 48 | ||||
-rw-r--r-- | config/systemhttpd.nix | 21 | ||||
-rw-r--r-- | config/weechat.nix | 47 | ||||
-rw-r--r-- | jobset-spec.json | 1 | ||||
-rw-r--r-- | machines/generic-container.nix | 11 | ||||
-rw-r--r-- | machines/minideck.nix | 86 | ||||
-rw-r--r-- | machines/x220-aji.nix | 75 | ||||
-rw-r--r-- | modules/desktop.nix | 1 | ||||
-rw-r--r-- | patches/xow/0001-Single-controller-patch.patch | 72 | ||||
-rw-r--r-- | release.nix | 59 |
19 files changed, 1 insertions, 699 deletions
diff --git a/config/acme-sh.nix b/config/acme-sh.nix deleted file mode 100644 index 95a6c4f..0000000 --- a/config/acme-sh.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ config, lib, pkgs, ... }: -let acme-sh = pkgs.callPackage ../pkgs/acme-sh/default.nix { }; -in { environment.systemPackages = [ acme-sh ]; } diff --git a/config/borg-backup.nix b/config/borg-backup.nix deleted file mode 100644 index 188fd06..0000000 --- a/config/borg-backup.nix +++ /dev/null @@ -1,77 +0,0 @@ -# To initialize repo -# borg init --encryption=keyfile /staging/backup -# Key file also stored in pass -{ config, lib, pkgs, ... }: -let - repo = "/staging/backup"; - probe = rec { - path = "/storage/archive/backup-probe.txt"; - repo = "storage"; - repo_path = lib.removePrefix "/" path; - }; -in { - systemd.services.borg-backup = { - description = "Run backups."; - path = with pkgs; [ borgbackup rsync openssh ]; - startAt = "03:30"; - environment = { - BORG_KEY_FILE = "/opt/secret/borg-backup-keys/staging_backup"; - BORG_RELOCATED_REPO_ACCESS_IS_OK = "yes"; - }; - script = '' - echo "Database backup" - ssh orbekk@raigh.orbekk.com sqlite3 /home/orbekk/linoquotes.sqlite \".backup /home/orbekk/linoquotes-backup.sqlite\" - rsync -Hax orbekk@raigh.orbekk.com:linoquotes-backup.sqlite /storage/archive/linoquotes/ - - echo "Writing probe file at ${probe.path}" - # No need for atomic move, because the script terminates if this fails. - date +%s > "${probe.path}" - - echo "Creating backup" - borg create -v --stats \ - --compression lzma,6 \ - ${repo}::'storage-{now:%Y-%m-%dT%H:%M:%S}' \ - /storage - - borg create -v --stats \ - --compression lzma,6 \ - ${repo}::'{hostname}-{now:%Y-%m-%dT%H:%M:%S}' \ - /opt /home /var \ - --exclude /var/lib/lxd \ - --exclude /var/lib/nextcloud - - echo "Pruning old versions" - borg prune -v --list ${repo} --prefix 'storage-' \ - --keep-daily=7 --keep-weekly=4 --keep-monthly=6 - borg prune -v --list ${repo} --prefix '{hostname}-' \ - --keep-daily=7 --keep-weekly=4 --keep-monthly=6 - - echo "Synchronizing backup" - rsync --delete -Hax ${repo} root@orbekk.osl.trygveandre.net:/storage - echo "Success." - ''; - }; - - systemd.services.backup-prober = { - description = "Find latest backup probe timestamp."; - path = with pkgs; [ borgbackup rsync openssh sshfs moreutils ]; - startAt = "06:30"; - serviceConfig = { PrivateTmp = true; }; - environment = { - BORG_KEY_FILE = "/opt/secret/borg-backup-keys/staging_backup"; - BORG_RELOCATED_REPO_ACCESS_IS_OK = "yes"; - }; - script = '' - mkdir -p "/tmp/mnt" - sshfs root@orbekk.osl.trygveandre.net:/storage "/tmp/mnt" - REPOSITORY="/tmp/mnt/backup" - - last_repo="$(borg list $REPOSITORY -P ${probe.repo} --last 1 --short)" - target="${config.orbekk.monitoring-server.textFileDir}/backup_probe.prom" - timestamp=$(borg extract --stdout $REPOSITORY::"$last_repo" "${probe.repo_path}") - echo "backup_probe_timestamp_seconds $timestamp" > "$target.next" - mv "$target.next" "$target" - echo Done - ''; - }; -} diff --git a/config/keycloak.nix b/config/keycloak.nix deleted file mode 100644 index 7209d8e..0000000 --- a/config/keycloak.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - age.secrets."dragon-keycloak.age".file = ../secrets/dragon-keycloak.age; - services.postgresql.enable = true; - services.keycloak = { - enable = true; - settings.hostname = "auth.orbekk.com"; - settings.log-level = "INFO"; - settings.http-port = - (import ../data/aliases.nix).services.keycloak.http-port; - settings.hostname-strict-https = false; - settings.proxy = "edge"; - database.type = "postgresql"; - database.passwordFile = config.age.secrets."dragon-keycloak.age".path; - }; -} diff --git a/config/mail-server.nix b/config/mail-server.nix deleted file mode 100644 index fd363fb..0000000 --- a/config/mail-server.nix +++ /dev/null @@ -1,82 +0,0 @@ -{ config, lib, pkgs, ... }: { - networking.firewall.allowedTCPPorts = [ 25 465 587 ]; - services.dovecot2 = { - enable = true; - sslServerCert = "/var/lib/acme/shape.orbekk.com/fullchain.pem"; - sslServerKey = "/var/lib/acme/shape.orbekk.com/key.pem"; - enablePAM = false; - extraConfig = '' - passdb { - driver = passwd-file - args = username_format=%n /opt/secret/dovecot-passwd - } - userdb { - driver = passwd-file - args = username_format=%n /opt/secret/dovecot-passwd - } - mail_debug = yes - service auth { - unix_listener auth-client-postfix { - group = postfix - mode = 0660 - user = postfix - } - user = root - } - ''; - }; - - services.postfix = { - enable = true; - - hostname = "shape"; - domain = "orbekk.com"; - destination = - [ "orbekk.com" "kj.orbekk.com" "orbekk.no" "kj.orbekk.no" "kufieta.net" ]; - - relayHost = "smtp.gmail.com"; - relayPort = 587; - - enableSubmission = true; - submissionOptions = { - "smtpd_tls_security_level" = "encrypt"; - "smtpd_sasl_auth_enable" = "yes"; - "smtpd_sasl_type" = "dovecot"; - "smtpd_sasl_path" = "/var/run/dovecot2/auth-client-postfix"; - "smtpd_client_restrictions" = "permit_sasl_authenticated,reject"; - "milter_macro_daemon_name" = "ORIGINATING"; - }; - - extraConfig = '' - smtp_tls_security_level = encrypt - smtp_sasl_auth_enable = yes - smtp_sasl_password_maps = hash:/opt/secret/postfix-sasl-passwd - header_size_limit = 4096000 - smtp_sasl_security_options = noanonymous - ''; - - extraAliases = let - erik = "erikorbekk@gmail.com"; - kjetil = "kjetil.orbekk@gmail.com"; - lise = "lise.orbekk@gmail.com"; - katharina = "katharina.kufieta@gmail.com"; - in '' - eo: ${erik} - erik: ${erik} - orbekk: ${kjetil} - k: ${kjetil} - kj: ${kjetil} - kjetil: ${kjetil} - root: ${kjetil} - postmaster: ${kjetil} - katharina: ${katharina} - kathi: ${katharina} - kasiunia: ${katharina} - kat: ${katharina} - lise: ${lise} - ''; - sslCert = "/var/lib/acme/shape.orbekk.com/fullchain.pem"; - sslCACert = "/var/lib/acme/shape.orbekk.com/fullchain.pem"; - sslKey = "/var/lib/acme/shape.orbekk.com/key.pem"; - }; -} diff --git a/config/matrix.nix b/config/matrix.nix deleted file mode 100644 index 8747d62..0000000 --- a/config/matrix.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ config, lib, pkgs, ... }: -let - matrixPort = (import ../data/aliases.nix).services.matrix.port; - matrixFederationPort = - (import ../data/aliases.nix).services.matrixFederation.port; -in { - networking.firewall.allowedTCPPorts = [ matrixPort matrixFederationPort ]; - - services.matrix-synapse = { - enable = true; - server_name = "orbekk.com"; - # registration_shared_secret = "disable_after_registration"; - listeners = [ - { - port = matrixPort; - bind_address = ""; - type = "http"; - tls = false; - x_forwarded = true; - resources = [{ - names = [ "client" "webclient" ]; - compress = true; - } - # { names = ["federation"]; compress = false; } - ]; - } - { - port = matrixFederationPort; - bind_address = ""; - type = "http"; - tls = true; - x_forwarded = false; - resources = [{ - names = [ "federation" ]; - compress = false; - }]; - } - ]; - }; -} diff --git a/config/minecraft.nix b/config/minecraft.nix deleted file mode 100644 index 9aa7720..0000000 --- a/config/minecraft.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ config, lib, pkgs, ... }: -let - minecraft-port = 25565; - allowedAddresses = [ "108.30.16.212" "24.193.7.0/24" ]; -in { - networking.firewall.extraCommands = lib.concatMapStrings (addr: '' - iptables -A nixos-fw -p tcp \ - --dport ${toString minecraft-port} \ - -s ${addr} \ - -j nixos-fw-accept - '') allowedAddresses; - services.minecraft-server = { - eula = true; - enable = true; - dataDir = "/storage/srv/minecraft/annie"; - }; -} diff --git a/config/mpd.nix b/config/mpd.nix deleted file mode 100644 index a9dcee0..0000000 --- a/config/mpd.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ config, lib, pkgs, ... }: -let - mpdport = (import ../data/aliases.nix).services.mpd.port; - mpdwebport = (import ../data/aliases.nix).services.mpdweb.port; -in { - networking.firewall.allowedTCPPorts = [ mpdport mpdwebport ]; - - services.ympd = { - enable = true; - webPort = toString mpdwebport; - }; - - services.mpd = { - enable = true; - musicDirectory = "/storage/music"; - extraConfig = '' - audio_output { - type "httpd" - name "KJ mpd stream" - encoder "lame" - port "${toString mpdport}" - quality "0" # do not define if bitrate is defined - #bitrate "128" # do not define if quality is defined - format "44100:16:1" - always_on "yes" # prevent MPD from disconnecting all listeners when playback is stopped. - tags "yes" # httpd supports sending tags to listening streams. - audio_buffer_size "8192" - } - ''; - }; -} diff --git a/config/postgresql.nix b/config/postgresql.nix deleted file mode 100644 index 5d4aa7d..0000000 --- a/config/postgresql.nix +++ /dev/null @@ -1 +0,0 @@ -{ config, lib, pkgs, ... }: { services.postgresql.enable = true; } diff --git a/config/pxe.nix b/config/pxe.nix deleted file mode 100644 index ad90e0c..0000000 --- a/config/pxe.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ config, lib, pkgs, ... }: { - services.dnsmasq = { - extraConfig = '' - enable-tftp - tftp-root=${pkgs.ipxe} - dhcp-userclass=set:ipxe,iPXE - dhcp-boot=tag:!ipxe,undionly.kpxe - dhcp-boot=http://boot.ipxe.org/demo/boot.php - ''; - }; -} diff --git a/config/stats.nix b/config/stats.nix deleted file mode 100644 index d30f426..0000000 --- a/config/stats.nix +++ /dev/null @@ -1,48 +0,0 @@ -{ config, lib, pkgs, ... }: -let - home = (import ../data/aliases.nix).services.stats.home; - stats-pkg = "/opt/site/stats"; -in -{ - services.postgresql = { - enable = true; - extraConfig = '' - track_commit_timestamp = on - ''; - }; - - systemd.services.stats-init = { - wantedBy = ["multi-user.target"]; - requires = ["postgresql.service"]; - after = ["postgresql.service"]; - script = '' - if [[ ! -e ${home}/.db-created ]]; then - ${pkgs.sudo}/bin/sudo -u ${config.services.postgresql.superUser} ${config.services.postgresql.package}/bin/createuser stats - ${pkgs.sudo}/bin/sudo -u ${config.services.postgresql.superUser} ${config.services.postgresql.package}/bin/createdb -O stats stats - touch ${home}/.db-created - fi - - ${pkgs.sudo}/bin/sudo -u stats ${stats-pkg}/result/bin/stats --db postgresql://stats:stats@localhost/stats init - ''; - }; - - # systemd.services.stats-currency-fetch = { - # environment = { RUST_LOG = "stats=info"; }; - # serviceConfig.ExecStart = "${stats-pkg}/target/debug/stats --db postgresql://orbekk:orbekk@localhost/stats currency"; - # }; - # systemd.timers.stats-currency-fetch = { - # wantedBy = [ "timers.target" ]; - # timerConfig = { - # OnBootSec = "5m"; - # OnUnitInactiveSec = "5m"; - # }; - # }; - # - # systemd.services.stats-currency-dash = { - # path = [ pkgs.nix ]; - # wantedBy = ["multi-user.target"]; - # serviceConfig.ExecStart = "${stats-pkg}/R/dashboard.sh"; - # requires = ["stats-currency-fetch.service"]; - # after = ["stats-currency-fetch.service"]; - #}; -}
\ No newline at end of file diff --git a/config/systemhttpd.nix b/config/systemhttpd.nix deleted file mode 100644 index 3dcdb92..0000000 --- a/config/systemhttpd.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ configs, lib, pkgs, ... }: -let - port = (import ../data/aliases.nix).services.systemhttpd.port; -in -{ - systemd.services.systemhttpd = { - description = "Web frontend for systemd"; - after = [ "networking.target" ]; - wantedBy = [ "multi-user.target" ]; - environment = { - RUST_BACKTRACE = "1"; - RUST_LOG = "error,systemhttp=info,main=info"; - }; - serviceConfig = { - ExecStart = "${pkgs.systemhttpd}/bin/systemhttpd --port ${toString port} " + - "--db_file /var/lib/systemhttpd/db.sqlite " + - "--base_url https://kj.orbekk.com/systemd/ serve"; - User = "root"; - }; - }; -} diff --git a/config/weechat.nix b/config/weechat.nix deleted file mode 100644 index d90272c..0000000 --- a/config/weechat.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ config, pkgs, ... }: -{ - # nixpkgs.config.packageOverrides = pkgs: { - # weechat = pkgs.weechat.override { - # extraBuildInputs = with pkgs; [ - # pythonPackages.potr - # ]; - # }; - # }; - - systemd.services = { - weechat = { - description = "weechat session"; - path = [ pkgs.weechat pkgs.tmux pkgs.coreutils ]; - after = [ "networking.target" ]; - wantedBy = [ "multi-user.target" ]; - environment = { - LANG = "en_US.utf8"; - LC_ALL = "en_US.utf8"; - TERM = "${pkgs.rxvt_unicode.terminfo}"; - }; - serviceConfig = { - Type = "oneshot"; - User = "orbekk"; - RemainAfterExit = true; - Environment = "TMUX_TMPDIR=/run/user/1000"; - }; - - script = '' - mkdir -p /run/user/1000 - tmux -2 new-session -d -s irc "${pkgs.weechat}/bin/weechat" - ''; - - preStop = '' - # Gently shut down weechat. - # -xf is needed to kill precisely weechat (and not this script). - pkill -SIGTERM -xf "${pkgs.weechat}/bin/weechat" - for i in {1..10}; do - echo "Waiting for weechat to stop" - pgrep -xlf "${pkgs.weechat}/bin/weechat" || break - sleep 1 - done - tmux kill-session -t irc || true - ''; - }; - }; -} diff --git a/jobset-spec.json b/jobset-spec.json deleted file mode 100644 index bf126a2..0000000 --- a/jobset-spec.json +++ /dev/null @@ -1 +0,0 @@ -{"checkinterval":300,"description":"orbekk's NixOS configuration","emailoverride":"","enabled":1,"enableemail":false,"hidden":false,"inputs":{"nixpkgs":{"emailresponsible":false,"type":"git","value":"https://github.com/NixOS/nixpkgs-channels.git nixos-unstable"},"src":{"emailresponsible":false,"type":"git","value":"https://git.orbekk.com/git/nixos-config.git"}},"keepnr":0,"nixexprinput":"src","nixexprpath":"release.nix","schedulingshares":100}
\ No newline at end of file diff --git a/machines/generic-container.nix b/machines/generic-container.nix deleted file mode 100644 index 6c6c332..0000000 --- a/machines/generic-container.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ config, lib, pkgs, ... }: -{ - imports = [ - ../config/container.nix - ../config/users.nix - ]; - - networking = { - hostName = lib.mkForce "new-container"; - }; -} diff --git a/machines/minideck.nix b/machines/minideck.nix deleted file mode 100644 index 7a76936..0000000 --- a/machines/minideck.nix +++ /dev/null @@ -1,86 +0,0 @@ -{ lib, config, pkgs, ... }: - -with lib; - -{ - orbekk.simple-firewall.enable = mkForce false; - - # Install desktop packages, but don't enable X11. - orbekk.desktop.enable = true; - orbekk.development.enable = true; - services.xserver.enable = mkForce false; - services.xserver.displayManager.lightdm.enable = mkForce false; - - # Fake pipewire socket activation. - services.pipewire.socketActivation = false; - systemd.user.services.pipewire-setup = { - description = "Link pipewire socket"; - after = [ "paths.target" ]; - wantedBy = [ "default.target" ]; - serviceConfig = { - ExecStart = "${pkgs.coreutils}/bin/ln -s /tmp/pipewire-0 %t/pipewire-0"; - Type = "oneshot"; - }; - }; - - # GPG socket is forwarded by SSH. - systemd.user.sockets.gpg-agent.enable = mkForce false; - - nix.gc.persistent = false; - - boot.cleanTmpDir = mkForce false; # Don't delete bind mounts in /tmp. - boot.isContainer = true; - boot.postBootCommands = '' - # After booting, register the contents of the Nix store in the Nix - # database. - if [ -f /nix-path-registration ]; then - ${config.nix.package.out}/bin/nix-store --load-db < /nix-path-registration && - rm /nix-path-registration - fi - # nixos-rebuild also requires a "system" profile - ${config.nix.package.out}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system - ''; - - environment.defaultPackages = with pkgs; [ neovim xmonad ]; - environment.etc."resolv.conf".text = '' - nameserver 172.20.100.1 - nameserver 8.8.8.8 - ''; - - networking.hostName = "minideck"; - networking.interfaces.host0 = { - ipv4.addresses = [{ - address = "172.20.199.2"; - prefixLength = 24; - }]; - ipv4.routes = [{ - address = "0.0.0.0"; - prefixLength = 0; - via = "172.20.199.1"; - }]; - }; - - users.users.root.initialHashedPassword = mkOverride 150 ""; - - system.activationScripts.installInitScript = mkForce '' - ln -fs $systemConfig/init /sbin/init - ''; - environment.shellInit = '' - source /.host-profile - ''; - services.openssh.enable = mkDefault true; - services.openssh.startWhenNeeded = mkDefault true; - system.stateVersion = "22.05"; - - systemd.tmpfiles.rules = [ - # Don't remove the X11 socket. - "d /tmp/.X11-unix 1777 root root" - ]; - systemd.suppressedSystemUnits = [ - "systemd-udev-trigger.service" - "systemd-udevd.service" - "sys-fs-fuse-connections.mount" - "sys-kernel-debug.mount" - "dev-mqueue.mount" - ]; -} diff --git a/machines/x220-aji.nix b/machines/x220-aji.nix deleted file mode 100644 index 771d1b8..0000000 --- a/machines/x220-aji.nix +++ /dev/null @@ -1,75 +0,0 @@ -{ config, lib, pkgs, ... }: -{ - imports = [ - ../config/desktop.nix - ../config/thinkpad.nix - ../config/yubikey.nix - ../config/postgresql.nix - # ../config/ap.nix - ]; - - services.thinkfan.enable = true; - services.thinkfan.sensors = '' - hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon4/temp1_input - hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon4/temp2_input - hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon4/temp3_input - ''; - services.openssh.enable = true; - services.postgresql.package = lib.mkForce pkgs.postgresql_11; - - nixpkgs.config.allowUnfree = true; - nixpkgs.config.packageOverrides = pkgs: { - my-steam-run = (pkgs.steam.override { - extraPkgs = pkgs: [ ]; - }).run; - }; - - environment.systemPackages = with pkgs; [ - # my-steam-run - # wine - ]; - - networking = { - hostName = "aji"; - }; - - boot = { - initrd.luks.devices = { - cryptroot = { - device = "/dev/disk/by-id/ata-INTEL_SSDSC2BW240H6_CVTR609508W0240CGN-part2"; - allowDiscards = true; - }; - }; - - extraModulePackages = [ config.boot.kernelPackages.tp_smapi ]; - - extraModprobeConfig = '' - options i915 enable_rc6=1 - options thinkpad_acpi fan_control=1 - ''; - }; - - fileSystems = { - "/boot" = lib.mkForce { - mountPoint = "/boot"; - device = "/dev/disk/by-uuid/829B-F56C"; - fsType = "vfat"; - }; - "/" = { - mountPoint = "/"; - device = "/dev/mapper/cryptvg-root"; - fsType = "btrfs"; - options = ["subvol=aji-root" "discard" "compress=lzo"]; - }; - "/btrfs" = { - mountPoint = "/btrfs"; - device = "/dev/mapper/cryptvg-root"; - fsType = "btrfs"; - options = ["discard" "compress=lzo"]; - }; - }; - swapDevices = - [ { device = "/dev/mapper/cryptvg-swap"; } - ]; - system.stateVersion = "17.04"; -} diff --git a/modules/desktop.nix b/modules/desktop.nix index 30c1d60..0099d75 100644 --- a/modules/desktop.nix +++ b/modules/desktop.nix @@ -91,6 +91,7 @@ in { environment.systemPackages = with pkgs; [ anki + gimp opencpn # Wayland packages river diff --git a/patches/xow/0001-Single-controller-patch.patch b/patches/xow/0001-Single-controller-patch.patch deleted file mode 100644 index b56270a..0000000 --- a/patches/xow/0001-Single-controller-patch.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 8937ae5e05e64c884b9f8d0736628a596bba6728 Mon Sep 17 00:00:00 2001 -From: Kjetil Orbekk <kj@orbekk.com> -Date: Mon, 22 Feb 2021 08:17:49 -0500 -Subject: [PATCH] Single controller patch - ---- - controller/controller.cpp | 6 ++++++ - controller/controller.h | 1 + - dongle/dongle.cpp | 13 +++++++++---- - 3 files changed, 16 insertions(+), 4 deletions(-) - -diff --git a/controller/controller.cpp b/controller/controller.cpp -index d138e0c..83640ea 100644 ---- a/controller/controller.cpp -+++ b/controller/controller.cpp -@@ -171,6 +171,12 @@ void Controller::initInput(const AnnounceData *announce) - return; - } - -+ if (initialized) { -+ Log::info("HACK: Skip initialization because of reute"); -+ return; -+ } -+ initialized = true; -+ - InputDevice::AxisConfig stickConfig = {}; - - // 16 bits (signed) for the sticks -diff --git a/controller/controller.h b/controller/controller.h -index 5486895..cd11853 100644 ---- a/controller/controller.h -+++ b/controller/controller.h -@@ -52,4 +52,5 @@ private: - InputDevice inputDevice; - - uint8_t batteryLevel = 0xff; -+ bool initialized = false; - }; -diff --git a/dongle/dongle.cpp b/dongle/dongle.cpp -index b931ff8..5c5305e 100644 ---- a/dongle/dongle.cpp -+++ b/dongle/dongle.cpp -@@ -72,9 +72,13 @@ void Dongle::handleControllerConnect(Bytes address) - std::placeholders::_1 - ); - -- controllers[wcid - 1].reset(new Controller(sendPacket)); -- -- Log::info("Controller '%d' connected", wcid); -+ if (controllers[wcid - 1] == nullptr) -+ { -+ controllers[wcid - 1].reset(new Controller(sendPacket)); -+ Log::info("Controller '%d' connected", wcid); -+ } else { -+ Log::info("Controller '%d' connected (re-attached)", wcid); -+ } - } - - void Dongle::handleControllerDisconnect(uint8_t wcid) -@@ -93,7 +97,8 @@ void Dongle::handleControllerDisconnect(uint8_t wcid) - return; - } - -- controllers[wcid - 1].reset(); -+ // QQQ: Figure out how to flag protect this. -+ // controllers[wcid - 1].reset(); - - if (!removeClient(wcid)) - { --- -2.29.2 - diff --git a/release.nix b/release.nix deleted file mode 100644 index e9fc353..0000000 --- a/release.nix +++ /dev/null @@ -1,59 +0,0 @@ -{ nixpkgs ? <nixpkgs> }: -with import <nixpkgs/lib>; -let - pkgs = import nixpkgs {}; - stdenv = pkgs.stdenv; - pkgs2storeContents = l : map (x: { object = x; symlink = "none"; }) l; - - makeSystemTarball = - { module, system }: - - let - versionModule = { - system.nixosVersionSuffix = "orbekk"; - system.nixosRevision = "master"; - }; - - config = (import <nixpkgs/nixos/lib/eval-config.nix> { - inherit system; - modules = [ module versionModule ]; - }).config; - - tarball = import <nixpkgs/nixos/lib/make-system-tarball.nix> { - inherit (pkgs) stdenv perl xz pathsFromGraph; - contents = []; - extraArgs = "--owner=0"; - - # Add init script to image - storeContents = [ - { object = config.system.build.toplevel + "/init"; - symlink = "/init"; - } - ] ++ (pkgs2storeContents [ stdenv ]); - - # Some container managers like lxc need these - extraCommands = pkgs.writeScript "setup.sh" '' - mkdir -p proc sys dev sbin - ln -s ${config.system.build.toplevel}/init sbin/init - ''; - }; - in - tarball // { inherit config; }; -in -{ - containerTarball = (import <nixpkgs/nixos/release.nix> {}) - .containerTarball.x86_64-linux; - - kjContainerTarball = makeSystemTarball { - module = ./machines/generic-container.nix; - system = "x86_64-linux"; - }; - - tests = { - common = import tests/common.nix; - desktop = import tests/desktop.nix; - container-shape = import tests/container-shape.nix; - # gitlab = import tests/gitlab.nix; - }; -} - |