1

reformat using alejandra

This commit is contained in:
2023-01-18 14:00:02 +01:00
parent 3ad68f24d6
commit eb44696de3
43 changed files with 1283 additions and 1095 deletions

View File

@ -1,5 +1,8 @@
{ lib, stdenv, src }: {
lib,
stdenv,
src,
}:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "adwaita-for-steam"; pname = "adwaita-for-steam";
version = "unstable"; version = "unstable";

View File

@ -1,6 +1,8 @@
{ stdenv, lib, pkgs }: {
stdenv,
let lib,
pkgs,
}: let
inherit (pkgs.python310Packages) buildPythonPackage buildPythonApplication fetchPypi; inherit (pkgs.python310Packages) buildPythonPackage buildPythonApplication fetchPypi;
# Too old in nixpkgs # Too old in nixpkgs
@ -13,7 +15,7 @@ let
sha256 = "9107f1ca0b2a5553987a94a3c9959fe5b491fdf731389aa5b7b1bd0733e32de6"; sha256 = "9107f1ca0b2a5553987a94a3c9959fe5b491fdf731389aa5b7b1bd0733e32de6";
}; };
propagatedBuildInputs = with pkgs.python310Packages; [ ]; propagatedBuildInputs = with pkgs.python310Packages; [];
doCheck = false; doCheck = false;
}; };
@ -51,7 +53,7 @@ let
sha256 = "0d9c601124e5a6ba9712dbc60d9c53c21e34f5f641fe83002317394311bdce14"; sha256 = "0d9c601124e5a6ba9712dbc60d9c53c21e34f5f641fe83002317394311bdce14";
}; };
propagatedBuildInputs = with pkgs.python310Packages; [ ]; propagatedBuildInputs = with pkgs.python310Packages; [];
doCheck = false; doCheck = false;
}; };
@ -65,7 +67,7 @@ let
sha256 = "1cc54630f1f4cbc09654ded012b4a5cd4992aa6ee67442dbba873edd63d01eff"; sha256 = "1cc54630f1f4cbc09654ded012b4a5cd4992aa6ee67442dbba873edd63d01eff";
}; };
propagatedBuildInputs = with pkgs.python310Packages; [ requests ]; propagatedBuildInputs = with pkgs.python310Packages; [requests];
doCheck = false; doCheck = false;
}; };
@ -79,75 +81,67 @@ let
sha256 = "252a9c6eee001d67bb000ceb8fdf99729c06cf46ff18a00fc89468672388de1e"; sha256 = "252a9c6eee001d67bb000ceb8fdf99729c06cf46ff18a00fc89468672388de1e";
}; };
propagatedBuildInputs = with pkgs.python310Packages; [ requests pycryptodome ]; propagatedBuildInputs = with pkgs.python310Packages; [requests pycryptodome];
doCheck = false; doCheck = false;
}; };
# TODO: When new version is in nixpkgs update this derivation # TODO: When new version is in nixpkgs update this derivation
# Too old in nixpkgs # Too old in nixpkgs
# my-setuptools = buildPythonPackage rec { # my-setuptools = buildPythonPackage rec {
# version = "65.5.0"; # version = "65.5.0";
# pname = "setuptools"; # pname = "setuptools";
# src = fetchPypi { # src = fetchPypi {
# inherit version pname; # inherit version pname;
# sha256 = "512e5536220e38146176efb833d4a62aa726b7bbff82cfbc8ba9eaa3996e0b17"; # sha256 = "512e5536220e38146176efb833d4a62aa726b7bbff82cfbc8ba9eaa3996e0b17";
# }; # };
# # From https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/development/python-modules/setuptools/default.nix#L75 # # From https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/development/python-modules/setuptools/default.nix#L75
# # nativeBuildInputs = [ # # nativeBuildInputs = [
# # bootstrapped-pip # # bootstrapped-pip
# # (pipInstallHook.override{pip=null;}) # # (pipInstallHook.override{pip=null;})
# # (setuptoolsBuildHook.override{setuptools=null; wheel=null;}) # # (setuptoolsBuildHook.override{setuptools=null; wheel=null;})
# # ]; # # ];
# # preBuild = lib.optionalString (!stdenv.hostPlatform.isWindows) '' # # preBuild = lib.optionalString (!stdenv.hostPlatform.isWindows) ''
# # export SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES=0 # # export SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES=0
# # ''; # # '';
# pipInstallFlags = [ "--ignore-installed" ]; # pipInstallFlags = [ "--ignore-installed" ];
# # Adds setuptools to nativeBuildInputs causing infinite recursion. # # Adds setuptools to nativeBuildInputs causing infinite recursion.
# # catchConflicts = false; # # catchConflicts = false;
# propagatedBuildInputs = with pkgs.python310Packages; [ ]; # propagatedBuildInputs = with pkgs.python310Packages; [ ];
# doCheck = false; # doCheck = false;
# }; # };
in
buildPythonApplication rec {
version = "3.4.14";
pname = "cyberdrop-dl";
src = fetchPypi {
inherit version pname;
sha256 = "bdf1e21452571a74bf4448d32b158b8600381f210696dd60d16fc83213793559";
};
in buildPythonApplication rec { propagatedBuildInputs = with pkgs.python310Packages; [
version = "3.4.14"; my-aiofiles
pname = "cyberdrop-dl"; my-aiohttp
beautifulsoup4
my-certifi
colorama
gofile-client
myjdapi
pyyaml
# Needed in the latest versions, don't know how to make it work right now...
# my-setuptools
tqdm
yarl
];
src = fetchPypi { doCheck = false;
inherit version pname;
sha256 = "bdf1e21452571a74bf4448d32b158b8600381f210696dd60d16fc83213793559";
};
propagatedBuildInputs = with pkgs.python310Packages; [ # Otherwise duplicates are found in closure (certifi), don't know why this happens
my-aiofiles # TODO: Investigate duplicates
my-aiohttp catchConflicts = false;
beautifulsoup4
my-certifi
colorama
gofile-client
myjdapi
pyyaml
# Needed in the latest versions, don't know how to make it work right now...
# my-setuptools
tqdm
yarl
];
doCheck = false; meta = with lib; {
homepage = "https://github.com/Jules-WinnfieldX/CyberDropDownloader";
# Otherwise duplicates are found in closure (certifi), don't know why this happens description = "Bulk downloader for multiple file hosts";
# TODO: Investigate duplicates license = licenses.gpl3Only;
catchConflicts = false; };
}
meta = with lib; {
homepage = "https://github.com/Jules-WinnfieldX/CyberDropDownloader";
description = "Bulk downloader for multiple file hosts";
license = licenses.gpl3Only;
};
}

View File

@ -3,10 +3,7 @@
# /nix/store/z3gxkwakzgiswvakfrpbirhpcach509j-mutter-42.3/share/gsettings-schemas/mutter-42.3 # /nix/store/z3gxkwakzgiswvakfrpbirhpcach509j-mutter-42.3/share/gsettings-schemas/mutter-42.3
# but this is the wrong path for dconf-editor to find the schema, correct one would be # but this is the wrong path for dconf-editor to find the schema, correct one would be
# /nix/store/z3gxkwakzgiswvakfrpbirhpcach509j-mutter-42.3/share/gsettings-schemas/mutter-42.3/glib-2.0/schemas # /nix/store/z3gxkwakzgiswvakfrpbirhpcach509j-mutter-42.3/share/gsettings-schemas/mutter-42.3/glib-2.0/schemas
{pkgs}: let
{ pkgs }:
let
find-gsettings-schemas = pkgs.callPackage ./find-gsettings-schemas.nix {}; find-gsettings-schemas = pkgs.callPackage ./find-gsettings-schemas.nix {};
dconf-editor-wrapped = pkgs.writeShellScriptBin "dconf-editor-wrapped" '' dconf-editor-wrapped = pkgs.writeShellScriptBin "dconf-editor-wrapped" ''
@ -20,7 +17,7 @@ let
icon = "ca.desrt.dconf-editor"; icon = "ca.desrt.dconf-editor";
comment = "Modify the Gnome/GTK settings database"; comment = "Modify the Gnome/GTK settings database";
genericName = "Desktop application to manage Gnome/GTK settings."; genericName = "Desktop application to manage Gnome/GTK settings.";
categories = [ "GNOME" "GTK" "System" ]; categories = ["GNOME" "GTK" "System"];
}; };
in in
# Combine multiple derivations into a single store path # Combine multiple derivations into a single store path

View File

@ -1,5 +1,4 @@
{ pkgs, ... }: {pkgs, ...}:
pkgs.writeShellScriptBin "find-gsettings-schemas" '' pkgs.writeShellScriptBin "find-gsettings-schemas" ''
schemas="" schemas=""
for d in $(ls -1 --ignore "*.drv" /nix/store); do for d in $(ls -1 --ignore "*.drv" /nix/store); do

View File

@ -1,10 +1,11 @@
{ inputs, pkgs }:
{ {
inputs,
pkgs,
}: {
# vital-synth = pkgs.callPackage ./vital-synth {}; # Kept as an example, don't know if I will fix this or keep using distrho # vital-synth = pkgs.callPackage ./vital-synth {}; # Kept as an example, don't know if I will fix this or keep using distrho
cyberdrop-dl = pkgs.callPackage ./cyberdrop-dl {}; cyberdrop-dl = pkgs.callPackage ./cyberdrop-dl {};
firefox-gnome-theme = pkgs.callPackage ./firefox-gnome-theme { src = inputs.firefox-gnome-theme; }; firefox-gnome-theme = pkgs.callPackage ./firefox-gnome-theme {src = inputs.firefox-gnome-theme;};
adwaita-for-steam = pkgs.callPackage ./adwaita-for-steam { src = inputs.adwaita-for-steam; }; adwaita-for-steam = pkgs.callPackage ./adwaita-for-steam {src = inputs.adwaita-for-steam;};
dconf-editor-wrapped = pkgs.callPackage ./dconf-editor-wrapped {}; dconf-editor-wrapped = pkgs.callPackage ./dconf-editor-wrapped {};
bitwig-studio-pipewire = pkgs.callPackage ./bitwig-studio-pipewire {}; bitwig-studio-pipewire = pkgs.callPackage ./bitwig-studio-pipewire {};
oversteer = pkgs.callPackage ./oversteer {}; oversteer = pkgs.callPackage ./oversteer {};

View File

@ -1,13 +1,14 @@
# Taken from https://github.com/tadfisher/flake/blob/main/pkgs/firefox-gnome-theme/default.nix # Taken from https://github.com/tadfisher/flake/blob/main/pkgs/firefox-gnome-theme/default.nix
# We don't use fetchTarbal or fetchFromGithub because we are using flakes: # We don't use fetchTarbal or fetchFromGithub because we are using flakes:
# - Specify the firefox-gnome-theme github repo as input in flake.nix # - Specify the firefox-gnome-theme github repo as input in flake.nix
# - We don't need to add sha256 or commit revision because it is automatically locked in flake.lock # - We don't need to add sha256 or commit revision because it is automatically locked in flake.lock
# - Pass the input to overlays/default.nix and from there to derivations/default.nix # - Pass the input to overlays/default.nix and from there to derivations/default.nix
# - There we plug the input into the src argument of this derivation # - There we plug the input into the src argument of this derivation
{
{ lib, stdenv, src }: lib,
stdenv,
src,
}:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "firefox-gnome-theme"; pname = "firefox-gnome-theme";
version = "unstable"; version = "unstable";

View File

@ -1,8 +1,23 @@
# Taken from https://github.com/NixOS/nixpkgs/pull/176779/files # Taken from https://github.com/NixOS/nixpkgs/pull/176779/files
{
{ lib, stdenv, meson, ninja, pkg-config, gettext, cmake, udev, fetchFromGitHub, python3 lib,
, wrapGAppsHook, gtk3, glib, gnome, appstream-glib, gobject-introspection, desktop-file-utils }: stdenv,
meson,
ninja,
pkg-config,
gettext,
cmake,
udev,
fetchFromGitHub,
python3,
wrapGAppsHook,
gtk3,
glib,
gnome,
appstream-glib,
gobject-introspection,
desktop-file-utils,
}:
python3.pkgs.buildPythonApplication rec { python3.pkgs.buildPythonApplication rec {
pname = "oversteer"; pname = "oversteer";
version = "0.7.1"; version = "0.7.1";
@ -44,9 +59,9 @@ python3.pkgs.buildPythonApplication rec {
udev udev
]; ];
buildInputs = [ udev gtk3 glib gnome.adwaita-icon-theme python3 ]; buildInputs = [udev gtk3 glib gnome.adwaita-icon-theme python3];
propagatedBuildInputs = with python3.pkgs; [ pyudev pyxdg evdev pygobject3 matplotlib scipy ]; propagatedBuildInputs = with python3.pkgs; [pyudev pyxdg evdev pygobject3 matplotlib scipy];
meta = with lib; { meta = with lib; {
description = "Application to configure Logitech steering wheels on Linux"; description = "Application to configure Logitech steering wheels on Linux";

View File

@ -1,90 +1,96 @@
# Has a problem with vertically offset UI, replaced by distrho for now but kept as an example # Has a problem with vertically offset UI, replaced by distrho for now but kept as an example
# TODO: Flake derivation # TODO: Flake derivation
# Damn I hate this style # Damn I hate this style
{ lib {
, stdenv lib,
, fetchurl stdenv,
, dpkg fetchurl,
, autoPatchelfHook dpkg,
, alsa-lib autoPatchelfHook,
, freetype alsa-lib,
, gcc freetype,
, glib gcc,
, glibc glib,
, curlWithGnuTls glibc,
, libGL curlWithGnuTls,
, libglvnd libGL,
, libsecret libglvnd,
libsecret,
}: }:
# Adapted from https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=vital-synth # Adapted from https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=vital-synth
# Example https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/audio/bitwig-studio/bitwig-studio4.nix # Example https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/audio/bitwig-studio/bitwig-studio4.nix
let let
# Variables from AUR pkgbuild # Variables from AUR pkgbuild
maintainer = "jackreeds"; maintainer = "jackreeds";
pkgname_deb = "VitalInstaller"; pkgname_deb = "VitalInstaller";
in
stdenv.mkDerivation rec {
pname = "vital-synth";
version = "1.0.8";
in stdenv.mkDerivation rec { src = fetchurl {
pname = "vital-synth"; url = "https://github.com/${maintainer}/${pkgname_deb}/releases/download/${version}/${pkgname_deb}.deb";
version = "1.0.8"; sha512 = "829d29a0c41ac9f79ca6d069e2e4f404a501abdcdc487fbb4e1e8afd44bf870c6c41095587c98f810fb946d946179468f8d5f417e67785313152a1613cf4a832";
};
src = fetchurl { # autoPatchelfHook patches the binary to use the dynamic loader and "tells it" where all the libraries are that
url = "https://github.com/${maintainer}/${pkgname_deb}/releases/download/${version}/${pkgname_deb}.deb"; # the program wants to dynamically load at runtime.
sha512 = "829d29a0c41ac9f79ca6d069e2e4f404a501abdcdc487fbb4e1e8afd44bf870c6c41095587c98f810fb946d946179468f8d5f417e67785313152a1613cf4a832"; # This is necessary because NixOS doesn't have the linux typical static location where these libraries are placed,
}; # so the binary needs the correct paths to the nix store for each one.
# autoPatchelfHook propagates all the buildInputs so they are available at runtime.
# View also:
# https://nixos.org/manual/nixpkgs/unstable/#setup-hook-autopatchelfhook
# https://nixos.wiki/wiki/Packaging/Binaries
# https://unix.stackexchange.com/questions/522822/different-methods-to-run-a-non-nixos-executable-on-nixos/522823#522823
nativeBuildInputs = [
dpkg
autoPatchelfHook
];
# autoPatchelfHook patches the binary to use the dynamic loader and "tells it" where all the libraries are that # We downloaded a .deb file, unpack it to root = [ usr/bin usr/lib usr/share ]
# the program wants to dynamically load at runtime. unpackCmd = ''
# This is necessary because NixOS doesn't have the linux typical static location where these libraries are placed, mkdir -p root
# so the binary needs the correct paths to the nix store for each one. dpkg-deb -x $curSrc root
# autoPatchelfHook propagates all the buildInputs so they are available at runtime.
# View also:
# https://nixos.org/manual/nixpkgs/unstable/#setup-hook-autopatchelfhook
# https://nixos.wiki/wiki/Packaging/Binaries
# https://unix.stackexchange.com/questions/522822/different-methods-to-run-a-non-nixos-executable-on-nixos/522823#522823
nativeBuildInputs = [
dpkg
autoPatchelfHook
];
# We downloaded a .deb file, unpack it to root = [ usr/bin usr/lib usr/share ]
unpackCmd = ''
mkdir -p root
dpkg-deb -x $curSrc root
'';
# This is already built
dontBuild = true;
# From AUR pkgbuild:
# depends=('alsa-lib>=1.0.16' 'freetype2>=2.2.1' 'gcc-libs' 'gcc>=3.3.1' 'glib2>=2.12.0' 'glibc>=2.17'
# 'libcurl-gnutls>=7.16.2' 'libgl' 'libglvnd' 'libsecret>=0.7')
buildInputs = [
alsa-lib freetype gcc.cc.lib gcc.cc glib glibc curlWithGnuTls libGL libglvnd libsecret
];
# Copy the contents of the .deb package to the $out directory that nix creates for built derivations
# Very simple as the vital .deb has a very basic format (only [ usr/bin usr/lib usr/share ])
installPhase = ''
runHook preInstall
mkdir -p $out
cp -r usr/* $out/
chmod +x $out/bin/vital
runHook postInstall
'';
meta = with lib; {
description = "A wavetable synthesizer.";
longDescription = ''
Powerful wavetable synthesizer with realtime modulation feedback.
Vital is a MIDI enabled polyphonic music synthesizer with an easy to use
parameter modulation system with real-time graphical feedback.
''; '';
homepage = "https://vital.audio/";
license = licenses.gpl3Only; # This is already built
platforms = [ "x86_64-linux" ]; dontBuild = true;
};
} # From AUR pkgbuild:
# depends=('alsa-lib>=1.0.16' 'freetype2>=2.2.1' 'gcc-libs' 'gcc>=3.3.1' 'glib2>=2.12.0' 'glibc>=2.17'
# 'libcurl-gnutls>=7.16.2' 'libgl' 'libglvnd' 'libsecret>=0.7')
buildInputs = [
alsa-lib
freetype
gcc.cc.lib
gcc.cc
glib
glibc
curlWithGnuTls
libGL
libglvnd
libsecret
];
# Copy the contents of the .deb package to the $out directory that nix creates for built derivations
# Very simple as the vital .deb has a very basic format (only [ usr/bin usr/lib usr/share ])
installPhase = ''
runHook preInstall
mkdir -p $out
cp -r usr/* $out/
chmod +x $out/bin/vital
runHook postInstall
'';
meta = with lib; {
description = "A wavetable synthesizer.";
longDescription = ''
Powerful wavetable synthesizer with realtime modulation feedback.
Vital is a MIDI enabled polyphonic music synthesizer with an easy to use
parameter modulation system with real-time graphical feedback.
'';
homepage = "https://vital.audio/";
license = licenses.gpl3Only;
platforms = ["x86_64-linux"];
};
}

152
env/c_cxx.nix vendored
View File

@ -5,80 +5,84 @@
inputs.flake-utils.url = "github:numtide/flake-utils"; inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.devshell.url = "github:numtide/devshell"; inputs.devshell.url = "github:numtide/devshell";
outputs = { self, nixpkgs, flake-utils, devshell }: outputs = {
flake-utils.lib.eachDefaultSystem (system: self,
let nixpkgs,
pkgs = import nixpkgs { flake-utils,
inherit system; devshell,
config.allowUnfree = true; # For clion }:
overlays = [ devshell.overlay ]; flake-utils.lib.eachDefaultSystem (system: let
}; pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true; # For clion
overlays = [devshell.overlay];
};
# NOTE: Usual 64 bit compilers that don't collide # NOTE: Usual 64 bit compilers that don't collide
bintools = pkgs.wrapBintoolsWith { bintools = pkgs.wrapBintoolsWith {
bintools = pkgs.bintools.bintools; bintools = pkgs.bintools.bintools;
libc = pkgs.glibc; libc = pkgs.glibc;
}; };
gcc12 = pkgs.hiPrio (pkgs.wrapCCWith { gcc12 = pkgs.hiPrio (pkgs.wrapCCWith {
cc = pkgs.gcc12.cc; cc = pkgs.gcc12.cc;
libc = pkgs.glibc; libc = pkgs.glibc;
bintools = bintools; bintools = bintools;
});
clang14 = pkgs.wrapCCWith {
cc = pkgs.clang_14.cc;
libc = pkgs.glibc;
bintools = bintools;
};
# NOTE: Multilib compilers that don't collide
bintools_multi = pkgs.wrapBintoolsWith {
bintools = pkgs.bintools.bintools; # Get the unwrapped bintools from the wrapper
libc = pkgs.glibc_multi;
};
gcc12_multi = pkgs.hiPrio (pkgs.wrapCCWith {
cc = pkgs.gcc12.cc; # Get the unwrapped gcc from the wrapper
libc = pkgs.glibc_multi;
bintools = bintools_multi;
});
clang14_multi = pkgs.wrapCCWith {
cc = pkgs.clang_14.cc;
libc = pkgs.glibc_multi;
bintools = bintools_multi;
};
in {
# devShell = pkgs.devshell.mkShell ...
devShell = pkgs.devshell.mkShell {
name = "";
packages = with pkgs; [
# Compilers
bintools
gcc12
clang14
# bintools_multi
# gcc12_multi
# clang14_multi
# Native buildinputs
gnumake
cmake
nasm
# Development
jetbrains.clion
bear # To generate compilation database
gdb
cling # To try out my bullshit implementations
# doxygen # Generate docs + graphs
];
commands = [
{
name = "ide";
help = "Run clion for project";
command = "clion &>/dev/null ./ &";
}
];
};
}); });
clang14 = pkgs.wrapCCWith {
cc = pkgs.clang_14.cc;
libc = pkgs.glibc;
bintools = bintools;
};
# NOTE: Multilib compilers that don't collide
bintools_multi = pkgs.wrapBintoolsWith {
bintools = pkgs.bintools.bintools; # Get the unwrapped bintools from the wrapper
libc = pkgs.glibc_multi;
};
gcc12_multi = pkgs.hiPrio (pkgs.wrapCCWith {
cc = pkgs.gcc12.cc; # Get the unwrapped gcc from the wrapper
libc = pkgs.glibc_multi;
bintools = bintools_multi;
});
clang14_multi = pkgs.wrapCCWith {
cc = pkgs.clang_14.cc;
libc = pkgs.glibc_multi;
bintools = bintools_multi;
};
in {
# devShell = pkgs.devshell.mkShell ...
devShell = pkgs.devshell.mkShell {
name = "";
packages = with pkgs; [
# Compilers
bintools
gcc12
clang14
# bintools_multi
# gcc12_multi
# clang14_multi
# Native buildinputs
gnumake
cmake
nasm
# Development
jetbrains.clion
bear # To generate compilation database
gdb
cling # To try out my bullshit implementations
# doxygen # Generate docs + graphs
];
commands = [
{
name = "ide";
help = "Run clion for project";
command = "clion &>/dev/null ./ &";
}
];
};
});
} }

55
env/python.nix vendored
View File

@ -5,37 +5,42 @@
inputs.flake-utils.url = "github:numtide/flake-utils"; inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.devshell.url = "github:numtide/devshell"; inputs.devshell.url = "github:numtide/devshell";
outputs = { self, nixpkgs, flake-utils, devshell }: outputs = {
flake-utils.lib.eachDefaultSystem (system: self,
let nixpkgs,
pkgs = import nixpkgs { flake-utils,
inherit system; devshell,
config.allowUnfree = true; }:
overlays = [ devshell.overlay ]; flake-utils.lib.eachDefaultSystem (system: let
}; pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [devshell.overlay];
};
myPython = pkgs.python310.withPackages (p: with p; [ myPython = pkgs.python310.withPackages (p:
with p; [
rich rich
numpy numpy
scipy scipy
matplotlib matplotlib
]); ]);
in { in {
devShell = pkgs.devshell.mkShell { devShell = pkgs.devshell.mkShell {
name = ""; name = "";
packages = with pkgs; [ packages = with pkgs; [
myPython myPython
]; ];
# Use $1 for positional args # Use $1 for positional args
commands = [ commands = [
# { # {
# name = ""; # name = "";
# help = ""; # help = "";
# command = ""; # command = "";
# } # }
]; ];
}; };
}); });
} }

101
env/python_pytorch.nix vendored
View File

@ -5,39 +5,44 @@
inputs.flake-utils.url = "github:numtide/flake-utils"; inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.devshell.url = "github:numtide/devshell"; inputs.devshell.url = "github:numtide/devshell";
outputs = { self, nixpkgs, flake-utils, devshell }: outputs = {
flake-utils.lib.eachDefaultSystem (system: self,
let nixpkgs,
pkgs = import nixpkgs { flake-utils,
inherit system; devshell,
config.allowUnfree = true; }:
overlays = [ devshell.overlay ]; flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [devshell.overlay];
};
# TODO: Originally it was nixpkgs.fetchurl but that didn't work, pkgs.fetchurl did...
# Determine the difference between nixpkgs and pkgs
# NOTE: These packages have to be updated manually!
# Taken from: https://github.com/gbtb/nix-stable-diffusion/blob/master/flake.nix
# Overlay: https://nixos.wiki/wiki/Overlays
# FetchURL: https://ryantm.github.io/nixpkgs/builders/fetchers/
torch-rocm = pkgs.hiPrio (pkgs.python310Packages.torch-bin.overrideAttrs (old: {
src = pkgs.fetchurl {
name = "torch-1.12.1+rocm5.1.1-cp310-cp310-linux_x86_64.whl";
url = "https://download.pytorch.org/whl/rocm5.1.1/torch-1.12.1%2Brocm5.1.1-cp310-cp310-linux_x86_64.whl";
hash = "sha256-kNShDx88BZjRQhWgnsaJAT8hXnStVMU1ugPNMEJcgnA=";
}; };
}));
torchvision-rocm = pkgs.hiPrio (pkgs.python310Packages.torchvision-bin.overrideAttrs (old: {
src = pkgs.fetchurl {
name = "torchvision-0.13.1+rocm5.1.1-cp310-cp310-linux_x86_64.whl";
url = "https://download.pytorch.org/whl/rocm5.1.1/torchvision-0.13.1%2Brocm5.1.1-cp310-cp310-linux_x86_64.whl";
hash = "sha256-mYk4+XNXU6rjpgWfKUDq+5fH/HNPQ5wkEtAgJUDN/Jg=";
};
}));
# TODO: Originally it was nixpkgs.fetchurl but that didn't work, pkgs.fetchurl did... myPython = pkgs.python310.withPackages (p:
# Determine the difference between nixpkgs and pkgs with p; [
# NOTE: These packages have to be updated manually!
# Taken from: https://github.com/gbtb/nix-stable-diffusion/blob/master/flake.nix
# Overlay: https://nixos.wiki/wiki/Overlays
# FetchURL: https://ryantm.github.io/nixpkgs/builders/fetchers/
torch-rocm = pkgs.hiPrio (pkgs.python310Packages.torch-bin.overrideAttrs (old: {
src = pkgs.fetchurl {
name = "torch-1.12.1+rocm5.1.1-cp310-cp310-linux_x86_64.whl";
url = "https://download.pytorch.org/whl/rocm5.1.1/torch-1.12.1%2Brocm5.1.1-cp310-cp310-linux_x86_64.whl";
hash = "sha256-kNShDx88BZjRQhWgnsaJAT8hXnStVMU1ugPNMEJcgnA=";
};
}));
torchvision-rocm = pkgs.hiPrio (pkgs.python310Packages.torchvision-bin.overrideAttrs (old: {
src = pkgs.fetchurl {
name = "torchvision-0.13.1+rocm5.1.1-cp310-cp310-linux_x86_64.whl";
url = "https://download.pytorch.org/whl/rocm5.1.1/torchvision-0.13.1%2Brocm5.1.1-cp310-cp310-linux_x86_64.whl";
hash = "sha256-mYk4+XNXU6rjpgWfKUDq+5fH/HNPQ5wkEtAgJUDN/Jg=";
};
}));
myPython = pkgs.python310.withPackages (p: with p; [
# Basic # Basic
rich rich
@ -48,23 +53,23 @@
matplotlib matplotlib
nltk nltk
]); ]);
in { in {
devShell = pkgs.devshell.mkShell { devShell = pkgs.devshell.mkShell {
name = "Machine Learning Environment"; name = "Machine Learning Environment";
packages = with pkgs; [ packages = with pkgs; [
myPython myPython
nodePackages.pyright # LSP nodePackages.pyright # LSP
]; ];
# Use $1 for positional args # Use $1 for positional args
commands = [ commands = [
# { # {
# name = ""; # name = "";
# help = ""; # help = "";
# command = ""; # command = "";
# } # }
]; ];
}; };
}); });
} }

93
env/rust.nix vendored
View File

@ -6,54 +6,59 @@
inputs.devshell.url = "github:numtide/devshell"; inputs.devshell.url = "github:numtide/devshell";
inputs.rust-overlay.url = "github:oxalica/rust-overlay"; inputs.rust-overlay.url = "github:oxalica/rust-overlay";
outputs = { self, nixpkgs, flake-utils, devshell, rust-overlay }: outputs = {
flake-utils.lib.eachDefaultSystem (system: self,
let nixpkgs,
pkgs = import nixpkgs { flake-utils,
inherit system; devshell,
config.allowUnfree = true; # For clion rust-overlay,
overlays = [ }:
devshell.overlay flake-utils.lib.eachDefaultSystem (system: let
rust-overlay.overlays.default pkgs = import nixpkgs {
]; inherit system;
}; config.allowUnfree = true; # For clion
overlays = [
devshell.overlay
rust-overlay.overlays.default
];
};
# Includes cargo, rustc, rustfmt # Includes cargo, rustc, rustfmt
rust-stable = pkgs.rust-bin.stable.latest.default.override { rust-stable = pkgs.rust-bin.stable.latest.default.override {
extensions = [ "rust-src" ]; # Include the rust stdlib source for intellij extensions = ["rust-src"]; # Include the rust stdlib source for intellij
}; };
in { in {
devShell = pkgs.devshell.mkShell { devShell = pkgs.devshell.mkShell {
name = "Rust development shell"; name = "Rust development shell";
packages = with pkgs; [ packages = with pkgs; [
rust-stable rust-stable
rust-analyzer rust-analyzer
jetbrains.clion jetbrains.clion
]; ];
env = [ env = [
# Allow for intellij to find the stdlib # Allow for intellij to find the stdlib
# { # {
# name = "RUST_SRC_PATH"; # name = "RUST_SRC_PATH";
# value = "${rust-stable}/lib/rustlib/src/rust/library"; # value = "${rust-stable}/lib/rustlib/src/rust/library";
# } # }
# Use this if the rust binary needs additional libraries # Use this if the rust binary needs additional libraries
# { # {
# name = "LD_LIBRARY_PATH"; # name = "LD_LIBRARY_PATH";
# value = "${pkgs.xorg.libX11}/lib:${pkgs.xorg.libXcursor}/lib:${pkgs.xorg.libXrandr}/lib:${pkgs.xorg.libXi}/lib:${pkgs.libGL}/lib"; # value = "${pkgs.xorg.libX11}/lib:${pkgs.xorg.libXcursor}/lib:${pkgs.xorg.libXrandr}/lib:${pkgs.xorg.libXi}/lib:${pkgs.libGL}/lib";
# } # }
]; ];
commands = [ commands = [
{ {
name = "ide"; name = "ide";
help = "Run clion for project"; help = "Run clion for project";
command = "clion &>/dev/null ./ &"; command = "clion &>/dev/null ./ &";
} }
]; ];
}; };
}); });
} }

View File

@ -1,5 +1,4 @@
# The curly braces denote a set of keys and values. # The curly braces denote a set of keys and values.
{ {
description = "ChUrl's very bad and basic Nix config using Flakes"; description = "ChUrl's very bad and basic Nix config using Flakes";
@ -39,62 +38,65 @@
# Outputs is a function that takes the inputs as arguments. # Outputs is a function that takes the inputs as arguments.
# To handle extra arguments we use the inputs@ pattern. # To handle extra arguments we use the inputs@ pattern.
# It gives a name to the ... ellipses. # It gives a name to the ... ellipses.
outputs = inputs @ { nixpkgs, home-manager, ... }: outputs = inputs @ {
nixpkgs,
home-manager,
...
}:
# With let you can define local variables
let
system = "x86_64-linux";
# With let you can define local variables # Set overlays + unfree globally
let pkgs = import nixpkgs {
system = "x86_64-linux"; inherit system;
# Set overlays + unfree globally config.allowUnfree = true;
pkgs = import nixpkgs { overlays = [
inherit system; inputs.devshell.overlay
inputs.nur.overlay
inputs.emacs-overlay.overlay
config.allowUnfree = true; # All my own overlays
overlays = [ (import ./overlays {inherit nixpkgs inputs;})
inputs.devshell.overlay ];
inputs.nur.overlay };
inputs.emacs-overlay.overlay
# All my own overlays
(import ./overlays { inherit nixpkgs inputs; })
];
};
# I don't know how to extend the nixpkgs.lib directly so just propagate mylib to the config modules as argument
mylib = import ./lib { inherit inputs pkgs; lib = nixpkgs.lib; };
# I don't know how to extend the nixpkgs.lib directly so just propagate mylib to the config modules as argument
mylib = import ./lib {
inherit inputs pkgs;
lib = nixpkgs.lib;
};
# The rec expression turns a basic set into a set where self-referencing is possible. # The rec expression turns a basic set into a set where self-referencing is possible.
# It is a shorthand for recursive and allows to use the values defined in this set from its own scope. # It is a shorthand for recursive and allows to use the values defined in this set from its own scope.
in rec { in rec {
# Local shell for NixFlake directory
devShells."${system}".default = import ./shell.nix {inherit pkgs;};
# Local shell for NixFlake directory # System configurations + HomeManager module
devShells."${system}".default = import ./shell.nix { inherit pkgs; }; # Accessible via 'nixos-rebuild'
nixosConfigurations = {
# We give our configuration a name (the hostname) to choose a configuration when rebuilding.
# This makes it easy to add different configurations (e.g. for a laptop).
# Usage: sudo nixos-rebuild switch --flake .#nixinator
nixinator = mylib.nixos.mkNixosConfig {
inherit system mylib;
# System configurations + HomeManager module hostname = "nixinator";
# Accessible via 'nixos-rebuild' username = "christoph";
nixosConfigurations = {
# We give our configuration a name (the hostname) to choose a configuration when rebuilding. extraModules = [];
# This makes it easy to add different configurations (e.g. for a laptop). };
# Usage: sudo nixos-rebuild switch --flake .#nixinator
nixinator = mylib.nixos.mkNixosConfig {
inherit system mylib;
hostname = "nixinator"; # Usage: sudo nixos-rebuild switch --flake .#nixtop
username = "christoph"; nixtop = mylib.nixos.mkNixosConfig {
inherit system mylib;
extraModules = [ ]; hostname = "nixtop";
}; username = "christoph";
# Usage: sudo nixos-rebuild switch --flake .#nixtop extraModules = [];
nixtop = mylib.nixos.mkNixosConfig {
inherit system mylib;
hostname = "nixtop";
username = "christoph";
extraModules = [ ];
};
}; };
}; };
};
} }

View File

@ -1,17 +1,22 @@
# This is your home-manager configuration file # This is your home-manager configuration file
# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix) # Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix)
# The nixosConfig allows to access the toplevel system configuration from within home manager # The nixosConfig allows to access the toplevel system configuration from within home manager
# https://github.com/nix-community/home-manager/blob/586ac1fd58d2de10b926ce3d544b3179891e58cb/nixos/default.nix#L19 # https://github.com/nix-community/home-manager/blob/586ac1fd58d2de10b926ce3d544b3179891e58cb/nixos/default.nix#L19
{ inputs, hostname, username, lib, mylib, config, nixosConfig, pkgs, ... }: {
inputs,
hostname,
username,
lib,
mylib,
config,
nixosConfig,
pkgs,
...
}:
# This is a module # This is a module
# Because no imports/options/config is defined explicitly, everything is treated as config # Because no imports/options/config is defined explicitly, everything is treated as config
# { inputs, lib, ... }: { ... } gets turned into { inputs, lib, ... }: { config = { ... }; } implicitly # { inputs, lib, ... }: { ... } gets turned into { inputs, lib, ... }: { config = { ... }; } implicitly
let rec {
in rec {
# Every module is a nix expression, specifically a function { inputs, lib, ... }: { ... } # Every module is a nix expression, specifically a function { inputs, lib, ... }: { ... }
# Every module (/function) is called with the same arguments as this module (home.nix) # Every module (/function) is called with the same arguments as this module (home.nix)
# Arguments with matching names are "plugged in" into the right slots, # Arguments with matching names are "plugged in" into the right slots,
@ -214,7 +219,7 @@ in rec {
ffmpeg_5-full # v5, including ffplay ffmpeg_5-full # v5, including ffplay
imagemagick # Convert image (magic) imagemagick # Convert image (magic)
httpie # Cool http client httpie # Cool http client
(ripgrep.override { withPCRE2 = true; }) # fast as fuck (ripgrep.override {withPCRE2 = true;}) # fast as fuck
nvd # nix rebuild diff nvd # nix rebuild diff
# du-dust # Disk usage analyzer (for directories) # du-dust # Disk usage analyzer (for directories)
gdu # Alternative to du-dust (I like it better) gdu # Alternative to du-dust (I like it better)
@ -241,6 +246,8 @@ in rec {
texlive.combined.scheme-full texlive.combined.scheme-full
pandoc # document converting madness pandoc # document converting madness
lm_sensors lm_sensors
alejandra # nix code formatter
nil # nix language server
# Xooooorg/Desktop environment stuff # Xooooorg/Desktop environment stuff
xclip xclip
@ -302,7 +309,6 @@ in rec {
# jetbrains.idea-ultimate # jetbrains.idea-ultimate
# jetbrains.clion # jetbrains.clion
# TODO: LaTeX module # TODO: LaTeX module
texlab texlab
@ -342,6 +348,8 @@ in rec {
# Use NixCommunity binary cache # Use NixCommunity binary cache
cachix cachix
# tor-browser-bundle-bin
]; ];
# Packages with extra options managed by HomeManager natively # Packages with extra options managed by HomeManager natively
@ -411,8 +419,8 @@ in rec {
enable = true; enable = true;
enableFishIntegration = config.modules.fish.enable; enableFishIntegration = config.modules.fish.enable;
enableXsessionIntegration = true; enableXsessionIntegration = true;
agents = [ "ssh" ]; agents = ["ssh"];
keys = [ "id_ed25519" ]; keys = ["id_ed25519"];
}; };
# Realtime Motion Interpolation: https://gist.github.com/phiresky/4bfcfbbd05b3c2ed8645 # Realtime Motion Interpolation: https://gist.github.com/phiresky/4bfcfbbd05b3c2ed8645
@ -421,10 +429,13 @@ in rec {
# NOTE: wrapMpv explained here: https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/applications/video/mpv/wrapper.nix#L84 # NOTE: wrapMpv explained here: https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/applications/video/mpv/wrapper.nix#L84
# wrapMpv gets two args: the mpv derivation and some options # wrapMpv gets two args: the mpv derivation and some options
# Possible overrides for derivation: https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/applications/video/mpv/default.nix#L222 # Possible overrides for derivation: https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/applications/video/mpv/default.nix#L222
package = pkgs.wrapMpv (pkgs.mpv-unwrapped.override { vapoursynthSupport = true; }) { package = pkgs.wrapMpv (pkgs.mpv-unwrapped.override {vapoursynthSupport = true;}) {
youtubeSupport = true; youtubeSupport = true;
extraMakeWrapperArgs = [ extraMakeWrapperArgs = [
"--prefix" "LD_LIBRARY_PATH" ":" "${pkgs.vapoursynth-mvtools}/lib" "--prefix"
"LD_LIBRARY_PATH"
":"
"${pkgs.vapoursynth-mvtools}/lib"
]; ];
}; };
}; };

View File

@ -1,7 +1,15 @@
{ inputs, hostname, username, lib, mylib, config, nixosConfig, pkgs, ... }: {
inputs,
hostname,
username,
lib,
mylib,
config,
nixosConfig,
pkgs,
...
}:
# Here goes the stuff that will only be enabled on the desktop # Here goes the stuff that will only be enabled on the desktop
rec { rec {
imports = [ imports = [
../../modules ../../modules
@ -21,8 +29,10 @@ rec {
yabridge.autoSync = true; yabridge.autoSync = true;
noisesuppression = { noisesuppression = {
noisetorch.enable = true; noisetorch.enable = false;
noisetorch.autostart = true; noisetorch.autostart = false;
easyeffects.enable = false;
easyeffects.autostart = false;
}; };
cardinal.enable = true; cardinal.enable = true;

View File

@ -1,7 +1,15 @@
{ inputs, hostname, username, lib, mylib, config, nixosConfig, pkgs, ... }: {
inputs,
hostname,
username,
lib,
mylib,
config,
nixosConfig,
pkgs,
...
}:
# Here goes the stuff that will only be enabled on the laptop # Here goes the stuff that will only be enabled on the laptop
rec { rec {
imports = [ imports = [
../../modules ../../modules

View File

@ -1,9 +1,13 @@
{ config, nixosConfig, lib, mylib, pkgs, ... }: {
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib; with lib;
with mylib.modules; with mylib.modules; let
let
cfg = config.modules.audio; cfg = config.modules.audio;
cfgfp = config.modules.flatpak; cfgfp = config.modules.flatpak;
in { in {
@ -64,35 +68,35 @@ in {
# Use builtins.concatLists instead of mkMerge as this is more safe as the type is specified, # Use builtins.concatLists instead of mkMerge as this is more safe as the type is specified,
# also mkMerge doesn't work in every case as it yields a set # also mkMerge doesn't work in every case as it yields a set
home.packages = with pkgs; builtins.concatLists [ home.packages = with pkgs;
builtins.concatLists [
# lib.optional is preferred over mkIf or if...then...else by nix coding standards
# lib.optional wraps its argument in a list, lib.optionals doesn't
# This means that lib.optional can be used for single packages/arguments
# and lib.optionals has to be used when the argument is itself a list
# I use lib.optionals everywhere as I think this is more clear
# lib.optional is preferred over mkIf or if...then...else by nix coding standards # Some of these include gamemode as I use that to enable performance governors for CPU/GPU and other stuff
# lib.optional wraps its argument in a list, lib.optionals doesn't
# This means that lib.optional can be used for single packages/arguments
# and lib.optionals has to be used when the argument is itself a list
# I use lib.optionals everywhere as I think this is more clear
# Some of these include gamemode as I use that to enable performance governors for CPU/GPU and other stuff # Enable some default pipewire stuff if pipewire is enabled
(optionals nixosConfig.services.pipewire.enable [helvum])
# Enable some default pipewire stuff if pipewire is enabled (optionals cfg.carla.enable [carla gamemode])
(optionals nixosConfig.services.pipewire.enable [ helvum ]) (optionals cfg.bitwig.enable [
bitwig-studio
gamemode
])
(optionals cfg.tenacity.enable [tenacity])
(optionals cfg.carla.enable [ carla gamemode ]) (optionals cfg.faust.enable [faust])
(optionals cfg.bitwig.enable [ (optionals cfg.yabridge.enable [yabridge yabridgectl])
bitwig-studio (optionals cfg.noisesuppression.noisetorch.enable [noisetorch])
gamemode
])
(optionals cfg.tenacity.enable [ tenacity ])
(optionals cfg.faust.enable [ faust ]) # (optionals cfg.vcvrack.enable [ vcv-rack ]) # Replaced by cardinal
(optionals cfg.yabridge.enable [ yabridge yabridgectl ]) (optionals cfg.cardinal.enable [cardinal])
(optionals cfg.noisesuppression.noisetorch.enable [ noisetorch ]) # (optionals cfg.vital.enable [ vital-synth ]) # Replaced by distrho
(optionals cfg.distrho.enable [distrho])
# (optionals cfg.vcvrack.enable [ vcv-rack ]) # Replaced by cardinal ];
(optionals cfg.cardinal.enable [ cardinal ])
# (optionals cfg.vital.enable [ vital-synth ]) # Replaced by distrho
(optionals cfg.distrho.enable [ distrho ])
];
services.easyeffects = mkIf cfg.noisesuppression.easyeffects.enable { services.easyeffects = mkIf cfg.noisesuppression.easyeffects.enable {
enable = true; enable = true;
@ -107,7 +111,7 @@ in {
icon = "carla"; icon = "carla";
exec = "env PIPEWIRE_LATENCY=256/48000 gamemoderun carla ${config.home.homeDirectory}/.config/carla/GuitarDefault.carxp"; exec = "env PIPEWIRE_LATENCY=256/48000 gamemoderun carla ${config.home.homeDirectory}/.config/carla/GuitarDefault.carxp";
terminal = false; terminal = false;
categories = [ "Music" "Audio" ]; categories = ["Music" "Audio"];
}; };
xdg.desktopEntries.bitwig-low-latency = mkIf cfg.bitwig.enable { xdg.desktopEntries.bitwig-low-latency = mkIf cfg.bitwig.enable {
@ -116,7 +120,7 @@ in {
icon = "bitwig-studio"; icon = "bitwig-studio";
exec = "env PIPEWIRE_LATENCY=256/48000 gamemoderun bitwig-studio"; exec = "env PIPEWIRE_LATENCY=256/48000 gamemoderun bitwig-studio";
terminal = false; terminal = false;
categories = [ "Music" "Audio" ]; categories = ["Music" "Audio"];
}; };
# TODO: Disable only for plasma # TODO: Disable only for plasma
@ -147,12 +151,14 @@ in {
home.activation = mkMerge [ home.activation = mkMerge [
# The module includes the default carla project with ArchetypePetrucci + ArchetypeGojira # The module includes the default carla project with ArchetypePetrucci + ArchetypeGojira
(mkIf cfg.carla.enable { (mkIf cfg.carla.enable {
linkCarlaConfig = hm.dag.entryAfter [ "writeBoundary" ] linkCarlaConfig =
(mkLink "${config.home.homeDirectory}/NixFlake/config/carla" "${config.home.homeDirectory}/.config/carla"); hm.dag.entryAfter ["writeBoundary"]
(mkLink "${config.home.homeDirectory}/NixFlake/config/carla" "${config.home.homeDirectory}/.config/carla");
}) })
(mkElse cfg.carla.enable { (mkElse cfg.carla.enable {
unlinkCarlaConfig = hm.dag.entryAfter [ "writeBoundary" ] unlinkCarlaConfig =
(mkUnlink "${config.home.homeDirectory}/.config/carla"); hm.dag.entryAfter ["writeBoundary"]
(mkUnlink "${config.home.homeDirectory}/.config/carla");
}) })
# Replaced by distrho # Replaced by distrho
@ -166,24 +172,30 @@ in {
# }) # })
(mkIf cfg.distrho.enable { (mkIf cfg.distrho.enable {
linkDistrhoLV2 = hm.dag.entryAfter [ "writeBoundary" ] linkDistrhoLV2 =
(mkLink "${pkgs.distrho}/lib/lv2" "${config.home.homeDirectory}/.lv2/distrho"); hm.dag.entryAfter ["writeBoundary"]
linkDistrhoVST = hm.dag.entryAfter [ "writeBoundary" ] (mkLink "${pkgs.distrho}/lib/lv2" "${config.home.homeDirectory}/.lv2/distrho");
(mkLink "${pkgs.distrho}/lib/vst" "${config.home.homeDirectory}/.vst/distrho"); linkDistrhoVST =
linkDistrhoVST3 = hm.dag.entryAfter [ "writeBoundary" ] hm.dag.entryAfter ["writeBoundary"]
(mkLink "${pkgs.distrho}/lib/vst3" "${config.home.homeDirectory}/.vst3/distrho"); (mkLink "${pkgs.distrho}/lib/vst" "${config.home.homeDirectory}/.vst/distrho");
linkDistrhoVST3 =
hm.dag.entryAfter ["writeBoundary"]
(mkLink "${pkgs.distrho}/lib/vst3" "${config.home.homeDirectory}/.vst3/distrho");
}) })
(mkElse cfg.distrho.enable { (mkElse cfg.distrho.enable {
unlinkDistrhoLV2 = hm.dag.entryAfter [ "writeBoundary" ] unlinkDistrhoLV2 =
(mkUnlink "${config.home.homeDirectory}/.lv2/distrho"); hm.dag.entryAfter ["writeBoundary"]
unlinkDistrhoVST = hm.dag.entryAfter [ "writeBoundary" ] (mkUnlink "${config.home.homeDirectory}/.lv2/distrho");
(mkUnlink "${config.home.homeDirectory}/.vst/distrho"); unlinkDistrhoVST =
unlinkDistrhoVST3 = hm.dag.entryAfter [ "writeBoundary" ] hm.dag.entryAfter ["writeBoundary"]
(mkUnlink "${config.home.homeDirectory}/.vst3/distrho"); (mkUnlink "${config.home.homeDirectory}/.vst/distrho");
unlinkDistrhoVST3 =
hm.dag.entryAfter ["writeBoundary"]
(mkUnlink "${config.home.homeDirectory}/.vst3/distrho");
}) })
(mkIf (cfg.yabridge.enable && cfg.yabridge.autoSync) { (mkIf (cfg.yabridge.enable && cfg.yabridge.autoSync) {
syncYabridge = hm.dag.entryAfter [ "writeBoundary" ] '' syncYabridge = hm.dag.entryAfter ["writeBoundary"] ''
yabridgectl sync yabridgectl sync
''; '';
}) })

View File

@ -1,6 +1,12 @@
{ inputs, config, nixosConfig, lib, pkgs, mylib, ... }:
{ {
inputs,
config,
nixosConfig,
lib,
pkgs,
mylib,
...
}: {
imports = [ imports = [
./audio.nix ./audio.nix
./emacs.nix ./emacs.nix

View File

@ -1,18 +1,20 @@
# https://nixos.org/manual/nixos/stable/index.html#sec-writing-modules # https://nixos.org/manual/nixos/stable/index.html#sec-writing-modules
# This is a function with arguments # This is a function with arguments
{ config, lib, mylib, pkgs, ... }: {
config,
lib,
mylib,
pkgs,
...
}:
# We add stuff from lib to our namespace (mkOption...) # We add stuff from lib to our namespace (mkOption...)
with lib; with lib;
with mylib.modules; with mylib.modules; let
let
# This is the current state of the option that this module defines # This is the current state of the option that this module defines
# We use it to determine if the config should be changed below # We use it to determine if the config should be changed below
cfg = config.modules.emacs; cfg = config.modules.emacs;
in { in {
imports = [ ]; imports = [];
# Options is a vector of options this module defines # Options is a vector of options this module defines
# This module defines only the "emacs" option and suboptions "enable" and "doom" # This module defines only the "emacs" option and suboptions "enable" and "doom"
@ -56,39 +58,43 @@ in {
]; ];
# What home packages should be enabled # What home packages should be enabled
home.packages = with pkgs; builtins.concatLists [ home.packages = with pkgs;
(optionals cfg.nativeComp [ ((emacsPackagesFor emacsNativeComp).emacsWithPackages (epkgs: [ epkgs.vterm epkgs.pdf-tools ])) ]) builtins.concatLists [
(optionals cfg.pgtkNativeComp [ ((emacsPackagesFor emacsPgtkNativeComp).emacsWithPackages (epkgs: [ epkgs.vterm epkgs.pdf-tools ])) ]) (optionals cfg.nativeComp [((emacsPackagesFor emacsNativeComp).emacsWithPackages (epkgs: [epkgs.vterm epkgs.pdf-tools]))])
(optionals cfg.nixpkgs [ ((emacsPackagesFor emacs).emacsWithPackages (epkgs: [ epkgs.vterm epkgs.pdf-tools ])) ]) (optionals cfg.pgtkNativeComp [((emacsPackagesFor emacsPgtkNativeComp).emacsWithPackages (epkgs: [epkgs.vterm epkgs.pdf-tools]))])
(optionals cfg.nixpkgs [((emacsPackagesFor emacs).emacsWithPackages (epkgs: [epkgs.vterm epkgs.pdf-tools]))])
# TODO: Check what hlissner has enabled # TODO: Check what hlissner has enabled
(optionals cfg.doom.enable [ (optionals cfg.doom.enable [
# emacs-all-the-icons-fonts # Needs to be in fonts.fonts # emacs-all-the-icons-fonts # Needs to be in fonts.fonts
(ripgrep.override { withPCRE2 = true; }) (ripgrep.override {withPCRE2 = true;})
fd fd
zstd zstd
sqlite # Org roam sqlite # Org roam
inkscape # Org latex preview inkscape # Org latex preview
graphviz # Org graphviz support graphviz # Org graphviz support
gnuplot # Org gnuplot support gnuplot # Org gnuplot support
pandoc # Org export formats pandoc # Org export formats
maim maim
bashInteractive # For keychain bashInteractive # For keychain
# TODO: I don't want to have this here permanently, maybe put in a shell.nix if compilation is needed? # TODO: I don't want to have this here permanently, maybe put in a shell.nix if compilation is needed?
gcc # Need this for org roam gcc # Need this for org roam
# withPackages expects a function that gets all the packages as argument and returns a list with the packages we want # TODO: Conflicts with global python?
(python310.withPackages (ppkgs: [ ppkgs.pygments ])) # Latex minted # withPackages expects a function that gets all the packages as argument and returns a list with the packages we want
(python310.withPackages (ppkgs: [ppkgs.pygments])) # Latex minted
# TODO: Does it work like this aswell?
# python310Packages.pygments
# nixfmt # This belongs in specific flake.nix # nixfmt # This belongs in specific flake.nix
# shellcheck # This belongs in specific flake.nix # shellcheck # This belongs in specific flake.nix
texlive.combined.scheme-full texlive.combined.scheme-full
]) ])
]; ];
home.sessionPath = mkIf cfg.doom.enable [ "${config.home.homeDirectory}/.emacs.d/bin" ]; home.sessionPath = mkIf cfg.doom.enable ["${config.home.homeDirectory}/.emacs.d/bin"];
# Note: Don't do it this way as the config becomes immutable # Note: Don't do it this way as the config becomes immutable
# We tell HomeManager where the config files belong # We tell HomeManager where the config files belong
@ -99,36 +105,36 @@ in {
# }; # };
home.activation = mkMerge [ home.activation = mkMerge [
# The parantheses around mkIf are needed for precedence in this case # The parantheses around mkIf are needed for precedence in this case
(mkIf cfg.doom.enable { (mkIf cfg.doom.enable {
# If doom is enabled we want to clone the framework # If doom is enabled we want to clone the framework
# The activation script is being run when home-manager rebuilds # The activation script is being run when home-manager rebuilds
# Because we write to the filesystem, this script has to be run after HomeManager's writeBoundary # Because we write to the filesystem, this script has to be run after HomeManager's writeBoundary
installDoomEmacs = hm.dag.entryAfter [ "writeBoundary" ] '' installDoomEmacs = hm.dag.entryAfter ["writeBoundary"] ''
if [ ! -d "${config.home.homeDirectory}/.emacs.d" ]; then if [ ! -d "${config.home.homeDirectory}/.emacs.d" ]; then
git clone --depth=1 --single-branch "https://github.com/doomemacs/doomemacs" "${config.home.homeDirectory}/.emacs.d" git clone --depth=1 --single-branch "https://github.com/doomemacs/doomemacs" "${config.home.homeDirectory}/.emacs.d"
fi fi
''; '';
# With this approach we keep the config mutable as it is not copied and linked from store # With this approach we keep the config mutable as it is not copied and linked from store
linkDoomConfig = hm.dag.entryAfter [ "writeBoundary" "installDoomEmacs" ] linkDoomConfig =
(mkLink "${config.home.homeDirectory}/NixFlake/config/doom" "${config.home.homeDirectory}/.config/doom"); hm.dag.entryAfter ["writeBoundary" "installDoomEmacs"]
(mkLink "${config.home.homeDirectory}/NixFlake/config/doom" "${config.home.homeDirectory}/.config/doom");
}) })
(mkElse cfg.doom.enable { (mkElse cfg.doom.enable {
unlinkDoomConfig = hm.dag.entryAfter [ "writeBoundary" "installDoomEmacs" ] unlinkDoomConfig =
(mkUnlink "${config.home.homeDirectory}/.config/doom"); hm.dag.entryAfter ["writeBoundary" "installDoomEmacs"]
(mkUnlink "${config.home.homeDirectory}/.config/doom");
}) })
(mkIf (cfg.doom.enable && cfg.doom.autoSync) { (mkIf (cfg.doom.enable && cfg.doom.autoSync) {
syncDoomEmacs = hm.dag.entryAfter [ "writeBoundary" "linkDoomConfig" ] '' syncDoomEmacs = hm.dag.entryAfter ["writeBoundary" "linkDoomConfig"] ''
${config.home.homeDirectory}/.emacs.d/bin/doom sync & ${config.home.homeDirectory}/.emacs.d/bin/doom sync &
''; '';
}) })
(mkIf (cfg.doom.enable && cfg.doom.autoUpgrade) { (mkIf (cfg.doom.enable && cfg.doom.autoUpgrade) {
upgradeDoomEmacs = hm.dag.entryAfter [ "writeBoundary" "linkDoomConfig" ] '' upgradeDoomEmacs = hm.dag.entryAfter ["writeBoundary" "linkDoomConfig"] ''
${config.home.homeDirectory}/.emacs.d/bin/doom upgrade -! ${config.home.homeDirectory}/.emacs.d/bin/doom upgrade -!
''; '';
}) })

View File

@ -1,18 +1,19 @@
# Example: https://beb.ninja/post/email/ # Example: https://beb.ninja/post/email/
# Example: https://sbr.pm/configurations/mails.html # Example: https://sbr.pm/configurations/mails.html
# NOTE: The passwords must exist in kwallet # NOTE: The passwords must exist in kwallet
# TODO: Emacs mail config # TODO: Emacs mail config
{
{ config, nixosConfig, lib, mylib, pkgs, ... }: config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib; with lib;
with mylib.modules; with mylib.modules; let
let
cfg = config.modules.email; cfg = config.modules.email;
in { in {
options.modules.email = { options.modules.email = {
enable = mkEnableOpt "Email"; enable = mkEnableOpt "Email";
autosync = mkEnableOpt "Automatically call \"notmuch new\" via systemd timer"; autosync = mkEnableOpt "Automatically call \"notmuch new\" via systemd timer";
@ -26,9 +27,10 @@ in {
# TODO: Add Maildir to nextcloud sync # TODO: Add Maildir to nextcloud sync
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = with pkgs; builtins.concatLists [ home.packages = with pkgs;
(optionals cfg.kmail.enable [ kmail ]) builtins.concatLists [
]; (optionals cfg.kmail.enable [kmail])
];
home.file = mkMerge [ home.file = mkMerge [
(optionalAttrs (cfg.kmail.enable && cfg.kmail.autostart) { (optionalAttrs (cfg.kmail.enable && cfg.kmail.autostart) {
@ -54,7 +56,7 @@ in {
# Autosync, don't need imapnotify when enabled # Autosync, don't need imapnotify when enabled
systemd.user.services.mail-autosync = (mkIf cfg.autosync) { systemd.user.services.mail-autosync = (mkIf cfg.autosync) {
Unit = { Description = "Automatic notmuch/mbsync synchronization"; }; Unit = {Description = "Automatic notmuch/mbsync synchronization";};
Service = { Service = {
Type = "oneshot"; Type = "oneshot";
# ExecStart = "${pkgs.isync}/bin/mbsync -a"; # ExecStart = "${pkgs.isync}/bin/mbsync -a";
@ -62,12 +64,12 @@ in {
}; };
}; };
systemd.user.timers.mail-autosync = (mkIf cfg.autosync) { systemd.user.timers.mail-autosync = (mkIf cfg.autosync) {
Unit = { Description = "Automatic notmuch/mbsync synchronization"; }; Unit = {Description = "Automatic notmuch/mbsync synchronization";};
Timer = { Timer = {
OnBootSec = "30"; OnBootSec = "30";
OnUnitActiveSec = "5m"; OnUnitActiveSec = "5m";
}; };
Install = { WantedBy = [ "timers.target" ]; }; Install = {WantedBy = ["timers.target"];};
}; };
accounts.email.accounts = { accounts.email.accounts = {
@ -84,14 +86,15 @@ in {
passwordCommand = "kwallet-query -f email -r urpost kdewallet"; passwordCommand = "kwallet-query -f email -r urpost kdewallet";
mbsync = { # Imap mbsync = {
# Imap
enable = true; enable = true;
create = "maildir"; create = "maildir";
}; };
msmtp.enable = true; # Smtp msmtp.enable = true; # Smtp
notmuch.enable = true; notmuch.enable = true;
imapnotify.enable = cfg.imapnotify; imapnotify.enable = cfg.imapnotify;
imapnotify.onNotify = { imapnotify.onNotify = {
mail = "${pkgs.notmuch}/bin/notmuch new && ${pkgs.libnotify}/bin/notify-send 'New mail arrived on Urpost'"; mail = "${pkgs.notmuch}/bin/notmuch new && ${pkgs.libnotify}/bin/notify-send 'New mail arrived on Urpost'";
}; };
@ -111,14 +114,15 @@ in {
passwordCommand = "kwallet-query -f email -r hhu kdewallet"; passwordCommand = "kwallet-query -f email -r hhu kdewallet";
mbsync = { # Imap mbsync = {
# Imap
enable = true; enable = true;
create = "maildir"; create = "maildir";
}; };
msmtp.enable = true; # Smtp msmtp.enable = true; # Smtp
notmuch.enable = true; notmuch.enable = true;
imapnotify.enable = cfg.imapnotify; imapnotify.enable = cfg.imapnotify;
imapnotify.onNotify = { imapnotify.onNotify = {
mail = "${pkgs.notmuch}/bin/notmuch new && ${pkgs.libnotify}/bin/notify-send 'New mail arrived on HHU'"; mail = "${pkgs.notmuch}/bin/notmuch new && ${pkgs.libnotify}/bin/notify-send 'New mail arrived on HHU'";
}; };
@ -137,7 +141,8 @@ in {
# NOTE: Uses Gmail app password # NOTE: Uses Gmail app password
passwordCommand = "kwallet-query -f email -r gmail kdewallet"; passwordCommand = "kwallet-query -f email -r gmail kdewallet";
mbsync = { # Imap mbsync = {
# Imap
enable = true; enable = true;
create = "maildir"; create = "maildir";
patterns = ["*" "![Gmail]*" "[Gmail]/Sent Mail" "[Gmail]/Starred" "[Gmail]/All Mail"]; # Only sync inbox patterns = ["*" "![Gmail]*" "[Gmail]/Sent Mail" "[Gmail]/Starred" "[Gmail]/All Mail"]; # Only sync inbox
@ -145,7 +150,7 @@ in {
msmtp.enable = true; # Smtp msmtp.enable = true; # Smtp
notmuch.enable = true; notmuch.enable = true;
imapnotify.enable = cfg.imapnotify; imapnotify.enable = cfg.imapnotify;
imapnotify.onNotify = { imapnotify.onNotify = {
mail = "${pkgs.notmuch}/bin/notmuch new && ${pkgs.libnotify}/bin/notify-send 'New mail arrived on GMail'"; mail = "${pkgs.notmuch}/bin/notmuch new && ${pkgs.libnotify}/bin/notify-send 'New mail arrived on GMail'";
}; };

View File

@ -1,14 +1,17 @@
# TODO: https://github.com/nix-community/home-manager/commit/69d19b9839638fc487b370e0600a03577a559081 # TODO: https://github.com/nix-community/home-manager/commit/69d19b9839638fc487b370e0600a03577a559081
{
{ inputs, config, nixosConfig, lib, mylib, pkgs, ... }: inputs,
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib; with lib;
with mylib.modules; with mylib.modules; let
let
cfg = config.modules.firefox; cfg = config.modules.firefox;
in { in {
options.modules.firefox = { options.modules.firefox = {
enable = mkEnableOpt "Firefox"; enable = mkEnableOpt "Firefox";
wayland = mkBoolOpt false "Enable firefox wayland support"; wayland = mkBoolOpt false "Enable firefox wayland support";
@ -19,16 +22,17 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = with pkgs; builtins.concatLists [ home.packages = with pkgs;
# TODO: I don't think vaapi works yet builtins.concatLists [
(optionals cfg.vaapi [ # TODO: I don't think vaapi works yet
# NOTE: I put these into hardware.opengl.extrapackages, don't know if they belong there... (optionals cfg.vaapi [
# libva # NOTE: I put these into hardware.opengl.extrapackages, don't know if they belong there...
# libvdpau # libva
]) # libvdpau
])
(optionals cfg.gnomeTheme [ firefox-gnome-theme ]) (optionals cfg.gnomeTheme [firefox-gnome-theme])
]; ];
home.sessionVariables = mkMerge [ home.sessionVariables = mkMerge [
{ {
@ -52,7 +56,7 @@ in {
icon = "firefox"; icon = "firefox";
exec = "firefox --private-window %U"; exec = "firefox --private-window %U";
terminal = false; terminal = false;
categories = [ "Network" "WebBrowser" ]; categories = ["Network" "WebBrowser"];
}; };
programs.firefox = { programs.firefox = {
@ -72,7 +76,7 @@ in {
# not strictly necessary # not strictly necessary
extraPolicies = { extraPolicies = {
# TODO: Make library function to allow easy bookmark creation and add my default bookmarks/folders # TODO: Make library function to allow easy bookmark creation and add my default bookmarks/folders
Bookmarks = (optionalAttrs cfg.defaultBookmarks { }); Bookmarks = optionalAttrs cfg.defaultBookmarks {};
CaptivePortal = false; CaptivePortal = false;
DisableFirefoxAccounts = true; DisableFirefoxAccounts = true;
DisableFirefoxStudies = true; DisableFirefoxStudies = true;

View File

@ -1,12 +1,15 @@
{ config, nixosConfig, lib, mylib, pkgs, ... }: {
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib; with lib;
with mylib.modules; with mylib.modules; let
let
cfg = config.modules.fish; cfg = config.modules.fish;
in { in {
options.modules.fish = { options.modules.fish = {
enable = mkEnableOpt "Fish"; enable = mkEnableOpt "Fish";
}; };
@ -31,87 +34,88 @@ in {
hasHomePackage = package: (contains config.home.packages package); hasHomePackage = package: (contains config.home.packages package);
# Only add fish abbr if package is installed # Only add fish abbr if package is installed
abbrify = package: abbr: (optionalAttrs (hasHomePackage package) abbr); abbrify = package: abbr: (optionalAttrs (hasHomePackage package) abbr);
in mkMerge [ in
# Default abbrs, always available mkMerge [
{ # Default abbrs, always available
# Shell basic {
c = "clear"; # Shell basic
q = "exit"; c = "clear";
q = "exit";
# Fish # Fish
h = batifyWithArgs "history" "-l fish"; # -l fish sets syntax highlighting to fish h = batifyWithArgs "history" "-l fish"; # -l fish sets syntax highlighting to fish
listabbrs = batifyWithArgs "abbr" "-l fish"; listabbrs = batifyWithArgs "abbr" "-l fish";
# tools # tools
cd = "z"; # zoxide for quickjump to previously visited locations cd = "z"; # zoxide for quickjump to previously visited locations
mkdir = "mkdir -p"; # also create parents (-p) mkdir = "mkdir -p"; # also create parents (-p)
blk = batify "lsblk -o NAME,LABEL,UUID,FSTYPE,SIZE,FSUSE%,MOUNTPOINT,MODEL"; blk = batify "lsblk -o NAME,LABEL,UUID,FSTYPE,SIZE,FSUSE%,MOUNTPOINT,MODEL";
grep = "grep --color=auto -E"; # grep with extended regex grep = "grep --color=auto -E"; # grep with extended regex
watch = "watch -d -c -n -0.5"; watch = "watch -d -c -n -0.5";
# systemd # systemd
failed = "systemctl --failed"; failed = "systemctl --failed";
errors = "journalctl -p 3 -xb"; errors = "journalctl -p 3 -xb";
kernelerrors = "journalctl -p 3 -xb -k"; kernelerrors = "journalctl -p 3 -xb -k";
uniterrors = "journalctl -xb --unit="; uniterrors = "journalctl -xb --unit=";
useruniterrors = "journalctl -xb --user-unit="; useruniterrors = "journalctl -xb --user-unit=";
# ssh locations # ssh locations
xxhamster = "TERM=ansi ssh christoph@217.160.142.51"; xxhamster = "TERM=ansi ssh christoph@217.160.142.51";
} }
# Abbrs only available if package is installed # Abbrs only available if package is installed
(abbrify pkgs.btop { top = "btop"; }) (abbrify pkgs.btop {top = "btop";})
(abbrify pkgs.duf { (abbrify pkgs.duf {
df = "duf"; df = "duf";
disksummary = "duf"; disksummary = "duf";
}) })
(abbrify pkgs.exa { (abbrify pkgs.exa {
ls = "exa --color always --group-directories-first -F --git --icons"; # color-ls ls = "exa --color always --group-directories-first -F --git --icons"; # color-ls
lsl = "exa --color always --group-directories-first -F -l --git --icons"; lsl = "exa --color always --group-directories-first -F -l --git --icons";
lsa = "exa --color always --group-directories-first -F -l -a --git --icons"; lsa = "exa --color always --group-directories-first -F -l -a --git --icons";
tre = "exa --color always --group-directories-first -F -T -L 2 ---icons"; tre = "exa --color always --group-directories-first -F -T -L 2 ---icons";
}) })
(abbrify pkgs.fd { find = "fd"; }) (abbrify pkgs.fd {find = "fd";})
(abbrify pkgs.fzf { fuzzy = "fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'"; }) (abbrify pkgs.fzf {fuzzy = "fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'";})
(abbrify pkgs.gdu { (abbrify pkgs.gdu {
du = "gdu"; du = "gdu";
storageanalysis = "gdu"; storageanalysis = "gdu";
}) })
(abbrify pkgs.git { (abbrify pkgs.git {
gs = "git status"; gs = "git status";
gcm = "git commit -m"; gcm = "git commit -m";
ga = "git add"; ga = "git add";
glg = "git log --graph --decorate --oneline"; glg = "git log --graph --decorate --oneline";
gcl = "git clone"; gcl = "git clone";
}) })
(abbrify pkgs.gping { ping = "gping"; }) (abbrify pkgs.gping {ping = "gping";})
(abbrify pkgs.lazygit { lg = "lazygit"; }) (abbrify pkgs.lazygit {lg = "lazygit";})
(abbrify pkgs.navi { n = "navi"; }) (abbrify pkgs.navi {n = "navi";})
(abbrify pkgs.notmuch { (abbrify pkgs.notmuch {
mailrefresh = "notmuch new"; mailrefresh = "notmuch new";
mailsearch = "notmuch search"; mailsearch = "notmuch search";
}) })
(abbrify pkgs.protonvpn-cli { (abbrify pkgs.protonvpn-cli {
vpnat = "protonvpn-cli c --cc at"; vpnat = "protonvpn-cli c --cc at";
vpnch = "protonvpn-cli c --cc ch"; vpnch = "protonvpn-cli c --cc ch";
vpnlu = "protonvpn-cli c --cc lu"; vpnlu = "protonvpn-cli c --cc lu";
vpnus = "protonvpn-cli c --cc us"; vpnus = "protonvpn-cli c --cc us";
vpnhk = "protonvpn-cli c --cc hk"; vpnhk = "protonvpn-cli c --cc hk";
vpnkr = "protonvpn-cli c --cc kr"; vpnkr = "protonvpn-cli c --cc kr";
vpnoff = "protonvpn-cli d"; vpnoff = "protonvpn-cli d";
}) })
(abbrify pkgs.ranger { r = "ranger --choosedir=$HOME/.rangerdir; set LASTDIR (cat $HOME/.rangerdir); cd $LASTDIR"; }) (abbrify pkgs.ranger {r = "ranger --choosedir=$HOME/.rangerdir; set LASTDIR (cat $HOME/.rangerdir); cd $LASTDIR";})
(abbrify pkgs.rsync { (abbrify pkgs.rsync {
cp = "rsync -ahv --inplace --partial --info=progress2"; cp = "rsync -ahv --inplace --partial --info=progress2";
rsync = "rsync -ahv --inplace --partial --info=progress2"; rsync = "rsync -ahv --inplace --partial --info=progress2";
}) })
(abbrify pkgs.sd { sed = "sd"; }) (abbrify pkgs.sd {sed = "sd";})
(abbrify pkgs.yt-dlp { (abbrify pkgs.yt-dlp {
mp4 = "yt-dlp -f 'bv*[ext=mp4]+ba[ext=m4a]/b[ext=mp4] / bv*+ba/b' --recode-video mp4"; # the -f options are yt-dlp defaults mp4 = "yt-dlp -f 'bv*[ext=mp4]+ba[ext=m4a]/b[ext=mp4] / bv*+ba/b' --recode-video mp4"; # the -f options are yt-dlp defaults
mp3 = "yt-dlp -f 'ba' --extract-audio --audio-format mp3"; mp3 = "yt-dlp -f 'ba' --extract-audio --audio-format mp3";
}) })
]; ];
shellInit = '' shellInit = ''
set -e fish_greeting set -e fish_greeting

View File

@ -1,191 +1,199 @@
{ config, nixosConfig, lib, mylib, pkgs, ... }: {
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib; with lib;
with mylib.modules; with mylib.modules;
# NOTE: The module is also used by other modules (gaming, audio). # NOTE: The module is also used by other modules (gaming, audio).
# It is important that every flatpak interaction is handled through this module # It is important that every flatpak interaction is handled through this module
# to prevent that anything is removed by a module although it is required by another one # to prevent that anything is removed by a module although it is required by another one
let
cfg = config.modules.flatpak;
in {
options.modules.flatpak = {
enable = mkEnableOpt "Flatpak module";
fontFix = mkBoolOpt true "Link fonts to ~/.local/share/fonts so flatpak apps can find them";
iconFix = mkBoolOpt true "Link icons to ~/.local/share/icons so flatpak apps can find them";
autoUpdate = mkBoolOpt false "Update flatpak apps on nixos-rebuild";
autoPrune = mkBoolOpt false "Remove unused packages on nixos-rebuild";
let # TODO: Add library function to make this easier
cfg = config.modules.flatpak; # TODO: The flatpak name should be included and a list of all enabled apps should be available
in { # TODO: Do this for strings + packages
options.modules.flatpak = { discord.enable = mkEnableOpt "Discord";
enable = mkEnableOpt "Flatpak module"; spotify.enable = mkEnableOpt "Spotify";
fontFix = mkBoolOpt true "Link fonts to ~/.local/share/fonts so flatpak apps can find them"; flatseal.enable = mkEnableOpt "Flatseal";
iconFix = mkBoolOpt true "Link icons to ~/.local/share/icons so flatpak apps can find them"; bottles.enable = mkEnableOpt "Bottles";
autoUpdate = mkBoolOpt false "Update flatpak apps on nixos-rebuild";
autoPrune = mkBoolOpt false "Remove unused packages on nixos-rebuild";
# TODO: Add library function to make this easier # This is mainly used by other modules to allow them to use flatpak packages
# TODO: The flatpak name should be included and a list of all enabled apps should be available extraInstall = mkOption {
# TODO: Do this for strings + packages type = types.listOf types.str;
discord.enable = mkEnableOpt "Discord"; default = [];
spotify.enable = mkEnableOpt "Spotify"; description = "Flatpaks that will be installed additionally";
flatseal.enable = mkEnableOpt "Flatseal"; };
bottles.enable = mkEnableOpt "Bottles";
# This is mainly used by other modules to allow them to use flatpak packages # This doesn't uninstall if any flatpak is still present in the extraInstall list
extraInstall = mkOption { extraRemove = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; default = [];
description = "Flatpaks that will be installed additionally"; description = "Flatpaks that will be removed additionally (use with extraInstall)";
};
extraOverride = mkOption {
type = types.listOf types.attrs;
default = [];
# TODO: Change the format to { "com.usebottles.bottles" = [ "~/Documents" "~/Downloads" ]; }
# TODO: This requires that the lists of the same key are being merged recursively, mkMerge would override the key
example = [{"com.usebottles.bottles" = "\${config.home.homeDirectory}/Documents";}];
description = "Additional overrides";
};
extraGlobalOverride = mkOption {
type = types.listOf types.str;
default = [];
example = ["\${config.home.homeDirectory}/Documents:ro"];
description = "Additional global overrides";
};
}; };
# This doesn't uninstall if any flatpak is still present in the extraInstall list config = mkIf cfg.enable {
extraRemove = mkOption { assertions = [
type = types.listOf types.str; {
default = [ ]; assertion = nixosConfig.services.flatpak.enable;
description = "Flatpaks that will be removed additionally (use with extraInstall)"; message = "Cannot use the flatpak module with flatpak disabled in nixos!";
}; }
extraOverride = mkOption {
type = types.listOf types.attrs;
default = [ ];
# TODO: Change the format to { "com.usebottles.bottles" = [ "~/Documents" "~/Downloads" ]; }
# TODO: This requires that the lists of the same key are being merged recursively, mkMerge would override the key
example = [ { "com.usebottles.bottles" = "\${config.home.homeDirectory}/Documents"; } ];
description = "Additional overrides";
};
extraGlobalOverride = mkOption {
type = types.listOf types.str;
default = [ ];
example = [ "\${config.home.homeDirectory}/Documents:ro" ];
description = "Additional global overrides";
};
};
config = mkIf cfg.enable {
assertions = [
{
assertion = nixosConfig.services.flatpak.enable;
message = "Cannot use the flatpak module with flatpak disabled in nixos!";
}
];
# NOTE: Is already set by flatpak.enable in configuration.nix
# xdg.systemDirs.data = [
# "/var/lib/flatpak/exports/share"
# "${home.homeDirectory}/.local/share/flatpak/exports/share"
# ];
# TODO: Currently it is not possible to define overrides for the same flatpak from different places
# TODO: Also only filesystem overrides are applied
home.file = let
# Specific overrides
# This generates the set { "<filename>" = "<overrides>"; }
concat_override = name: value:
(optionalAttrs (name != null) { ".local/share/flatpak/overrides/${name}".text = "[Context]\nfilesystems=${value}"; });
# This is a list of sets: [ { "<filename>" = "<overrides>"; } { "<filename>" = "<overrides>"; } ]
extra_overrides = (map (set: concat_override (attrName set) (attrValue set)) cfg.extraOverride);
# Global overrides
global_default_overrides = [
"/nix/store:ro"
# TODO: There are irregular problems with flatpak app font antialiasing, I don't know where it comes from or when
# Also some icons are missing, even when icon dir is accessible
# I remember I did something one time that fixed it, but what was it :(?
# NOTE: This doesn't help sadly, also steam can't launch with this because it wants to create a link to ~/.local/share/fonts?
# "${config.home.homeDirectory}/.local/share/icons"
# "${config.home.homeDirectory}/.local/share/fonts"
# TODO: These are not necessary (Really?)
# Make sure flatpaks are allowed to use the icons/fonts that are symlinked by icon/font fix
# "/run/current-system/sw/share/X11/fonts:ro"
# "/run/current-system/sw/share/icons:ro"
]; ];
global_overrides = builtins.concatLists [ global_default_overrides cfg.extraGlobalOverride ]; # NOTE: Is already set by flatpak.enable in configuration.nix
# xdg.systemDirs.data = [
# "/var/lib/flatpak/exports/share"
# "${home.homeDirectory}/.local/share/flatpak/exports/share"
# ];
str_global_overrides = builtins.concatStringsSep ";" global_overrides; # TODO: Currently it is not possible to define overrides for the same flatpak from different places
in mkMerge ([ # TODO: Also only filesystem overrides are applied
{ home.file = let
".local/share/flatpak/overrides/global".text = "[Context]\nfilesystems=${str_global_overrides}"; # Specific overrides
} # This generates the set { "<filename>" = "<overrides>"; }
] ++ extra_overrides); concat_override = name: value: (optionalAttrs (name != null) {".local/share/flatpak/overrides/${name}".text = "[Context]\nfilesystems=${value}";});
home.activation = mkMerge [ # This is a list of sets: [ { "<filename>" = "<overrides>"; } { "<filename>" = "<overrides>"; } ]
# We link like this to be able to address the absolute location, also the fonts won't get copied to store extra_overrides = map (set: concat_override (attrName set) (attrValue set)) cfg.extraOverride;
# NOTE: This path contains all the fonts because fonts.fontDir.enable is true
(mkIf cfg.fontFix {
linkFontDir = lib.hm.dag.entryAfter [ "writeBoundary" ]
(mkLink "/run/current-system/sw/share/X11/fonts" "${config.home.homeDirectory}/.local/share/fonts");
})
(mkElse cfg.fontFix {
unlinkFontDir = lib.hm.dag.entryAfter [ "writeBoundary" ]
(mkUnlink "${config.home.homeDirectory}/.local/share/fonts");
})
# Fixes missing icons + cursor # Global overrides
# NOTE: This path works because we have homeManager.useUserPackages = true (everything is stored in /etc/profiles/)
(mkIf cfg.iconFix {
linkIconDir = lib.hm.dag.entryAfter [ "writeBoundary" ]
(mkLink "/etc/profiles/per-user/christoph/share/icons" "${config.home.homeDirectory}/.local/share/icons");
})
(mkElse cfg.iconFix {
unlinkIconDir = lib.hm.dag.entryAfter [ "writeBoundary" ]
(mkUnlink "${config.home.homeDirectory}/.local/share/icons");
})
# TODO: I should find a smarter way than this to make it easy to add flatpak options global_default_overrides = [
{ "/nix/store:ro"
# TODO: Enable this block only if any flatpak is enabled
installFlatpaks = let
to_install = builtins.concatLists [
(optionals cfg.discord.enable [ "com.discordapp.Discord" ])
(optionals cfg.spotify.enable [ "com.spotify.Client" ])
(optionals cfg.flatseal.enable [ "com.github.tchx84.Flatseal" ])
(optionals cfg.bottles.enable [ "com.usebottles.bottles" ])
cfg.extraInstall
];
to_install_str = builtins.concatStringsSep " " to_install; # TODO: There are irregular problems with flatpak app font antialiasing, I don't know where it comes from or when
in # Also some icons are missing, even when icon dir is accessible
# I remember I did something one time that fixed it, but what was it :(?
# NOTE: This doesn't help sadly, also steam can't launch with this because it wants to create a link to ~/.local/share/fonts?
# "${config.home.homeDirectory}/.local/share/icons"
# "${config.home.homeDirectory}/.local/share/fonts"
# TODO: These are not necessary (Really?)
# Make sure flatpaks are allowed to use the icons/fonts that are symlinked by icon/font fix
# "/run/current-system/sw/share/X11/fonts:ro"
# "/run/current-system/sw/share/icons:ro"
];
global_overrides = builtins.concatLists [global_default_overrides cfg.extraGlobalOverride];
str_global_overrides = builtins.concatStringsSep ";" global_overrides;
in
mkMerge ([
{
".local/share/flatpak/overrides/global".text = "[Context]\nfilesystems=${str_global_overrides}";
}
]
++ extra_overrides);
home.activation = mkMerge [
# We link like this to be able to address the absolute location, also the fonts won't get copied to store
# NOTE: This path contains all the fonts because fonts.fontDir.enable is true
(mkIf cfg.fontFix {
linkFontDir =
lib.hm.dag.entryAfter ["writeBoundary"]
(mkLink "/run/current-system/sw/share/X11/fonts" "${config.home.homeDirectory}/.local/share/fonts");
})
(mkElse cfg.fontFix {
unlinkFontDir =
lib.hm.dag.entryAfter ["writeBoundary"]
(mkUnlink "${config.home.homeDirectory}/.local/share/fonts");
})
# Fixes missing icons + cursor
# NOTE: This path works because we have homeManager.useUserPackages = true (everything is stored in /etc/profiles/)
(mkIf cfg.iconFix {
linkIconDir =
lib.hm.dag.entryAfter ["writeBoundary"]
(mkLink "/etc/profiles/per-user/christoph/share/icons" "${config.home.homeDirectory}/.local/share/icons");
})
(mkElse cfg.iconFix {
unlinkIconDir =
lib.hm.dag.entryAfter ["writeBoundary"]
(mkUnlink "${config.home.homeDirectory}/.local/share/icons");
})
# TODO: I should find a smarter way than this to make it easy to add flatpak options
{
# TODO: Enable this block only if any flatpak is enabled
installFlatpaks = let
to_install = builtins.concatLists [
(optionals cfg.discord.enable ["com.discordapp.Discord"])
(optionals cfg.spotify.enable ["com.spotify.Client"])
(optionals cfg.flatseal.enable ["com.github.tchx84.Flatseal"])
(optionals cfg.bottles.enable ["com.usebottles.bottles"])
cfg.extraInstall
];
to_install_str = builtins.concatStringsSep " " to_install;
in
# Flatpak install can take a long time so we disconnect the process to not trigger the HM timeout (90s)
lib.hm.dag.entryAfter ["writeBoundary"] ''
sudo flatpak install -y ${to_install_str} &
'';
}
{
# TODO: Enable this block only if any flatpak is disabled
removeFlatpaks = let
to_remove = builtins.concatLists [
(optionals (!cfg.discord.enable) ["com.discordapp.Discord"])
(optionals (!cfg.spotify.enable) ["com.spotify.Client"])
(optionals (!cfg.flatseal.enable) ["com.github.tchx84.Flatseal"])
(optionals (!cfg.bottles.enable) ["com.usebottles.bottles"])
# Remove only the flatpaks that are not present in extraInstall
(without cfg.extraRemove cfg.extraInstall)
];
to_remove_str = builtins.concatStringsSep " " to_remove;
in
# By using || we make sure this command never throws any errors
# Uninstallation is fast so HM timeout shouldn't be triggered
lib.hm.dag.entryAfter ["writeBoundary"] ''
sudo flatpak uninstall -y ${to_remove_str} || echo "Nothing to be removed"
'';
}
(mkIf cfg.autoUpdate {
# Flatpak install can take a long time so we disconnect the process to not trigger the HM timeout (90s) # Flatpak install can take a long time so we disconnect the process to not trigger the HM timeout (90s)
lib.hm.dag.entryAfter [ "writeBoundary" ] '' updateFlatpak = lib.hm.dag.entryAfter ["writeBoundary"] ''
sudo flatpak install -y ${to_install_str} & sudo flatpak update -y &
''; '';
} })
{ # Execute this after flatpak removal as there can be leftovers
# TODO: Enable this block only if any flatpak is disabled (mkIf cfg.autoPrune {
removeFlatpaks = let pruneFlatpak = lib.hm.dag.entryAfter ["writeBoundary" "removeFlatpak"] ''
to_remove = builtins.concatLists [ sudo flatpak uninstall --unused -y
(optionals (!cfg.discord.enable) [ "com.discordapp.Discord" ])
(optionals (!cfg.spotify.enable) [ "com.spotify.Client" ])
(optionals (!cfg.flatseal.enable) [ "com.github.tchx84.Flatseal" ])
(optionals (!cfg.bottles.enable) [ "com.usebottles.bottles" ])
# Remove only the flatpaks that are not present in extraInstall
(without cfg.extraRemove cfg.extraInstall)
];
to_remove_str = builtins.concatStringsSep " " to_remove;
in
# By using || we make sure this command never throws any errors
# Uninstallation is fast so HM timeout shouldn't be triggered
lib.hm.dag.entryAfter [ "writeBoundary" ] ''
sudo flatpak uninstall -y ${to_remove_str} || echo "Nothing to be removed"
''; '';
} })
];
(mkIf cfg.autoUpdate { };
# Flatpak install can take a long time so we disconnect the process to not trigger the HM timeout (90s) }
updateFlatpak = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
sudo flatpak update -y &
'';
})
# Execute this after flatpak removal as there can be leftovers
(mkIf cfg.autoPrune {
pruneFlatpak = lib.hm.dag.entryAfter [ "writeBoundary" "removeFlatpak" ] ''
sudo flatpak uninstall --unused -y
'';
})
];
};
}

View File

@ -1,9 +1,12 @@
{ config, lib, mylib, pkgs, ... }: {
config,
lib,
mylib,
pkgs,
...
}:
with lib; with lib;
with mylib.modules; with mylib.modules; let
let
cfg = config.modules.gaming; cfg = config.modules.gaming;
cfgfp = config.modules.flatpak; cfgfp = config.modules.flatpak;
in { in {
@ -50,26 +53,27 @@ in {
}) })
]; ];
home.packages = with pkgs; builtins.concatLists [ home.packages = with pkgs;
[ builtins.concatLists [
gamemode # gamemode should be always enabled (could also be enabled by audio module) [
oversteer # TODO: Make option gamemode # gamemode should be always enabled (could also be enabled by audio module)
# Sometimes needed for Proton prefix shenenigans (for AC etc.), but probably only works with Protontricks only so disable for now... oversteer # TODO: Make option
# wine64 # TODO: Make option or dependant on protontricks? # Sometimes needed for Proton prefix shenenigans (for AC etc.), but probably only works with Protontricks only so disable for now...
] # wine64 # TODO: Make option or dependant on protontricks?
]
# TODO: Extra config (extensions etc) in chromium module # TODO: Extra config (extensions etc) in chromium module
(optionals cfg.discordChromium.enable [ chromium ]) (optionals cfg.discordChromium.enable [chromium])
# Prefer flatpak version as nixpkgs version isn't always updated in time # Prefer flatpak version as nixpkgs version isn't always updated in time
(optionals cfg.discordElectron.enable [ discord ]) (optionals cfg.discordElectron.enable [discord])
(optionals cfg.steam.adwaita [ adwaita-for-steam ]) (optionals cfg.steam.adwaita [adwaita-for-steam])
# Prefer flatpak version as this one doesn't find the STEAM_DIR automatically # Prefer flatpak version as this one doesn't find the STEAM_DIR automatically
# (optionals cfg.steam.enable [ protontricks ]) # (optionals cfg.steam.enable [ protontricks ])
(optionals cfg.dwarffortress.enable [ dwarf-fortress-packages.dwarf-fortress-full ]) (optionals cfg.dwarffortress.enable [dwarf-fortress-packages.dwarf-fortress-full])
]; ];
# This doesn't work because steam doesn't detect symlinked skins, files have to be copied # This doesn't work because steam doesn't detect symlinked skins, files have to be copied
# https://github.com/ValveSoftware/steam-for-linux/issues/3572 # https://github.com/ValveSoftware/steam-for-linux/issues/3572
@ -84,7 +88,7 @@ in {
# ]; # ];
home.activation = mkMerge [ home.activation = mkMerge [
(optionalAttrs cfg.steam.adwaita { (optionalAttrs cfg.steam.adwaita {
copySteamAdwaitaSkin = hm.dag.entryAfter [ "writeBoundary" ] '' copySteamAdwaitaSkin = hm.dag.entryAfter ["writeBoundary"] ''
if [ ! -d ${config.home.homeDirectory}/.var/app/com.valvesoftware.Steam/.local/share/Steam/skins ]; then if [ ! -d ${config.home.homeDirectory}/.var/app/com.valvesoftware.Steam/.local/share/Steam/skins ]; then
mkdir ${config.home.homeDirectory}/.var/app/com.valvesoftware.Steam/.local/share/Steam/skins mkdir ${config.home.homeDirectory}/.var/app/com.valvesoftware.Steam/.local/share/Steam/skins
fi fi
@ -100,7 +104,7 @@ in {
}) })
(optionalAttrs (! cfg.steam.adwaita) { (optionalAttrs (! cfg.steam.adwaita) {
deleteSteamAdwaitaSkin = hm.dag.entryAfter [ "writeBoundary" ] '' deleteSteamAdwaitaSkin = hm.dag.entryAfter ["writeBoundary"] ''
rm -rf ${config.home.homeDirectory}/.var/app/com.valvesoftware.Steam/.local/share/Steam/skins/Adwaita rm -rf ${config.home.homeDirectory}/.var/app/com.valvesoftware.Steam/.local/share/Steam/skins/Adwaita
''; '';
}) })
@ -112,7 +116,7 @@ in {
icon = "discord"; icon = "discord";
exec = "chromium --new-window discord.com/app"; exec = "chromium --new-window discord.com/app";
terminal = false; terminal = false;
categories = [ "Network" "Chat" ]; categories = ["Network" "Chat"];
}; };
# NOTE: Important to not disable this option if another module enables it # NOTE: Important to not disable this option if another module enables it
@ -152,8 +156,8 @@ in {
# "com.valvesoftware.Steam.CompatibilityTool.Proton-GE" # "com.valvesoftware.Steam.CompatibilityTool.Proton-GE"
"net.davidotek.pupgui2" "net.davidotek.pupgui2"
]) ])
(optionals (cfg.steam.enable && cfg.steam.gamescope) [ "com.valvesoftware.Steam.Utility.gamescope" ]) (optionals (cfg.steam.enable && cfg.steam.gamescope) ["com.valvesoftware.Steam.Utility.gamescope"])
(optionals cfg.prism.enable [ "org.prismlauncher.PrismLauncher" ]) (optionals cfg.prism.enable ["org.prismlauncher.PrismLauncher"])
]; ];
modules.flatpak.extraRemove = builtins.concatLists [ modules.flatpak.extraRemove = builtins.concatLists [
@ -168,8 +172,8 @@ in {
# "com.valvesoftware.Steam.CompatibilityTool.Proton-GE" # "com.valvesoftware.Steam.CompatibilityTool.Proton-GE"
"net.davidotek.pupgui2" "net.davidotek.pupgui2"
]) ])
(optionals (!cfg.steam.enable || !cfg.steam.gamescope) [ "com.valvesoftware.Steam.Utility.gamescope" ]) (optionals (!cfg.steam.enable || !cfg.steam.gamescope) ["com.valvesoftware.Steam.Utility.gamescope"])
(optionals (!cfg.prism.enable) [ "org.prismlauncher.PrismLauncher" ]) (optionals (!cfg.prism.enable) ["org.prismlauncher.PrismLauncher"])
]; ];
}; };
} }

View File

@ -1,12 +1,15 @@
{ config, nixosConfig, lib, mylib, pkgs, ... }: {
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib; with lib;
with mylib.modules; with mylib.modules; let
let
cfg = config.modules.gnome; cfg = config.modules.gnome;
in { in {
options.modules.gnome = { options.modules.gnome = {
enable = mkEnableOpt "Gnome Desktop"; enable = mkEnableOpt "Gnome Desktop";
# TODO: Add option for dash-to-dock # TODO: Add option for dash-to-dock
@ -40,7 +43,7 @@ in {
]; ];
gtk = mkMerge [ gtk = mkMerge [
{ enable = true; } {enable = true;}
(optionalAttrs cfg.theme.papirusIcons { (optionalAttrs cfg.theme.papirusIcons {
iconTheme.package = pkgs.papirus-icon-theme; iconTheme.package = pkgs.papirus-icon-theme;
@ -60,42 +63,43 @@ in {
}) })
]; ];
home.packages = with pkgs; builtins.concatLists [ home.packages = with pkgs;
[ builtins.concatLists [
# gnome.gnome-session # Allow to start gnome from tty (sadly this is not usable, many things don't work) [
gnome.gnome-boxes # VM # gnome.gnome-session # Allow to start gnome from tty (sadly this is not usable, many things don't work)
# gnome.sushi # Gnome files previews (use service, has to be added to dbus packages) gnome.gnome-boxes # VM
gnome.gnome-logs # systemd log viewer # gnome.sushi # Gnome files previews (use service, has to be added to dbus packages)
gnome.gnome-tweaks # conflicts with nixos/hm gnome settings file sometimes, watch out what settings to change gnome.gnome-logs # systemd log viewer
gnome.gnome-nettool gnome.gnome-tweaks # conflicts with nixos/hm gnome settings file sometimes, watch out what settings to change
gnome.simple-scan gnome.gnome-nettool
gnome.gnome-sound-recorder gnome.simple-scan
gnome.file-roller # archive manager gnome.gnome-sound-recorder
# gnome.dconf-editor gnome.file-roller # archive manager
dconf-editor-wrapped # Sets XDG_DATA_DIRS to include all gsettings-schemas # gnome.dconf-editor
gsettings-desktop-schemas dconf-editor-wrapped # Sets XDG_DATA_DIRS to include all gsettings-schemas
# gnome-usage # Alternative system performance monitor (gnome.gnome-system-monitor is the preinstalled one) gsettings-desktop-schemas
# gnome-secrets # Alternative keepass database viewer # gnome-usage # Alternative system performance monitor (gnome.gnome-system-monitor is the preinstalled one)
gnome-firmware # gnome-secrets # Alternative keepass database viewer
] gnome-firmware
]
(optionals cfg.extensions [ (optionals cfg.extensions [
gnomeExtensions.appindicator gnomeExtensions.appindicator
gnomeExtensions.auto-activities gnomeExtensions.auto-activities
gnomeExtensions.blur-my-shell gnomeExtensions.blur-my-shell
gnomeExtensions.custom-hot-corners-extended gnomeExtensions.custom-hot-corners-extended
gnomeExtensions.extensions-sync gnomeExtensions.extensions-sync
gnomeExtensions.gamemode gnomeExtensions.gamemode
gnomeExtensions.launch-new-instance gnomeExtensions.launch-new-instance
gnomeExtensions.maximize-to-empty-workspace gnomeExtensions.maximize-to-empty-workspace
gnomeExtensions.no-overview gnomeExtensions.no-overview
gnomeExtensions.pip-on-top gnomeExtensions.pip-on-top
gnomeExtensions.rounded-window-corners gnomeExtensions.rounded-window-corners
gnomeExtensions.sound-output-device-chooser gnomeExtensions.sound-output-device-chooser
gnomeExtensions.tweaks-in-system-menu gnomeExtensions.tweaks-in-system-menu
gnomeExtensions.vitals gnomeExtensions.vitals
]) ])
]; ];
# TODO: Check what gnome-tweaks sets # TODO: Check what gnome-tweaks sets
dconf.settings = with lib.hm.gvariant; { dconf.settings = with lib.hm.gvariant; {
@ -216,7 +220,7 @@ in {
}; };
"org/gnome/nautilus/icon-view" = { "org/gnome/nautilus/icon-view" = {
captions = [ "size" "date_modified" "none" ]; captions = ["size" "date_modified" "none"];
default-zoom-level = "larger"; default-zoom-level = "larger";
}; };
@ -254,28 +258,29 @@ in {
"drive-menu@gnome-shell-extensions.gcampax.github.com" "drive-menu@gnome-shell-extensions.gcampax.github.com"
"user-theme@gnome-shell-extensions.gcampax.github.com" "user-theme@gnome-shell-extensions.gcampax.github.com"
]; ];
enabled-extensions = with pkgs; builtins.concatLists [ enabled-extensions = with pkgs;
[ builtins.concatLists [
"workspace-indicator@gnome-shell-extensions.gcampax.github.com" [
] "workspace-indicator@gnome-shell-extensions.gcampax.github.com"
]
(optionals cfg.extensions [ (optionals cfg.extensions [
gnomeExtensions.appindicator.extensionUuid gnomeExtensions.appindicator.extensionUuid
gnomeExtensions.auto-activities.extensionUuid gnomeExtensions.auto-activities.extensionUuid
gnomeExtensions.blur-my-shell.extensionUuid gnomeExtensions.blur-my-shell.extensionUuid
gnomeExtensions.custom-hot-corners-extended.extensionUuid gnomeExtensions.custom-hot-corners-extended.extensionUuid
gnomeExtensions.extensions-sync.extensionUuid gnomeExtensions.extensions-sync.extensionUuid
gnomeExtensions.gamemode.extensionUuid gnomeExtensions.gamemode.extensionUuid
gnomeExtensions.launch-new-instance.extensionUuid gnomeExtensions.launch-new-instance.extensionUuid
gnomeExtensions.maximize-to-empty-workspace.extensionUuid gnomeExtensions.maximize-to-empty-workspace.extensionUuid
gnomeExtensions.no-overview.extensionUuid gnomeExtensions.no-overview.extensionUuid
gnomeExtensions.pip-on-top.extensionUuid gnomeExtensions.pip-on-top.extensionUuid
gnomeExtensions.rounded-window-corners.extensionUuid gnomeExtensions.rounded-window-corners.extensionUuid
gnomeExtensions.sound-output-device-chooser.extensionUuid gnomeExtensions.sound-output-device-chooser.extensionUuid
gnomeExtensions.tweaks-in-system-menu.extensionUuid gnomeExtensions.tweaks-in-system-menu.extensionUuid
gnomeExtensions.vitals.extensionUuid gnomeExtensions.vitals.extensionUuid
]) ])
]; ];
}; };
"org/gnome/shell/app-switcher" = { "org/gnome/shell/app-switcher" = {
@ -310,7 +315,7 @@ in {
fixed-widths = true; fixed-widths = true;
hide-icons = false; hide-icons = false;
hide-zeros = false; hide-zeros = false;
hot-sensors = [ "__network-rx_max__" ]; hot-sensors = ["__network-rx_max__"];
position-in-panel = 2; position-in-panel = 2;
show-battery = false; show-battery = false;
show-fan = false; show-fan = false;

View File

@ -1,13 +1,16 @@
{ config, nixosConfig, lib, mylib, pkgs, ... }: {
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib; with lib;
with mylib.modules; with mylib.modules; let
let
cfg = config.modules.kitty; cfg = config.modules.kitty;
# cfgnv = config.modules.neovim; # cfgnv = config.modules.neovim;
in { in {
options.modules.kitty = { options.modules.kitty = {
enable = mkEnableOpt "Kitty"; enable = mkEnableOpt "Kitty";
}; };
@ -30,7 +33,7 @@ in {
# Light Theme # Light Theme
# background = "#f7f7f7"; # background = "#f7f7f7";
# foreground = "#494542"; # foreground = "#39FF14"; # Matrix green because I'm a master hacker
# selection_background = "#a4a1a1"; # selection_background = "#a4a1a1";
# selection_foreground = "#f7f7f7"; # selection_foreground = "#f7f7f7";
# cursor = "#494542"; # cursor = "#494542";

View File

@ -1,9 +1,13 @@
{ config, nixosConfig, lib, mylib, pkgs, ... }: {
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib; with lib;
with mylib.modules; with mylib.modules; let
let
cfg = config.modules.misc; cfg = config.modules.misc;
in { in {
options.modules.misc = { options.modules.misc = {
@ -21,11 +25,11 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = with pkgs;
home.packages = with pkgs; builtins.concatLists [ builtins.concatLists [
(optionals cfg.keepass.enable [ keepassxc ]) (optionals cfg.keepass.enable [keepassxc])
(optionals cfg.protonmail.enable [ protonmail-bridge ]) (optionals cfg.protonmail.enable [protonmail-bridge])
]; ];
systemd.user.services = mkMerge [ systemd.user.services = mkMerge [
(optionalAttrs (cfg.keepass.enable && cfg.keepass.autostart) { (optionalAttrs (cfg.keepass.enable && cfg.keepass.autostart) {

View File

@ -1,12 +1,15 @@
{ config, nixosConfig, lib, mylib, pkgs, ... }: {
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib; with lib;
with mylib.modules; with mylib.modules; let
let
cfg = config.modules.neovim; cfg = config.modules.neovim;
in { in {
options.modules.neovim = { options.modules.neovim = {
enable = mkEnableOpt "NeoVim"; enable = mkEnableOpt "NeoVim";
alias = mkBoolOpt false "Link nvim to vim/vi"; alias = mkBoolOpt false "Link nvim to vim/vi";
@ -70,7 +73,7 @@ in {
} }
{ {
plugin = (nvim-treesitter.withPlugins (plugins: pkgs.tree-sitter.allGrammars)); plugin = nvim-treesitter.withPlugins (plugins: pkgs.tree-sitter.allGrammars);
config = '' config = ''
lua << EOF lua << EOF
require('nvim-treesitter.configs').setup { require('nvim-treesitter.configs').setup {

View File

@ -1,15 +1,16 @@
# Changed from https://github.com/nix-community/home-manager/blob/master/modules/services/nextcloud-client.nix # Changed from https://github.com/nix-community/home-manager/blob/master/modules/services/nextcloud-client.nix
# I use this instead of the HM module as the autostart wasn't working there # I use this instead of the HM module as the autostart wasn't working there
# TODO: Check the HM module again if anything changed, as this has also stopped working # TODO: Check the HM module again if anything changed, as this has also stopped working
# Nextcloud immediately crashes on start, autostart isn't working either... # Nextcloud immediately crashes on start, autostart isn't working either...
{
{ config, lib, mylib, pkgs, ... }: config,
lib,
mylib,
pkgs,
...
}:
with lib; with lib;
with mylib.modules; with mylib.modules; let
let
cfg = config.modules.nextcloud; cfg = config.modules.nextcloud;
in { in {
options.modules.nextcloud = { options.modules.nextcloud = {
@ -26,7 +27,7 @@ in {
]; ];
# I want to have nextcloud-client in the path when the module is enabled # I want to have nextcloud-client in the path when the module is enabled
home.packages = with pkgs; [ nextcloud-client ]; home.packages = with pkgs; [nextcloud-client];
# TODO: Disable only for plasma # TODO: Disable only for plasma
# systemd.user.services = (mkIf cfg.autostart) { # systemd.user.services = (mkIf cfg.autostart) {

View File

@ -1,21 +1,20 @@
# TODO: KDE Connect config # TODO: KDE Connect config
# TODO: Plasma Configuration (https://github.com/pjones/plasma-manager) # TODO: Plasma Configuration (https://github.com/pjones/plasma-manager)
{
{ config, lib, mylib, pkgs, ... }: config,
lib,
mylib,
pkgs,
...
}:
with lib; with lib;
with mylib.modules; with mylib.modules; let
let
cfg = config.modules.plasma; cfg = config.modules.plasma;
in { in {
options.modules.plasma = { options.modules.plasma = {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = with pkgs; [];
home.packages = with pkgs; [ ];
}; };
} }

View File

@ -1,63 +1,79 @@
{ config, nixosConfig, lib, mylib, pkgs, ... }: {
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib; with lib;
with mylib.modules; with mylib.modules; let
let
cfg = config.modules.ranger; cfg = config.modules.ranger;
in { in {
options.modules.ranger = { options.modules.ranger = {
enable = mkEnableOpt "Ranger"; enable = mkEnableOpt "Ranger";
preview = mkBoolOpt false "Enable Ranger image preview"; preview = mkBoolOpt false "Enable Ranger image preview";
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = with pkgs; lib.concatLists [ home.packages = with pkgs;
[ lib.concatLists [
ranger [
atool ranger
p7zip atool
zip p7zip
unzip zip
unrar unzip
libarchive unrar
exiftool libarchive
mediainfo exiftool
] mediainfo
]
(optionals cfg.preview [ (optionals cfg.preview [
# ueberzug # Only X11 # ueberzug # Only X11
python310Packages.pillow # TODO: Conflicts with global python?
ffmpegthumbnailer python310Packages.pillow
imagemagick ffmpegthumbnailer
poppler_utils imagemagick
]) poppler_utils
]; ])
];
home.file = mkMerge [ home.file = mkMerge [
{ {
".config/ranger/rc.conf".text = let ".config/ranger/rc.conf".text = let
# TODO: Why does mkMerge don't work here? # TODO: Why does mkMerge don't work here?
settings = { settings =
column_ratios = "1,1"; {
vcs_aware = "true"; column_ratios = "1,1";
preview_images_method = "kitty"; # TODO: Only if kitty enabled vcs_aware = "true";
unicode_ellipsis = "true"; preview_images_method = "kitty"; # TODO: Only if kitty enabled
draw_borders = (if cfg.preview then "none" else "both"); # doesn't work well with preview unicode_ellipsis = "true";
line_numbers = "relative"; draw_borders =
preview_images = (if cfg.preview then "true" else "false"); if cfg.preview
use_preview_script = (if cfg.preview then "true" else "false"); then "none"
} // (optionalAttrs cfg.preview { else "both"; # doesn't work well with preview
preview_script = "${config.home.homeDirectory}/.config/ranger/scope.sh"; line_numbers = "relative";
}); preview_images =
if cfg.preview
then "true"
else "false";
use_preview_script =
if cfg.preview
then "true"
else "false";
}
// (optionalAttrs cfg.preview {
preview_script = "${config.home.homeDirectory}/.config/ranger/scope.sh";
});
# The settings { column_ratios = "1,1"; } get turned into { column_ratios = "set column_ratios = 1,1"; } # The settings { column_ratios = "1,1"; } get turned into { column_ratios = "set column_ratios = 1,1"; }
settings_in_values = mapAttrs (name: value: concatStringsSep " " ["set" name value]) settings; settings_in_values = mapAttrs (name: value: concatStringsSep " " ["set" name value]) settings;
settings_list = attrValues settings_in_values; # Results in [ "set column_rations = 1,1" ] settings_list = attrValues settings_in_values; # Results in [ "set column_rations = 1,1" ]
settings_str = concatStringsSep "\n" settings_list; settings_str = concatStringsSep "\n" settings_list;
in
in settings_str; settings_str;
} }
(optionalAttrs cfg.preview { (optionalAttrs cfg.preview {

View File

@ -1,6 +1,9 @@
{ inputs, pkgs, lib, ... }:
{ {
nixos = import ./nixos.nix { inherit inputs pkgs lib; }; inputs,
modules = import ./modules.nix { inherit inputs pkgs lib; }; pkgs,
lib,
...
}: {
nixos = import ./nixos.nix {inherit inputs pkgs lib;};
modules = import ./modules.nix {inherit inputs pkgs lib;};
} }

View File

@ -1,25 +1,26 @@
{ inputs, pkgs, lib, ... }: {
inputs,
rec { pkgs,
lib,
...
}: rec {
# Conveniance wrapper for mkOption with boolean type # Conveniance wrapper for mkOption with boolean type
mkBoolOpt = def: desc: mkBoolOpt = def: desc:
lib.mkOption { lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = def; default = def;
description = desc; description = desc;
}; };
# Alias for consistency # Alias for consistency
mkEnableOpt = lib.mkEnableOption; mkEnableOpt = lib.mkEnableOption;
# Like mkIf but the predicate is inverted # Like mkIf but the predicate is inverted
mkElse = pred: do: mkElse = pred: do: (lib.mkIf (!pred) do);
(lib.mkIf (!pred) do);
# Creates a symlink if it doesn't exist # Creates a symlink if it doesn't exist
# If it exists renew the link # If it exists renew the link
mkLink = src: dest: mkLink = src: dest: ''
''
if [ -L "${dest}" ]; then if [ -L "${dest}" ]; then
rm ${dest} rm ${dest}
fi fi
@ -27,40 +28,43 @@ rec {
''; '';
# Removes a symlink if it exists # Removes a symlink if it exists
mkUnlink = dest: mkUnlink = dest: ''
''
if [ -L "${dest}" ]; then if [ -L "${dest}" ]; then
rm ${dest} rm ${dest}
fi fi
''; '';
# TODO # TODO
mkMultiOptStr = { }: mkMultiOptStr = {}: {
{
}; };
# TODO # TODO
mkMultiOptPkg = { }: mkMultiOptPkg = {}: {
{
}; };
# Returns true if base contains element # Returns true if base contains element
contains = base: element: contains = base: element:
lib.any (x: x == element) base; lib.any (x: x == element) base;
# Returns base without occurences of elements that are also in remove # Returns base without occurences of elements that are also in remove
without = base: remove: without = base: remove:
lib.filter (x: !(contains remove x)) base; lib.filter (x: !(contains remove x)) base;
# For use with single element sets # For use with single element sets
attrName = set: let attrName = set: let
names = lib.attrNames set; names = lib.attrNames set;
in (if (names != [ ]) then (lib.head names) else null); in (
if (names != [])
then (lib.head names)
else null
);
# For use with single element sets # For use with single element sets
attrValue = set: let attrValue = set: let
values = lib.attrValues set; values = lib.attrValues set;
in (if (values != [ ]) then (lib.head values) else null); in (
if (values != [])
then (lib.head values)
else null
);
} }

View File

@ -1,47 +1,56 @@
{ inputs, pkgs, lib, ... }: {
inputs,
let pkgs,
lib,
...
}: let
inherit (inputs) home-manager; inherit (inputs) home-manager;
in { in {
mkNixosConfig = { system ? "x86_64-linux", mylib, hostname, username ? "christoph", extraModules ? [ ] }: mkNixosConfig = {
lib.nixosSystem { system ? "x86_64-linux",
inherit system; mylib,
hostname,
username ? "christoph",
extraModules ? [],
}:
lib.nixosSystem {
inherit system;
# Make our inputs available to the configuration.nix (for importing modules) # Make our inputs available to the configuration.nix (for importing modules)
# specialArgs are propagated to all modules # specialArgs are propagated to all modules
specialArgs = { inherit inputs hostname username mylib; }; specialArgs = {inherit inputs hostname username mylib;};
modules = builtins.concatLists [ modules = builtins.concatLists [
[ [
# Replace the pkgs to include overlays/unfree # Replace the pkgs to include overlays/unfree
{ nixpkgs.pkgs = pkgs; } {nixpkgs.pkgs = pkgs;}
# Main config file for all configs/hosts # Main config file for all configs/hosts
../system ../system
] ]
extraModules extraModules
# I included the home config statically like this as I am the only user # I included the home config statically like this as I am the only user
# I would have liked to make it more flexible (for multiple users on the same host) # I would have liked to make it more flexible (for multiple users on the same host)
# but I failed because nix stopped autoinjecting the required arguments and I didn't # but I failed because nix stopped autoinjecting the required arguments and I didn't
# know how to handle that... # know how to handle that...
[ [
home-manager.nixosModules.home-manager { home-manager.nixosModules.home-manager
# extraSpecialArgs are propagated to all hm config modules {
home-manager.extraSpecialArgs = { inherit inputs hostname username mylib; }; # extraSpecialArgs are propagated to all hm config modules
home-manager.extraSpecialArgs = {inherit inputs hostname username mylib;};
# Use systems pkgs, disables nixpkgs.* options in home.nix # Use systems pkgs, disables nixpkgs.* options in home.nix
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
# Enable installing packages through users.christoph.packages to /etc/profiles instead of ~/.nix-profile # Enable installing packages through users.christoph.packages to /etc/profiles instead of ~/.nix-profile
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
# User specific config file # User specific config file
home-manager.users.${username}.imports = [ ../home/${username} ]; home-manager.users.${username}.imports = [../home/${username}];
} }
] ]
]; ];
}; };
} }

View File

@ -1,18 +1,23 @@
{ inputs, nixpkgs, ... }: {
inputs,
let nixpkgs,
...
}: let
# Taken from https://github.com/Misterio77/nix-config/blob/main/overlay/default.nix # Taken from https://github.com/Misterio77/nix-config/blob/main/overlay/default.nix
# By specifying this we can just add our derivation to derivations/default.nix and it will land here # By specifying this we can just add our derivation to derivations/default.nix and it will land here
additions = final: prev: import ../derivations { inherit inputs; pkgs = final; }; additions = final: prev:
import ../derivations {
inherit inputs;
pkgs = final;
};
modifications = final: prev: rec { modifications = final: prev: rec {
# dconf-editor-wrapped = import ./dconf-editor.nix { inherit final prev; }; # Only kept as an example, has nothing to do with current dconf-editor-wrapped derivation # dconf-editor-wrapped = import ./dconf-editor.nix { inherit final prev; }; # Only kept as an example, has nothing to do with current dconf-editor-wrapped derivation
# Use dconf-editor.nix: { final, prev }: final.<package>.overrideAttrs (oldAttrs: { ... }) or sth similar # Use dconf-editor.nix: { final, prev }: final.<package>.overrideAttrs (oldAttrs: { ... }) or sth similar
}; };
in in
# TODO: I have absolutely no clue what happens here lol # TODO: I have absolutely no clue what happens here lol
# Basically we need some sort of list of all overlays that can be imported from the flake # Basically we need some sort of list of all overlays that can be imported from the flake
# in the overlays = [ ... ] section of the pkgs = import nixpkgs { ... } configuration # in the overlays = [ ... ] section of the pkgs = import nixpkgs { ... } configuration
# Somehow this library function turns additions/modifications into that # Somehow this library function turns additions/modifications into that
nixpkgs.lib.composeManyExtensions [ additions modifications ] nixpkgs.lib.composeManyExtensions [additions modifications]

View File

@ -1,5 +1,4 @@
{ pkgs }: {pkgs}:
pkgs.devshell.mkShell { pkgs.devshell.mkShell {
name = "NixFlake Shell"; name = "NixFlake Shell";

View File

@ -1,13 +1,16 @@
# WARN: this file will get overwritten by $ cachix use <name> # WARN: this file will get overwritten by $ cachix use <name>
{ pkgs, lib, ... }: {
pkgs,
let lib,
...
}: let
folder = ./cachix; folder = ./cachix;
toImport = name: value: folder + ("/" + name); toImport = name: value: folder + ("/" + name);
filterCaches = key: value: value == "regular" && lib.hasSuffix ".nix" key; filterCaches = key: value: value == "regular" && lib.hasSuffix ".nix" key;
imports = lib.mapAttrsToList toImport imports =
lib.mapAttrsToList toImport
(lib.filterAttrs filterCaches (builtins.readDir folder)); (lib.filterAttrs filterCaches (builtins.readDir folder));
in { in {
inherit imports; inherit imports;
nix.settings.substituters = [ "https://cache.nixos.org/" ]; nix.settings.substituters = ["https://cache.nixos.org/"];
} }

View File

@ -1,4 +1,3 @@
{ {
nix.settings = { nix.settings = {
substituters = [ substituters = [

View File

@ -1,10 +1,15 @@
# Edit this configuration file to define what should be installed on # Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help). # and in the NixOS manual (accessible by running nixos-help).
{ inputs, hostname, lib, mylib, config, pkgs, ... }:
{ {
inputs,
hostname,
lib,
mylib,
config,
pkgs,
...
}: {
imports = [ imports = [
# Import the host-specific system config # Import the host-specific system config
./${hostname} ./${hostname}
@ -19,7 +24,7 @@
experimental-features = nix-command flakes experimental-features = nix-command flakes
''; '';
settings.trusted-users = [ "root" "christoph" ]; settings.trusted-users = ["root" "christoph"];
# Keep nix-shell from garbage collection for direnv (keep-outputs + keep-derivations) # Keep nix-shell from garbage collection for direnv (keep-outputs + keep-derivations)
# NOTE: nix-direnv use nix or use flake should do this automatically # NOTE: nix-direnv use nix or use flake should do this automatically
@ -35,13 +40,13 @@
# This will add your inputs as registries, making operations with them (such # This will add your inputs as registries, making operations with them (such
# as nix shell nixpkgs#name) consistent with your flake inputs. # as nix shell nixpkgs#name) consistent with your flake inputs.
# (Registry contains flakes) # (Registry contains flakes)
registry = lib.mapAttrs' (n: v: lib.nameValuePair n { flake = v; }) inputs; registry = lib.mapAttrs' (n: v: lib.nameValuePair n {flake = v;}) inputs;
}; };
# Bootloader/Kernel stuff # Bootloader/Kernel stuff
boot = { boot = {
kernelPackages = pkgs.linuxPackages_zen; kernelPackages = pkgs.linuxPackages_zen;
kernelParams = [ "mitigations=off" ]; kernelParams = ["mitigations=off"];
# plymouth.enable = true; # plymouth.enable = true;
loader.systemd-boot.enable = true; loader.systemd-boot.enable = true;
@ -63,7 +68,7 @@
sudo.enable = true; sudo.enable = true;
sudo.extraRules = [ sudo.extraRules = [
{ {
users = [ "christoph" ]; users = ["christoph"];
commands = [ commands = [
# Launch gamemode without password because it is annoying # Launch gamemode without password because it is annoying
# { # {
@ -78,7 +83,7 @@
# We allow running flatpak without password so flatpaks can be installed from the hm config (needs sudo) # We allow running flatpak without password so flatpaks can be installed from the hm config (needs sudo)
{ {
command = "/run/current-system/sw/bin/flatpak"; command = "/run/current-system/sw/bin/flatpak";
options = [ "SETENV" "NOPASSWD" ]; options = ["SETENV" "NOPASSWD"];
} }
]; ];
} }
@ -104,7 +109,7 @@
}; };
# https://github.com/NixOS/nixpkgs/issues/179486 # https://github.com/NixOS/nixpkgs/issues/179486
i18n.supportedLocales = [ "en_US.UTF-8/UTF-8" "de_DE.UTF-8/UTF-8" ]; i18n.supportedLocales = ["en_US.UTF-8/UTF-8" "de_DE.UTF-8/UTF-8"];
# TODO: Other ports (tcp/udp/ssh...)? # TODO: Other ports (tcp/udp/ssh...)?
# Open ports in the firewall. # Open ports in the firewall.
@ -121,10 +126,9 @@
# Enable networking # Enable networking
networkmanager.enable = true; networkmanager.enable = true;
firewall.enable = true; firewall.enable = true;
firewall.allowedTCPPorts = [ ]; firewall.allowedTCPPorts = [];
firewall.allowedTCPPortRanges = [ ]; firewall.allowedTCPPortRanges = [];
firewall.allowedUDPPorts = [ firewall.allowedUDPPorts = [
18000 # Anno 1800 18000 # Anno 1800
@ -132,8 +136,7 @@
9995 # TelemetryApp 9995 # TelemetryApp
9996 # TelemetryApp 9996 # TelemetryApp
]; ];
firewall.allowedUDPPortRanges = [ ]; firewall.allowedUDPPortRanges = [];
}; };
# Enable the X11 windowing system. # Enable the X11 windowing system.
@ -168,14 +171,14 @@
# XDG # XDG
# NOTE: I think only the fitting portal is required # NOTE: I think only the fitting portal is required
xdg.portal = { xdg.portal = {
enable = true; enable = true;
extraPortals = with pkgs; [ extraPortals = with pkgs; [
# xdg-desktop-portal-wlr # For wlroots based desktops # xdg-desktop-portal-wlr # For wlroots based desktops
xdg-desktop-portal-kde # Comes with Plasma xdg-desktop-portal-kde # Comes with Plasma
# xdg-desktop-portal-gtk # Comes with Gnome # xdg-desktop-portal-gtk # Comes with Gnome
# xdg-desktop-portal-gnome # Comes with Gnome # xdg-desktop-portal-gnome # Comes with Gnome
]; ];
# gtkUsePortal = true; # Deprecated, don't use (gdm takes ages to load and other fishy stuff) # gtkUsePortal = true; # Deprecated, don't use (gdm takes ages to load and other fishy stuff)
}; };
# Enable sound with pipewire. # Enable sound with pipewire.
@ -203,7 +206,7 @@
victor-mono victor-mono
jetbrains-mono jetbrains-mono
source-code-pro source-code-pro
(pkgs.nerdfonts.override { fonts = [ "VictorMono" ]; }) (pkgs.nerdfonts.override {fonts = ["VictorMono"];})
# Chinese fonts # Chinese fonts
source-han-mono source-han-mono
@ -262,7 +265,7 @@
]; ];
shell = pkgs.fish; # TODO: Is this needed if programs.fish.enable = true? shell = pkgs.fish; # TODO: Is this needed if programs.fish.enable = true?
# We do this with HomeManager # We do this with HomeManager
packages = with pkgs; [ ]; packages = with pkgs; [];
}; };
# Generate a list of installed system packages in /etc/current-system-packages # Generate a list of installed system packages in /etc/current-system-packages
@ -273,10 +276,9 @@
in in
formatted; formatted;
# We want these packages to be available even when no user profile is active # We want these packages to be available even when no user profile is active
# Empty since we basically only need git + editor which is enabled below # Empty since we basically only need git + editor which is enabled below
environment.systemPackages = with pkgs; [ ]; environment.systemPackages = with pkgs; [];
# NOTE: Gnome # NOTE: Gnome
# TODO: Identify all the crap # TODO: Identify all the crap

View File

@ -1,6 +1,11 @@
{ inputs, config, lib, mylib, pkgs, ... }: {
inputs,
rec { config,
lib,
mylib,
pkgs,
...
}: rec {
imports = [ imports = [
# Include the results of the hardware scan. # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
@ -20,6 +25,6 @@ rec {
xkbVariant = "altgr-intl"; xkbVariant = "altgr-intl";
# videoDrivers = [ "nvidia" ]; # NVIDIA # videoDrivers = [ "nvidia" ]; # NVIDIA
videoDrivers = [ "amdgpu" ]; videoDrivers = ["amdgpu"];
}; };
} }

View File

@ -1,19 +1,23 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{ {
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; config,
lib,
pkgs,
modulesPath,
...
}: {
imports = [(modulesPath + "/installer/scan/not-detected.nix")];
boot = { boot = {
initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod"];
# Enable early Nvidia kernel modesetting # Enable early Nvidia kernel modesetting
# https://wiki.archlinux.org/title/GDM#GDM_ignores_Wayland_and_uses_X.Org_by_default (not fixed by this) # https://wiki.archlinux.org/title/GDM#GDM_ignores_Wayland_and_uses_X.Org_by_default (not fixed by this)
# https://wiki.archlinux.org/title/Kernel_mode_setting#Early_KMS_start # https://wiki.archlinux.org/title/Kernel_mode_setting#Early_KMS_start
# initrd.kernelModules = [ "nvidia" "nvidia_modeset" "nvidia_uvm" "nvidia_drm" ]; # NVIDIA # initrd.kernelModules = [ "nvidia" "nvidia_modeset" "nvidia_uvm" "nvidia_drm" ]; # NVIDIA
initrd.kernelModules = [ "amdgpu" ]; initrd.kernelModules = ["amdgpu"];
kernelModules = [ "kvm-intel" ]; kernelModules = ["kvm-intel"];
# Specific to used kernel (currently linux_zen) # Specific to used kernel (currently linux_zen)
extraModulePackages = with pkgs.linuxKernel.packages.linux_zen; [ extraModulePackages = with pkgs.linuxKernel.packages.linux_zen; [
new-lg4ff # Logitech force feedback new-lg4ff # Logitech force feedback
@ -96,7 +100,7 @@
sane.enable = true; # Scanning sane.enable = true; # Scanning
xpadneo.enable = true; # Xbox Controller xpadneo.enable = true; # Xbox Controller
}; };
environment.variables.AMD_VULKAN_ICD = "RADV"; # Choose mesa driver by default environment.variables.AMD_VULKAN_ICD = "RADV"; # Choose mesa driver by default

View File

@ -1,6 +1,11 @@
{ inputs, config, lib, mylib, pkgs, ... }: {
inputs,
rec { config,
lib,
mylib,
pkgs,
...
}: rec {
imports = [ imports = [
# Include the results of the hardware scan. # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
@ -12,6 +17,6 @@ rec {
xkbVariant = "nodeadkeys"; xkbVariant = "nodeadkeys";
# Proprietary graphics drivers # Proprietary graphics drivers
videoDrivers = [ "intel" ]; videoDrivers = ["intel"];
}; };
} }

View File

@ -1,18 +1,22 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{ {
config,
lib,
pkgs,
modulesPath,
...
}: {
imports = [ imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot = { boot = {
initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; initrd.availableKernelModules = ["xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"];
initrd.kernelModules = [ ]; initrd.kernelModules = [];
kernelModules = [ "kvm-intel" ]; kernelModules = ["kvm-intel"];
extraModulePackages = [ ]; extraModulePackages = [];
}; };
fileSystems."/" = { fileSystems."/" = {
@ -25,7 +29,7 @@
fsType = "vfat"; fsType = "vfat";
}; };
swapDevices = [ ]; swapDevices = [];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's