seporate gaming and gui environments

This commit is contained in:
ChaotiCryptidz 2022-01-16 11:22:44 +00:00
parent 4099cfe82c
commit a439a91de1
31 changed files with 199 additions and 149 deletions

View file

@ -7,11 +7,11 @@
"utils": "utils"
},
"locked": {
"lastModified": 1638665590,
"narHash": "sha256-nhtfL3z4TizWHemyZvgLvq11FhYX5Ya4ke+t6Np5PKQ=",
"lastModified": 1642113498,
"narHash": "sha256-4tNIt2EGDppYQI06gsid0QKW5dtBEOAiNKfMYC8wxv8=",
"owner": "serokell",
"repo": "deploy-rs",
"rev": "715e92a13018bc1745fb680b5860af0c5641026a",
"rev": "0ac333cdc03407538b5b19d60a8e7c64588490fb",
"type": "github"
},
"original": {
@ -41,11 +41,11 @@
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1641799033,
"narHash": "sha256-f7/p46rC65buVGk7OHb9sxJ+kF1xzs3NUuLZExoqCqY=",
"lastModified": 1642117744,
"narHash": "sha256-/SvxBe/m6JiRSlKIrgD6LQxee9GGewFyq+lsPxoViMY=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "f3be3cda6a69365f2acecc201b3cd1ee4f6d4614",
"rev": "a5dd5d5f197724f3065fd39c59c7ccea3c8dcb8f",
"type": "github"
},
"original": {
@ -72,11 +72,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1641726770,
"narHash": "sha256-7Wk3V+/gNbQ4/5LgGQz9KVSwSw3V/L3+iqgH8+G/6V0=",
"lastModified": 1642069818,
"narHash": "sha256-666w6j8wl/bojfgpp0k58/UJ5rbrdYFbI2RFT2BXbSQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "27d2fe1e69deb1894f9113a1fe2ca43fb89c8ad1",
"rev": "46821ea01c8f54d2a20f5a503809abfc605269d7",
"type": "github"
},
"original": {
@ -86,11 +86,11 @@
},
"nixpkgs_3": {
"locked": {
"lastModified": 1641710811,
"narHash": "sha256-yVJ+CtwWZY8BnkNIJ/ue5a28yrRM6CkDF1LvmGmqqwM=",
"lastModified": 1641887635,
"narHash": "sha256-kDGpufwzVaiGe5e1sBUBPo9f1YN+nYHJlYqCaVpZTQQ=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "0ecf7d414811f831060cf55707c374d54fbb1dec",
"rev": "b2737d4980a17cc2b7d600d7d0b32fd7333aca88",
"type": "github"
},
"original": {

View file

@ -23,8 +23,8 @@ let
updateUrl = "https://clients2.google.com/service/update2/crx";
inherit version;
};
createChromiumExtension = createChromiumExtensionFor
(lib.versions.major pkgs.vivaldi.version);
createChromiumExtension =
createChromiumExtensionFor (lib.versions.major pkgs.vivaldi.version);
in {
programs.chromium = {
enable = true;

View file

@ -1,6 +0,0 @@
{ pkgs, ... }: {
home.packages = with pkgs; [
multimc
jdk17
];
}

View file

@ -1,4 +1,4 @@
{tree, ...}: {
{ tree, ... }: {
# basically everything apart from home.dev.debugging
imports = with tree; [
home.dev.all.archives

View file

@ -0,0 +1 @@
{ pkgs, ... }: { home.packages = with pkgs; [ melonDS ]; }

View file

@ -0,0 +1 @@
{ pkgs, ... }: { home.packages = with pkgs; [ multimc jdk17 ]; }

View file

@ -1,12 +0,0 @@
{ config, pkgs, ... }: {
home.packages = with pkgs; [
steam
lutris
#mgba
#nestopia
#snes9x-gtk
#melonDS
sixpair
xboxdrv
];
}

View file

@ -0,0 +1 @@
{ pkgs, ... }: { home.packages = with pkgs; [ lutris ]; }

View file

@ -0,0 +1 @@
{ pkgs, ... }: { home.packages = with pkgs; [ steam ]; }

View file

@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }: {
{ config, pkgs, lib, tree, ... }: {
# import default terminal
imports = with tree; [
home.apps.kitty
];
home.sessionVariables = {
XDG_CURRENT_DESKTOP = "sway";
XDG_SESSION_TYPE = "wayland";
@ -26,34 +31,6 @@
libdbusmenu-gtk3
];
programs.zsh.profileExtra = ''
# If running from tty1 start sway
if [ "$(tty)" = "/dev/tty1" ]; then
systemctl --user unset-environment \
SWAYSOCK \
I3SOCK \
WAYLAND_DISPLAY \
DISPLAY \
IN_NIX_SHELL \
__HM_SESS_VARS_SOURCED \
GPG_TTY \
NIX_PATH \
SHLVL
exec env --unset=SHLVL systemd-cat -t sway -- sway
fi
'';
programs.waybar = {
enable = true;
settings = [{
position = "bottom";
modules-left = [ ];
modules-center = [ ];
modules-right = [ "tray" ];
}];
};
wayland.windowManager.sway = {
enable = true;
wrapperFeatures.base = true;

View file

@ -0,0 +1,12 @@
{ ... }: {
programs.waybar = {
enable = true;
settings = [{
position = "bottom";
modules-left = [ ];
modules-center = [ ];
modules-right = [ "tray" ];
}];
};
}

View file

@ -0,0 +1,18 @@
{ ... }: {
programs.zsh.profileExtra = ''
# If running from tty1 start sway
if [ "$(tty)" = "/dev/tty1" ]; then
systemctl --user unset-environment \
SWAYSOCK \
I3SOCK \
WAYLAND_DISPLAY \
DISPLAY \
IN_NIX_SHELL \
__HM_SESS_VARS_SOURCED \
GPG_TTY \
NIX_PATH \
SHLVL
exec env --unset=SHLVL systemd-cat -t sway -- sway
fi
'';
}

View file

@ -1,11 +1,7 @@
{ ... }:
let
backupUser = "root";
backupPaths = [
"/var/lib/postgresql"
"/var/lib/vault"
"/var/lib/acme"
];
backupPaths = [ "/var/lib/postgresql" "/var/lib/vault" "/var/lib/acme" ];
timerConfig = {
OnBootSec = "1m";
OnCalendar = "daily";

View file

@ -4,41 +4,49 @@
imports = with tree; [
users.root
users.chaoticryptidz
#profiles.hardening
profiles.tailscale
profiles.gui
profiles.dnscrypt
profiles.printing
profiles.sshd
profiles.laptop
profiles.gui
profiles.gui.environments.sway
#profiles.bluetooth
profiles.pulse
profiles.network_manager
profiles.sway
profiles.dnscrypt
profiles.gaming
profiles.printing
# for sci-hub and whenever websites break
#profiles.tor
profiles.sshd
profiles.gaming.steam
# for sci-hub and whenever websites break
profiles.tor
];
home-manager.users.root = { imports = with tree; [ home.base ]; };
home-manager.users.chaoticryptidz = {
imports = with tree; [
home.base
#home.bluetooth
home.gui
home.gaming
home.dev.all
home.network_manager
home.sway
home.reversing
home.gui
home.gui.environments.sway
home.gaming.emulators.ds
home.gaming.games.minecraft
#home.gaming.games.osu
home.gaming.platforms.steam
#home.bluetooth
home.network_manager
home.apps.vivaldi
home.apps.telegram
home.apps.quassel
home.apps.chromium
home.apps.multimc
#home.apps.osu-lazer
home.programming
#home.programming.languages.go
home.programming.languages.nix
@ -55,6 +63,8 @@
services.getty.extraArgs =
[ "--skip-login" "--login-options" "chaoticryptidz" ];
boot.kernelPackages = pkgs.linuxPackages_latest;
networking.firewall.enable = true;
# let vscode, vivaldi, etc work.
security.unprivilegedUsernsClone = true;

View file

@ -13,8 +13,12 @@
(modulesPath + "/installer/sd-card/sd-image-aarch64.nix")
];
home-manager.users.root = { imports = with tree; [ home.base home.dev.small ]; };
home-manager.users.chaoticryptidz = { imports = with tree; [ home.base home.dev.small ]; };
home-manager.users.root = {
imports = with tree; [ home.base home.dev.small ];
};
home-manager.users.chaoticryptidz = {
imports = with tree; [ home.base home.dev.small ];
};
boot.kernelPackages = pkgs.linuxPackages_latest;
networking.hostName = "raspberry";

View file

@ -5,11 +5,10 @@ let
ssid = "Test Wifi";
password = "UwUPassUwU";
in {
imports = with tree; [
profiles.dnscrypt
];
imports = with tree; [ profiles.dnscrypt ];
services.dnscrypt-proxy2.settings."listen_addresses" = ["0.0.0.0:53" "[::]:53"];
services.dnscrypt-proxy2.settings."listen_addresses" =
[ "0.0.0.0:53" "[::]:53" ];
services.hostapd = {
enable = true;
@ -28,7 +27,7 @@ in {
networking.firewall = {
trustedInterfaces = [ wifiInterface ];
checkReversePath = false;
allowedTCPPorts = [53];
allowedTCPPorts = [ 53 ];
};
networking.nat = {

View file

@ -6,26 +6,29 @@
users.chaoticryptidz
profiles.base
profiles.gui
profiles.gui.environments.sway
profiles.network_manager
profiles.sway
profiles.tor
(modulesPath + "/installer/cd-dvd/installation-cd-base.nix")
];
home-manager.users.root = { imports = with tree; [ home.base home.dev.all ]; };
home-manager.users.root = {
imports = with tree; [ home.base home.dev.all ];
};
home-manager.users.chaoticryptidz = {
imports = with tree; [
home.base
home.gui
home.gui.environments.sway
home.dev.all
home.network_manager
home.sway
home.apps.vivaldi
home.programming
home.programming.languages.nix
];
};
users.users.root.initialPassword = "";
users.users.chaoticryptidz.initialPassword = "";
# let vscode, vivaldi, etc work.

View file

@ -7,9 +7,16 @@ let
config = {
"hosts/*/services".functor.enable = true;
"profiles/*".functor.enable = true;
"profiles/gaming/*".functor.enable = true;
"profiles/gui/environments/*".functor.enable = true;
"users/*".functor.enable = true;
"home/*".functor.enable = true;
"home/gui/environments/*".functor.enable = true;
"home/apps/*".functor.enable = true;
"home/gaming/emulators/*".functor.enable = true;
"home/gaming/games/*".functor.enable = true;
"home/gaming/platforms/*".functor.enable = true;
"home/programming/languages/*".functor.enable = true;
"modules/nixos" = {
functor = {

View file

@ -0,0 +1,13 @@
{ lib, fetchzip }:
fetchzip {
name = "comic-code-1.0";
url =
"https://cdn.discordapp.com/attachments/890298617833857055/931224386143408239/comic.zip";
sha256 = "sha256-QTCdQosgHiRkedGT2PjVzeaOqYiotLYpXNyGe9k9nuk=";
postFetch = ''
mkdir -p $out/share/fonts
unzip -j $downloadedFile \*.ttf -d $out/share/fonts/truetype
'';
}

View file

@ -1,4 +1,5 @@
final: prev: {
comic-sans = final.callPackage ./comic-sans { };
comic-code = final.callPackage ./comic-code { };
zar = final.callPackage ./zar { };
gobar = final.callPackage ./gobar { };
@ -6,5 +7,7 @@ final: prev: {
# needs a specific version of lsquic
lsquic = final.callPackage ./invidious-latest/lsquic.nix { };
};
multimc = prev.multimc.override { msaClientID = "499546d9-bbfe-4b9b-a086-eb3d75afb78f"; };
multimc = prev.multimc.override {
msaClientID = "499546d9-bbfe-4b9b-a086-eb3d75afb78f";
};
}

View file

@ -1,4 +1,5 @@
{ lib, crystal, fetchFromGitHub, librsvg, pkg-config, libxml2, openssl, sqlite, lsquic, shards }:
{ lib, crystal, fetchFromGitHub, librsvg, pkg-config, libxml2, openssl, sqlite
, lsquic, shards }:
let
# When updating, always update the following:
# * the git revision
@ -9,8 +10,7 @@ let
# * If the lsquic.cr dependency changed: lsquic in lsquic.nix (version, sha256)
# * If the lsquic version changed: boringssl' in lsquic.nix (version, sha256)
rev = "d928b9eaadc8298f2e92a766fdd10c79e6048858";
in
crystal.buildCrystalPackage rec {
in crystal.buildCrystalPackage rec {
pname = "invidious";
version = "master";
@ -21,38 +21,53 @@ crystal.buildCrystalPackage rec {
sha256 = "sha256-WojYv9HMqS3UcZFewgE/svbpqeAY6BIyAtxAMfdn1xk=";
};
postPatch =
let
postPatch = let
# Replacing by the value (templates) of the variables ensures that building
# fails if upstream changes the way the metadata is formatted.
branchTemplate = ''{{ "#{`git branch | sed -n '/* /s///p'`.strip}" }}'';
commitTemplate = ''{{ "#{`git rev-list HEAD --max-count=1 --abbrev-commit`.strip}" }}'';
versionTemplate = ''{{ "#{`git log -1 --format=%ci | awk '{print $1}' | sed s/-/./g`.strip}" }}'';
commitTemplate =
''{{ "#{`git rev-list HEAD --max-count=1 --abbrev-commit`.strip}" }}'';
versionTemplate = ''
{{ "#{`git log -1 --format=%ci | awk '{print $1}' | sed s/-/./g`.strip}" }}'';
# This always uses the latest commit which invalidates the cache even if
# the assets were not changed
assetCommitTemplate = ''{{ "#{`git rev-list HEAD --max-count=1 --abbrev-commit -- assets`.strip}" }}'';
in
''
assetCommitTemplate = ''
{{ "#{`git rev-list HEAD --max-count=1 --abbrev-commit -- assets`.strip}" }}'';
in ''
# Use the version metadata from the derivation instead of using git at
# build-time
substituteInPlace src/invidious.cr \
--replace ${lib.escapeShellArg branchTemplate} '"master"' \
--replace ${lib.escapeShellArg commitTemplate} '"${lib.substring 0 7 rev}"' \
--replace ${lib.escapeShellArg versionTemplate} '"${lib.replaceChars ["-"] ["."] (lib.substring 9 10 version)}"' \
--replace ${lib.escapeShellArg assetCommitTemplate} '"${lib.substring 0 7 rev}"'
--replace ${lib.escapeShellArg commitTemplate} '"${
lib.substring 0 7 rev
}"' \
--replace ${lib.escapeShellArg versionTemplate} '"${
lib.replaceChars [ "-" ] [ "." ] (lib.substring 9 10 version)
}"' \
--replace ${lib.escapeShellArg assetCommitTemplate} '"${
lib.substring 0 7 rev
}"'
# Patch the assets and locales paths to be absolute
substituteInPlace src/invidious.cr \
--replace 'public_folder "assets"' 'public_folder "${placeholder "out"}/share/invidious/assets"'
--replace 'public_folder "assets"' 'public_folder "${
placeholder "out"
}/share/invidious/assets"'
substituteInPlace src/invidious/helpers/i18n.cr \
--replace 'File.read("locales/' 'File.read("${placeholder "out"}/share/invidious/locales/'
--replace 'File.read("locales/' 'File.read("${
placeholder "out"
}/share/invidious/locales/'
# Reference sql initialisation/migration scripts by absolute path
substituteInPlace src/invidious/database/base.cr \
--replace 'config/sql' '${placeholder "out"}/share/invidious/config/sql'
--replace 'config/sql' '${
placeholder "out"
}/share/invidious/config/sql'
substituteInPlace src/invidious/users.cr \
--replace 'Process.run(%(rsvg-convert' 'Process.run(%(${lib.getBin librsvg}/bin/rsvg-convert'
--replace 'Process.run(%(rsvg-convert' 'Process.run(%(${
lib.getBin librsvg
}/bin/rsvg-convert'
'';
# shards required for spectator

View file

@ -1,4 +1,5 @@
{ lib, boringssl, stdenv, fetchgit, fetchFromGitHub, cmake, zlib, perl, libevent }:
{ lib, boringssl, stdenv, fetchgit, fetchFromGitHub, cmake, zlib, perl, libevent
}:
let
# lsquic requires a specific boringssl version (noted in its README)
boringssl' = boringssl.overrideAttrs (old: rec {
@ -9,8 +10,7 @@ let
sha256 = "sha256-EU6T9yQCdOLx98Io8o01rEsgxDFF/Xoy42LgPopD2/A=";
};
});
in
stdenv.mkDerivation rec {
in stdenv.mkDerivation rec {
pname = "lsquic";
version = "2.18.1";
@ -53,6 +53,11 @@ stdenv.mkDerivation rec {
description = "A library for QUIC and HTTP/3 (version for Invidious)";
homepage = "https://github.com/litespeedtech/lsquic";
maintainers = with maintainers; [ infinisil sbruder ];
license = with licenses; [ openssl isc mit bsd3 ]; # statically links against boringssl, so has to include its licenses
license = with licenses; [
openssl
isc
mit
bsd3
]; # statically links against boringssl, so has to include its licenses
};
}

View file

@ -1,7 +1,9 @@
{ lib, pkgs, ... }: {
hardware.enableRedistributableFirmware = true;
hardware.enableAllFirmware = true;
hardware.cpu.intel.updateMicrocode = lib.mkIf ("${pkgs.system}" == "x86_64-linux") true;
hardware.cpu.amd.updateMicrocode = lib.mkIf ("${pkgs.system}" == "x86_64-linux") true;
hardware.cpu.intel.updateMicrocode =
lib.mkIf ("${pkgs.system}" == "x86_64-linux") true;
hardware.cpu.amd.updateMicrocode =
lib.mkIf ("${pkgs.system}" == "x86_64-linux") true;
hardware.wirelessRegulatoryDatabase = true;
}

View file

@ -1 +1 @@
{ config, pkgs, ... }: { fonts.fonts = with pkgs; [ comic-neue comic-code ]; }
{ config, pkgs, ... }: { fonts.fonts = with pkgs; [ comic-sans comic-code ]; }