diff options
Diffstat (limited to 'makefu')
-rw-r--r-- | makefu/1systems/snake/config.nix | 26 | ||||
-rw-r--r-- | makefu/1systems/snake/disk.nix | 64 | ||||
-rw-r--r-- | makefu/1systems/snake/hardware-config.nix | 21 | ||||
-rw-r--r-- | makefu/1systems/snake/source.nix | 7 | ||||
-rw-r--r-- | makefu/2configs/binary-cache/gum.nix | 6 | ||||
-rw-r--r-- | makefu/2configs/binary-cache/lass.nix | 6 | ||||
-rw-r--r-- | makefu/2configs/binary-cache/nixos.nix | 6 | ||||
-rw-r--r-- | makefu/2configs/default.nix | 2 | ||||
-rw-r--r-- | makefu/2configs/minimal.nix | 4 | ||||
-rw-r--r-- | makefu/5pkgs/HermesLedControl/default.nix | 54 | ||||
-rw-r--r-- | makefu/5pkgs/HermesLedControl/remove-logger.patch | 31 | ||||
-rw-r--r-- | makefu/5pkgs/foomatic-db-engine/default.nix | 86 |
12 files changed, 215 insertions, 98 deletions
diff --git a/makefu/1systems/snake/config.nix b/makefu/1systems/snake/config.nix new file mode 100644 index 000000000..1c6068e98 --- /dev/null +++ b/makefu/1systems/snake/config.nix @@ -0,0 +1,26 @@ +{ config, lib, pkgs, ... }: +let + primaryInterface = "eth0"; +in { + imports = [ + <stockholm/makefu> + ./hardware-config.nix + <stockholm/makefu/2configs/home-manager> + <stockholm/makefu/2configs/tools/core.nix> + <stockholm/makefu/2configs/binary-cache/nixos.nix> + + <stockholm/makefu/2configs/home/rhasspy> + <stockholm/makefu/2configs/home/rhasspy/led-control.nix> + ]; + krebs = { + enable = true; + tinc.retiolum.enable = true; + build.host = config.krebs.hosts.snake; + }; + # ensure disk usage is limited + services.journald.extraConfig = "Storage=volatile"; + networking.firewall.trustedInterfaces = [ primaryInterface ]; + documentation.info.enable = false; + documentation.man.enable = false; + documentation.nixos.enable = false; +} diff --git a/makefu/1systems/snake/disk.nix b/makefu/1systems/snake/disk.nix new file mode 100644 index 000000000..f9e14844f --- /dev/null +++ b/makefu/1systems/snake/disk.nix @@ -0,0 +1,64 @@ +{ disks ? [ "/dev/sda" ], ... }: { + disk = { + x = { + type = "disk"; + device = "/dev/sda"; + content = { + type = "table"; + format = "gpt"; + partitions = [ + { + name = "boot"; + type = "partition"; + start = "0"; + end = "1M"; + part-type = "primary"; + flags = ["bios_grub"]; + } + { + type = "partition"; + name = "ESP"; + start = "1M"; + end = "512MiB"; + fs-type = "fat32"; + bootable = true; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + } + { + type = "partition"; + name = "zfs"; + start = "512MiB"; + end = "100%"; + content = { + type = "zfs"; + pool = "zroot"; + }; + } + ]; + }; + }; + }; + zpool = { + zroot = { + type = "zpool"; + rootFsOptions.compression = "lz4"; + mountpoint = "/"; + + datasets = { + home = { + zfs_type = "filesystem"; + mountpoint = "/home"; + options.mountpoint = "legacy"; + }; + reserved = { + zfs_type = "filesystem"; + options.refreservation = "1G"; + }; + }; + }; + }; +} diff --git a/makefu/1systems/snake/hardware-config.nix b/makefu/1systems/snake/hardware-config.nix new file mode 100644 index 000000000..827c1d3eb --- /dev/null +++ b/makefu/1systems/snake/hardware-config.nix @@ -0,0 +1,21 @@ +{ pkgs, lib, ... }: +{ + imports = [ + <nixpkgs/nixos/modules/installer/scan/not-detected.nix> + ]; + boot.loader.grub.enable = true; + boot.loader.grub.version = 2; + boot.loader.grub.efiSupport = true; + boot.loader.grub.device = "/dev/sda"; + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "sd_mod" ]; + boot.kernelModules = [ "kvm-amd" ]; + disko.devices = import ./disk.nix; + + hardware.enableRedistributableFirmware = true; + hardware.cpu.amd.updateMicrocode = true; + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; + + boot.kernelParams = [ "net.ifnames=0" ]; + networking.hostId = "0123AABB"; +} diff --git a/makefu/1systems/snake/source.nix b/makefu/1systems/snake/source.nix new file mode 100644 index 000000000..b9a32a2c4 --- /dev/null +++ b/makefu/1systems/snake/source.nix @@ -0,0 +1,7 @@ +{ + name="cake"; + full = true; + home-manager = true; + hw = true; + disko = true; +} diff --git a/makefu/2configs/binary-cache/gum.nix b/makefu/2configs/binary-cache/gum.nix index fc54bd917..fc6e26fe0 100644 --- a/makefu/2configs/binary-cache/gum.nix +++ b/makefu/2configs/binary-cache/gum.nix @@ -2,11 +2,11 @@ { config, ... }: { - nix = { - binaryCaches = [ + nix.settings = { + substituters = [ "https://cache.euer.krebsco.de/" ]; - binaryCachePublicKeys = [ + trusted-public-keys = [ "gum:iIXIFlCAotib+MgI3V/i3HMlFXiVYOT/jfP0y54Zuvg=" ]; }; diff --git a/makefu/2configs/binary-cache/lass.nix b/makefu/2configs/binary-cache/lass.nix index 51b4a1afc..7d7549d8d 100644 --- a/makefu/2configs/binary-cache/lass.nix +++ b/makefu/2configs/binary-cache/lass.nix @@ -1,11 +1,11 @@ { config, ... }: { - nix = { - binaryCaches = [ + nix.settings = { + substituters = [ "https://cache.krebsco.de" ]; - binaryCachePublicKeys = [ + trusted-public-keys = [ "cache.prism-1:+S+6Lo/n27XEtvdlQKuJIcb1yO5NUqUCE2lolmTgNJU=" "cache.prism-2:YwmCm3/s/D+SxrPKN/ETjlpw/219pNUbpnluatp6FKI=" ]; diff --git a/makefu/2configs/binary-cache/nixos.nix b/makefu/2configs/binary-cache/nixos.nix index 2ff5e1307..299130059 100644 --- a/makefu/2configs/binary-cache/nixos.nix +++ b/makefu/2configs/binary-cache/nixos.nix @@ -1,11 +1,11 @@ { config, ... }: { - nix = { - binaryCaches = [ + nix.settings = { + substituters = [ "https://cache.nixos.org/" ]; - binaryCachePublicKeys = [ + trusted-public-keys = [ "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" ]; }; diff --git a/makefu/2configs/default.nix b/makefu/2configs/default.nix index ef4f8fbcd..2bfb42732 100644 --- a/makefu/2configs/default.nix +++ b/makefu/2configs/default.nix @@ -30,7 +30,7 @@ with import <stockholm/lib>; openssh.authorizedKeys.keys = [ config.krebs.users.makefu.pubkey ]; }; }; - nix.trustedUsers = [ config.krebs.build.user.name ]; + nix.settings.trusted-users = [ config.krebs.build.user.name ]; boot.kernelPackages = lib.mkDefault pkgs.linuxPackages; diff --git a/makefu/2configs/minimal.nix b/makefu/2configs/minimal.nix index 1761f65e2..0334422c8 100644 --- a/makefu/2configs/minimal.nix +++ b/makefu/2configs/minimal.nix @@ -8,13 +8,13 @@ time.timeZone = "Europe/Berlin"; networking.hostName = lib.mkIf (lib.hasAttr "host" config.krebs.build) config.krebs.build.host.name; - nix.buildCores = 0; # until https://github.com/NixOS/nixpkgs/pull/50440 is in stable # we use gpg if necessary (or nothing at all) programs.ssh.startAgent = false; # all boxes look the same - nix.useSandbox = true; + nix.settings.sandbox = true; + nix.settings.cores = 0; # until https://github.com/NixOS/nixpkgs/pull/50440 is in stable # we configure users via nix users.mutableUsers = false; diff --git a/makefu/5pkgs/HermesLedControl/default.nix b/makefu/5pkgs/HermesLedControl/default.nix new file mode 100644 index 000000000..88aed898d --- /dev/null +++ b/makefu/5pkgs/HermesLedControl/default.nix @@ -0,0 +1,54 @@ +{ lib, pkgs, python3Packages, makeWrapper, ... }: + +# How to use: +# create configuration .config/HermesLedControl/configuration.yml: +# engine: "rhasspy" +# pathToConfig: "/var/lib/rhasspy/de/profile.json" +# hardware: "respeaker4MicArray" +# pattern: "fake-name" +# enableDoA: false + + +with python3Packages; buildPythonApplication rec { + name = "HermesLedControl-${version}"; + format = "other"; + version = "3.0.4"; + + src = pkgs.fetchFromGitHub { + owner = "project-alice-assistant"; + repo = "HermesLedControl"; + rev = "v${version}"; + hash = "sha256-fVbTQPSo3fNjLb8PDDDqhMC9Hez01rTH46cKz/mfwoU="; + }; + + patches = [ + ./remove-logger.patch + ]; + + execWrapper = '' + #!/bin/sh + cd $out/lib/HermesLedControl && \ + PYTHONPATH="${makePythonPath propagatedBuildInputs}" exec \ + ${python}/bin/python "$out/lib/HermesLedControl/main.py" "$@" + ''; + + installPhase = '' + install -d "$out/lib/" + install -d "$out/bin" + cp -r . $out/lib/HermesLedControl + + echo "${execWrapper}" > HermesLedControl + install -Dm755 HermesLedControl $out/bin/HermesLedControl + + ''; + + propagatedBuildInputs = [ + spidev gpiozero rpi-gpio pyyaml paho-mqtt types-pyyaml makeWrapper + ]; + + meta = { + homepage = "https://github.com/project-alice-assistant/HermesLedControl"; + description = "Provides an easy way to control your leds in an Hermes environment"; + license = lib.licenses.gpl3; + }; +} diff --git a/makefu/5pkgs/HermesLedControl/remove-logger.patch b/makefu/5pkgs/HermesLedControl/remove-logger.patch new file mode 100644 index 000000000..a6b757d35 --- /dev/null +++ b/makefu/5pkgs/HermesLedControl/remove-logger.patch @@ -0,0 +1,31 @@ +diff --git a/main.py b/main.py +old mode 100644 +new mode 100755 +index 9b5a269..350d443 +--- a/main.py ++++ b/main.py +@@ -1,3 +1,4 @@ ++#!/usr/bin/env python3 + from logging import handlers + + import logging +@@ -17,18 +18,6 @@ _logger.setLevel(logging.DEBUG) + + date = int(datetime.now().strftime('%Y%m%d')) + +-handler = logging.FileHandler(filename='logs.log', mode='w') +-rotatingHandler = handlers.RotatingFileHandler(filename=f'./logs/{date}-logs.log', mode='a', maxBytes=100000, backupCount=5) +-streamHandler = logging.StreamHandler() +- +-handler.setFormatter(formatter) +-rotatingHandler.setFormatter(formatter) +-streamHandler.setFormatter(formatter) +- +-_logger.addHandler(handler) +-_logger.addHandler(rotatingHandler) +-_logger.addHandler(streamHandler) +- + + def stopHandler(_signum, frame): + onStop() + diff --git a/makefu/5pkgs/foomatic-db-engine/default.nix b/makefu/5pkgs/foomatic-db-engine/default.nix deleted file mode 100644 index 242232c88..000000000 --- a/makefu/5pkgs/foomatic-db-engine/default.nix +++ /dev/null @@ -1,86 +0,0 @@ -{ lib, stdenv -, fetchFromGitHub -, autoreconfHook -, gd -, libusb1 -, cups -, libpng -, perl -, perlPackages -, libxml2 -, ghostscript -, a2ps -, wget -, file -, foomatic-filters -, makeWrapper -}: - -stdenv.mkDerivation rec { - pname = "foomatic-db-engine"; - version = "2020-01-31"; - - src = fetchFromGitHub { - owner = "OpenPrinting"; - repo = "foomatic-db-engine-4"; - rev = "bd265b77a9f66f672bf1e3f0803145f2eccabf06"; - sha256 = "1f53kd3b0sxgx7hg2dvw2624bpwdfcx0zh4dn0h89l84mirgw1bs"; - }; - - nativeBuildInputs = [ - autoreconfHook - perl - makeWrapper - ]; - postConfigure = '' - sed -i "s#$ENV{BINDIR}#${placeholder "out"}/bin#" makeDefaults - ''; - configureFlags = [ - #"PERL_INSTALLDIRS=vendor" - "PERL_INSTALLDIRS=site" - "--prefix=/" - "PERLPREFIX=/" - #"DESTDIR=$(out)" - #"sysconfdir=/etc" - "LIBDIR=/lib" - #"PERL_INSTALLDIRS=site" - #"PERL_INSTALLDIRS=perl" - #PERL_INSTALLDIRS=perl" - "PERL=${perl}/bin/perl" - "FILEUTIL=${file}/bin/file" - "SBINDIR=/bin" - ]; - makeFlags = [ - "DESTDIR=${placeholder "out"}" - "PERLLIB=$(out)/${perlPackages.perl.libPrefix}" - ]; - - buildInputs = [ - cups - ghostscript - a2ps - wget - perl - libxml2 - file - foomatic-filters - ]; - postFixup = '' - echo cups > "$out"/etc/foomatic/defaultspooler - - for file in $out/bin/foomatic-*;do - wrapProgram "$file" \ - --set PERL5LIB "$out/${perlPackages.perl.libPrefix}" \ - --prefix PATH : "$out/bin" - done - - ''; - - meta = with lib; { - description = "Command line tool to print labels on Brother P-Touch printers on Linux"; - license = licenses.gpl3Plus; - homepage = "https://mockmoon-cybernetics.ch/computer/p-touch2430pc/"; - maintainers = with maintainers; [ shamilton ]; - platforms = platforms.linux; - }; -} |