init flake-x

This commit is contained in:
makefu 2023-06-09 14:58:43 +02:00
parent b49d095fd7
commit d92cd0eb94
9 changed files with 496 additions and 0 deletions

256
1systems/flake-x/config.nix Normal file
View file

@ -0,0 +1,256 @@
{ config, pkgs, lib, ... }:
{
imports =
[
# ./x13
# ./x230
## Common Hardware Components
#<nix-ld/modules/nix-ld.nix>
## <stockholm/makefu/2configs/hw/mceusb.nix>
## <stockholm/makefu/2configs/hw/rtl8812au.nix>
#<stockholm/makefu/2configs/hw/network-manager.nix>
## <stockholm/makefu/2configs/hw/stk1160.nix>
## <stockholm/makefu/2configs/hw/irtoy.nix>
## <stockholm/makefu/2configs/hw/malduino_elite.nix>
#<stockholm/makefu/2configs/hw/switch.nix>
## <stockholm/makefu/2configs/hw/rad1o.nix>
#<stockholm/makefu/2configs/hw/cc2531.nix>
#<stockholm/makefu/2configs/hw/droidcam.nix>
#<stockholm/makefu/2configs/hw/smartcard.nix>
#<stockholm/makefu/2configs/hw/upower.nix>
##<stockholm/makefu/2configs/hw/ps4-compat.nix>
## base
#<stockholm/makefu>
#<stockholm/makefu/2configs/nur.nix>
#<stockholm/makefu/2configs/home-manager>
#<stockholm/makefu/2configs/home-manager/desktop.nix>
#<stockholm/makefu/2configs/home-manager/cli.nix>
#<stockholm/makefu/2configs/home-manager/mail.nix>
#<stockholm/makefu/2configs/home-manager/taskwarrior.nix>
#<stockholm/makefu/2configs/main-laptop.nix>
#<stockholm/makefu/2configs/kdeconnect.nix>
#<stockholm/makefu/2configs/extra-fonts.nix>
#<stockholm/makefu/2configs/editor/neovim>
#<stockholm/makefu/2configs/tools/all.nix>
#{ programs.adb.enable = true; }
#{
# services.openssh.hostKeys = [
# { bits = 4096; path = (toString <secrets/ssh_host_rsa_key>); type = "rsa";}
# ];
#}
##{
## imports = [
## <stockholm/makefu/2configs/bureautomation/rhasspy.nix>
## ];
## services.pipewire.config.pipewire-pulse = {
## "pulse.properties"."server.address" = [ "unix:native" "tcp:4713" ];
## };
## networking.firewall.allowedTCPPorts = [ 4713 ];
##}
##{
## users.users.makefu.packages = with pkgs;[ mpc_cli ncmpcpp ];
## services.ympd.enable = true;
## services.mpd = {
## enable = true;
## extraConfig = ''
## log_level "default"
## auto_update "yes"
## audio_output {
## type "httpd"
## name "lassulus radio"
## encoder "vorbis" # optional
## port "8000"
## quality "5.0" # do not define if bitrate is defined
## # bitrate "128" # do not define if quality is defined
## format "44100:16:2"
## always_on "yes" # prevent MPD from disconnecting all listeners when playback is stopped.
## tags "yes" # httpd supports sending tags to listening streams.
## }
## '';
## };
##}
## { systemd.services.docker.wantedBy = lib.mkForce []; }
## <stockholm/makefu/2configs/dict.nix>
## <stockholm/makefu/2configs/legacy_only.nix>
##<stockholm/makefu/3modules/netboot_server.nix>
##{
## netboot_server = {
## network.wan = "wlp3s0";
## network.lan = "enp0s25";
## };
##}
## Restore:
## systemctl cat borgbackup-job-state
## export BORG_PASSCOMMAND BORG_REPO BORG_RSH
## borg list "$BORG_REPO"
## mount newroot somewhere && cd somewhere
## borg extract "$BORG_REPO::x-state-2019-04-17T01:41:51" --progress # < extract to cwd
#<stockholm/makefu/2configs/backup/state.nix>
## <stockholm/makefu/2configs/dnscrypt/client.nix>
#<stockholm/makefu/2configs/avahi.nix>
#<stockholm/makefu/2configs/support-nixos.nix>
## Debugging
## <stockholm/makefu/2configs/disable_v6.nix>
## <stockholm/makefu/2configs/pyload.nix>
## Testing
##{
## services.nginx = {
## enable = true;
## recommendedProxySettings = true;
## virtualHosts.local = {
## default = true;
## locations."/".proxyPass= "http://localhost:4567";
## };
## };
## services.gollum = {
## enable = true;
## extraConfig = ''
## Gollum::Hook.register(:post_commit, :hook_id) do |committer, sha1|
## File.open('/tmp/lol', 'w') { |file| file.write(self.to_s) }
## end
## '';
## };
##}
## <stockholm/makefu/2configs/deployment/gitlab.nix>
## <stockholm/makefu/2configs/deployment/docker/etherpad.nix>
## <stockholm/makefu/2configs/deployment/wiki-irc-bot>
## <stockholm/makefu/2configs/torrent.nix>
## <stockholm/makefu/2configs/deployment/dirctator.nix>
## <stockholm/makefu/2configs/vncserver.nix>
## <stockholm/makefu/2configs/deployment/led-fader>
## <stockholm/makefu/2configs/deployment/hound>
## <stockholm/makefu/2configs/deployment/photostore.krebsco.de.nix>
## <stockholm/makefu/2configs/deployment/bureautomation/hass.nix>
## <stockholm/makefu/2configs/bureautomation/office-radio>
## Krebs
#<stockholm/makefu/2configs/tinc/retiolum.nix>
## <stockholm/makefu/2configs/share/anon-ftp.nix>
## <stockholm/makefu/2configs/share/anon-sftp.nix>
#<stockholm/makefu/2configs/share/gum-client.nix>
#<stockholm/makefu/2configs/share>
## <stockholm/makefu/2configs/share/temp-share-samba.nix>
## applications
#<stockholm/makefu/2configs/exim-retiolum.nix>
#<stockholm/makefu/2configs/mail-client.nix>
#<stockholm/makefu/2configs/printer.nix>
## <stockholm/makefu/2configs/syncthing.nix>
## <stockholm/makefu/2configs/sync>
## Virtualization
## <stockholm/makefu/2configs/virtualisation/libvirt.nix>
#<stockholm/makefu/2configs/virtualisation/docker.nix>
#<stockholm/makefu/2configs/virtualisation/virtualbox.nix>
##{
## networking.firewall.allowedTCPPorts = [ 8080 ];
## networking.nat = {
## enable = true;
## externalInterface = "wlp3s0";
## internalInterfaces = [ "vboxnet0" ];
## };
##}
## Services
#<stockholm/makefu/2configs/git/brain-retiolum.nix>
#<stockholm/makefu/2configs/tor.nix>
## <stockholm/makefu/2configs/vpn/vpngate.nix>
## <stockholm/makefu/2configs/buildbot-standalone.nix>
#<stockholm/makefu/2configs/remote-build/aarch64-community.nix>
## <stockholm/makefu/2configs/remote-build/gum.nix>
## { nixpkgs.overlays = [ (self: super: super.prefer-remote-fetch self super) ]; }
## <stockholm/makefu/2configs/binary-cache/gum.nix>
#<stockholm/makefu/2configs/binary-cache/lass.nix>
## Security
## <stockholm/makefu/2configs/sshd-totp.nix>
## temporary
## { services.redis.enable = true; }
## citadel exporter
## { services.mongodb.enable = true; }
## { services.elasticsearch.enable = true; }
## <stockholm/makefu/2configs/deployment/nixos.wiki>
## <stockholm/makefu/2configs/home/photoprism.nix>
## <stockholm/makefu/2configs/dcpp/airdcpp.nix>
## <stockholm/makefu/2configs/nginx/rompr.nix>
## <stockholm/makefu/2configs/lanparty/lancache.nix>
## <stockholm/makefu/2configs/lanparty/lancache-dns.nix>
## <stockholm/makefu/2configs/lanparty/samba.nix>
## <stockholm/makefu/2configs/lanparty/mumble-server.nix>
#<stockholm/makefu/2configs/wireguard/wiregrill.nix>
# {
# networking.wireguard.interfaces.wg0 = {
# ips = [ "10.244.0.2/24" ];
# privateKeyFile = (toString <secrets>) + "/wireguard.key";
# allowedIPsAsRoutes = true;
# peers = [
# {
# # gum
# endpoint = "${config.krebs.hosts.gum.nets.internet.ip4.addr}:51820";
# allowedIPs = [ "10.244.0.0/24" ];
# publicKey = "yAKvxTvcEVdn+MeKsmptZkR3XSEue+wSyLxwcjBYxxo=";
# }
# #{
# # # vbob
# # allowedIPs = [ "10.244.0.3/32" ];
# # publicKey = "Lju7EsCu1OWXhkhdNR7c/uiN60nr0TUPHQ+s8ULPQTw=";
# #}
# ];
# };
# }
];
nixpkgs.config.allowUnfree = true;
nixpkgs.config.oraclejdk.accept_license = true;
environment.systemPackages = [ xxx ];
# configure pulseAudio to provide a HDMI sink as well
networking.firewall.enable = true;
networking.firewall.allowedUDPPorts = [ 665 26061 1514 ];
networking.firewall.trustedInterfaces = [ "vboxnet0" "enp0s25" ];
# krebs.build.host = config.krebs.hosts.x;
#krebs.tinc.retiolum.connectTo = lib.mkForce [ "gum" ];
#krebs.tinc.retiolum.extraConfig = "AutoConnect = no";
# environment.variables = { GOROOT = [ "${pkgs.go.out}/share/go" ]; };
#state = [
# "/home/makefu/stockholm"
# "/home/makefu/.ssh/"
# "/home/makefu/.zsh_history"
# "/home/makefu/.bash_history"
# "/home/makefu/bin"
# "/home/makefu/.gnupg"
# "/home/makefu/.imapfilter"
# "/home/makefu/.mutt"
# "/home/makefu/docs"
# "/home/makefu/notes"
# "/home/makefu/.password-store"
# "/home/makefu/.secrets-pass"
# "/home/makefu/.config/syncthing"
#];
# services.syncthing.user = lib.mkForce "makefu";
# services.syncthing.dataDir = lib.mkForce "/home/makefu/.config/syncthing/";
}

View file

@ -0,0 +1,12 @@
{
name="x";
full = true;
python = true;
hw = true;
# unstable = true;
mic92 = true;
clever_kexec = true;
home-manager = true;
nix-ld = true;
# torrent = true;
}

View file

@ -0,0 +1,6 @@
{ pkgs, ... }:
{
powerManagement.powertop.enable = true;
services.power-profiles-daemon.enable = true;
users.users.makefu.packages = [ pkgs.gnome.gnome-power-manager ];
}

View file

@ -0,0 +1,46 @@
{ pkgs, lib, ... }:
# new zfs deployment
{
imports = [
./zfs.nix
./input.nix
./battery.nix
<stockholm/makefu/2configs/hw/bluetooth.nix>
<nixos-hardware/lenovo/thinkpad/l14/amd> # close enough
# <stockholm/makefu/2configs/hw/tpm.nix>
<stockholm/makefu/2configs/hw/ssd.nix>
# <stockholm/makefu/2configs/hw/xmm7360.nix>
];
boot.zfs.requestEncryptionCredentials = true;
networking.hostId = "f8b8e0a2";
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# services.xserver.enable = lib.mkForce false;
services.xserver.videoDrivers = [ "amdgpu" ];
boot.initrd.kernelModules = [ "amdgpu" ];
hardware.opengl.driSupport = true;
hardware.opengl.extraPackages = [ pkgs.amdvlk pkgs.rocm-opencl-icd pkgs.rocm-opencl-runtime ];
# For 32 bit applications
hardware.opengl.driSupport32Bit = true;
hardware.opengl.extraPackages32 = with pkgs; [
driversi686Linux.amdvlk
];
# is required for amd graphics support ( xorg wont boot otherwise )
#boot.kernelPackages = pkgs.linuxPackages_latest;
boot.kernelPackages = lib.mkForce pkgs.linuxPackages;
services.fwupd.enable = true;
programs.light.enable = true;
users.groups.video = {};
users.groups.render = {};
users.users.makefu.extraGroups = [ "video" "render" ];
boot.extraModprobeConfig = ''
options thinkpad_acpi fan_control=1
'';
}

View file

@ -0,0 +1,67 @@
{ disk ? "/dev/sda", ... }: {
disko.devices = {
disk = {
nvme = {
type = "disk";
device = disk;
content = {
type = "table";
format = "gpt";
partitions = [
{
name = "ESP";
start = "0";
end = "512MiB";
fs-type = "fat32";
bootable = true;
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
}
{
name = "zfs";
start = "512MiB";
end = "100%";
content = {
type = "zfs";
pool = "tank";
};
}
];
};
};
};
zpool = {
tank = {
type = "zpool";
rootFsOptions = {
compression = "lz4";
#reservation = "5G";
"com.sun:auto-snapshot" = "false";
};
mountpoint = null;
postCreateHook = "zfs snapshot tank@blank";
datasets = {
root = {
type = "zfs_fs";
mountpoint = "/";
options = {
encryption = "aes-256-gcm";
keyformat = "passphrase";
"com.sun:auto-snapshot" = "true";
};
#keylocation = "file:///tmp/secret.key";
};
"root/home" = {
type = "zfs_fs";
mountpoint = "/home";
};
};
};
};
};
}

View file

@ -0,0 +1,48 @@
{ pkgs, lib, ... }:
{
# current issues:
# 1. for pressing insert hold shift+fn+Fin
# scroll by holding middle mouse
#services.xserver.displayManager.sessionCommands =''
# xinput set-int-prop "ETPS/2 Elantech TrackPoint" "Evdev Wheel Emulation" 8 1
# xinput set-int-prop "ETPS/2 Elantech TrackPoint" "Evdev Wheel Emulation Button" 8 2
# xinput set-prop "ETPS/2 Elantech TrackPoint" "Evdev Wheel Emulation Axes" 6 7 4 5
# # configure timeout of pressing and holding middle button
# # xinput set-int-prop "ETPS/2 Elantech TrackPoint" "Evdev Wheel Emulation Timeout" 8 200
# xinput disable 'ETPS/2 Elantech Touchpad'
#'';
services.xserver.libinput.enable = true;
boot.kernelParams = [
#"psmouse.proto=imps"
#"psmouse.proto=bare"
#"psmouse.resetafter=0"
"psmouse.synaptics_intertouch=1" # echo 1 > /sys/devices/platform/i8042/serio1/reg_07
];
programs.light.enable = true;
services.actkbd = {
enable = true;
bindings = [
{ keys = [ 225 ]; events = [ "key" ]; command = "${pkgs.light}/bin/light -A 10"; } # fn - F5
{ keys = [ 224 ]; events = [ "key" ]; command = "${pkgs.light}/bin/light -U 10"; } # fn - F6
# fn - 4 => suspend
# fn - d => lcdshadow
#{ keys = [ 227 ]; events = [ "key" ]; command = builtins.toString ( # fn - F7
# pkgs.writers.writeDash "toggle_touchpad" ''
# PATH=${lib.makeBinPath [ pkgs.xorg.xinput pkgs.gnugrep ]}
# DISPLAY=:0
# export DISPLAY PATH
# device=$(xinput list --name-only | grep Touchpad)
# if [ "$(xinput list-props "$device" | grep -P ".*Device Enabled.*\K.(?=$)" -o)" -eq 1 ];then
# xinput disable "$device"
# else
# xinput enable "$device"
# fi
# '');
#}
];
};
}

View file

@ -0,0 +1,8 @@
#!/bin/sh
proc=/proc/acpi/ibm/lcdshadow
status=$(awk '/status:/{print $2}' "$proc")
if [ "$status" -eq 0 ];then
echo 1 > "$proc"
else
echo 0 > "$proc"
fi

View file

@ -0,0 +1,34 @@
# 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 = [ "nvme" "ehci_pci" "xhci_pci" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
boot.zfs.enableUnstable = true; # required for 21.05
fileSystems."/" =
{ device = "zroot/root/nixos";
fsType = "zfs";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/20BF-2755";
fsType = "vfat";
};
fileSystems."/home" =
{ device = "zroot/root/home";
fsType = "zfs";
};
swapDevices = [ ];
services.zfs.autoScrub.enable = true;
}

View file

@ -0,0 +1,19 @@
{
imports = [
<stockholm/makefu/2configs/hw/tp-x230.nix> # + bluetooth
<stockholm/makefu/2configs/fs/sda-crypto-root-home.nix>
<stockholm/makefu/2configs/hw/tpm.nix>
<stockholm/makefu/2configs/hw/ssd.nix>
# hard dependency because otherwise the device will not be unlocked
{
boot.initrd.luks.devices.luksroot =
{
device = "/dev/sda2";
allowDiscards = true;
};
}
{ makefu.server.primary-itf = "wlp3s0"; }
];
}