Archiv/Projekte/Matemat

From dezentrale wiki
< Archiv‎ | Projekte(Redirected from Projekte/Matemat)
Jump to navigation Jump to search
Ersetzt durch Cash Register (#ECR 7100)

Matemat

Der Matemat soll eine einfache Abrechnung und Bestandshaltung zu Mate und anderes übliches Verzehrbares möglich machen. Maßgeblich soll die Verwaltung auf "Kreidetafeln" im Space ersetzt sein. Die Gepflogenheiten zur Bezahlung und Beschaffung von Verzehrbaren sollte abbildbar sein.

Es handelt sich um eine gemeinschaftliche Selbstverwaltung für Nahrungsmittel und Getränke ohne Gewinnerzielungsabsicht. Die Beschaffung und der Konsum findet im Einvernehmen durch die einander bekannten Privatpersonen statt.

How to

Hier ist, wie es funktioniert: An der Kasse finden Sie ein iPad, das speziell für Bestellungen eingerichtet ist. Es ist einfach zu bedienen und führt Sie durch den gesamten Klickprozess.

PIN neu setzen

Benötigt eine Person, die einen Zugang zum Host hat. Es ist angebracht, die Person zusätzlich per E-Mail über die Änderung zu benachrichtigen – bei persönlich nicht hinreichend bekannten Personen auch Vorab zur Kontrolle der Verfügungsfähigkeit über die Adresse.

$ ssh matemat@matemat.intern.dezentrale.space
$ docker exec -it a1e980b7b0fa bash
(docker) $ su postgres
(docker) $ psql # – connects to DB
(postgres) $ SELECT id,ident,balance,email,timestamp FROM "user" WHERE ident = 'name'; # – Daten ohne PIN zum einem Username anzeigen um ggf. zu prüfen
(postgres) $ UPDATE "user" SET pin = 1234 WHERE email = 'user@mail.com' AND ident = 'name'; # – setze neue PIN für Nutzer mit bekannten Angaben zu E-Mail und Username

Anwendungsfälle

tl;dr: es handelt sich um eine Bestandsverwaltung, keine Buchhaltung

  • Nutzerkonto aufladen
  • Erwerb von Speisen/Getränken
  • Erstellen/Editieren von Gegenständen für Lagerhaltung
  • Kassensturz (Fehler: ohne Verbindung mit Nutzer)
  • Auszahlung/Entnahme aus Kasse (Fehler: ohne Verbindung mit Nutzer)
  • fehlt: Einzahlung in Kasse (z.B. Pfanderlöse)
    + Fiktion 1: Pfandflaschen aus dem Bestand werden gegen volle Flaschen getauscht / beim Einkauf verrechnet => In Kasse legen
    + Fiktion 2: Mitgebrachte Pfandflaschen sind Spenden an den Trägerverein => in Spendenbox legen

Behebung von Fehlbefüllung

ssh matemat@matemat.intern.dezentrale.space
docker exec -it a1e980b7b0fa bash
su postgresl
psql
update beverage set amount=amount-24 where ident='Eis';

NixOS Config

configuration.nix

# Edit this configuration file to define what should be installed on
# your system.  Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, ... }:

{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
    ];

  # Bootloader.
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;
  boot.loader.efi.efiSysMountPoint = "/boot/efi";

  networking.hostName = "matemat"; # Define your hostname.
  # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.

  # Configure network proxy if necessary
  # networking.proxy.default = "http://user:password@proxy:port/";
  # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";

  # Enable networking
  networking.networkmanager.enable = true;

  # Set your time zone.
  time.timeZone = "Europe/Berlin";

  # Select internationalisation properties.
  i18n.defaultLocale = "en_US.UTF-8";

  i18n.extraLocaleSettings = {
    LC_ADDRESS = "de_DE.UTF-8";
    LC_IDENTIFICATION = "de_DE.UTF-8";
    LC_MEASUREMENT = "de_DE.UTF-8";
    LC_MONETARY = "de_DE.UTF-8";
    LC_NAME = "de_DE.UTF-8";
    LC_NUMERIC = "de_DE.UTF-8";
    LC_PAPER = "de_DE.UTF-8";
    LC_TELEPHONE = "de_DE.UTF-8";
    LC_TIME = "de_DE.UTF-8";
  };

  # Configure keymap in X11
  services.xserver = {
    layout = "us";
    xkbVariant = "";
  };

  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.users.matemat = {
    isNormalUser = true;
    description = "matemat";
    extraGroups = [ "docker" "networkmanager" "wheel" ];
    packages = with pkgs; [
       git
       neovim
       screen
    ];
  };

  # List packages installed in system profile. To search, run:
  # $ nix search wget
  environment.systemPackages = with pkgs; [
  #  vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
  #  wget
     scdl
     ffmpeg
     mpd
  ];

  # 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 = [ 22 80 443 3000 6600 8080 8000 6601 6602];
  networking.firewall.allowedUDPPorts = [ 3000 6600 8080 8000 6601 6602 ];
  # Or disable the firewall altogether.
  networking.firewall.enable = true;

  # This value determines the NixOS release from which the default
  # settings for stateful data, like file locations and database versions
  # on your system were taken. It‘s perfectly fine and recommended to leave
  # this value at the release version of the first install of this system.
  # Before changing this value read the documentation for this option
  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
  system.stateVersion = "23.05"; # Did you read the comment?

  virtualisation.docker.enable = true;

  sound.enable = true;

  services.ympd.enable = true;

  services.ympd.mpd.host = "127.0.0.1";


  system.autoUpgrade.enable = true;
  system.autoUpgrade.allowReboot = true;


  system.autoUpgrade.channel = "https://channels.nixos.org/nixos-23.05";
}

hardware-configuration.nix

# 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 = [ "xhci_pci" "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
  boot.initrd.kernelModules = [ ];
  boot.kernelModules = [ "kvm-intel" ];
  boot.extraModulePackages = [ ];

  fileSystems."/" =
    { device = "/dev/disk/by-uuid/a3329bd2-ddc7-4ed7-a6d6-040fdd1bb5b3";
      fsType = "ext4";
    };

  fileSystems."/boot/efi" =
    { device = "/dev/disk/by-uuid/3590-7A93";
      fsType = "vfat";
    };

  swapDevices =
    [ { device = "/dev/disk/by-uuid/c5db6f92-3247-4c22-bd7d-afa36a8f2c72"; }
    ];

  # 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.enp0s25.useDHCP = lib.mkDefault true;

  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
  hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
          ▗▄▄▄       ▗▄▄▄▄    ▄▄▄▖            matemat@matemat
          ▜███▙       ▜███▙  ▟███▛            ---------------
           ▜███▙       ▜███▙▟███▛             OS: NixOS 23.05.553.e7603eba51f (Stoat)
            ▜███▙       ▜██████▛              Host: FUJITSU D3220-A1
     ▟█████████████████▙ ▜████▛     ▟▙        Kernel: 6.1.31
    ▟███████████████████▙ ▜███▙    ▟██▙       Uptime: 3 days, 13 hours, 11 mins
           ▄▄▄▄▖           ▜███▙  ▟███▛       Packages: 644 (nix-system), 112 (nix-user)
          ▟███▛             ▜██▛ ▟███▛        Shell: bash 5.1.16
         ▟███▛               ▜▛ ▟███▛         Terminal: /dev/pts/0
▟███████████▛                  ▟██████████▙   CPU: Intel i3-4130 (4) @ 3.400GHz
▜██████████▛                  ▟███████████▛   GPU: Intel 4th Generation Core Processor
      ▟███▛ ▟▙               ▟███▛            Memory: 562MiB / 7841MiB
     ▟███▛ ▟██▙             ▟███▛
    ▟███▛  ▜███▙           ▝▀▀▀▀
    ▜██▛    ▜███▙ ▜██████████████████▛
     ▜▛     ▟████▙ ▜████████████████▛
           ▟██████▙       ▜███▙
          ▟███▛▜███▙       ▜███▙
         ▟███▛  ▜███▙       ▜███▙
         ▝▀▀▀    ▀▀▀▀▘       ▀▀▀▘