flakes: Migrate the config and miku to flakes

This commit is contained in:
PapaTutuWawa 2021-11-01 21:33:21 +01:00
parent 09d385806a
commit 1d8f2f8053
64 changed files with 2612 additions and 1739 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
packages/result
result

327
flake.lock Normal file
View File

@ -0,0 +1,327 @@
{
"nodes": {
"agenix": {
"inputs": {
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1634404028,
"narHash": "sha256-JyP2Y6JCCYvUcVz7CXX5pXUfTGTU4GX51Yza82BgMfk=",
"owner": "ryantm",
"repo": "agenix",
"rev": "53aa91b4170da35a96fab1577c9a34bc0da44e27",
"type": "github"
},
"original": {
"owner": "ryantm",
"repo": "agenix",
"type": "github"
}
},
"emacs": {
"locked": {
"lastModified": 1635818927,
"narHash": "sha256-q5mJS+2t4X67eqEua/k4HOhLfKCIvblfYWpB+DmOgA4=",
"owner": "nix-community",
"repo": "emacs-overlay",
"rev": "64580e3ac034e2704895a272f341a0729d165b93",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "emacs-overlay",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1634851050,
"narHash": "sha256-N83GlSGPJJdcqhUxSCS/WwW5pksYf3VP1M13cDRTSVA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c91f3de5adaf1de973b797ef7485e441a65b8935",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1634851050,
"narHash": "sha256-N83GlSGPJJdcqhUxSCS/WwW5pksYf3VP1M13cDRTSVA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c91f3de5adaf1de973b797ef7485e441a65b8935",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1635839387,
"narHash": "sha256-2B6DqfTiwY5w2TljC4+AxEUuVYMTP5Fo2h5iGNIONvk=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "288faaa5a65e72e37e6027024829b15c8bb69286",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "master",
"repo": "home-manager",
"type": "github"
}
},
"home-manager_2": {
"inputs": {
"nixpkgs": [
"ostylk",
"nixpkgs"
]
},
"locked": {
"lastModified": 1634544068,
"narHash": "sha256-RlRQBaAHfdWqfRyHdWuDPMkplBTYwuyDQqDcNbP/Sog=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "ff2bed9dac84fb202bbb3c49fdcfe30c29d0b12f",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-21.05",
"repo": "home-manager",
"type": "github"
}
},
"impermanence": {
"locked": {
"lastModified": 1635517258,
"narHash": "sha256-8iV8f9eZ/5cE0DmG7VmNSiCqpe00yL5HbOO7nZJm1Oo=",
"owner": "nix-community",
"repo": "impermanence",
"rev": "ce77ed9bd069e57a7a688d360196e576ca63a842",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "impermanence",
"type": "github"
}
},
"naersk": {
"inputs": {
"nixpkgs": [
"ostylk",
"rnix-lsp",
"nixpkgs"
]
},
"locked": {
"lastModified": 1629707199,
"narHash": "sha256-sGxlmfp5eXL5sAMNqHSb04Zq6gPl+JeltIZ226OYN0w=",
"owner": "nmattia",
"repo": "naersk",
"rev": "df71f5e4babda41cd919a8684b72218e2e809fa9",
"type": "github"
},
"original": {
"owner": "nmattia",
"repo": "naersk",
"type": "github"
}
},
"nixos-hardware": {
"locked": {
"lastModified": 1635762949,
"narHash": "sha256-goQTG3VaYkbNe5vcfA8neNUJoh23WW1eX8BSkkC1xlQ=",
"owner": "ostylk",
"repo": "nixos-hardware",
"rev": "83336d73604a38d492fa8e85b860b2d937547e09",
"type": "github"
},
"original": {
"owner": "ostylk",
"ref": "surface-update",
"repo": "nixos-hardware",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1635844945,
"narHash": "sha256-tZcL307dj28jgEU1Wdn+zwG9neyW0H2+ZjdVhvJxh9g=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b67e752c29f18a0ca5534a07661366d6a2c2e649",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1635702959,
"narHash": "sha256-ZKxX9DjJJGJqq20pE4dIj1G4ssCLVXXRFerM6lNuF0k=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "e544ee88fa4590df75e221e645a03fe157a99e5b",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1635792138,
"narHash": "sha256-D79GqaYrwgyM4wvOPbQeKveAHROnVh97F36iSGZO9uA=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "b165ce0c4efbb74246714b5c66b6bcdce8cde175",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1618628710,
"narHash": "sha256-9xIoU+BrCpjs5nfWcd/GlU7XCVdnNKJPffoNTxgGfhs=",
"path": "/nix/store/z1rf17q0fxj935cmplzys4gg6nxj1as0-source",
"rev": "7919518f0235106d050c77837df5e338fb94de5d",
"type": "path"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_4": {
"locked": {
"lastModified": 1635719588,
"narHash": "sha256-pWjdy0NheM97NsPE6+jUnr5LYyeA0sBGTdw4mfXMGZQ=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "f0869b1a2c0b150aac26e10bb5c2364ffb2e804f",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-21.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nur": {
"locked": {
"lastModified": 1635841629,
"narHash": "sha256-DDgUT9vVJXIcjQW4Idv2ejIx0Ksjg3z+VLYRhwa+GxQ=",
"owner": "nix-community",
"repo": "nur",
"rev": "1e5920035311eac2cc98304ef6633d3063b63e9f",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nur",
"type": "github"
}
},
"ostylk": {
"inputs": {
"agenix": "agenix",
"flake-utils": "flake-utils_2",
"home-manager": "home-manager_2",
"impermanence": "impermanence",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_4",
"nixpkgs-unstable": "nixpkgs-unstable",
"rnix-lsp": "rnix-lsp"
},
"locked": {
"lastModified": 1635797605,
"narHash": "sha256-syj9QJmOwQdQOYhnHJn+jNJLshX73jvdJAepiNC/6qo=",
"ref": "master",
"rev": "c1b6e767ba39d7c3d3a7308882ba44d0ed334471",
"revCount": 136,
"type": "git",
"url": "https://dev.ostylk.de/NixDistro/Config"
},
"original": {
"type": "git",
"url": "https://dev.ostylk.de/NixDistro/Config"
}
},
"rnix-lsp": {
"inputs": {
"naersk": "naersk",
"nixpkgs": [
"ostylk",
"nixpkgs"
],
"utils": "utils"
},
"locked": {
"lastModified": 1634449716,
"narHash": "sha256-JuRCU4KCIA3/pp8BjHqqF9dj1d2xtpkxKKAtSuOzTIY=",
"owner": "nix-community",
"repo": "rnix-lsp",
"rev": "a2d06d2d2910cbe35b4f323a54ef484f51d71e20",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "master",
"repo": "rnix-lsp",
"type": "github"
}
},
"root": {
"inputs": {
"emacs": "emacs",
"flake-utils": "flake-utils",
"home-manager": "home-manager",
"nixpkgs": "nixpkgs_2",
"nur": "nur",
"ostylk": "ostylk"
}
},
"utils": {
"locked": {
"lastModified": 1629481132,
"narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "997f7efcb746a9c140ce1f13c72263189225f482",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

53
flake.nix Normal file
View File

@ -0,0 +1,53 @@
{
description = "PapaTutuWawa's flake configuration";
inputs = {
home-manager.url = "github:nix-community/home-manager/master";
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
#stable.url = "github:nixos/nixpkgs/nixos-21.05";
emacs.url = "github:nix-community/emacs-overlay";
nur.url = "github:nix-community/nur";
ostylk.url = "git+https://dev.ostylk.de/NixDistro/Config";
};
outputs = {
self
, nixpkgs
, home-manager
, flake-utils
, ...
}@inputs: let
inherit (import ./lib/flake.nix {
inherit flake-utils;
inherit (nixpkgs) lib;
}) eachDefaultLinuxSystem;
mkSystem = import ./lib/mkSystem.nix {
inherit inputs;
inherit (inputs) nur emacs;
inherit (nixpkgs) lib config;
};
in {
# Defines outputs that is not dependent on a specific system, i.e. overlays
overlay = import ./packages;
nixosConfigurations = {
miku = mkSystem {
hostConfigFile = ./hosts/miku.nix;
};
};
} // eachDefaultLinuxSystem (system: {
packages = let
pkgs = import nixpkgs {
inherit system;
overlays = [
self.overlay
];
};
in {
# key-mapper only runs on linux
inherit (pkgs) key-mapper;
};
});
}

View File

@ -1,73 +0,0 @@
{ config, pkgs, lib, ... }:
let
mkHost = (import ../modules { lib = lib; pkgs = pkgs; }).mkHost;
in mkHost config {
userName = "alexander";
hostName = "ayame";
wireless = true;
wifiInterface = "wlan0";
overlays = [ "nur" "unstable" ];
hardwareImports = [ "intel" "mobile" ];
programImports = [
"zsh" "mpv" "git" "tmux" "firefox" "gnome-terminal" "gnome"
];
extraImports = [ "distributed-build/offload.nix" ];
extraPackages = pkgs: with pkgs; [
unstable.firmwareLinuxNonFree unstable.sof-firmware
];
fileSystems = {
"/" = {
device = "/dev/disk/by-label/root";
fsType = "btrfs";
};
"/boot" = {
device = "/dev/disk/by-label/boot";
fsType = "vfat";
};
};
swapDevices = [
{ device = "/dev/disk/by-uuid/cf3b1e1c-c245-4452-ad49-68ac72369e77"; }
];
extraOptions = old: {
boot = {
loader = {
systemd-boot.enable = false;
efi.canTouchEfiVariables = false;
grub = {
enable = true;
efiInstallAsRemovable = true;
device = "nodev";
efiSupport = true;
# The UEFI is pretty wonky
forcei686 = true;
};
};
extraModprobeConfig = "";
initrd = {
availableKernelModules = [ "xhci_pci" "usbhid" "usb_storage" "sd_mod" "sdhci_acpi" ];
kernelModules = [
"kvm-intel" "i915"
];
};
# This spams the console and takes up so much CPU time
kernelParams = [ "modprobe.blacklist=arizona_spi" ];
kernelModules = [];
extraModulePackages = [];
kernelPackages = pkgs.linuxPackages_zen;
};
/*systemd.services = {
rfkill-workaround = {
enable = true;
description = "Work around rfkill having the Wifi blocked at boot";
before = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "oneshot";
ExecStart = "rfkill unblock all";
};
};
};*/
};
}

View File

@ -1,74 +0,0 @@
{ config, pkgs, modulesPath, lib, ... }:
{
imports = [
./generic.nix
../modules/hardware/generic.nix ../modules/hardware/video.nix
../modules/users/fuck-xi.nix
../modules/programs/zsh ../modules/programs/tmux ../modules/programs/emacs ../modules/programs/firefox ../modules/programs/gnome-terminal ../modules/programs/gnome
];
nixpkgs.overlays = [
(import (builtins.fetchGit {
url = "https://github.com/nix-community/emacs-overlay.git";
ref = "master";
rev = "ce0e9482d53d69bedc8416d8a984d00e17607826";
}))
# Unstable, NUR, ...
(import ../overlays/unstable.nix pkgs)
(import ../overlays/nur.nix pkgs)
(import ../overlays/custom.nix pkgs)
];
environment = {
systemPackages = with pkgs; [
emacsPgtkGcc
];
sessionVariables = {
# Prevent us from having to always type it out
#NIXOS_CONFIG = "\${HOME}/Development/Personal/nixos-config/hosts/isla.nix";
};
};
networking = {
interfaces.enp6s0.useDHCP = false;
hostName = "isla";
# Nix otherwise has a conflict with this option
wireless.enable = lib.mkForce false;
# Allow scream to connect to this host
firewall.allowedUDPPorts = [ 4010 ];
};
boot = {
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
extraModprobeConfig = "";
initrd = {
availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" "amdgpu" "vendor-reset" ];
kernelModules = [];
};
kernelParams = [];
kernelModules = [];
extraModulePackages = [];
kernelPackages = pkgs.linuxPackages_zen;
};
services = {
emacs.package = pkgs.emacsPgtkGcc;
};
systemd.services.NetworkManager-wait-online.enable = false;
fileSystems = {
"/" = {
device = "/dev/disk/by-label/root";
fsType = "btrfs";
};
};
swapDevices = [ ];
}

View File

@ -1,20 +1,6 @@
{ config, lib, pkgs, ... }:
let
mkHost = (import ../modules { lib = lib; pkgs = pkgs; }).mkHost;
in mkHost config {
userName = "alexander";
hostName = "miku";
primaryInterface = "enp6s0";
overlays = [ "nur" "unstable" "stable" "simple" "custom" "emacs" ];
hardwareImports = [ "amdgpu" "amd" ];
programImports = [
"zsh" "git" "mpv" "tmux" "emacs" "firefox" "i18n" "gamemode" "gnome" #"gnome-terminal"
"alacritty" "sway" "waybar" "swaync" "kanshi"
"distributed-build/builder.nix"
"music"
];
extraImports = [ "virtualisation/gaming.nix" "virtualisation" ];
{
fileSystems = {
"/" = {
device = "/dev/disk/by-label/root";
@ -29,12 +15,11 @@ in mkHost config {
fsType = "ext4";
};
};
extraPackages = pkgs: with pkgs; [
environment.systemPackages = with pkgs; [
emacsPgtkGcc
gajim-mainwindow
virt-manager unstable.qemu scream
#gamemode # Custom package
#key-mapper # Custom package
virt-manager qemu scream
replaysorcery # Custom package
#evdev-proxy # Custom package
vfio-isolate # Custom Package
@ -44,77 +29,138 @@ in mkHost config {
mumble
piper
anime-dl trackma # Custom package
unstable.thunderbird
thunderbird
multimc-wrapped # Custom package
nwg-launchers
];
extraOptions = old: {
system.autoUpgrade.channel = "https://nixos.org/channels/nixos-unstable";
ptw = {
programs = {
mpv.primaryScreen = "C27F398";
adb.enable = true;
sway.enable = true;
alacritty.enable = true;
emacs.enable = true;
firefox.enable = true;
git.enable = true;
#gnome-terminal.enable = true;
mpv.enable = true;
tmux.enable = true;
waybar.enable = true;
xournalpp.enable = true;
zsh.enable = true;
};
services = {
gamemode.enable = true;
#gnome.enable = true;
kanshi = let
horizontal = "Samsung Electric Company C27F398 H4ZR101145";
vertical = "Goldstar Company Ltd IPS235 305NDPHKN600";
boot = {
extraModprobeConfig = ''
helpers = import ../lib/helpers/kanshi.nix;
mkProfile = helpers.mkProfile;
wallpaperScript = helpers.mkWallpaperScript {
inherit pkgs config;
};
in {
enable = true;
profiles = {
homeMultihead = mkProfile {
outputs = [
{
criteria = vertical;
status = "enable";
mode = "1920x1080";
transform = "90";
position = "-1080,0";
}
{
criteria = horizontal;
status = "enable";
mode = "1920x1080";
position = "0,0";
}
];
name = "homeMultihead";
script = wallpaperScript;
};
};
};
swaync.enable = true;
key-mapper.enable = true;
};
system = {
i18n.enable = true;
singleUser = "alexander";
primaryInterface = "enp6s0";
hostName = "miku";
};
virtualisation = {
enable = true;
};
};
programs.adb.enable = true;
boot = {
extraModprobeConfig = ''
options kvm_amd nested=1
options vfio-pci ids=1002:67df,1002:aaf0
options amdgpu dpm=0
'';
initrd = {
availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" "amdgpu" "vendor-reset" ];
kernelModules = [
"amdgpu" # GPU (duh)
"kvm-amd" "vfio_virqfd" "vfio_pci" "vfio_iommu_type1" "vfio" # Virt
"uinput" # key-mapper
"vendor-reset"
];
};
kernelParams = [
"amd_iommu=on"
"iommu=pt"
"sysrq_always_enabled=1"
"kvm.ignore_msrs=1"
"kvm.report_ignored_msrs=N"
"fbcon=rotate:3"
"quiet"
"tsc=unstable"
initrd = {
availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" "amdgpu" ]; #"vendor-reset" ];
kernelModules = [
"amdgpu" # GPU (duh)
"kvm-amd" "vfio_virqfd" "vfio_pci" "vfio_iommu_type1" "vfio" # Virt
"uinput" # key-mapper
#"vendor-reset"
];
extraModulePackages = [ pkgs.linuxPackages_xanmod.vendor-reset ];
};
kernelParams = [
"amd_iommu=on"
"iommu=pt"
"sysrq_always_enabled=1"
"kvm.ignore_msrs=1"
"kvm.report_ignored_msrs=N"
"fbcon=rotate:3"
"quiet"
"tsc=unstable"
];
#extraModulePackages = [ pkgs.linuxPackages.vendor-reset ];
# NOTE: A regression appears to have happend between 5.10 and 5.12
# which leads to the RX590 to have the fence fallback timer on
# sdma0 time out (whatever this means). Maybe bisect?
kernelPackages = pkgs.linuxPackages_xanmod;
};
xdg.portal = {
enable = true;
extraPortals = [
pkgs.xdg-desktop-portal-wlr
];
};
services = {
ratbagd.enable = true;
flatpak.enable = true;
etesync-dav.enable = true;
connman.extraConfig = ''
#extraModulePackages = [ pkgs.linuxPackages_xanmod.vendor-reset ];
#extraModulePackages = [ pkgs.linuxPackages.vendor-reset ];
# NOTE: A regression appears to have happend between 5.10 and 5.12
# which leads to the RX590 to have the fence fallback timer on
# sdma0 time out (whatever this means). Maybe bisect?
kernelPackages = pkgs.linuxPackages_zen;
};
xdg.portal = {
enable = true;
extraPortals = [
pkgs.xdg-desktop-portal-wlr
];
};
services = {
ratbagd.enable = true;
flatpak.enable = true;
etesync-dav.enable = true;
connman.extraConfig = ''
WriteResolvConf=false
'';
udev = {
#packages = with pkgs; [ key-mapper ];
extraRules = ''
KERNEL=="uinput", GROUP="input", MODE="0660"
'';
xserver = {
enable = true;
layout = "de";
libinput.enable = true;
displayManager.gdm = {
enable = true;
wayland = true;
};
gnome.gnome-keyring.enable = true;
};
};
environment.sessionVariables = {
# sway
#"_JAVA_AWT_NONREPARENTING" = 1;
environment.sessionVariables = {
# sway
#"_JAVA_AWT_NONREPARENTING" = 1;
# Wayland
"QT_QPA_PLATFORM" = "wayland-egl";
@ -148,17 +194,6 @@ in mkHost config {
Restart = "always";
};
};
#key-mapper = {
# description = "A tool to change the mapping of your input device buttons";
# wantedBy = [ "default.target" ];
# serviceConfig = {
# Type = "simple";
# ExecStart = "${pkgs.key-mapper}/bin/key-mapper-service";
# Restart = "always";
# # NOTE: The Tartarus may not be connected, so don't fail if we cannot set the preset
# ExecPostStart = "${pkgs.key-mapper}/bin/key-mapper --command start --preset NOOP --device \"Razer Razer Tartarus V2\"; exit 0";
# };
#};
replaysorcery = {
description = "An open-source, instant-replay solution for Linux";
#wantedBy = [ "default.target" ];

179
lib/baseSystem.nix Normal file
View File

@ -0,0 +1,179 @@
{ config, pkgs, lib, ... }:
let
network = import ./network.nix;
isVM = config.ptw.system.isVM;
wireless = config.ptw.system.wireless;
in {
time.timeZone = "Europe/Berlin";
ostylk.nftables = {
enable = true;
tables.firewall = {
family = "inet";
chains = {
non-libvirt.extraConfig = let
deviceIPString = lib.concatStringsSep "," (with network; [
miku nishimiya tamaki mashu # ayame
]);
in ''
# Accept traffic from my devices
ip saddr != { ${deviceIPString} } drop
'';
input.extraConfig = ''
type filter hook input priority 0
ct state { established, related } accept
iif lo accept
# TODO
#iif {primaryInterfaceWrapper} goto non-libvirt
'';
};
};
};
networking = {
useDHCP = false; # Done by the network manager
networkmanager.enable = false;
#interfaces.*.useDHCP = false;
hostName = config.ptw.system.hostName;
wireless.enable = (if wireless then true else lib.mkForce false);
hosts = lib.mkIf (!isVM) {
"${network.miku}" = [ "miku.local" ];
"${network.nishimiya}" = [ "nishimiya.local" ];
#"${network.ayame}" = [ "ayame.local" ];
"${network.tamaki}" = [ "tamaki.local" ];
"${network.mashu}" = [ "mashu.local" ];
};
};
i18n.defaultLocale = "en_GB.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "de";
};
users = {
mutableUsers = false;
extraUsers = {
root = {
# Disable root login
hashedPassword = "*";
};
};
};
environment = {
systemPackages = with pkgs; [
htop
vim
git # Otherwise we cannot install home-manager
git-crypt
gnupg
python3
# RT scheduling
rtkit
] ++ lib.optionals (!isVM) (with pkgs; [ gopass ]);
sessionVariables = {
# Prevent us from having to always type it out
NIXOS_CONFIG = "/home/${config.ptw.system.singleUser}/Development/Personal/nixos-config/hosts/${config.networking.hostName}.nix";
};
};
fonts.fonts = with pkgs; [
# CJK fonts
source-han-sans source-han-serif
# Coding fonts
source-code-pro
# Icon fonts
nerdfonts
];
# We don't tolerate non-free software, except for Steam and Linux firmware
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"firmwareLinuxNonfree" "microcodeAmd" "microcodeIntel"
"steam" "steam-original" "steam-runtime"
"discord"
];
services = {
connman.enable = true;
# TODO: Is this correct? Maybe run once
timesyncd.enable = false;
# Everyone needs sound
pipewire = {
enable = true;
pulse.enable = true;
jack.enable = true;
alsa.enable = true;
alsa.support32Bit = true;
};
# On desktop: Monitor keyboards, mice, ...
# On portable devices: Monitor their battery
upower.enable = true;
# What generated entropy?
haveged.enable = true;
printing.enable = lib.mkDefault false;
avahi.enable = false;
# For debugging.
# TODO: Lock to known IPs and keys
sshd.enable = true;
# Prevent unexpected OOM situations with heavy swapping
earlyoom = {
enable = true;
enableNotifications = true;
};
};
# Don't wait for a network connection
systemd.services.NetworkManager-wait-online.enable = false;
security.sudo.extraConfig = ''
Defaults env_keep += "NIXOS_CONFIG"
'';
hardware = {
enableRedistributableFirmware = true;
# This is a Pipewire household!
pulseaudio.enable = false;
opengl = {
enable = true;
driSupport32Bit = true;
driSupport = true;
extraPackages = with pkgs; [ vaapiVdpau libvdpau-va-gl ];
};
# Only a subset of my devices have bluetooth
bluetooth = lib.mkIf wireless {
enable = true;
};
} // (if wireless then {
wifiInterface = config.ptw.system.wifiInterface;
} else {});
nix.package = pkgs.nixUnstable;
nix.extraOptions = ''
experimental-features = nix-command flakes ca-references
'';
boot = {
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
};
system.stateVersion = "21.05";
}

22
lib/default.nix Normal file
View File

@ -0,0 +1,22 @@
{ inputs, config, lib, ... }:
{
# Creates an overlay from a given input
mkOverlayFromInput = name: input: {
nixpkgs.overlays = [
(final: prev:
prev.lib.attrsets.setAttrByPath [ name ] (
import input {
system = prev.system;
overlays = [ inputs.self.overlay ];
#config = config.nixpkgs.config;
}
))
];
};
mkSystem = import ./mkSystem.nix {
inherit inputs config lib;
};
network = import ./network.nix;
}

7
lib/flake.nix Normal file
View File

@ -0,0 +1,7 @@
{ flake-utils, lib }:
let
defaultLinuxSystems = lib.filter (system: lib.strings.hasSuffix "-linux" system) flake-utils.lib.defaultSystems;
in {
eachDefaultLinuxSystem = arg: flake-utils.lib.eachSystem defaultLinuxSystems arg;
}

45
lib/helpers/kanshi.nix Normal file
View File

@ -0,0 +1,45 @@
{
mkWallpaperScript = { pkgs, config }: let
wallpapers = "/home/${config.ptw.system.singleUser}/Data/Wallpaper";
wallpapersHorizontal = "${wallpapers}/horizontal";
wallpapersVertical = "${wallpapers}/vertical";
in pkgs.writeShellScript "wallpaper.sh" ''
set -x
[[ $# -lt 1 ]] && echo "No profile specified" && exit 1
random_file() {
find "$1" -maxdepth 1 -type f | shuf -n 1
}
setbg() {
# Sets the background of $1 to $2
swaymsg "output \"$1\" background $2 fill"
}
case $1 in
homeMultihead)
horiz=$(random_file ${wallpapersHorizontal})
vert=$(random_file ${wallpapersVertical})
setbg "DP-2" $horiz
setbg "HDMI-A-3" $vert
;;
genericMultihead)
horiz1=$(random_file ${wallpapersHorizontal})
horiz2=$(random_file ${wallpapersHorizontal})
setbg "eDP-1" $horiz1
setbg "HDMI-A-1" $horiz2
;;
laptop)
horiz=$(random_file ${wallpapersHorizontal})
setbg "eDP-1" $horiz
;;
esac
'';
mkProfile = { script, name, outputs }: {
outputs = outputs;
exec = "${script} ${name}";
};
}

48
lib/mkSystem.nix Normal file
View File

@ -0,0 +1,48 @@
{ inputs, config, lib, nur, emacs, ... }:
{
hostConfigFile
, architecture ? "x86_64-linux"
}: let
pkgs = inputs.nixpkgs;
config = pkgs.lib;
network = import ./network.nix;
util = import ./default.nix {
inherit inputs config lib;
};
#primaryInterfaceWrapper = if wifiInterface != "" && primaryInterface == "" then wifiInterface else primaryInterface;
in inputs.nixpkgs.lib.nixosSystem {
system = architecture;
modules = [
inputs.home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
}
(util.mkOverlayFromInput "stable" inputs.stable)
(util.mkOverlayFromInput "unstable" inputs.nixpkgs)
{
nixpkgs.overlays = [
nur.overlay
emacs.overlay
(import ../packages)
];
}
(import ../modules)
inputs.ostylk.nixosModules.nftables
(import ./baseSystem.nix)
(import hostConfigFile)
#(extraOptions baseConfig)
];
specialArgs = {
inherit inputs;
};
}

View File

@ -4,7 +4,7 @@ rec {
# A collection of IP addresses for various uses
miku = "${network-base}.38";
nishimiya = "${network-base}.21";
ayame = "${network-base}.35"; # TODO: That one's wrong
#ayame = "${network-base}.35"; # TODO: That one's wrong
tamaki = "${network-base}.27";
mashu = "${network-base}.52";
mashu = "${network-base}.52"; # TODO: That's wrong
}

26
modules/base.nix Normal file
View File

@ -0,0 +1,26 @@
{ config, lib, ... }:
{
options.ptw.system = {
singleUser = lib.mkOption {
type = lib.types.str;
example = "PapaTutuWawa";
readOnly = true;
description = "The username of this single-user system";
};
wireless = lib.mkEnableOption "Enable wireless functionality";
wifiInterface = lib.mkOption {
type = lib.types.str;
description = "The wireless interface to use for various options";
};
primaryInterface = lib.mkOption {
type = lib.types.str;
description = "The primary network interface to use";
};
hostName = lib.mkOption {
type = lib.types.str;
description = "The hostname to use";
};
isVM = lib.mkEnableOption "Sets whether the treat the host as VM";
};
}

View File

@ -1,8 +1,48 @@
{
lib, pkgs
}:
imports = [
# Hardware modules
./hardware/amdgpu.nix
./hardware/amd.nix
./hardware/intel.nix
./hardware/mobile.nix
./hardware/surface-pro6.nix
./hardware/wifi.nix
{
mkHost = import ./host.nix { lib = lib; pkgs = pkgs; };
mkSandbox = pkgs.callPackage ./sandbox.nix {};
# Programs
./programs/alacritty
./programs/emacs
./programs/firefox
./programs/gnome
./programs/gnome-terminal
./programs/i18n # TODO: Move to toplevel
./programs/mpv
./programs/git
./programs/sway
./programs/swaync
./programs/tmux
./programs/waybar
./programs/zsh
./programs/xournalpp
# Services
./services/kanshi
./services/key-mapper
./services/gamemode
# User
#./users/default.nix
./users/alexander.nix
./users/fuck-xi.nix
# Offloading
./offloading/builder.nix
./offloading/offload.nix
# Virtualisation
./virtualisation/default.nix
./virtualisation/gaming.nix
# Pure options
./base.nix
];
}

View File

@ -1,5 +1,13 @@
{ ... }:
{ config, lib, ... }:
{
hardware.cpu.amd.updateMicrocode = true;
let
cfg = config.ptw.hardware.amdcpu;
in {
options.ptw.hardware.amdcpu = {
enable = lib.mkEnableOption "Enable support for AMD CPUs";
};
config = lib.mkIf cfg.enable {
hardware.cpu.amd.updateMicrocode = true;
};
}

View File

@ -1,11 +1,19 @@
{
pkgs, ...
config, lib, pkgs, ...
}:
{
environment.systemPackages = with pkgs; [
unstable.mesa
unstable.firmwareLinuxNonfree
];
services.xserver.videoDrivers = [ "amdgpu" ];
let
cfg = config.ptw.hardware.amdgpu;
in {
options.ptw.hardware.amdgpu = {
enable = lib.mkEnableOption "Enable support for AMDGPU GPUs";
};
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [
unstable.mesa
unstable.firmwareLinuxNonfree
];
services.xserver.videoDrivers = [ "amdgpu" ];
};
}

View File

@ -1,13 +1,19 @@
{
pkgs, ...
}:
{ config, lib, pkgs, ... }:
{
hardware = {
cpu.intel.updateMicrocode = true;
# NOTE: Assuming each Intel CPU has integrated graphics
opengl.extraPackages = with pkgs; [ vaapiIntel intel-media-driver ];
let
cfg = config.ptw.hardware.intel;
in {
options.ptw.hardware.intel = {
enable = lib.mkEnableOption "Enable support for Intel CPUs";
};
config = lib.mkIf cfg.enable {
hardware = {
cpu.intel.updateMicrocode = true;
# NOTE: Assuming each Intel CPU has integrated graphics
opengl.extraPackages = with pkgs; [ vaapiIntel intel-media-driver ];
};
# TODO: Remove?
services.xserver.videoDrivers = [ "modesetting" "fbdev" ];
};
# TODO: Remove?
services.xserver.videoDrivers = [ "modesetting" "fbdev" ];
}

View File

@ -1,9 +1,17 @@
{ pkgs, ... }:
{ config, lib, pkgs, ... }:
# Special options for mobile devices
{
# Battery savings
#services.tlp.enable = true;
let
cfg = config.ptw.hardware.mobile;
in {
options.ptw.hardware.mobile = {
enable = lib.mkEnableOption "Enable support for mobile devices";
};
hardware.sensor.iio.enable = true;
config = lib.mkIf cfg.enable {
# Battery savings
#services.tlp.enable = true;
hardware.sensor.iio.enable = true;
};
}

View File

@ -1,4 +1,4 @@
{ pkgs, ... }:
{ config, lib, pkgs, ... }:
let
fetchurl = pkgs.fetchurl;
@ -12,66 +12,72 @@ let
sha256 = sha256;
};
};
cfg = config.ptw.hardware.surface;
in {
environment.etc = {
"ipts.conf".text = ''
options.ptw.hardware.surface = {
enable = lib.mkEnableOption "Enable support for the Microsoft Surface Pro 6";
};
config = lib.mkIf cfg.enable {
environment.etc = {
"ipts.conf".text = ''
[Config]
BlockOnPalm = true
'';
"thermald/thermal-cpu-cdev-order.xml".source = fetchurl {
url = "https://raw.githubusercontent.com/linux-surface/linux-surface/${commit}/contrib/thermald/surface_pro_5/thermal-conf.xml.auto.mobile";
sha256 = "1wsrgad6k4haw4m0jjcjxhmj4742kcb3q8rmfpclbw0czm8384al";
};
};
powerManagement = {
enable = true;
cpuFreqGovernor = "powersave";
};
hardware.video.hidpi.enable = true;
systemd.services.iptsd = {
description = "Userspace daemon for Intel Precise Touch & Stylus";
wantedBy = [ "multi-user.target" ];
wants = [ "dev-ipts-15.device" ];
after = [ "dev-ipts-15.device" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.iptsd}/bin/iptsd";
};
};
environment.systemPackages = with pkgs; [ iptsd surface-control ];
services = {
udev.packages = with pkgs; [ iptsd surface-control ];
thermald = {
enable = true;
configFile = fetchurl {
url = "https://raw.githubusercontent.com/linux-surface/linux-surface/${commit}/contrib/thermald/thermal-conf.xml";
sha256 = "1xj70n9agy41906jgm4yjmsx58i7pzsizpvv3rkzq78k95qjfmc9";
"thermald/thermal-cpu-cdev-order.xml".source = fetchurl {
url = "https://raw.githubusercontent.com/linux-surface/linux-surface/${commit}/contrib/thermald/surface_pro_5/thermal-conf.xml.auto.mobile";
sha256 = "1wsrgad6k4haw4m0jjcjxhmj4742kcb3q8rmfpclbw0czm8384al";
};
};
};
boot = {
kernelPackages = pkgs.linuxPackages_5_13;
kernelPatches = [
(mkPatch "0001-surface3-oemb" "1h5f4qgrv74x8q02f29xfia9imcm6svh5gv5vb5izxx6w5i6c9fh")
#(mkPatch "0002-mwifiex" "1qn5lqhbg67j1226msiijq42zdjwmvxzyfd5q366hlczcsw7a7r2")
(mkPatch "0003-ath10k" "0zwyb1vksh6sjbwy5fp2c108m6fqzrv78cz3a296cff550ldn0fj")
(mkPatch "0004-ipts" "0ap5li17zyvba1zx4ryyyk42m00rg5ympj2n24g5ylrld0n2xc3x")
(mkPatch "0005-surface-sam-over-hid" "1vm4v84zbyiiqwby3cr7n8ffibx072rb7rhrl5hv37dsdr03gsa3")
(mkPatch "0006-surface-sam" "1fi0w9bnfnwllmypk3llc58dmfsvx34772g8c52dgi4h9wsgnbhj")
(mkPatch "0007-surface-hotplug" "0g3fkc12pc15aqq6nqk1zfp99lj1wj7cgc1n9691bp8fhqx5aj28")
(mkPatch "0008-surface-typecover" "0803nd0w5rv17kwk3y577pm22zwzpcb52ddlkanm7jrbsrhk130f")
#(mkPatch "0009-cameras" "1i5c16bx8drzagv5nkvmsyixvsz3w75lblabsmgxlh1znxsh7cj5")
(mkPatch "0010-amd-gpio" "0qibdak0ivsch0r5kxd5hhmvw7rd75xy9mmxjbcmysv8q2y9m6hn") # TODO: Maybe drop
(mkPatch "0011-amd-s0ix" "0awv32wqwkjsxs1bhg82rqq3c4ni2f9vsdm7iscilbad28ngdab8") # TODO: Maybe drop
powerManagement = {
enable = true;
cpuFreqGovernor = "powersave";
};
hardware.video.hidpi.enable = true;
{
name = "surface-config";
patch = null;
# Options from https://github.com/linux-surface/linux-surface/blob/master/configs/surface-5.13.config
extraConfig = ''
systemd.services.iptsd = {
description = "Userspace daemon for Intel Precise Touch & Stylus";
wantedBy = [ "multi-user.target" ];
wants = [ "dev-ipts-15.device" ];
after = [ "dev-ipts-15.device" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.iptsd}/bin/iptsd";
};
};
environment.systemPackages = with pkgs; [ iptsd surface-control ];
services = {
udev.packages = with pkgs; [ iptsd surface-control ];
thermald = {
enable = true;
configFile = fetchurl {
url = "https://raw.githubusercontent.com/linux-surface/linux-surface/${commit}/contrib/thermald/thermal-conf.xml";
sha256 = "1xj70n9agy41906jgm4yjmsx58i7pzsizpvv3rkzq78k95qjfmc9";
};
};
};
boot = {
kernelPackages = pkgs.linuxPackages_5_13;
kernelPatches = [
(mkPatch "0001-surface3-oemb" "1h5f4qgrv74x8q02f29xfia9imcm6svh5gv5vb5izxx6w5i6c9fh")
#(mkPatch "0002-mwifiex" "1qn5lqhbg67j1226msiijq42zdjwmvxzyfd5q366hlczcsw7a7r2")
(mkPatch "0003-ath10k" "0zwyb1vksh6sjbwy5fp2c108m6fqzrv78cz3a296cff550ldn0fj")
(mkPatch "0004-ipts" "0ap5li17zyvba1zx4ryyyk42m00rg5ympj2n24g5ylrld0n2xc3x")
(mkPatch "0005-surface-sam-over-hid" "1vm4v84zbyiiqwby3cr7n8ffibx072rb7rhrl5hv37dsdr03gsa3")
(mkPatch "0006-surface-sam" "1fi0w9bnfnwllmypk3llc58dmfsvx34772g8c52dgi4h9wsgnbhj")
(mkPatch "0007-surface-hotplug" "0g3fkc12pc15aqq6nqk1zfp99lj1wj7cgc1n9691bp8fhqx5aj28")
(mkPatch "0008-surface-typecover" "0803nd0w5rv17kwk3y577pm22zwzpcb52ddlkanm7jrbsrhk130f")
#(mkPatch "0009-cameras" "1i5c16bx8drzagv5nkvmsyixvsz3w75lblabsmgxlh1znxsh7cj5")
(mkPatch "0010-amd-gpio" "0qibdak0ivsch0r5kxd5hhmvw7rd75xy9mmxjbcmysv8q2y9m6hn") # TODO: Maybe drop
(mkPatch "0011-amd-s0ix" "0awv32wqwkjsxs1bhg82rqq3c4ni2f9vsdm7iscilbad28ngdab8") # TODO: Maybe drop
{
name = "surface-config";
patch = null;
# Options from https://github.com/linux-surface/linux-surface/blob/master/configs/surface-5.13.config
extraConfig = ''
#
# Surface Aggregator Module
#
@ -147,7 +153,8 @@ in {
MFD_INTEL_LPSS_PCI y
INTEL_IDMA64 y
'';
}
];
}
];
};
};
}

Binary file not shown.

View File

@ -1,220 +0,0 @@
{
lib, pkgs
}:
config: {
userName
, hostName
, wireless ? false
, wifiInterface ? ""
, primaryInterface ? ""
, overlays ? []
, hardwareImports ? [ "generic" ]
, programImports ? []
, extraImports ? []
, isVM ? false
, fileSystems
, swapDevices ? []
, extraPackages ? pkgs: []
, extraOptions ? old: {}
}:
let
overlaysSet = import ../overlays { pkgs = pkgs; lib = lib; };
network = import ./network.nix;
home-manager = builtins.fetchGit {
url = "https://github.com/nix-community/home-manager.git";
rev = "35a24648d155843a4d162de98c17b1afd5db51e4";
ref = "release-21.05";
};
primaryInterfaceWrapper = if wifiInterface != "" && primaryInterface == "" then wifiInterface else primaryInterface;
baseConfig = {
# Install home-manager
imports = [
"${home-manager}/nixos"
./users # For system.singleUser
(./users + "/${userName}.nix")
((import (fetchTarball https://github.com/edolstra/flake-compat/archive/master.tar.gz) {
src = builtins.fetchGit {
url = "https://dev.ostylk.de/NixDistro/Config.git";
rev = "703d3d727a86c5c45d59608b35e0dea62a3f8486";
};
}).defaultNix.nixosModules.nftables)
] ++ (map (item: ./programs + "/${item}") programImports)
++ (map (item: ./hardware + "/${item}.nix") hardwareImports)
++ lib.optional wireless ./hardware/wifi.nix
++ (map (item: ./. + "/${item}") extraImports);
home-manager.useGlobalPkgs = true;
nixpkgs.overlays = (map (item: lib.getAttr item overlaysSet) overlays);
time.timeZone = "Europe/Berlin";
ostylk.nftables = {
enable = true;
tables.firewall = {
family = "inet";
chains = {
non-libvirt.extraConfig = let
deviceIPString = lib.concatStringsSep "," (with network; [
miku nishimiya ayame tamaki mashu
]);
in ''
# Accept traffic from my devices
ip saddr != { ${deviceIPString} } drop
'';
input.extraConfig = ''
type filter hook input priority 0
ct state { established, related } accept
iif lo accept
iif ${primaryInterfaceWrapper} goto non-libvirt
'';
};
};
};
networking = {
useDHCP = false; # Done by the network manager
networkmanager.enable = false;
#interfaces.*.useDHCP = false;
hostName = hostName;
wireless.enable = (if wireless then true else lib.mkForce false);
connman.enable = true;
hosts = lib.mkIf (!isVM) {
"${network.miku}" = [ "miku.local" ];
"${network.nishimiya}" = [ "nishimiya.local" ];
"${network.ayame}" = [ "ayame.local" ];
"${network.tamaki}" = [ "tamaki.local" ];
"${network.mashu}" = [ "mashu.local" ];
};
};
i18n.defaultLocale = "en_GB.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "de";
};
users = {
mutableUsers = false;
extraUsers = {
root = {
# Disable root login
hashedPassword = "*";
};
};
};
environment = {
systemPackages = with pkgs; [
htop
vim
git # Otherwise we cannot install home-manager
git-crypt
gnupg
python3
# RT scheduling
rtkit
] ++ extraPackages pkgs
++ lib.optionals (!isVM) (with pkgs; [ gopass ]);
sessionVariables = {
# Prevent us from having to always type it out
NIXOS_CONFIG = "/home/${config.system.singleUser}/Development/Personal/nixos-config/hosts/${config.networking.hostName}.nix";
};
};
fonts.fonts = with pkgs; [
# CJK fonts
source-han-sans source-han-serif
# Coding fonts
source-code-pro
# Icon fonts
nerdfonts
];
# We don't tolerate non-free software, except for Steam and Linux firmware
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"firmwareLinuxNonfree" "microcodeAmd" "microcodeIntel"
"steam" "steam-original" "steam-runtime"
"discord"
];
services = {
# TODO: Is this correct? Maybe run once
timesyncd.enable = false;
# Everyone needs sound
pipewire = {
enable = true;
pulse.enable = true;
jack.enable = true;
alsa.enable = true;
alsa.support32Bit = true;
};
# On desktop: Monitor keyboards, mice, ...
# On portable devices: Monitor their battery
upower.enable = true;
# What generated entropy?
haveged.enable = true;
printing.enable = lib.mkDefault false;
avahi.enable = false;
# For debugging.
# TODO: Lock to known IPs and keys
sshd.enable = true;
# Prevent unexpected OOM situations with heavy swapping
earlyoom = {
enable = true;
enableNotifications = true;
};
};
# Don't wait for a network connection
systemd.services.NetworkManager-wait-online.enable = false;
security.sudo.extraConfig = ''
Defaults env_keep += "NIXOS_CONFIG"
'';
hardware = {
enableRedistributableFirmware = true;
# This is a Pipewire household!
pulseaudio.enable = false;
opengl = {
enable = true;
driSupport32Bit = true;
driSupport = true;
extraPackages = with pkgs; [ vaapiVdpau libvdpau-va-gl ];
};
# Only a subset of my devices have bluetooth
bluetooth = lib.mkIf wireless {
enable = true;
};
} // (if wireless then {
wifiInterface = wifiInterface;
} else {});
boot = {
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
};
fileSystems = fileSystems;
swapDevices = swapDevices;
system.stateVersion = "21.05";
};
in lib.attrsets.recursiveUpdate baseConfig (extraOptions baseConfig)

View File

@ -0,0 +1,29 @@
{ config, lib, pkgs, ... }:
let
cfg = config.ptw.system.offloading.builder;
in {
options.ptw.system.offloading.builder = {
enable = lib.mkEnableOption "Allow building derivations for other systems";
};
config = lib.mkIf cfg.enable {
boot.binfmt.emulatedSystems = [ "i686-linux" "aarch64-linux" ]; # For remote building
environment.systemPackages = with pkgs; [ openssh ];
nix.trustedUsers = [ "builder" ];
# TODO: Specify a firewall rule to only allow this from my other NixOS machines
users = {
groups.builder = {};
extraUsers."builder" = {
group = "builder";
isSystemUser = true;
useDefaultShell = true;
openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCYfZ6FF3I7Bc8h1VmRxNDHOL08OffetE4DaOZKgw3ZFYSYub80eGN14jevx4Ie525MptFIYbvO5FUcpXx3d6Dh7AE7WUsGzbvPPCmaRy/wiwn2mpCKWqSC3EVxabPakTfVD2+OWDVUW/LWDb2bK40NegBykxf9Vo7112lBFXD8xcq1p8cyhCaq/vsnWUr/8T5z029ySp5UnzuesqrXpfVwnBVzj7xaZizs3Y0bUxdP6vWQSqrTl9KXUveRt3AL+TG3ny4KESvFzGo4YZQCQ2WgCGWgf8SLeHm8UDp8h7dPWkzmT/y7ZSWKGp2R0VDklsjJQqi91l+NXBmKs/uLTVMVqGTYeO04z2mzwzI7aBLrN7A2n3/SmFHz6gW64BYkWNh6iRaDAnu0CgDM4rWyBD/vrgjlojJv6tmSCA3hNGm2ndRfsjiv49+K9NEAxkiijnf0277KHgPHstzlhFq6hYT9qEbaPtqfbKUeWMhj3FpqTHfNVznOXR6+bsGW7h28uLc= alexander@ayame"
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCnhM7E78tisAJuHpLURXXuR3Ya6bFXgh0gLAPU41EAw4QXg77NvW5vuSwGoGLsGmJCYUQSkQbzoqDpjDkdIzuJFMlkQrSBgHSm1g5BdQSY+g/Coey452vd8Xw/tHejlB102ZQI6Pp7IuWTVvJR0jZDosd3igEUmlWN7EVhtS4BIYioZTYS03XPHhZLsLvpXBtX9PST/iHINg1BkvVMAwHd3sRotTCFkJD8dlLrstKDPWijWNjnAmXuTFYPe0PQFUJFaM9JqoXbbu8JuOITtJDNnbh/3z6FNBnn7waJBL5hY+CRaDTnL5icNXzn+L3pcSNUMIm9/AlciqADf9gKx89+bdsM87KFVoFHYWkqHVEo1vBHxssMFFEF9hyTd68bav6rCLlF4CCH+TWG/wUbFR+s2eM+OEAhOl4fcfXMCOKRIMa2N8mAUm5Ms/1Ix1pWQ3MVqfidq7TXhh3Nu91jEoAVjVHihcpfDoNcwPVGXcQY/HcscR6A8VKiQt3ektKTan8= alexander@miku"
];
};
};
};
}

View File

@ -0,0 +1,31 @@
{ config, lib, pkgs, ... }:
let
network = import ../../network.nix;
cfg = config.ptw.system.offloading.offload;
in {
options.ptw.system.offloading.offload = {
enable = lib.mkEnableOption "Allow offloading building of derivations";
};
config = lib.mkIf cfg.enable {
nix = {
distributedBuilds = true;
buildMachines = [{
hostName = "miku";
systems = [ "x86_64-linux" "i686-linux" ];
maxJobs = 4;
speedFactor = 2;
supportedFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ];
}];
};
programs.ssh.extraConfig = ''
Host miku
HostName ${network.miku}
User builder
IdentitiesOnly yes
IdentityFile /root/.ssh/id_builder
'';
};
}

File diff suppressed because it is too large Load Diff

View File

@ -1,21 +0,0 @@
{ pkgs, ... }:
{
boot.binfmt.emulatedSystems = [ "i686-linux" "aarch64-linux" ]; # For remote building
environment.systemPackages = with pkgs; [ openssh ];
nix.trustedUsers = [ "builder" ];
# TODO: Specify a firewall rule to only allow this from my other NixOS machines
users = {
groups.builder = {};
extraUsers."builder" = {
group = "builder";
isSystemUser = true;
useDefaultShell = true;
openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCYfZ6FF3I7Bc8h1VmRxNDHOL08OffetE4DaOZKgw3ZFYSYub80eGN14jevx4Ie525MptFIYbvO5FUcpXx3d6Dh7AE7WUsGzbvPPCmaRy/wiwn2mpCKWqSC3EVxabPakTfVD2+OWDVUW/LWDb2bK40NegBykxf9Vo7112lBFXD8xcq1p8cyhCaq/vsnWUr/8T5z029ySp5UnzuesqrXpfVwnBVzj7xaZizs3Y0bUxdP6vWQSqrTl9KXUveRt3AL+TG3ny4KESvFzGo4YZQCQ2WgCGWgf8SLeHm8UDp8h7dPWkzmT/y7ZSWKGp2R0VDklsjJQqi91l+NXBmKs/uLTVMVqGTYeO04z2mzwzI7aBLrN7A2n3/SmFHz6gW64BYkWNh6iRaDAnu0CgDM4rWyBD/vrgjlojJv6tmSCA3hNGm2ndRfsjiv49+K9NEAxkiijnf0277KHgPHstzlhFq6hYT9qEbaPtqfbKUeWMhj3FpqTHfNVznOXR6+bsGW7h28uLc= alexander@ayame"
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCnhM7E78tisAJuHpLURXXuR3Ya6bFXgh0gLAPU41EAw4QXg77NvW5vuSwGoGLsGmJCYUQSkQbzoqDpjDkdIzuJFMlkQrSBgHSm1g5BdQSY+g/Coey452vd8Xw/tHejlB102ZQI6Pp7IuWTVvJR0jZDosd3igEUmlWN7EVhtS4BIYioZTYS03XPHhZLsLvpXBtX9PST/iHINg1BkvVMAwHd3sRotTCFkJD8dlLrstKDPWijWNjnAmXuTFYPe0PQFUJFaM9JqoXbbu8JuOITtJDNnbh/3z6FNBnn7waJBL5hY+CRaDTnL5icNXzn+L3pcSNUMIm9/AlciqADf9gKx89+bdsM87KFVoFHYWkqHVEo1vBHxssMFFEF9hyTd68bav6rCLlF4CCH+TWG/wUbFR+s2eM+OEAhOl4fcfXMCOKRIMa2N8mAUm5Ms/1Ix1pWQ3MVqfidq7TXhh3Nu91jEoAVjVHihcpfDoNcwPVGXcQY/HcscR6A8VKiQt3ektKTan8= alexander@miku"
];
};
};
}

View File

@ -1,24 +0,0 @@
{ pkgs, ... }:
let
network = import ../../network.nix;
in {
nix = {
distributedBuilds = true;
buildMachines = [{
hostName = "miku";
systems = [ "x86_64-linux" "i686-linux" ];
maxJobs = 4;
speedFactor = 2;
supportedFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ];
}];
};
programs.ssh.extraConfig = ''
Host miku
HostName ${network.miku}
User builder
IdentitiesOnly yes
IdentityFile /root/.ssh/id_builder
'';
}

View File

@ -0,0 +1,293 @@
(defconst dd/using-native-comp-p (fboundp 'native-comp-available-p))
(when dd/using-native-comp-p
(setq comp-async-query-on-exit t)
(setq comp-async-jobs-number 8)
(setq comp-async-report-warnings-errors nil)
(setq comp-deferred-compilation t))
(setq redisplay-dont-pause t)
(setq jit-lock-defer-time 0)
(setq fast-but-imprecise-scrolling t)
(setq make-backup-files nil)
(setq create-lockfiles nil)
;; A trick for faster startup is to just disable GC for the init phase
;;; See: https://github.com/nilcons/emacs-use-package-fast#a-trick-less-gc-during-startup
(setq gc-cons-threshold 64000000)
(add-hook 'after-init-hook #'(lambda ()
;; restore after startup
(setq gc-cons-threshold 800000)))
(defun http-download-verify-and-exec (url sha256-hash name func)
(let ((actual-hash ""))
(with-temp-buffer
;; Somewhat not documented function. Based on https://emacs.stackexchange.com/a/38482
;; The problem is that url-retrieve-synchronously prints the HTTP headers at
;; the top, which are, since they include time, non-deterministic and thus cannot
;; be used for hashing.
(url-insert-file-contents url)
(setq actual-hash (secure-hash 'sha256 (current-buffer)))
(unless (string= sha256-hash actual-hash)
(error "Unexpected hash for %s: Got %s, expected %s" name actual-hash sha256-hash))
func)))
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 5)
(install-hash ""))
(unless (file-exists-p bootstrap-file)
(http-download-verify-and-exec
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
"5bbeee903a90a0fda88a6b8516697c121400facb36a2c349e9447a53baef154e"
"straight's install.el"
(lambda ()
(goto-char (point-max))
(eval-print-last-sexp))))
(load bootstrap-file nil 'nomessage))
(setq straight-use-package-by-default t)
(straight-use-package 'use-package)
; Visual things
(defvar emacs-font "SourceCodePro:style=Light-7")
(add-to-list 'default-frame-alist `(font . ,emacs-font))
(set-face-attribute 'default t :height 150 :font emacs-font)
(tool-bar-mode -1)
(menu-bar-mode -1)
(toggle-scroll-bar -1)
(setq inhibit-startup-screen t)
;; We cannot exactly use use-package, so we just download it "manually".
(let* ((theme-dir (expand-file-name "themes" user-emacs-directory))
(theme-file (expand-file-name "weyland-yutani-theme.el" theme-dir)))
(unless (file-exists-p theme-file)
(unless (file-exists-p theme-dir)
(make-directory theme-dir))
(http-download-verify-and-exec
"https://raw.githubusercontent.com/jstaursky/weyland-yutani-theme/246410e1c03f7d8d8e76102f7c5e3cda83acb36b/weyland-yutani-theme.el"
"6593a0a7e46710e25f9b9caf9888106c93230bd20f9af87c5fc883a98b187253"
"weyland-yutani-theme.el"
(lambda ()
(write-file theme-file))))
(add-to-list 'custom-theme-load-path theme-dir)
(load-theme 'weyland-yutani t))
(use-package rainbow-delimiters
:straight t
:config
(add-hook 'prog-mode-hook
#'rainbow-delimiters-mode))
(use-package hl-todo
:straight t
:config
(add-hook 'prog-mode-hook
#'hl-todo-mode))
(global-hl-line-mode 1)
(use-package nlinum
:straight t
:config
(add-hook 'prog-mode-hook
(lambda ()
(nlinum-mode 1))))
(add-hook 'prog-mode-hook
(lambda ()
(show-paren-mode 1)
(setq show-parens-delay 0)))
(use-package ivy
:straight t
:config
(defvar ivy-use-virtual-buffers t)
(ivy-mode 1))
(setq enable-recursive-minibuffers t)
; This function allows us to exit EVIL states with C-c
; (https://www.emacswiki.org/emacs/Evil#toc16)
(defun escape (prompt)
(cond ((or (evil-insert-state-p) (evil-normal-state-p) (evil-replace-state-p) (evil-visual-state-p)) [escape])
(t (kbd "C-g"))))
(use-package evil
:init
(setq evil-want-keybinding nil)
:config
(define-key key-translation-map (kbd "C-c") 'escape)
(evil-mode 1))
(use-package evil-collection
:after evil
:ensure t
:config
(evil-collection-init))
; Vim-like buffer navigation
(global-set-key (kbd "C-h") 'windmove-left)
(global-set-key (kbd "C-l") 'windmove-right)
(global-set-key (kbd "C-k") 'windmove-up)
(global-set-key (kbd "C-j") 'windmove-down)
(use-package rainbow-delimiters
:config
(add-hook 'prog-mode-hook
#'rainbow-delimiters-mode))
(use-package highlight-parentheses
:straight t
:config
(highlight-parentheses-mode))
(use-package smartparens
:straight t
:config
(smartparens-global-mode t))
(use-package undo-tree
:straight t
:config
(global-undo-tree-mode))
(use-package hl-todo
:config
(add-hook 'prog-mode-hook
#'hl-todo-mode))
(global-hl-line-mode 1)
(setq-default indent-tab-mode t)
(setq tab-width 4)
(use-package perspective
:bind
("C-x C-b" . (lambda (arg)
(interactive "P")
(if (fboundp 'persp-bs-show)
(persp-bs-show arg)
(bs-show "all"))))
:config
(message "Persp-mode")
(persp-mode))
;; mu4e config
(unless (string= (system-name) "miku")
; I don't need mu4e on my desktop
(load-file (expand-file-name "mu4e.el" user-emacs-directory))
(use-package mu4e
:straight t
:config
(ptw/init-mu4e)))
(use-package calfw
:straight (calfw
:host github
:repo "kiwanami/emacs-calfw"
:files ("calfw.el" "calfw-cal.el")))
;; Org mode stuff
;(use-package org-evil
; :straight t)
(use-package graphviz-dot-mode
:straight t)
(use-package org
:straight t
:bind
("C-x P" . (lambda ()
(interactive)
(org-babel-execute-src-block)
(org-redisplay-inline-images)))
:config
(org-babel-do-load-languages
'org-babel-load-languages
'((dot . t)))
(add-hook 'org-mode-hook
(lambda ()
(local-set-key
(kbd "C-x q")
(lambda ()
(interactive)
(org-present-quit)))
(local-set-key
(kbd "C-x p")
(lambda ()
(interactive)
(org-present))))))
(use-package org-present
:straight (org-present
:host github
:repo "rlister/org-present"
:files ("org-present.el"))
:config
(add-hook 'org-present-mode-hook
(lambda ()
(org-present-big)
(org-display-inline-images)
(org-present-hide-cursor)
(org-present-read-only)
(org-hide-block-all)
; Disable evil, but bind left (prev) and right (next)
(turn-off-evil-mode)
(local-set-key
(kbd "l")
(lambda ()
(interactive)
(org-present-next)
;; NOTE: Workaround for images not being shown wen
;; the slide has been changed
(org-redisplay-inline-images)))
(local-set-key
(kbd "h")
(lambda ()
(interactive)
(org-present-prev)
;; NOTE: Workaround for images not being shown wen
;; the slide has been changed
(org-redisplay-inline-images)))
;; Disable the modeline. But save it before so that we
;; can restore it
(set (make-local-variable 'saved-mode-line-format) mode-line-format)
(setq mode-line-format nil)))
(add-hook 'org-present-mode-quit-hook
(lambda ()
(org-present-small)
(org-remove-inline-images)
(org-present-show-cursor)
(org-present-read-write)
(org-show-all)
(turn-on-evil-mode)
(local-unset-key (kbd "h"))
(local-unset-key (kbd "l"))
;; Restore the modeline.
;; NOTE: We need to call redraw-display or else the modeline
;; won't be complete
(setq mode-line-format saved-mode-line-format)
(redraw-display))))
;; Development
(use-package tide
:straight t
:config
(defun setup-tide-mode ()
(interactive)
(tide-setup)
(tide-hl-identifier-mode +1))
(add-hook 'typescript-mode-hook #'setup-tide-mode)
(add-hook 'web-mode-hook
(lambda ()
(when (string-equal "tsx" (file-name-extension buffer-file-name))
(setup-tide-mode))))
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . web-mode)))
(use-package nix-mode
:straight t)
(use-package go-mode
:straight t)
(use-package json-mode
:straight t)
(use-package rust-mode
:straight t)
;; Debugging
(use-package explain-pause-mode
:straight
(explain-pause-mode
:type git
:host github
:repo "lastquestion/explain-pause-mode")
:config
(explain-pause-mode))

View File

@ -1,11 +1,19 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
{
services.emacs.package = pkgs.emacsPgtkGcc;
let
cfg = config.ptw.programs.emacs;
in {
options.ptw.programs.emacs = {
enable = lib.mkEnableOption "Configure emacs";
};
home-manager.users."${config.system.singleUser}".home.file = {
".emacs".source = ./dotemacs;
".emacs.d/early-init.el".source = ./early-init.el;
".emacs.d/mu4e.el".source = ./mu4e.el;
config = lib.mkIf cfg.enable {
services.emacs.package = pkgs.emacsPgtkGcc;
home-manager.users."${config.ptw.system.singleUser}".home.file = {
".emacs".source = ./dotemacs;
".emacs.d/early-init.el".source = ./early-init.el;
".emacs.d/mu4e.el".source = ./mu4e.el;
};
};
}

View File

@ -1,9 +1,15 @@
{ config, pkgs, ... }:
{ inputs, config, lib, pkgs, ... }:
{
config = {
let
cfg = config.ptw.programs.firefox;
in {
options.ptw.programs.firefox = {
enable = lib.mkEnableOption "Configure Firefox using HomeManager";
};
config = lib.mkIf cfg.enable {
environment = {
systemPackages = with pkgs; [ unstable.firefox-wayland tor-browser-bundle-bin ];
systemPackages = with pkgs; [ firefox-wayland tor-browser-bundle-bin ];
# Deploy a Firefox policy to set the search engine and do some other things
etc."firefox/policies/policies.json".source = ./policies.json;
@ -16,7 +22,7 @@
};
};
home-manager.users."${config.system.singleUser}".programs.firefox = {
home-manager.users."${config.ptw.system.singleUser}".programs.firefox = {
enable = true;
extensions = with pkgs.nur.repos.rycee.firefox-addons; [
https-everywhere

View File

@ -1,36 +0,0 @@
[general]
reaper_freq=5
desiredgov=performance
; TODO: Maybe set this
;defaultgov=powersave
; The iGPU desired governor is used when the integrated GPU is under heavy load
igpu_desiredgov=powersave
igpu_power_threshold=0.3
softrealtime=on;
renice=0
ioprio=0
inhibit_screensaver=1
[filter]
; If "whitelist" entry has a value(s)
; gamemode will reject anything not in the whitelist
;whitelist=RiseOfTheTombRaide
; Gamemode will always reject anything in the blacklist
;blacklist=HalfLife3
; glxgears
[gpu]
[supervisor]
[custom]
start=systemctl --user start replaysorcery-kms
systemctl --user start replaysorcery
end=systemctl --user stop replaysorcery-kms
systemctl --user stop replaysorcery
script_timeout=10

View File

@ -1,21 +0,0 @@
{ ... }:
{
config.programs.gamemode = {
enable = true;
enableRenice = true;
settings = {
general = {
reaper_freq = 5;
desiredgov = "performance";
igpu_desiredgov = "powersave";
igpu_power_threshold = 0.3;
softrealtime = "on";
renice = 0;
ioprio = 0;
inhibit_screensaver = 1;
};
};
};
}

View File

@ -1,36 +0,0 @@
[general]
reaper_freq=5
desiredgov=performance
; TODO: Maybe set this
;defaultgov=powersave
; The iGPU desired governor is used when the integrated GPU is under heavy load
igpu_desiredgov=powersave
igpu_power_threshold=0.3
softrealtime=on;
renice=0
ioprio=0
inhibit_screensaver=1
[filter]
; If "whitelist" entry has a value(s)
; gamemode will reject anything not in the whitelist
;whitelist=RiseOfTheTombRaider
; Gamemode will always reject anything in the blacklist
;blacklist=HalfLife3
; glxgears
[gpu]
[supervisor]
[custom]
start=systemctl --user start replaysorcery-kms
systemctl --user start replaysorcery
end=systemctl --user stop replaysorcery-kms
systemctl --user stop replaysorcery
script_timeout=10

View File

@ -1,9 +1,14 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
{
config = {
let
cfg = config.ptw.programs.git;
in {
options.ptw.programs.git = {
enable = lib.mkEnableOption "Configure git using HomeManager";
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [ pkgs.diff-so-fancy ];
home-manager.users."${config.system.singleUser}".programs.git = {
home-manager.users."${config.ptw.system.singleUser}".programs.git = {
enable = true;
userEmail = "papatutuwawa@polynom.me";
userName = "Alexander \"PapaTutuWawa\"";

View File

@ -1,9 +1,15 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
{
config = {
let
cfg = config.ptw.programs.gnome-terminal;
in {
options.ptw.programs.gnome-terminal = {
enable = lib.mkEnableOption "Configure GNOME Terminal using HomeManager";
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [ pkgs.gnome.gnome-terminal ];
home-manager.users."${config.system.singleUser}".programs.gnome-terminal = {
home-manager.users."${config.ptw.system.singleUser}".programs.gnome-terminal = {
enable = true;
profile.default = {
visibleName = "default";

View File

@ -1,7 +1,13 @@
{ pkgs, config, lib, ... }:
{
config = {
let
cfg = config.ptw.services.gnome;
in {
options.ptw.services.gnome = {
enable = lib.mkEnableOption "Configure GNOME using HomeManager";
};
config = lib.mkIf cfg.enable {
environment = {
systemPackages = with pkgs; [
arc-theme
@ -68,7 +74,7 @@
gtkUsePortal = true;
};
home-manager.users."${config.system.singleUser}" = {
home-manager.users."${config.ptw.system.singleUser}" = {
xdg.configFile = {
# Make QT apps use a dark theme
"Kvantum/kvantum.kvconfig".text = ''

View File

@ -1,15 +1,23 @@
{ pkgs, ... }:
{ config, lib, pkgs, ... }:
{
i18n.inputMethod = {
enabled = "ibus";
ibus.engines = with pkgs.ibus-engines; [ mozc ];
let
cfg = config.ptw.system.i18n;
in {
options.ptw.system.i18n = {
enable = lib.mkEnableOption "Configure i18n services on the system";
};
#environment.variables = {
# # TODO: Use pam_environment
# "GTK_IM_MODULE" = "xim";
# "XMODIFIERS" = "@im=ibus";
# "QT_IM_MODULE" = "xim";
#};
config = lib.mkIf cfg.enable {
i18n.inputMethod = {
enabled = "ibus";
ibus.engines = with pkgs.ibus-engines; [ mozc ];
};
#environment.variables = {
# # TODO: Use pam_environment
# "GTK_IM_MODULE" = "xim";
# "XMODIFIERS" = "@im=ibus";
# "QT_IM_MODULE" = "xim";
#};
};
}

View File

@ -1,105 +0,0 @@
{
config
, lib
, pkgs
, ...
}:
let
kanshi = pkgs.kanshi;
writeShellScript = pkgs.writeShellScript;
wallpapersPath = "/home/${config.system.singleUser}/Data/Wallpaper";
wallpapersHorizontal = "${wallpapersPath}/horizontal";
wallpapersVertical = "${wallpapersPath}/vertical";
wallpaperScript = writeShellScript "wallpaper.sh" ''
set -x
[[ $# -lt 1 ]] && echo "No profile specified" && exit 1
random_file() {
find "$1" -maxdepth 1 -type f | shuf -n 1
}
setbg() {
# Sets the background of $1 to $2
swaymsg "output \"$1\" background $2 fill"
}
case $1 in
homeMultihead)
horiz=$(random_file ${wallpapersHorizontal})
vert=$(random_file ${wallpapersVertical})
setbg "DP-2" $horiz
setbg "HDMI-A-3" $vert
;;
genericMultihead)
horiz1=$(random_file ${wallpapersHorizontal})
horiz2=$(random_file ${wallpapersHorizontal})
setbg "eDP-1" $horiz1
setbg "HDMI-A-1" $horiz2
;;
laptop)
horiz=$(random_file ${wallpapersHorizontal})
setbg "eDP-1" $horiz
;;
esac
'';
mkProfile = name: outputs: {
outputs = outputs;
exec = "${wallpaperScript} ${name}";
};
in {
environment.systemPackages = [ kanshi ];
home-manager.users."${config.system.singleUser}".services.kanshi = {
enable = true;
profiles = let
horizontal = "Samsung Electric Company C27F398 H4ZR101145";
vertical = "Goldstar Company Ltd IPS235 305NDPHKN600";
in {
homeMultihead = mkProfile "homeMultihead" [
{
criteria = vertical;
status = "enable";
mode = "1920x1080";
transform = "90";
position = "-1080,0";
}
{
criteria = horizontal;
status = "enable";
mode = "1920x1080";
position = "0,0";
}
#{
# criteria = "eDP-1";
# status = "enable";
# mode = "1920x1080";
# position = "0,0";
#}
];
#genericMultihead = mkProfile "genericMultihead" [
# {
# criteria = "eDP-1";
# mode = "1920x1080";
# status = "enable";
# }
# {
# criteria = "HDMI-A-1";
# status = "enable";
# }
#];
#laptop = mkProfile "laptop" [
# {
# criteria = "eDP-1";
# status = "enable";
# mode = "1920x1080";
# position = "0,0";
# }
#];
};
};
}

View File

@ -1,12 +1,21 @@
{
config
, mako
, lib
, pkgs
}:
{
environment.systemPackages = [ mako ];
let
cfg = config.ptw.services.mako;
in {
options.ptw.services.mako = {
enable = lib.mkEnableOption "Enable and configure mako using HomeManager";
};
home-manager.users."${config.system.singleUser}".programs.mako = {
enable = true;
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [ mako ];
home-manager.users."${config.ptw.system.singleUser}".programs.mako = {
enable = true;
};
};
}

View File

@ -12,13 +12,15 @@ let
video-sync = "display-resample";
interpolation = "";
tscale = "oversample";
} // additional // (if config.programs.mpv != "" then {
} // additional // (if config.ptw.programs.mpv != "" then {
# Make mpv pop up on the primary screen
screen-name = config.programs.mpv.primaryScreen;
fs-screen-name = config.programs.mpv.primaryScreen;
screen-name = config.ptw.programs.mpv.primaryScreen;
fs-screen-name = config.ptw.programs.mpv.primaryScreen;
} else {});
cfg = config.ptw.programs.mpv;
in {
options.programs.mpv = {
options.ptw.programs.mpv = {
enable = lib.mkEnableOption "Enable and configure mpv using HomeManager";
primaryScreen = lib.mkOption {
type = lib.types.str;
default = "";
@ -26,10 +28,10 @@ in {
};
};
config = {
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [ mpv ];
home-manager.users."${config.system.singleUser}" = {
home-manager.users."${config.ptw.system.singleUser}" = {
programs.mpv = {
enable = true;
config = {

View File

@ -30,54 +30,63 @@ let
nwggridWrapper = mkWrapperScript "${pkgs.nwg-launchers}/bin/nwggrid-server" "";
# TODO: Fuse this with kanshi
swayIdleWrapper = mkWrapperScript "${pkgs.swayidle}/bin/swayidle" "-w before-sleep '${pkgs.swaylock}/bin/swaylock -f --image $(find ~/Data/Wallpaper/horizontal/ -maxdepth 1 -type f | shuf -n 1)'";
cfg = config.ptw.programs.sway;
in {
home-manager.users."${config.system.singleUser}" = {
wayland.windowManager.sway = {
enable = true;
config = {
bars = [ ];
startup = [
{ command = "${nwggridWrapper}"; always = true; }
{ command = "${swayncWrapper}"; always = true; }
{ command = "${waybarWrapper}"; always = true; }
{ command = "${kanshiWrapper}"; always = true; }
{ command = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; always = true; }
{ command = "${swayIdleWrapper}"; always = true; }
];
modifier = "${modifier}";
gaps = {
inner = 5;
outer = 7;
};
input = {
"*" = { xkb_layout = "de"; };
"2:7:SynPS/2_Synaptics_TouchPad" = {
tap = "enabled";
natural_scroll = "disabled";
dwt = "enabled";
options.ptw.programs.sway = {
enable = lib.mkEnableOption "Configure sway using HomeManager";
};
config = lib.mkIf cfg.enable {
programs.sway.enable = true;
home-manager.users."${config.ptw.system.singleUser}" = {
wayland.windowManager.sway = {
enable = true;
config = {
bars = [ ];
startup = [
{ command = "${nwggridWrapper}"; always = true; }
{ command = "${swayncWrapper}"; always = true; }
{ command = "${waybarWrapper}"; always = true; }
{ command = "${kanshiWrapper}"; always = true; }
{ command = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; always = true; }
{ command = "${swayIdleWrapper}"; always = true; }
];
modifier = "${modifier}";
gaps = {
inner = 5;
outer = 7;
};
input = {
"*" = { xkb_layout = "de"; };
"2:7:SynPS/2_Synaptics_TouchPad" = {
tap = "enabled";
natural_scroll = "disabled";
dwt = "enabled";
};
"2:10:TPPS/2_Elan_TrackPoint" = { dwt = "enabled"; };
};
output = {
"*" = { adaptive_sync = "on"; };
};
keybindings = let
speakers = "alsa_output.pci-0000_00_1f.3.analog-stereo";
in lib.mkOptionDefault {
"${modifier}+Return" = "exec alacritty";
"${modifier}+e" = "exec emacs";
"${modifier}+Shift+q" = "kill";
"${modifier}+f" = "exec firefox";
"${modifier}+d" = "exec ${pkgs.nwg-launchers}/bin/nwggrid -client";
"${modifier}+p" = "exec ${passwordDmenu}";
"Mod4+s" = "exec systemctl suspend";
# TODO: Screenlock
#"Mod4+l" = "exec ..."
"F1" = "exec pactl set-sink-volume ${speakers} toggle";
"F2" = "exec pactl set-sink-volume ${speakers} -10%";
"F3" = "exec pactl set-sink-volume ${speakers} +10%";
"F5" = "exec brightnessctl --device=intel_backlight set 10%-";
"F6" = "exec brightnessctl --device=intel_backlight set +10%";
};
"2:10:TPPS/2_Elan_TrackPoint" = { dwt = "enabled"; };
};
output = {
"*" = { adaptive_sync = "on"; };
};
keybindings = let
speakers = "alsa_output.pci-0000_00_1f.3.analog-stereo";
in lib.mkOptionDefault {
"${modifier}+Return" = "exec alacritty";
"${modifier}+e" = "exec emacs";
"${modifier}+Shift+q" = "kill";
"${modifier}+f" = "exec firefox";
"${modifier}+d" = "exec ${pkgs.nwg-launchers}/bin/nwggrid -client";
"${modifier}+p" = "exec ${passwordDmenu}";
"Mod4+s" = "exec systemctl suspend";
# TODO: Screenlock
#"Mod4+l" = "exec ..."
"F1" = "exec pactl set-sink-volume ${speakers} toggle";
"F2" = "exec pactl set-sink-volume ${speakers} -10%";
"F3" = "exec pactl set-sink-volume ${speakers} +10%";
"F5" = "exec brightnessctl --device=intel_backlight set 10%-";
"F6" = "exec brightnessctl --device=intel_backlight set +10%";
};
};
};

View File

@ -1,8 +1,16 @@
{ config, ... }:
{ lib, config, ... }:
{
home-manager.users."${config.system.singleUser}".xdg.configFile = {
"swaync/config.json".source = ./config.json;
"swaync/style.css".source = ./style.css;
let
cfg = config.ptw.services.swaync;
in {
options.ptw.services.swaync = {
enable = lib.mkEnableOption "Configure swaync using HomeManager";
};
config = lib.mkIf cfg.enable {
home-manager.users."${config.ptw.system.singleUser}".xdg.configFile = {
"swaync/config.json".source = ./config.json;
"swaync/style.css".source = ./style.css;
};
};
}

View File

@ -1,9 +1,15 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
{
config = {
let
cfg = config.ptw.programs.tmux;
in {
options.ptw.programs.tmux = {
enable = lib.mkEnableOption "Enable and configure tmux using HomeManager";
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [ pkgs.tmux ];
home-manager.users."${config.system.singleUser}".programs.tmux = {
home-manager.users."${config.ptw.system.singleUser}".programs.tmux = {
enable = true;
extraConfig = ''
set -g mouse on

View File

@ -1,55 +1,63 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
{
home-manager.users."${config.system.singleUser}" = {
xdg.configFile."waybar/style.css".source = ./style.css;
programs.waybar = {
enable = true;
style = builtins.readFile ./style.css;
settings = [
{
output = [ "DP-2" ];
layer = "bottom";
position = "left";
gtk-layer-shell = true;
let
cfg = config.ptw.programs.waybar;
in {
options.ptw.programs.waybar = {
enable = lib.mkEnableOption "Enable and configure waybar using HomeManager";
};
modules-left = [ "custom/applauncher" "sway/workspaces" "sway/mode" ];
modules-center = [ "clock" ];
modules-right = [ "tray" "idle_inhibitor" "pulseaudio" "custom/notifications" "custom/menu" ];
config = lib.mkIf cfg.enable {
home-manager.users."${config.ptw.system.singleUser}" = {
xdg.configFile."waybar/style.css".source = ./style.css;
programs.waybar = {
enable = true;
style = builtins.readFile ./style.css;
settings = [
{
output = [ "DP-2" ];
layer = "bottom";
position = "left";
gtk-layer-shell = true;
modules = {
"idle_inhibitor" = {
format = "{icon}";
format-icons = {
activated = "";
deactivated = "";
};
modules-left = [ "custom/applauncher" "sway/workspaces" "sway/mode" ];
modules-center = [ "clock" ];
modules-right = [ "tray" "idle_inhibitor" "pulseaudio" "custom/notifications" "custom/menu" ];
modules = {
"idle_inhibitor" = {
format = "{icon}";
format-icons = {
activated = "";
deactivated = "";
};
};
"sway/workspaces" = {
disable-scroll = true;
all-outputs = true;
};
"custom/applauncher" = {
format = " ";
on-click = "${pkgs.nwg-launchers}/bin/nwggrid -client";
tooltip = "false";
};
"custom/notifications" = {
format = " ";
on-click = "${pkgs.swaync}/bin/swaync-client --toggle-panel";
tooltip = "false";
};
"custom/menu" = {
format = " ";
on-click = "${pkgs.wlogout}/bin/wlogout";
tooltip = "false";
};
"pulseaudio" = {
#on-click = "${pkgs.stable.myxer}/bin/myxer";
};
};
"sway/workspaces" = {
disable-scroll = true;
all-outputs = true;
};
"custom/applauncher" = {
format = " ";
on-click = "${pkgs.nwg-launchers}/bin/nwggrid -client";
tooltip = "false";
};
"custom/notifications" = {
format = " ";
on-click = "${pkgs.swaync}/bin/swaync-client --toggle-panel";
tooltip = "false";
};
"custom/menu" = {
format = " ";
on-click = "${pkgs.wlogout}/bin/wlogout";
tooltip = "false";
};
"pulseaudio" = {
on-click = "${pkgs.stable.myxer}/bin/myxer";
};
};
}
];
}
];
};
};
};
}

View File

@ -1,10 +1,19 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
{
environment.systemPackages = with pkgs; [ xournalpp-git ];
let
cfg = config.ptw.programs.xournalpp;
in {
options.ptw.programs.xournalpp = {
enable = lib.mkEnableOption "Install xournalpp";
configure = lib.mkEnableOption "Configure xournalpp using HomeManager";
};
#home-manager.users."${config.system.singleUser}".home.file = {
# ".xournalpp/settings.xml".source = ./settings.xml;
# ".xournalpp/toolbar.ini".source = ./toolbar.ini;
#};
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [ xournalpp-git ];
home-manager.users."${config.ptw.system.singleUser}".home.file = lib.mkIf cfg.configure {
".xournalpp/settings.xml".source = ./settings.xml;
".xournalpp/toolbar.ini".source = ./toolbar.ini;
};
};
}

View File

@ -1,42 +1,49 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
{
environment = {
systemPackages = [ pkgs.zsh ];
shells = [ pkgs.zsh ];
pathsToLink = [ "/share/zsh" ];
let
cfg = config.ptw.programs.zsh;
in {
options.ptw.programs.zsh = {
enable = lib.mkEnableOption "Enable and configure zsh using HomeManager";
};
# Otherwise the user won't appear on the GDM login screen
programs.zsh.enable = true;
config = lib.mkIf cfg.enable {
environment = {
systemPackages = [ pkgs.zsh ];
home-manager.users."${config.system.singleUser}".programs.zsh = {
enable = true;
history.ignoreSpace = true;
shellAliases = {
ls = "ls --color=always";
".." = "cd ..";
"..." = "cd ../../";
dev = "cd $HOME/Development";
home = "cd $HOME";
reload = "$SHELL -l";
gs = "git status";
gd = "git diff";
gds = "git diff --staged";
c = "clear";
suspend = "systemctl suspend";
waifu2x = "flatpak run com.github.nihui.waifu2x-ncnn-vulkan";
shells = [ pkgs.zsh ];
pathsToLink = [ "/share/zsh" ];
};
initExtra = ''
# Otherwise the user won't appear on the GDM login screen
programs.zsh.enable = true;
home-manager.users."${config.ptw.system.singleUser}".programs.zsh = {
enable = true;
history.ignoreSpace = true;
shellAliases = {
ls = "ls --color=always";
".." = "cd ..";
"..." = "cd ../../";
dev = "cd $HOME/Development";
home = "cd $HOME";
reload = "$SHELL -l";
gs = "git status";
gd = "git diff";
gds = "git diff --staged";
c = "clear";
suspend = "systemctl suspend";
waifu2x = "flatpak run com.github.nihui.waifu2x-ncnn-vulkan";
};
initExtra = ''
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
bindkey "\e[3~" delete-char
'';
history.share = true;
# TODO: Maybe move this somewhere else
initExtraFirst = ''
history.share = true;
# TODO: Maybe move this somewhere else
initExtraFirst = ''
wcurl() {
[[ -z "$1" ]] && echo "Error: No URL specified" && exit 1
@ -44,54 +51,55 @@
curl -fLo "$filename" "$1"
}
'';
plugins = [
{
name = "pure.zsh";
file = "pure.zsh";
src = pkgs.fetchFromGitHub {
owner = "sindresorhus";
repo = "pure";
rev = "v1.17.0";
sha256 = "0qfs7rvpyd8jb7x4ziqrkh0b6g9ldds8sn6qbqgrir80vdk90gpa";
};
}
{
name = "zsh-history-substring-search";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-history-substring-search";
rev = "0f80b8eb3368b46e5e573c1d91ae69eb095db3fb";
sha256 = "0y8va5kc2ram38hbk2cibkk64ffrabfv1sh4xm7pjspsba9n5p1y";
};
}
{
name = "completion";
file = "init.zsh";
src = pkgs.fetchFromGitHub {
owner = "zimfw";
repo = "completion";
rev = "db079f405397a9dc9af93883e47d8adff817e3b1";
sha256 = "1vakjj8l10discmzrzjq6nd0bg0jf4chxhwpiq7ldkirzy7lmm9c";
};
}
{
name = "zsh-completions";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-completions";
rev = "d4511c23659381b56dec8be8c8553b7ff3dc5fd8";
sha256 = "1y8wkmhgkkyfz91y1f8crh6cg912n87gmcchc8xhnwji11n1mqrq";
};
}
{
name = "zsh-syntax-highlighting";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-syntax-highlighting";
rev = "6e0e950154a4c6983d9e077ed052298ad9126144";
sha256 = "09bkg1a7qs6kvnq17jnw5cbcjhz9sk259mv0d5mklqaifd0hms4v";
};
}
];
plugins = [
{
name = "pure.zsh";
file = "pure.zsh";
src = pkgs.fetchFromGitHub {
owner = "sindresorhus";
repo = "pure";
rev = "v1.17.0";
sha256 = "0qfs7rvpyd8jb7x4ziqrkh0b6g9ldds8sn6qbqgrir80vdk90gpa";
};
}
{
name = "zsh-history-substring-search";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-history-substring-search";
rev = "0f80b8eb3368b46e5e573c1d91ae69eb095db3fb";
sha256 = "0y8va5kc2ram38hbk2cibkk64ffrabfv1sh4xm7pjspsba9n5p1y";
};
}
{
name = "completion";
file = "init.zsh";
src = pkgs.fetchFromGitHub {
owner = "zimfw";
repo = "completion";
rev = "db079f405397a9dc9af93883e47d8adff817e3b1";
sha256 = "1vakjj8l10discmzrzjq6nd0bg0jf4chxhwpiq7ldkirzy7lmm9c";
};
}
{
name = "zsh-completions";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-completions";
rev = "d4511c23659381b56dec8be8c8553b7ff3dc5fd8";
sha256 = "1y8wkmhgkkyfz91y1f8crh6cg912n87gmcchc8xhnwji11n1mqrq";
};
}
{
name = "zsh-syntax-highlighting";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-syntax-highlighting";
rev = "6e0e950154a4c6983d9e077ed052298ad9126144";
sha256 = "09bkg1a7qs6kvnq17jnw5cbcjhz9sk259mv0d5mklqaifd0hms4v";
};
}
];
};
};
}

View File

@ -0,0 +1,29 @@
{ config, lib, ... }:
let
cfg = config.ptw.services.gamemode;
in {
options.ptw.services.gamemode = {
enable = lib.mkEnableOption "Enable and configure gamemode";
};
config = lib.mkIf cfg.enable {
programs.gamemode = {
enable = true;
enableRenice = true;
settings = {
general = {
reaper_freq = 5;
desiredgov = "performance";
igpu_desiredgov = "powersave";
igpu_power_threshold = 0.3;
softrealtime = "on";
renice = 0;
ioprio = 0;
inhibit_screensaver = 1;
};
};
};
};
}

View File

@ -0,0 +1,72 @@
{
config
, lib
, pkgs
, ...
}:
let
kanshi = pkgs.kanshi;
writeShellScript = pkgs.writeShellScript;
wallpapersPath = "/home/${config.ptw.system.singleUser}/Data/Wallpaper";
wallpapersHorizontal = "${wallpapersPath}/horizontal";
wallpapersVertical = "${wallpapersPath}/vertical";
wallpaperScript = writeShellScript "wallpaper.sh" ''
set -x
[[ $# -lt 1 ]] && echo "No profile specified" && exit 1
random_file() {
find "$1" -maxdepth 1 -type f | shuf -n 1
}
setbg() {
# Sets the background of $1 to $2
swaymsg "output \"$1\" background $2 fill"
}
case $1 in
homeMultihead)
horiz=$(random_file ${wallpapersHorizontal})
vert=$(random_file ${wallpapersVertical})
setbg "DP-2" $horiz
setbg "HDMI-A-3" $vert
;;
genericMultihead)
horiz1=$(random_file ${wallpapersHorizontal})
horiz2=$(random_file ${wallpapersHorizontal})
setbg "eDP-1" $horiz1
setbg "HDMI-A-1" $horiz2
;;
laptop)
horiz=$(random_file ${wallpapersHorizontal})
setbg "eDP-1" $horiz
;;
esac
'';
mkProfile = name: outputs: {
outputs = outputs;
exec = "${wallpaperScript} ${name}";
};
cfg = config.ptw.services.kanshi;
in {
options.ptw.services.kanshi = {
enable = lib.mkEnableOption "Enable kanshi and configure using HomeManager";
profiles = lib.mkOption {
description = "The actual kanshi configuration";
type = lib.types.anything;
};
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [ kanshi ];
home-manager.users."${config.ptw.system.singleUser}".services.kanshi = {
enable = true;
inherit (cfg) profiles;
};
};
}

View File

@ -0,0 +1,35 @@
{ config, lib, pkgs, ... }:
let
cfg = config.ptw.services.key-mapper;
in {
options.ptw.services.key-mapper = {
enable = lib.mkEnableOption "Enable the key-mapper service and install it";
};
config = lib.mkIf cfg.enable {
# TODO: Assert that uinput is in kernelModules
services.udev = {
packages = with pkgs; [ key-mapper ];
extraRules = ''
KERNEL=="uinput", GROUP="input", MODE="0660"
'';
};
environment.systemPackages = [
pkgs.key-mapper # Custom package
];
systemd.user.services.key-mapper = {
description = "A tool to change the mapping of your input device buttons";
wantedBy = [ "default.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.key-mapper}/bin/key-mapper-service";
Restart = "always";
# NOTE: The Tartarus may not be connected, so don't fail if we cannot set the preset
ExecPostStart = "${pkgs.key-mapper}/bin/key-mapper --command start --preset NOOP --device \"Razer Razer Tartarus V2\"; exit 0";
};
};
};
}

View File

@ -1,7 +1,7 @@
{ pkgs, config, ... }:
{ pkgs, lib, config, ... }:
{
config = {
config = lib.mkIf (config.ptw.system.singleUser == "alexander") {
users.users.alexander = {
isNormalUser = true;
extraGroups = [ "wheel" "audio" "video" "kvm" "input" "libvirtd" ];
@ -12,8 +12,6 @@
isSystemUser = false;
};
system.singleUser = "alexander";
# Activate gpg
programs.gnupg.agent.enable = true;
@ -39,9 +37,10 @@
'';
};
# TODO: Maybe move this somewhere else
services.gpg-agent = {
enable = true;
pinentryFlavor = "gnome3";
pinentryFlavor = "qt";
};
};
};

View File

@ -1,7 +1,7 @@
{ lib, ... }:
{
options.system = {
options.ptw.system = {
singleUser = lib.options.mkOption {
example = "PapaTutuWawa";
readOnly = true;

View File

@ -1,7 +1,7 @@
{ pkgs, lib, config, ... }:
{
config = {
config = lib.mkIf (config.ptw.system.singleUser == "fuck-xi") {
users.users.fuck-xi = {
isNormalUser = true;
extraGroups = [ "wheel" "audio" "video" "kvm" "input" ];
@ -12,7 +12,5 @@
uid = 1000;
isSystemUser = false;
};
system.singleUser = "fuck-xi";
};
}

View File

@ -1,7 +1,14 @@
{ pkgs, ... }:
{ config, lib, pkgs, ... }:
{
environment.systemPackages = with pkgs; [ virglrenderer ];
let
cfg = config.ptw.virtualisation;
in {
options.ptw.virtualisation = {
enable = lib.mkEnableOption "Enable and configure virtualisation";
};
services.spice-vdagentd.enable = true;
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [ virglrenderer ];
services.spice-vdagentd.enable = true;
};
}

View File

@ -1,8 +1,15 @@
{ pkgs, ... }:
{ config, lib, pkgs, ... }:
{
environment.etc = {
"evdev-proxy/config.toml".source = pkgs.writeText "config.toml" ''
let
cfg = config.ptw.virtualisation.gaming;
in {
options.ptw.virtualisation.gaming = {
enable = lib.mkEnableOption "Configure virtualisation for gaming purposes";
};
config = lib.mkIf cfg.enable {
environment.etc = {
"evdev-proxy/config.toml".source = pkgs.writeText "config.toml" ''
log_level = "INFO"
[[device]]
@ -27,9 +34,9 @@
[[device.Simple.selector]]
EVDEVClass = {phys="\"key-mapper\""}
'';
"libvirt/hooks/qemu".source = let
vfio-isolate-state = "/tmp/vfio-isolate-state";
in pkgs.writeScript "qemu" ''
"libvirt/hooks/qemu".source = let
vfio-isolate-state = "/tmp/vfio-isolate-state";
in pkgs.writeScript "qemu" ''
#!${pkgs.stdenv.shell}
guest=$1
action=$2
@ -65,14 +72,14 @@
esac
fi
'';
};
};
virtualisation.libvirtd = {
enable = true;
#qemuRunAsRoot = false;
qemuOvmf = true;
qemuPackage = pkgs.unstable.qemu;
qemuVerbatimConfig = ''
virtualisation.libvirtd = {
enable = true;
#qemuRunAsRoot = false;
qemuOvmf = true;
qemuPackage = pkgs.unstable.qemu;
qemuVerbatimConfig = ''
seccomp_sandbox = 0
cgroup_device_acl = [
"/dev/null", "/dev/full", "/dev/zero",
@ -84,28 +91,29 @@
"/dev/input/by-id/virtual-event-EvdevProxyMouse",
"/dev/input/by-id/virtual-event-EvdevProxyTartarus",
"/dev/input/by-id/usb-Razer_Razer_BlackWidow_Ultimate-event-kbd"
]
]
'';
};
};
# NOTE: Workaround for libvirt's SYSCONFDIR being set to /var/lib
# (See https://github.com/NixOS/nixpkgs/issues/51152#issuecomment-899374407)
system.activationScripts.libvirt-hooks.text = ''
# NOTE: Workaround for libvirt's SYSCONFDIR being set to /var/lib
# (See https://github.com/NixOS/nixpkgs/issues/51152#issuecomment-899374407)
system.activationScripts.libvirt-hooks.text = ''
ln -Tfs /etc/libvirt/hooks /var/lib/libvirt/hooks
'';
#services.udev.packages = with pkgs; [ evdev-proxy ];
#services.udev.packages = with pkgs; [ evdev-proxy ];
systemd = {
services.libvirtd.path = with pkgs; [ vfio-isolate systemd bash ];
#user.services.evdev-proxy = {
# description = "Creates virtual device to proxy evdev devices events";
# #wantedBy = [ "default.target" ];
# serviceConfig = {
# Type = "simple";
# ExecStart = "${pkgs.evdev-proxy}/bin/evdev-proxy";
# Restart = "always";
# };
#};
systemd = {
services.libvirtd.path = with pkgs; [ vfio-isolate systemd bash ];
#user.services.evdev-proxy = {
# description = "Creates virtual device to proxy evdev devices events";
# #wantedBy = [ "default.target" ];
# serviceConfig = {
# Type = "simple";
# ExecStart = "${pkgs.evdev-proxy}/bin/evdev-proxy";
# Restart = "always";
# };
#};
};
};
}

View File

@ -1,5 +0,0 @@
pkgs: final: prev:
import ../packages {
pkgs = prev;
}

View File

@ -3,21 +3,14 @@
, lib
}:
let
importWrapper = file: import file {
pkgs = pkgs;
lib = lib;
};
in {
{
emacs = import (builtins.fetchGit {
url = "https://github.com/nix-community/emacs-overlay.git";
ref = "master";
rev = "ce0e9482d53d69bedc8416d8a984d00e17607826";
});
nur = import ./nur.nix pkgs;
unstable = importWrapper ./unstable.nix;
stable = importWrapper ./stable.nix;
custom = import ./custom.nix pkgs;
custom = import ../packages;
simple = import ./simple.nix;
surface = import ./surface.nix pkgs;
}

View File

@ -1,21 +0,0 @@
# NOTE: pkgs is unused but there for consistency with nur.nix
{
lib, ...
}: final: prev:
let
stableTarball =
fetchTarball
https://github.com/NixOS/nixpkgs/archive/nixos-21.05.tar.gz;
in {
stable = import stableTarball {
# TODO
config = {
allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"firmwareLinuxNonfree" "microcodeAmd" "microcodeIntel"
"steam" "steam-original" "steam-runtime"
"discord"
];
};
};
}

View File

@ -1,21 +0,0 @@
# NOTE: pkgs is unused but there for consistency with nur.nix
{
lib, ...
}: final: prev:
let
unstableTarball =
fetchTarball
https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz;
in {
unstable = import unstableTarball {
# TODO
config = {
allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"firmwareLinuxNonfree" "microcodeAmd" "microcodeIntel"
"steam" "steam-original" "steam-runtime"
"discord"
];
};
};
}

View File

@ -1,43 +1,43 @@
{ pkgs ? import <nixpkgs> {} }:
final: prev:
let
pySmartDL = pkgs.callPackage ./development/python/pySmartDL {};
cfscrape = pkgs.callPackage ./development/python/cfscrape {};
system_hotkey = pkgs.callPackage ./development/python/system_hotkey {};
discord-system-electron = pkgs.callPackage ./applications/networking/instant-messengers/discord {
pySmartDL = prev.callPackage ./development/python/pySmartDL {};
cfscrape = prev.callPackage ./development/python/cfscrape {};
system_hotkey = prev.callPackage ./development/python/system_hotkey {};
discord-system-electron = prev.callPackage ./applications/networking/instant-messengers/discord {
# Wayland
# NOTE: electron under Wayland has no window titlebars
extraStartupArgs = "--enable-features=UseOzonePlatform --ozone-platform=wayland";
#extraStartupArgs = "--enable-features=UseOzonePlatform --ozone-platform=wayland --enable-features=WebRTCPipeWireCapturer";
};
wrapInSandbox = pkgs.callPackage ./sandbox.nix {};
wrapInSandbox = prev.callPackage ./sandbox.nix {};
in {
#key-mapper = pkgs.callPackage ./tools/games/key-mapper {};
vfio-isolate = pkgs.callPackage ./tools/virtualisation/vfio-isolate {};
mopidy-funkwhale = pkgs.callPackage ./applications/audio/mopidy/funkwhale.nix {};
key-mapper = prev.callPackage ./tools/games/key-mapper {};
vfio-isolate = prev.callPackage ./tools/virtualisation/vfio-isolate {};
mopidy-funkwhale = prev.callPackage ./applications/audio/mopidy/funkwhale.nix {};
# Not as clean as I hoped, but it works
gnomeExtensions = pkgs.gnomeExtensions // {
notification-timeout = pkgs.callPackage ./desktop/gnome/extensions/notification-timeout {};
windowisready-remover = pkgs.callPackage ./desktop/gnome/extensions/windowisready-remover {};
gnomeExtensions = prev.gnomeExtensions // {
notification-timeout = prev.callPackage ./desktop/gnome/extensions/notification-timeout {};
windowisready-remover = prev.callPackage ./desktop/gnome/extensions/windowisready-remover {};
};
python3Packages = pkgs.python3Packages // {
python3Packages = prev.python3Packages // {
pySmartDL = pySmartDL;
cfscrape = cfscrape;
system_hotkey = system_hotkey;
};
replaysorcery = pkgs.callPackage ./tools/games/replaysorcery {};
evdev-proxy = pkgs.callPackage ./tools/virtualisation/evdev-proxy {};
anime4k = pkgs.callPackage ./misc/video/anime4k {};
anime-dl = pkgs.callPackage ./tools/video/animedl {
replaysorcery = prev.callPackage ./tools/games/replaysorcery {};
evdev-proxy = prev.callPackage ./tools/virtualisation/evdev-proxy {};
anime4k = prev.callPackage ./misc/video/anime4k {};
anime-dl = prev.callPackage ./tools/video/animedl {
pySmartDL = pySmartDL;
cfscrape = cfscrape;
};
superpaper = pkgs.callPackage ./applications/desktop/superpaper {
superpaper = prev.callPackage ./applications/desktop/superpaper {
system_hotkey = system_hotkey;
};
discord-wrapped = wrapInSandbox {
name = "discord";
package = pkgs.unstable.discord;
package = prev.discord;
#package = discord-system-electron;
binaryName = "discord";
mountInHome = [ ".config/discord" ".config/BetterDiscord" ];
@ -56,16 +56,16 @@ in {
};
};
sddm-sugar-dark = pkgs.callPackage ./sddm-sugar-dark {};
sddm-sugar-dark = prev.callPackage ./sddm-sugar-dark {};
iptsd = pkgs.callPackage ./tools/daemons/iptsd {};
surface-control = pkgs.callPackage ./tools/system/surface-control {};
iptsd = prev.callPackage ./tools/daemons/iptsd {};
surface-control = prev.callPackage ./tools/system/surface-control {};
trackma = pkgs.callPackage ./tools/video/trackma {};
trackma = prev.callPackage ./tools/video/trackma {};
multimc-wrapped = wrapInSandbox {
name = "multimc";
package = pkgs.multimc;
package = prev.multimc;
binaryName = "multimc";
mountInHome = [ ".local/share/multimc" ];
additionalBlacklist = [ "/mnt" ];
@ -77,7 +77,7 @@ in {
steam-wrapped = wrapInSandbox {
name = "steam";
package = pkgs.steam;
package = prev.steam;
binaryName = "steam";
mountInHome = [ ".steam" ".local/share/Steam" ];
additionalBlacklist = [ "/mnt" ];
@ -92,7 +92,7 @@ in {
styluslabs-wrapped = wrapInSandbox {
name = "Write";
package = pkgs.write_stylus;
package = prev.write_stylus;
binaryName = "Write";
additionalBlacklist = [ "/mnt" ];
mountInHome = [ "tmp" ];
@ -102,16 +102,16 @@ in {
android-studio-wrapped = wrapInSandbox {
name = "android-studio";
package = pkgs.android-studio;
package = prev.android-studio;
binaryName = "android-studio";
additionalBlacklist = [ "/mnt" ];
mountInHome = [ "Development/Personal/Android" ".android" ];
chdirTo = "/home/$USER";
};
xournalpp-git = pkgs.unstable.xournalpp.overrideAttrs (old: {
xournalpp-git = prev.xournalpp.overrideAttrs (old: {
version = "1.1.1";
src = pkgs.fetchFromGitHub {
src = prev.fetchFromGitHub {
owner = "xournalpp";
repo = "xournalpp";
rev = "master";
@ -119,9 +119,9 @@ in {
};
});
gajim-mainwindow = pkgs.callPackage ./applications/networking/instant-messengers/gajim {
nbxmpp = pkgs.python3Packages.nbxmpp.overrideAttrs (old: {
src = pkgs.fetchFromGitLab {
gajim-mainwindow = prev.callPackage ./applications/networking/instant-messengers/gajim {
nbxmpp = prev.python3Packages.nbxmpp.overrideAttrs (old: {
src = prev.fetchFromGitLab {
domain = "dev.gajim.org";
owner = "gajim";
repo = "python-nbxmpp";
@ -131,9 +131,9 @@ in {
});
};
swaync = pkgs.callPackage ./tools/desktop/swaync {};
swaync = prev.callPackage ./tools/desktop/swaync {};
myxer = pkgs.myxer.overrideAttrs (old: {
myxer = prev.myxer.overrideAttrs (old: {
cargoPatches = [ ./0000-1.2.1-set-gio-version.patch ];
});
}

View File

@ -6,7 +6,7 @@ stdenv.mkDerivation rec {
src = fetchFromGitHub {
owner = "bloc97";
repo = "Anime4k";
repo = "anime4k";
rev = "v${version}";
sha256 = "1gc1ka9i7xzxq58175q5svhvp8vr27hy477r4z4nkhp9q1cqj19r";
};

View File

@ -9,8 +9,7 @@
python3Packages.buildPythonApplication rec {
pname = "key-mapper";
# TODO: Update to 1.2.1
version = "1.0.0";
version = "1.2.1";
buildInputs = [ gobject-introspection gtk3 gnome.adwaita-icon-theme ];
@ -35,7 +34,7 @@ python3Packages.buildPythonApplication rec {
# Fix keymapper not finding its data files
preBuild = ''
sed -e "s|NIXOS_OUT_PATH|$out/usr/share/key-mapper|" --in-place keymapper/data.py
sed -e "s|@@NIXOS_OUT_PATH@@|$out/usr/share/key-mapper|" --in-place keymapper/data.py
'';
# Required as we otherwise don't get the dbus policy installed

View File

@ -1,12 +1,12 @@
diff --git a/keymapper/data.py b/keymapper/data.py
index d909399..7e4aad0 100644
index 6f3e428..8eded95 100644
--- a/keymapper/data.py
+++ b/keymapper/data.py
@@ -68,6 +68,7 @@ def get_data_path(filename=''):
'/usr/share/key-mapper',
'/usr/local/share/key-mapper',
os.path.join(site.USER_BASE, 'share/key-mapper'),
+ 'NIXOS_OUT_PATH',
@@ -68,6 +68,7 @@ def get_data_path(filename=""):
"/usr/share/key-mapper",
"/usr/local/share/key-mapper",
os.path.join(site.USER_BASE, "share/key-mapper"),
+ "@@NIXOS_OUT_PATH@@",
]
if data is None:

View File

@ -0,0 +1,57 @@
diff --git a/anime_downloader/sites/init.py b/anime_downloader/sites/init.py
index a0d0d3b..e555a56 100644
--- a/anime_downloader/sites/init.py
+++ b/anime_downloader/sites/init.py
@@ -3,6 +3,7 @@ from importlib import import_module
ALL_ANIME_SITES = [
# ('filename', 'sitename', 'classname')
# ('_4anime', '4anime', 'Anime4'),
+ ('kawaiifu', 'kawaiifu', 'Kawaiifu'),
('anitube', 'anitube', 'AniTube'),
('animtime', 'animtime', 'AnimTime'),
('anime8', 'anime8', 'Anime8'),
diff --git a/anime_downloader/sites/kawaiifu.py b/anime_downloader/sites/kawaiifu.py
new file mode 100644
index 0000000..dfffc6d
--- /dev/null
+++ b/anime_downloader/sites/kawaiifu.py
@@ -0,0 +1,39 @@
+from anime_downloader.sites.anime import Anime, AnimeEpisode, SearchResult
+from anime_downloader.sites import helpers
+
+import logging
+
+logger = logging.getLogger(__name__)
+
+class Kawaiifu(Anime, sitename='kawaiifu'):
+ sitename = 'kawaiifu'
+
+ @classmethod
+ def search(cls, query):
+ soup = helpers.soupify(helpers.get("https://kawaiifu.com/search-movie?keyword={}&cat-get=".format(query)))
+
+ items = soup.find_all("div", "item")
+ return [
+ SearchResult(
+ title = item.select("h4 > a")[1].text.strip(),
+ url = item.select("h4 > a")[1]['href']
+ ) for item in items
+ ]
+
+ def _scrape_episodes(self):
+ soup = helpers.soupify(helpers.get(self.url))
+ redirect = soup.select(".list-ep > li > a")[0]["href"]
+ soup = helpers.soupify(helpers.get(redirect))
+
+ return [item["href"] for item in soup.select(".list-ep > li > a")]
+
+ def _scrape_metadata(self):
+ soup = helpers.soupify(helpers.get(self.url))
+ self.title = soup.find_all("h2", "title")[0].text
+
+class KawaiifuEpisode(AnimeEpisode, sitename="kawaiifu"):
+ def _get_sources(self):
+ soup = helpers.soupify(helpers.get(self.url))
+ video = soup.find_all("video")[0]
+
+ return [('no_extractor', video["atr_id"])]

View File

@ -0,0 +1,49 @@
{
pkgs
, lib
, fetchFromGitHub
, python3Packages
, python3
, pySmartDL
, cfscrape
, extraPkgs ? pkgs: []
}:
python3Packages.buildPythonApplication rec {
pname = "anime-dl";
version = "5.0.14";
src = fetchFromGitHub {
owner = "anime-dl";
repo = "anime-downloader";
rev = version;
sha256 = "1ai71g8cp2i37p53lm32nl3h8cq7rcxifhnj1z1cfvxbqjvackaj";
};
propagatedBuildInputs = with python3.pkgs; [
pySmartDL
cfscrape
beautifulsoup4
requests
requests-cache
click
fuzzywuzzy
coloredlogs
tabulate
pycryptodome
] ++ extraPkgs pkgs;
patches = [
./0000-add-kawaiifu.patch
];
doCheck = false;
meta = with lib; {
homepage = "https://github.com/anime-dl/anime-downloader";
description = "A simple but powerful anime downloader and streamer.";
license = licenses.unlicense;
maintainers = [];
platforms = platforms.linux;
};
}

View File

@ -1,4 +1,10 @@
{ pkgs, lib, python3Packages, python3, gtk3, gobject-introspection, git, wrapGAppsHook, gnome }:
{
pkgs, lib
, python3Packages, python3
, gtk3, gobject-introspection, gnome
, wrapGAppsHook
, fetchFromGitHub
}:
python3Packages.buildPythonApplication rec {
pname = "vfio-isolate";
@ -9,9 +15,11 @@ python3Packages.buildPythonApplication rec {
patches = [ ./remove-versions.patch ];
src = builtins.fetchGit {
url = "https://github.com/spheenik/vfio-isolate.git";
ref = "master";
src = fetchFromGitHub {
owner = "spheenik";
repo = "vfio-isolate";
rev = "master";
sha256 = "0n85bmaj79i97j19wrn3z4hmg93p2rrsb3jk1qfd0107agx8mr3k";
};
doCheck = false;