Changes on zbox.sea

This commit is contained in:
root 2020-06-06 19:24:59 -07:00
parent 9f59ff30fe
commit 9eb6609c7a
11 changed files with 269 additions and 58 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
configuration.nix
hardware-configuration.nix

47
config/fudo/slynk.nix Normal file
View File

@ -0,0 +1,47 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.fudo.slynk;
initScript = port: pkgs.writeText "slynk.lisp" ''
(load (merge-pathnames "quicklisp/setup.lisp" (user-homedir-pathname)))
(ql:quickload :slynk)
(slynk:create-server :port ${toString port} :dont-close t)
(dolist (var '("LD_LIBRARY_PATH"))
(format t "~S: ~S~%" var (sb-unix::posix-getenv var)))
(loop (sleep 60))
'';
in {
options.fudo.slynk = {
enable = mkEnableOption "Enable Slynk emacs common lisp server.";
port = mkOption {
type = types.int;
description = "Port on which to open a Slynk server.";
default = 4005;
};
};
config = mkIf cfg.enable {
systemd.user.services.slynk = {
description = "Slynk Common Lisp server.";
serviceConfig = {
# Type = "simple";
ExecStartPre = "${pkgs.lispPackages.quicklisp}/bin/quicklisp init";
ExecStart = "${pkgs.sbcl-with-libs}/bin/sbcl --load ${initScript cfg.port}";
Restart = "on-failure";
PIDFile = "/run/slynk.$USERNAME.pid";
};
environment = {
LD_LIBRARY_PATH = "${pkgs.openssl_1_1.out}/lib:${pkgs.libuv.out}/lib";
};
wantedBy = [ "default.target" ];
};
};
}

View File

@ -18,6 +18,7 @@ with lib;
./fudo/postgres.nix ./fudo/postgres.nix
./fudo/prometheus.nix ./fudo/prometheus.nix
./fudo/system.nix ./fudo/system.nix
./fudo/slynk.nix
./fudo/webmail.nix ./fudo/webmail.nix
../fudo/profiles ../fudo/profiles

View File

@ -1 +0,0 @@
./hosts/france.nix

View File

@ -18,6 +18,7 @@
autoconf autoconf
automake automake
bash bash
boot
bind bind
binutils binutils
btrfs-progs btrfs-progs
@ -28,6 +29,7 @@
certbot certbot
clang clang
curl curl
dpkg
emacs emacs
fail2ban fail2ban
fortune fortune
@ -44,6 +46,7 @@
jdk jdk
kerberos kerberos
libisofs libisofs
libstdcxxHook
lispPackages.alexandria lispPackages.alexandria
lispPackages.cl-ppcre lispPackages.cl-ppcre
lispPackages.clx lispPackages.clx
@ -64,6 +67,7 @@
ruby ruby
rustc rustc
sbcl sbcl
sbclBootstrap
screen screen
service-wrapper service-wrapper
stdenv stdenv
@ -73,6 +77,7 @@
unzip unzip
vim vim
wget wget
yubikey-manager
]; ];
system.stateVersion = "19.09"; system.stateVersion = "19.09";

View File

@ -5,8 +5,10 @@ with lib;
config = mkIf (config.fudo.common.profile == "desktop") { config = mkIf (config.fudo.common.profile == "desktop") {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
cool-retro-term cool-retro-term
corefonts
chrome-gnome-shell chrome-gnome-shell
chromium chromium
evince
ffmpeg-full ffmpeg-full
firefox firefox
gimp gimp
@ -20,16 +22,44 @@ with lib;
gtkimageview gtkimageview
i3lock i3lock
libfixposix libfixposix
minecraft minecraft-current
mono
mplayer mplayer
mpv
nomacs nomacs
openssl_1_1 openssl_1_1
pdftk
python37Packages.youtube-dl
redshift redshift
rhythmbox rhythmbox
shotwell shotwell
spotify spotify
sqlite sqlite
steam (steam.override {
nativeOnly = true;
extraPkgs = pkgs: [
mono
gtk3
gtk3-x11
libgdiplus
zlib
];
withJava = true;
})
(steam.override {
nativeOnly = true;
extraPkgs = pkgs: [
mono
fmodex
gtk3
gtk3-x11
libgdiplus
zlib
];
withJava = true;
}).run
# steam-run
# steam-run-native
system-config-printer system-config-printer
virtmanager virtmanager
xorg.xev xorg.xev
@ -37,13 +67,15 @@ with lib;
virtmanager-qt virtmanager-qt
]; ];
nixpkgs.config.allowBroken = true;
# Splash screen # Splash screen
boot.plymouth.enable = true; boot.plymouth.enable = true;
services.avahi = { services.avahi = {
enable = true; enable = true;
browseDomains = [config.fudo.domain]; browseDomains = [config.fudo.common.domain];
domainName = config.fudo.domain; domainName = config.fudo.common.domain;
}; };
boot.tmpOnTmpfs = true; boot.tmpOnTmpfs = true;
@ -56,16 +88,17 @@ with lib;
xkbOptions = "ctrl:nocaps"; xkbOptions = "ctrl:nocaps";
desktopManager.gnome3.enable = true; desktopManager.gnome3.enable = true;
desktopManager.default = "gnome3";
displayManager.gdm.enable = true; displayManager.gdm.enable = true;
displayManager.defaultSession = "gnome";
windowManager.session = pkgs.lib.singleton { windowManager.session = pkgs.lib.singleton {
name = "stumpwm"; name = "stumpwm";
start = '' start = ''
${pkgs.lispPackages.stumpwm}/bin/stumpwm & ${pkgs.lispPackages.stumpwm}/bin/stumpwm &
waidPID=$! waidPID=$!
''; '';
}; };
}; };
@ -89,10 +122,12 @@ with lib;
hardware.pulseaudio.enable = true; hardware.pulseaudio.enable = true;
fonts = { fonts = {
enableCoreFonts = true;
enableFontDir = true; enableFontDir = true;
enableGhostscriptFonts = false; enableGhostscriptFonts = false;
fontconfig.ultimate.enable = true; fontconfig.antialias = true;
fontconfig.enable = true;
fontconfig.penultimate.enable = true;
fontconfig.subpixel.lcdfilter = "default";
fonts = with pkgs; [ fonts = with pkgs; [
cantarell_fonts cantarell_fonts

View File

@ -1,31 +0,0 @@
# 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, ... }:
{
imports =
[ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
];
boot.initrd.availableKernelModules = [ "uhci_hcd" "ehci_pci" "ata_piix" "ahci" "usb_storage" "floppy" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/87833c39-299b-4e84-9854-beda4a8e0115";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/bfb464c0-c259-4c29-8e8f-b3011bd30c95";
fsType = "ext4";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/ac0fe2b7-dd7a-4e86-aaa0-942acf3d541d"; }
];
nix.maxJobs = lib.mkDefault 8;
}

View File

@ -4,34 +4,84 @@ let
hostname = "zbox"; hostname = "zbox";
in { in {
imports = [
../defaults.nix
../networks/sea.fudo.org.nix
../profiles/desktop.nix
../hardware-configuration.nix
];
environment.systemPackages = with pkgs; [
glxinfo
];
# Use the systemd-boot EFI boot loader. # Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
imports = [
../defaults.nix
../hardware-configuration.nix
];
environment.systemPackages = with pkgs; [
androidenv.androidPkgs_9_0.platform-tools
android-studio
glxinfo
hll2380dw-cups
nodejs
signal-desktop
usbutils
];
fudo.common = {
profile = "desktop";
site = "seattle";
};
fudo.slynk = {
enable = true;
};
hardware.cpu.intel.updateMicrocode = true; hardware.cpu.intel.updateMicrocode = true;
programs.bash.enableCompletion = true; programs = {
adb.enable = true;
bash.enableCompletion = true;
};
services.xserver = { services.xserver = {
videoDrivers = ["nvidia"]; videoDrivers = ["nvidia"];
displayManager.gdm.wayland = false; # displayManager.gdm.wayland = false;
}; };
hardware.opengl.driSupport32Bit = true; hardware.opengl.driSupport32Bit = true;
hardware.opengl.extraPackages32 = with pkgs.pkgsi686Linux; [ libva ];
hardware.opengl.driSupport = true; hardware.opengl.driSupport = true;
networking.hostName = hostname; hardware.pulseaudio.support32Bit = true;
networking = {
hostName = hostname;
macvlans = {
intif0 = {
interface = "eno1";
mode = "bridge";
};
};
interfaces = {
eno1.useDHCP = false;
intif0 = {
macAddress = "02:dd:80:52:83:9b";
useDHCP = false;
ipv4.addresses = [
{
address = "10.0.0.110";
prefixLength = 24;
}
];
};
};
};
hardware.bluetooth.enable = true; hardware.bluetooth.enable = true;
users.users.niten = {
extraGroups = ["adbusers"];
};
virtualisation.lxd.enable = true;
} }

56
lib/ip.nix Normal file
View File

@ -0,0 +1,56 @@
{ lib }:
with lib;
let
joinString = lib.concatStringsSep;
pow = x: e: if (e == 0) then 1 else x * (pow x (e - 1));
in rec {
generateNBits = n: let
helper = n: c: if (c == n) then pow 2 c else (pow 2 c) + (helper n (c + 1));
in if (n <= 0) then throw "Can't generate 0 or fewer bits" else helper (n - 1) 0;
reverseIpv4 = ip: joinString "." (reverseList (splitString "." ip));
intToBinaryList = int: let
helper = int: cur: let
curExp = pow 2 cur;
in if (curExp > int) then
[]
else
[(if ((bitAnd curExp int) > 0) then 1 else 0)] ++ (helper int (cur + 1));
in reverseList (helper int 0);
leftShift = int: n: int * (pow 2 n);
rightShift = int: n: int / (pow 2 n);
ipv4ToInt = ip: let
els = map toInt (reverseList (splitString "." ip));
in foldr (a: b: a + b) 0 (imap0 (i: el: (leftShift el (i * 8))) els);
intToIpv4 = int: joinString "." (map (i: toString (bitAnd (rightShift int (i * 8)) 255)) [ 3 2 1 0 ]);
rightPadBits = int: bits: bitOr int (generateNBits bits);
maskFromV32Network = network: let
fullMask = ipv4ToInt "255.255.255.255";
insignificantBits = 32 - (getNetworkMask network);
in intToIpv4 (leftShift (rightShift fullMask insignificantBits) insignificantBits);
getNetworkMask = network: toInt (elemAt (splitString "/" network) 1);
getNetworkBase = network: let
ip = elemAt (splitString "/" network) 0;
insignificantBits = 32 - (getNetworkMask network);
in intToIpv4 (leftShift (rightShift (ipv4ToInt ip) insignificantBits) insignificantBits);
networkMinIp = network: intToIpv4 (1 + (ipv4ToInt (getNetworkBase network)));
networkMaxIp = network: intToIpv4 (rightPadBits (ipv4ToInt (getNetworkBase network)) (32 - (getNetworkMask network)));
# To avoid broadcast IP...
networkMaxButOneIp = network: intToIpv4 ((rightPadBits (ipv4ToInt (getNetworkBase network)) (32 - (getNetworkMask network))) - 1);
}

View File

@ -0,0 +1,40 @@
{ stdenv, fetchurl, makeWrapper, cups, dpkg, a2ps, ghostscript, gnugrep, gnused, coreutils, file, perl, which }:
stdenv.mkDerivation rec {
pname = "hll2380dw-cups";
version = "3.2.0-1";
platform = "i386";
src = fetchurl {
url = "https://download.brother.com/welcome/dlf101772/hll2380dwcupswrapper-${version}.i386.deb";
sha256 = "08g3kx5lgwzb3f9ypj8knmpkkj0h3kv1i4gd20rzjxrx6vx1wbpl";
};
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ cups ghostscript dpkg a2ps ];
dontUnpack = true;
installPhase = ''
dpkg-deb -x $src $out
wrapProgram $out/opt/brother/Printers/HLL2380DW/cupswrapper/paperconfigml1 \
--prefix PATH : ${stdenv.lib.makeBinPath [
coreutils ghostscript gnugrep gnused
]}
mkdir -p $out/lib/cups/filter/
ln -s $out/opt/brother/Printers/HLL2380DW/cupswrapper/brother_lpdwrapper_HLL2380W \
$out/lib/cups/filter/brother_lpdwrapper_HLL2380DW
ln -s $out/opt/brother/Printers/HLL2380DW/paperconfigml1 \
$out/lib/cups/filter/
mkdir -p $out/share/cups/model
ln -s $out/opt/brother/Printers/HLL2380DW/cupswrapper/brother-HLL2380DW-cups-en.ppd $out/share/cups/model/
'';
meta = with stdenv.lib; {
homepage = http://www.brother.com/;
description = "Brother HL-L2380DW combined print driver";
license = licenses.unfree;
platforms = [ "x86_64-linux" ];
downloadPage = http://support.brother.com/g/b/downloadlist.aspx?c=us_ot&lang=en&prod=hll2380dw_us&os=128;
};
}

View File

@ -15,22 +15,29 @@
}; };
}); });
minecraft-server_1_15_2 = pkgs.minecraft-server.overrideAttrs (oldAttrs: rec { minecraft-current = pkgs.minecraft.overrideAttrs (oldAttrs: rec {
version = "1.15.2";
src = builtins.fetchurl { src = builtins.fetchurl {
url = "https://launcher.mojang.com/v1/objects/bb2b6b1aefcd70dfd1892149ac3a215f6c636b07/server.jar"; url = "https://launcher.mojang.com/download/Minecraft.tar.gz";
sha256 = "12kynrpxgcdg8x12wcvwkxka0fxgm5siqg8qq0nnmv0443f8dkw0"; sha256 = "1k9gf1v1law4kiz8f7i2fxkj5vq2cm37b3ys95zpyf4aiw5nzg33";
}; };
}); });
postgresql_11_gssapi = pkgs.postgresql_11.overrideAttrs (oldAttrs: rec { postgresql_11_gssapi = pkgs.postgresql_11.overrideAttrs (oldAttrs: rec {
configureFlags = oldAttrs.configureFlags ++ [ "--with-gssapi" ]; configureFlags = oldAttrs.configureFlags ++ [ "--with-gssapi" ];
buildInputs = oldAttrs.buildInputs ++ [ pkgs.krb5 ]; buildInputs = oldAttrs.buildInputs ++ [ pkgs.krb5 ];
sbcl-with-libs = pkgs.sbcl.overrideAttrs (oldAttrs: rec {
extraLibs = with pkgs; [
openssl_1_1.dev
];
}); });
postgresql_12_gssapi = pkgs.postgresql_12.overrideAttrs (oldAttrs: rec { postgresql_12_gssapi = pkgs.postgresql_12.overrideAttrs (oldAttrs: rec {
configureFlags = oldAttrs.configureFlags ++ [ "--with-gssapi" ]; configureFlags = oldAttrs.configureFlags ++ [ "--with-gssapi" ];
buildInputs = oldAttrs.buildInputs ++ [ pkgs.krb5 ]; buildInputs = oldAttrs.buildInputs ++ [ pkgs.krb5 ];
}); });
hll2380dw-cups = import ./hll2380dw-cups.nix {
inherit (pkgs) stdenv fetchurl makeWrapper cups dpkg a2ps ghostscript gnugrep gnused coreutils file perl which;
};
}; };
} }