ma snake.r: init

This commit is contained in:
makefu 2023-01-15 01:22:56 +01:00
parent 3d89611de7
commit ce46f7be6a
5 changed files with 118 additions and 86 deletions

26
1systems/snake/config.nix Normal file
View file

@ -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;
}

64
1systems/snake/disk.nix Normal file
View file

@ -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";
};
};
};
};
}

View file

@ -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";
}

View file

@ -0,0 +1,7 @@
{
name="cake";
full = true;
home-manager = true;
hw = true;
disko = true;
}

View file

@ -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;
};
}