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 {
pname = "adwaita-for-steam";
version = "unstable";

View File

@ -1,6 +1,8 @@
{ stdenv, lib, pkgs }:
let
{
stdenv,
lib,
pkgs,
}: let
inherit (pkgs.python310Packages) buildPythonPackage buildPythonApplication fetchPypi;
# Too old in nixpkgs
@ -13,7 +15,7 @@ let
sha256 = "9107f1ca0b2a5553987a94a3c9959fe5b491fdf731389aa5b7b1bd0733e32de6";
};
propagatedBuildInputs = with pkgs.python310Packages; [ ];
propagatedBuildInputs = with pkgs.python310Packages; [];
doCheck = false;
};
@ -51,7 +53,7 @@ let
sha256 = "0d9c601124e5a6ba9712dbc60d9c53c21e34f5f641fe83002317394311bdce14";
};
propagatedBuildInputs = with pkgs.python310Packages; [ ];
propagatedBuildInputs = with pkgs.python310Packages; [];
doCheck = false;
};
@ -65,7 +67,7 @@ let
sha256 = "1cc54630f1f4cbc09654ded012b4a5cd4992aa6ee67442dbba873edd63d01eff";
};
propagatedBuildInputs = with pkgs.python310Packages; [ requests ];
propagatedBuildInputs = with pkgs.python310Packages; [requests];
doCheck = false;
};
@ -79,75 +81,67 @@ let
sha256 = "252a9c6eee001d67bb000ceb8fdf99729c06cf46ff18a00fc89468672388de1e";
};
propagatedBuildInputs = with pkgs.python310Packages; [ requests pycryptodome ];
propagatedBuildInputs = with pkgs.python310Packages; [requests pycryptodome];
doCheck = false;
};
# TODO: When new version is in nixpkgs update this derivation
# Too old in nixpkgs
# my-setuptools = buildPythonPackage rec {
# version = "65.5.0";
# pname = "setuptools";
# src = fetchPypi {
# inherit version pname;
# sha256 = "512e5536220e38146176efb833d4a62aa726b7bbff82cfbc8ba9eaa3996e0b17";
# };
# # From https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/development/python-modules/setuptools/default.nix#L75
# # nativeBuildInputs = [
# # bootstrapped-pip
# # (pipInstallHook.override{pip=null;})
# # (setuptoolsBuildHook.override{setuptools=null; wheel=null;})
# # ];
# # preBuild = lib.optionalString (!stdenv.hostPlatform.isWindows) ''
# # export SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES=0
# # '';
# pipInstallFlags = [ "--ignore-installed" ];
# # Adds setuptools to nativeBuildInputs causing infinite recursion.
# # catchConflicts = false;
# propagatedBuildInputs = with pkgs.python310Packages; [ ];
# doCheck = false;
# };
in
buildPythonApplication rec {
version = "3.4.14";
pname = "cyberdrop-dl";
src = fetchPypi {
inherit version pname;
sha256 = "bdf1e21452571a74bf4448d32b158b8600381f210696dd60d16fc83213793559";
};
in buildPythonApplication rec {
version = "3.4.14";
pname = "cyberdrop-dl";
propagatedBuildInputs = with pkgs.python310Packages; [
my-aiofiles
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 {
inherit version pname;
sha256 = "bdf1e21452571a74bf4448d32b158b8600381f210696dd60d16fc83213793559";
};
doCheck = false;
propagatedBuildInputs = with pkgs.python310Packages; [
my-aiofiles
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
];
# Otherwise duplicates are found in closure (certifi), don't know why this happens
# TODO: Investigate duplicates
catchConflicts = false;
doCheck = false;
# Otherwise duplicates are found in closure (certifi), don't know why this happens
# TODO: Investigate duplicates
catchConflicts = false;
meta = with lib; {
homepage = "https://github.com/Jules-WinnfieldX/CyberDropDownloader";
description = "Bulk downloader for multiple file hosts";
license = licenses.gpl3Only;
};
}
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
# 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
{ pkgs }:
let
{pkgs}: let
find-gsettings-schemas = pkgs.callPackage ./find-gsettings-schemas.nix {};
dconf-editor-wrapped = pkgs.writeShellScriptBin "dconf-editor-wrapped" ''
@ -20,7 +17,7 @@ let
icon = "ca.desrt.dconf-editor";
comment = "Modify the Gnome/GTK settings database";
genericName = "Desktop application to manage Gnome/GTK settings.";
categories = [ "GNOME" "GTK" "System" ];
categories = ["GNOME" "GTK" "System"];
};
in
# Combine multiple derivations into a single store path
@ -30,4 +27,4 @@ in
dconf-editor-wrapped
desktop-icon
];
}
}

View File

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

View File

@ -1,11 +1,12 @@
{ 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
cyberdrop-dl = pkgs.callPackage ./cyberdrop-dl {};
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; };
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;};
dconf-editor-wrapped = pkgs.callPackage ./dconf-editor-wrapped {};
bitwig-studio-pipewire = pkgs.callPackage ./bitwig-studio-pipewire {};
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
# We don't use fetchTarbal or fetchFromGithub because we are using flakes:
# - 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
# - 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
{ lib, stdenv, src }:
{
lib,
stdenv,
src,
}:
stdenv.mkDerivation {
pname = "firefox-gnome-theme";
version = "unstable";
@ -28,4 +29,4 @@ stdenv.mkDerivation {
homepage = "https://github.com/rafaelmardojai/firefox-gnome-theme";
license = licenses.unlicense;
};
}
}

View File

@ -1,8 +1,23 @@
# Taken from https://github.com/NixOS/nixpkgs/pull/176779/files
{ lib, stdenv, meson, ninja, pkg-config, gettext, cmake, udev, fetchFromGitHub, python3
, wrapGAppsHook, gtk3, glib, gnome, appstream-glib, gobject-introspection, desktop-file-utils }:
{
lib,
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 {
pname = "oversteer";
version = "0.7.1";
@ -44,9 +59,9 @@ python3.pkgs.buildPythonApplication rec {
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; {
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
# TODO: Flake derivation
# Damn I hate this style
{ lib
, stdenv
, fetchurl
, dpkg
, autoPatchelfHook
, alsa-lib
, freetype
, gcc
, glib
, glibc
, curlWithGnuTls
, libGL
, libglvnd
, libsecret
{
lib,
stdenv,
fetchurl,
dpkg,
autoPatchelfHook,
alsa-lib,
freetype,
gcc,
glib,
glibc,
curlWithGnuTls,
libGL,
libglvnd,
libsecret,
}:
# 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
let
# Variables from AUR pkgbuild
maintainer = "jackreeds";
pkgname_deb = "VitalInstaller";
in
stdenv.mkDerivation rec {
pname = "vital-synth";
version = "1.0.8";
in stdenv.mkDerivation rec {
pname = "vital-synth";
version = "1.0.8";
src = fetchurl {
url = "https://github.com/${maintainer}/${pkgname_deb}/releases/download/${version}/${pkgname_deb}.deb";
sha512 = "829d29a0c41ac9f79ca6d069e2e4f404a501abdcdc487fbb4e1e8afd44bf870c6c41095587c98f810fb946d946179468f8d5f417e67785313152a1613cf4a832";
};
src = fetchurl {
url = "https://github.com/${maintainer}/${pkgname_deb}/releases/download/${version}/${pkgname_deb}.deb";
sha512 = "829d29a0c41ac9f79ca6d069e2e4f404a501abdcdc487fbb4e1e8afd44bf870c6c41095587c98f810fb946d946179468f8d5f417e67785313152a1613cf4a832";
};
# autoPatchelfHook patches the binary to use the dynamic loader and "tells it" where all the libraries are that
# the program wants to dynamically load at runtime.
# 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
# the program wants to dynamically load at runtime.
# 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
];
# 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.
# We downloaded a .deb file, unpack it to root = [ usr/bin usr/lib usr/share ]
unpackCmd = ''
mkdir -p root
dpkg-deb -x $curSrc root
'';
homepage = "https://vital.audio/";
license = licenses.gpl3Only;
platforms = [ "x86_64-linux" ];
};
}
# 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;
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.devshell.url = "github:numtide/devshell";
outputs = { self, nixpkgs, flake-utils, devshell }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true; # For clion
overlays = [ devshell.overlay ];
};
outputs = {
self,
nixpkgs,
flake-utils,
devshell,
}:
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
bintools = pkgs.wrapBintoolsWith {
bintools = pkgs.bintools.bintools;
libc = pkgs.glibc;
};
gcc12 = pkgs.hiPrio (pkgs.wrapCCWith {
cc = pkgs.gcc12.cc;
libc = pkgs.glibc;
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 ./ &";
}
];
};
# NOTE: Usual 64 bit compilers that don't collide
bintools = pkgs.wrapBintoolsWith {
bintools = pkgs.bintools.bintools;
libc = pkgs.glibc;
};
gcc12 = pkgs.hiPrio (pkgs.wrapCCWith {
cc = pkgs.gcc12.cc;
libc = pkgs.glibc;
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 ./ &";
}
];
};
});
}

55
env/python.nix vendored
View File

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

101
env/python_pytorch.nix vendored
View File

@ -5,39 +5,44 @@
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.devshell.url = "github:numtide/devshell";
outputs = { self, nixpkgs, flake-utils, devshell }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [ devshell.overlay ];
outputs = {
self,
nixpkgs,
flake-utils,
devshell,
}:
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...
# 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=";
};
}));
myPython = pkgs.python310.withPackages (p: with p; [
myPython = pkgs.python310.withPackages (p:
with p; [
# Basic
rich
@ -48,23 +53,23 @@
matplotlib
nltk
]);
in {
devShell = pkgs.devshell.mkShell {
name = "Machine Learning Environment";
in {
devShell = pkgs.devshell.mkShell {
name = "Machine Learning Environment";
packages = with pkgs; [
myPython
nodePackages.pyright # LSP
];
packages = with pkgs; [
myPython
nodePackages.pyright # LSP
];
# Use $1 for positional args
commands = [
# {
# name = "";
# help = "";
# command = "";
# }
];
};
});
# Use $1 for positional args
commands = [
# {
# name = "";
# help = "";
# command = "";
# }
];
};
});
}

93
env/rust.nix vendored
View File

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

View File

@ -1,5 +1,4 @@
# The curly braces denote a set of keys and values.
{
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.
# To handle extra arguments we use the inputs@ pattern.
# 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
let
system = "x86_64-linux";
# Set overlays + unfree globally
pkgs = import nixpkgs {
inherit system;
# Set overlays + unfree globally
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [
inputs.devshell.overlay
inputs.nur.overlay
inputs.emacs-overlay.overlay
config.allowUnfree = true;
overlays = [
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; };
# 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;
};
# 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.
in rec {
in rec {
# Local shell for NixFlake directory
devShells."${system}".default = import ./shell.nix {inherit pkgs;};
# Local shell for NixFlake directory
devShells."${system}".default = import ./shell.nix { inherit pkgs; };
# System configurations + HomeManager module
# 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
# Accessible via 'nixos-rebuild'
nixosConfigurations = {
hostname = "nixinator";
username = "christoph";
# 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;
extraModules = [];
};
hostname = "nixinator";
username = "christoph";
# Usage: sudo nixos-rebuild switch --flake .#nixtop
nixtop = mylib.nixos.mkNixosConfig {
inherit system mylib;
extraModules = [ ];
};
hostname = "nixtop";
username = "christoph";
# Usage: sudo nixos-rebuild switch --flake .#nixtop
nixtop = mylib.nixos.mkNixosConfig {
inherit system mylib;
hostname = "nixtop";
username = "christoph";
extraModules = [ ];
};
extraModules = [];
};
};
};
}

View File

@ -1,17 +1,22 @@
# This is your home-manager configuration file
# 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
# 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
# Because no imports/options/config is defined explicitly, everything is treated as config
# { inputs, lib, ... }: { ... } gets turned into { inputs, lib, ... }: { config = { ... }; } implicitly
let
in rec {
rec {
# 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)
# Arguments with matching names are "plugged in" into the right slots,
@ -214,7 +219,7 @@ in rec {
ffmpeg_5-full # v5, including ffplay
imagemagick # Convert image (magic)
httpie # Cool http client
(ripgrep.override { withPCRE2 = true; }) # fast as fuck
(ripgrep.override {withPCRE2 = true;}) # fast as fuck
nvd # nix rebuild diff
# du-dust # Disk usage analyzer (for directories)
gdu # Alternative to du-dust (I like it better)
@ -241,6 +246,8 @@ in rec {
texlive.combined.scheme-full
pandoc # document converting madness
lm_sensors
alejandra # nix code formatter
nil # nix language server
# Xooooorg/Desktop environment stuff
xclip
@ -302,7 +309,6 @@ in rec {
# jetbrains.idea-ultimate
# jetbrains.clion
# TODO: LaTeX module
texlab
@ -342,6 +348,8 @@ in rec {
# Use NixCommunity binary cache
cachix
# tor-browser-bundle-bin
];
# Packages with extra options managed by HomeManager natively
@ -411,8 +419,8 @@ in rec {
enable = true;
enableFishIntegration = config.modules.fish.enable;
enableXsessionIntegration = true;
agents = [ "ssh" ];
keys = [ "id_ed25519" ];
agents = ["ssh"];
keys = ["id_ed25519"];
};
# 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
# 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
package = pkgs.wrapMpv (pkgs.mpv-unwrapped.override { vapoursynthSupport = true; }) {
package = pkgs.wrapMpv (pkgs.mpv-unwrapped.override {vapoursynthSupport = true;}) {
youtubeSupport = true;
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
rec {
imports = [
../../modules
@ -21,8 +29,10 @@ rec {
yabridge.autoSync = true;
noisesuppression = {
noisetorch.enable = true;
noisetorch.autostart = true;
noisetorch.enable = false;
noisetorch.autostart = false;
easyeffects.enable = false;
easyeffects.autostart = false;
};
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
rec {
imports = [
../../modules
@ -22,4 +30,4 @@ rec {
discordChromium.enable = true;
};
};
}
}

View File

@ -1,9 +1,13 @@
{ config, nixosConfig, lib, mylib, pkgs, ... }:
{
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib;
with mylib.modules;
let
with mylib.modules; let
cfg = config.modules.audio;
cfgfp = config.modules.flatpak;
in {
@ -64,35 +68,35 @@ in {
# 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
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
# 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
# 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 nixosConfig.services.pipewire.enable [ helvum ])
(optionals cfg.carla.enable [carla gamemode])
(optionals cfg.bitwig.enable [
bitwig-studio
gamemode
])
(optionals cfg.tenacity.enable [tenacity])
(optionals cfg.carla.enable [ carla gamemode ])
(optionals cfg.bitwig.enable [
bitwig-studio
gamemode
])
(optionals cfg.tenacity.enable [ tenacity ])
(optionals cfg.faust.enable [faust])
(optionals cfg.yabridge.enable [yabridge yabridgectl])
(optionals cfg.noisesuppression.noisetorch.enable [noisetorch])
(optionals cfg.faust.enable [ faust ])
(optionals cfg.yabridge.enable [ yabridge yabridgectl ])
(optionals cfg.noisesuppression.noisetorch.enable [ noisetorch ])
# (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 ])
];
# (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 {
enable = true;
@ -107,7 +111,7 @@ in {
icon = "carla";
exec = "env PIPEWIRE_LATENCY=256/48000 gamemoderun carla ${config.home.homeDirectory}/.config/carla/GuitarDefault.carxp";
terminal = false;
categories = [ "Music" "Audio" ];
categories = ["Music" "Audio"];
};
xdg.desktopEntries.bitwig-low-latency = mkIf cfg.bitwig.enable {
@ -116,7 +120,7 @@ in {
icon = "bitwig-studio";
exec = "env PIPEWIRE_LATENCY=256/48000 gamemoderun bitwig-studio";
terminal = false;
categories = [ "Music" "Audio" ];
categories = ["Music" "Audio"];
};
# TODO: Disable only for plasma
@ -147,12 +151,14 @@ in {
home.activation = mkMerge [
# The module includes the default carla project with ArchetypePetrucci + ArchetypeGojira
(mkIf cfg.carla.enable {
linkCarlaConfig = hm.dag.entryAfter [ "writeBoundary" ]
(mkLink "${config.home.homeDirectory}/NixFlake/config/carla" "${config.home.homeDirectory}/.config/carla");
linkCarlaConfig =
hm.dag.entryAfter ["writeBoundary"]
(mkLink "${config.home.homeDirectory}/NixFlake/config/carla" "${config.home.homeDirectory}/.config/carla");
})
(mkElse cfg.carla.enable {
unlinkCarlaConfig = hm.dag.entryAfter [ "writeBoundary" ]
(mkUnlink "${config.home.homeDirectory}/.config/carla");
unlinkCarlaConfig =
hm.dag.entryAfter ["writeBoundary"]
(mkUnlink "${config.home.homeDirectory}/.config/carla");
})
# Replaced by distrho
@ -166,24 +172,30 @@ in {
# })
(mkIf cfg.distrho.enable {
linkDistrhoLV2 = hm.dag.entryAfter [ "writeBoundary" ]
(mkLink "${pkgs.distrho}/lib/lv2" "${config.home.homeDirectory}/.lv2/distrho");
linkDistrhoVST = hm.dag.entryAfter [ "writeBoundary" ]
(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");
linkDistrhoLV2 =
hm.dag.entryAfter ["writeBoundary"]
(mkLink "${pkgs.distrho}/lib/lv2" "${config.home.homeDirectory}/.lv2/distrho");
linkDistrhoVST =
hm.dag.entryAfter ["writeBoundary"]
(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 {
unlinkDistrhoLV2 = hm.dag.entryAfter [ "writeBoundary" ]
(mkUnlink "${config.home.homeDirectory}/.lv2/distrho");
unlinkDistrhoVST = hm.dag.entryAfter [ "writeBoundary" ]
(mkUnlink "${config.home.homeDirectory}/.vst/distrho");
unlinkDistrhoVST3 = hm.dag.entryAfter [ "writeBoundary" ]
(mkUnlink "${config.home.homeDirectory}/.vst3/distrho");
unlinkDistrhoLV2 =
hm.dag.entryAfter ["writeBoundary"]
(mkUnlink "${config.home.homeDirectory}/.lv2/distrho");
unlinkDistrhoVST =
hm.dag.entryAfter ["writeBoundary"]
(mkUnlink "${config.home.homeDirectory}/.vst/distrho");
unlinkDistrhoVST3 =
hm.dag.entryAfter ["writeBoundary"]
(mkUnlink "${config.home.homeDirectory}/.vst3/distrho");
})
(mkIf (cfg.yabridge.enable && cfg.yabridge.autoSync) {
syncYabridge = hm.dag.entryAfter [ "writeBoundary" ] ''
syncYabridge = hm.dag.entryAfter ["writeBoundary"] ''
yabridgectl sync
'';
})

View File

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

View File

@ -1,18 +1,20 @@
# https://nixos.org/manual/nixos/stable/index.html#sec-writing-modules
# This is a function with arguments
{ config, lib, mylib, pkgs, ... }:
{
config,
lib,
mylib,
pkgs,
...
}:
# We add stuff from lib to our namespace (mkOption...)
with lib;
with mylib.modules;
let
with mylib.modules; let
# This is the current state of the option that this module defines
# We use it to determine if the config should be changed below
cfg = config.modules.emacs;
in {
imports = [ ];
imports = [];
# Options is a vector of options this module defines
# This module defines only the "emacs" option and suboptions "enable" and "doom"
@ -56,39 +58,43 @@ in {
];
# What home packages should be enabled
home.packages = with pkgs; builtins.concatLists [
(optionals cfg.nativeComp [ ((emacsPackagesFor emacsNativeComp).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 ])) ])
home.packages = with pkgs;
builtins.concatLists [
(optionals cfg.nativeComp [((emacsPackagesFor emacsNativeComp).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
(optionals cfg.doom.enable [
# emacs-all-the-icons-fonts # Needs to be in fonts.fonts
(ripgrep.override { withPCRE2 = true; })
fd
zstd
sqlite # Org roam
inkscape # Org latex preview
graphviz # Org graphviz support
gnuplot # Org gnuplot support
pandoc # Org export formats
maim
bashInteractive # For keychain
# TODO: Check what hlissner has enabled
(optionals cfg.doom.enable [
# emacs-all-the-icons-fonts # Needs to be in fonts.fonts
(ripgrep.override {withPCRE2 = true;})
fd
zstd
sqlite # Org roam
inkscape # Org latex preview
graphviz # Org graphviz support
gnuplot # Org gnuplot support
pandoc # Org export formats
maim
bashInteractive # For keychain
# 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
# 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
# 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: Conflicts with global python?
# 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
# shellcheck # This belongs in specific flake.nix
# nixfmt # 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
# We tell HomeManager where the config files belong
@ -99,36 +105,36 @@ in {
# };
home.activation = mkMerge [
# The parantheses around mkIf are needed for precedence in this case
(mkIf cfg.doom.enable {
# If doom is enabled we want to clone the framework
# 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
installDoomEmacs = hm.dag.entryAfter [ "writeBoundary" ] ''
installDoomEmacs = hm.dag.entryAfter ["writeBoundary"] ''
if [ ! -d "${config.home.homeDirectory}/.emacs.d" ]; then
git clone --depth=1 --single-branch "https://github.com/doomemacs/doomemacs" "${config.home.homeDirectory}/.emacs.d"
fi
'';
# With this approach we keep the config mutable as it is not copied and linked from store
linkDoomConfig = hm.dag.entryAfter [ "writeBoundary" "installDoomEmacs" ]
(mkLink "${config.home.homeDirectory}/NixFlake/config/doom" "${config.home.homeDirectory}/.config/doom");
linkDoomConfig =
hm.dag.entryAfter ["writeBoundary" "installDoomEmacs"]
(mkLink "${config.home.homeDirectory}/NixFlake/config/doom" "${config.home.homeDirectory}/.config/doom");
})
(mkElse cfg.doom.enable {
unlinkDoomConfig = hm.dag.entryAfter [ "writeBoundary" "installDoomEmacs" ]
(mkUnlink "${config.home.homeDirectory}/.config/doom");
unlinkDoomConfig =
hm.dag.entryAfter ["writeBoundary" "installDoomEmacs"]
(mkUnlink "${config.home.homeDirectory}/.config/doom");
})
(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 &
'';
})
(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 -!
'';
})

View File

@ -1,18 +1,19 @@
# Example: https://beb.ninja/post/email/
# Example: https://sbr.pm/configurations/mails.html
# NOTE: The passwords must exist in kwallet
# TODO: Emacs mail config
{ config, nixosConfig, lib, mylib, pkgs, ... }:
{
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib;
with mylib.modules;
let
with mylib.modules; let
cfg = config.modules.email;
in {
options.modules.email = {
enable = mkEnableOpt "Email";
autosync = mkEnableOpt "Automatically call \"notmuch new\" via systemd timer";
@ -26,9 +27,10 @@ in {
# TODO: Add Maildir to nextcloud sync
config = mkIf cfg.enable {
home.packages = with pkgs; builtins.concatLists [
(optionals cfg.kmail.enable [ kmail ])
];
home.packages = with pkgs;
builtins.concatLists [
(optionals cfg.kmail.enable [kmail])
];
home.file = mkMerge [
(optionalAttrs (cfg.kmail.enable && cfg.kmail.autostart) {
@ -54,7 +56,7 @@ in {
# Autosync, don't need imapnotify when enabled
systemd.user.services.mail-autosync = (mkIf cfg.autosync) {
Unit = { Description = "Automatic notmuch/mbsync synchronization"; };
Unit = {Description = "Automatic notmuch/mbsync synchronization";};
Service = {
Type = "oneshot";
# ExecStart = "${pkgs.isync}/bin/mbsync -a";
@ -62,12 +64,12 @@ in {
};
};
systemd.user.timers.mail-autosync = (mkIf cfg.autosync) {
Unit = { Description = "Automatic notmuch/mbsync synchronization"; };
Unit = {Description = "Automatic notmuch/mbsync synchronization";};
Timer = {
OnBootSec = "30";
OnUnitActiveSec = "5m";
};
Install = { WantedBy = [ "timers.target" ]; };
Install = {WantedBy = ["timers.target"];};
};
accounts.email.accounts = {
@ -84,14 +86,15 @@ in {
passwordCommand = "kwallet-query -f email -r urpost kdewallet";
mbsync = { # Imap
mbsync = {
# Imap
enable = true;
create = "maildir";
};
msmtp.enable = true; # Smtp
notmuch.enable = true;
imapnotify.enable = cfg.imapnotify;
imapnotify.onNotify = {
imapnotify.onNotify = {
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";
mbsync = { # Imap
mbsync = {
# Imap
enable = true;
create = "maildir";
};
msmtp.enable = true; # Smtp
notmuch.enable = true;
imapnotify.enable = cfg.imapnotify;
imapnotify.onNotify = {
imapnotify.onNotify = {
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
passwordCommand = "kwallet-query -f email -r gmail kdewallet";
mbsync = { # Imap
mbsync = {
# Imap
enable = true;
create = "maildir";
patterns = ["*" "![Gmail]*" "[Gmail]/Sent Mail" "[Gmail]/Starred" "[Gmail]/All Mail"]; # Only sync inbox
@ -145,7 +150,7 @@ in {
msmtp.enable = true; # Smtp
notmuch.enable = true;
imapnotify.enable = cfg.imapnotify;
imapnotify.onNotify = {
imapnotify.onNotify = {
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
{ inputs, config, nixosConfig, lib, mylib, pkgs, ... }:
{
inputs,
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib;
with mylib.modules;
let
with mylib.modules; let
cfg = config.modules.firefox;
in {
options.modules.firefox = {
enable = mkEnableOpt "Firefox";
wayland = mkBoolOpt false "Enable firefox wayland support";
@ -19,16 +22,17 @@ in {
};
config = mkIf cfg.enable {
home.packages = with pkgs; builtins.concatLists [
# TODO: I don't think vaapi works yet
(optionals cfg.vaapi [
# NOTE: I put these into hardware.opengl.extrapackages, don't know if they belong there...
# libva
# libvdpau
])
home.packages = with pkgs;
builtins.concatLists [
# TODO: I don't think vaapi works yet
(optionals cfg.vaapi [
# NOTE: I put these into hardware.opengl.extrapackages, don't know if they belong there...
# libva
# libvdpau
])
(optionals cfg.gnomeTheme [ firefox-gnome-theme ])
];
(optionals cfg.gnomeTheme [firefox-gnome-theme])
];
home.sessionVariables = mkMerge [
{
@ -52,7 +56,7 @@ in {
icon = "firefox";
exec = "firefox --private-window %U";
terminal = false;
categories = [ "Network" "WebBrowser" ];
categories = ["Network" "WebBrowser"];
};
programs.firefox = {
@ -72,7 +76,7 @@ in {
# not strictly necessary
extraPolicies = {
# 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;
DisableFirefoxAccounts = true;
DisableFirefoxStudies = true;

View File

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

View File

@ -1,191 +1,199 @@
{ config, nixosConfig, lib, mylib, pkgs, ... }:
{
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib;
with mylib.modules;
# NOTE: The module is also used by other modules (gaming, audio).
# 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
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
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";
# TODO: Add library function to make this easier
# TODO: The flatpak name should be included and a list of all enabled apps should be available
# TODO: Do this for strings + packages
discord.enable = mkEnableOpt "Discord";
spotify.enable = mkEnableOpt "Spotify";
flatseal.enable = mkEnableOpt "Flatseal";
bottles.enable = mkEnableOpt "Bottles";
# TODO: Add library function to make this easier
# TODO: The flatpak name should be included and a list of all enabled apps should be available
# TODO: Do this for strings + packages
discord.enable = mkEnableOpt "Discord";
spotify.enable = mkEnableOpt "Spotify";
flatseal.enable = mkEnableOpt "Flatseal";
bottles.enable = mkEnableOpt "Bottles";
# This is mainly used by other modules to allow them to use flatpak packages
extraInstall = mkOption {
type = types.listOf types.str;
default = [];
description = "Flatpaks that will be installed additionally";
};
# This is mainly used by other modules to allow them to use flatpak packages
extraInstall = mkOption {
type = types.listOf types.str;
default = [ ];
description = "Flatpaks that will be installed additionally";
# This doesn't uninstall if any flatpak is still present in the extraInstall list
extraRemove = mkOption {
type = types.listOf types.str;
default = [];
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
extraRemove = mkOption {
type = types.listOf types.str;
default = [ ];
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";
};
};
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"
config = mkIf cfg.enable {
assertions = [
{
assertion = nixosConfig.services.flatpak.enable;
message = "Cannot use the flatpak module with flatpak disabled in nixos!";
}
];
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;
in mkMerge ([
{
".local/share/flatpak/overrides/global".text = "[Context]\nfilesystems=${str_global_overrides}";
}
] ++ extra_overrides);
# 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}";});
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");
})
# This is a list of sets: [ { "<filename>" = "<overrides>"; } { "<filename>" = "<overrides>"; } ]
extra_overrides = map (set: concat_override (attrName set) (attrValue set)) cfg.extraOverride;
# 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");
})
# Global overrides
# 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
];
global_default_overrides = [
"/nix/store:ro"
to_install_str = builtins.concatStringsSep " " to_install;
in
# 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];
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)
lib.hm.dag.entryAfter [ "writeBoundary" ] ''
sudo flatpak install -y ${to_install_str} &
updateFlatpak = lib.hm.dag.entryAfter ["writeBoundary"] ''
sudo flatpak update -y &
'';
}
})
{
# 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"
# 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
'';
}
(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 mylib.modules;
let
with mylib.modules; let
cfg = config.modules.gaming;
cfgfp = config.modules.flatpak;
in {
@ -50,26 +53,27 @@ in {
})
];
home.packages = with pkgs; builtins.concatLists [
[
gamemode # gamemode should be always enabled (could also be enabled by audio module)
oversteer # TODO: Make option
# 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?
]
home.packages = with pkgs;
builtins.concatLists [
[
gamemode # gamemode should be always enabled (could also be enabled by audio module)
oversteer # TODO: Make option
# 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
(optionals cfg.discordChromium.enable [ chromium ])
# TODO: Extra config (extensions etc) in chromium module
(optionals cfg.discordChromium.enable [chromium])
# Prefer flatpak version as nixpkgs version isn't always updated in time
(optionals cfg.discordElectron.enable [ discord ])
(optionals cfg.steam.adwaita [ adwaita-for-steam ])
# Prefer flatpak version as nixpkgs version isn't always updated in time
(optionals cfg.discordElectron.enable [discord])
(optionals cfg.steam.adwaita [adwaita-for-steam])
# Prefer flatpak version as this one doesn't find the STEAM_DIR automatically
# (optionals cfg.steam.enable [ protontricks ])
# Prefer flatpak version as this one doesn't find the STEAM_DIR automatically
# (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
# https://github.com/ValveSoftware/steam-for-linux/issues/3572
@ -84,7 +88,7 @@ in {
# ];
home.activation = mkMerge [
(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
mkdir ${config.home.homeDirectory}/.var/app/com.valvesoftware.Steam/.local/share/Steam/skins
fi
@ -100,7 +104,7 @@ in {
})
(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
'';
})
@ -112,7 +116,7 @@ in {
icon = "discord";
exec = "chromium --new-window discord.com/app";
terminal = false;
categories = [ "Network" "Chat" ];
categories = ["Network" "Chat"];
};
# NOTE: Important to not disable this option if another module enables it
@ -152,8 +156,8 @@ in {
# "com.valvesoftware.Steam.CompatibilityTool.Proton-GE"
"net.davidotek.pupgui2"
])
(optionals (cfg.steam.enable && cfg.steam.gamescope) [ "com.valvesoftware.Steam.Utility.gamescope" ])
(optionals cfg.prism.enable [ "org.prismlauncher.PrismLauncher" ])
(optionals (cfg.steam.enable && cfg.steam.gamescope) ["com.valvesoftware.Steam.Utility.gamescope"])
(optionals cfg.prism.enable ["org.prismlauncher.PrismLauncher"])
];
modules.flatpak.extraRemove = builtins.concatLists [
@ -168,8 +172,8 @@ in {
# "com.valvesoftware.Steam.CompatibilityTool.Proton-GE"
"net.davidotek.pupgui2"
])
(optionals (!cfg.steam.enable || !cfg.steam.gamescope) [ "com.valvesoftware.Steam.Utility.gamescope" ])
(optionals (!cfg.prism.enable) [ "org.prismlauncher.PrismLauncher" ])
(optionals (!cfg.steam.enable || !cfg.steam.gamescope) ["com.valvesoftware.Steam.Utility.gamescope"])
(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 mylib.modules;
let
with mylib.modules; let
cfg = config.modules.gnome;
in {
options.modules.gnome = {
enable = mkEnableOpt "Gnome Desktop";
# TODO: Add option for dash-to-dock
@ -40,7 +43,7 @@ in {
];
gtk = mkMerge [
{ enable = true; }
{enable = true;}
(optionalAttrs cfg.theme.papirusIcons {
iconTheme.package = pkgs.papirus-icon-theme;
@ -60,42 +63,43 @@ in {
})
];
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.sushi # Gnome files previews (use service, has to be added to dbus packages)
gnome.gnome-logs # systemd log viewer
gnome.gnome-tweaks # conflicts with nixos/hm gnome settings file sometimes, watch out what settings to change
gnome.gnome-nettool
gnome.simple-scan
gnome.gnome-sound-recorder
gnome.file-roller # archive manager
# gnome.dconf-editor
dconf-editor-wrapped # Sets XDG_DATA_DIRS to include all gsettings-schemas
gsettings-desktop-schemas
# gnome-usage # Alternative system performance monitor (gnome.gnome-system-monitor is the preinstalled one)
# gnome-secrets # Alternative keepass database viewer
gnome-firmware
]
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.sushi # Gnome files previews (use service, has to be added to dbus packages)
gnome.gnome-logs # systemd log viewer
gnome.gnome-tweaks # conflicts with nixos/hm gnome settings file sometimes, watch out what settings to change
gnome.gnome-nettool
gnome.simple-scan
gnome.gnome-sound-recorder
gnome.file-roller # archive manager
# gnome.dconf-editor
dconf-editor-wrapped # Sets XDG_DATA_DIRS to include all gsettings-schemas
gsettings-desktop-schemas
# gnome-usage # Alternative system performance monitor (gnome.gnome-system-monitor is the preinstalled one)
# gnome-secrets # Alternative keepass database viewer
gnome-firmware
]
(optionals cfg.extensions [
gnomeExtensions.appindicator
gnomeExtensions.auto-activities
gnomeExtensions.blur-my-shell
gnomeExtensions.custom-hot-corners-extended
gnomeExtensions.extensions-sync
gnomeExtensions.gamemode
gnomeExtensions.launch-new-instance
gnomeExtensions.maximize-to-empty-workspace
gnomeExtensions.no-overview
gnomeExtensions.pip-on-top
gnomeExtensions.rounded-window-corners
gnomeExtensions.sound-output-device-chooser
gnomeExtensions.tweaks-in-system-menu
gnomeExtensions.vitals
])
];
(optionals cfg.extensions [
gnomeExtensions.appindicator
gnomeExtensions.auto-activities
gnomeExtensions.blur-my-shell
gnomeExtensions.custom-hot-corners-extended
gnomeExtensions.extensions-sync
gnomeExtensions.gamemode
gnomeExtensions.launch-new-instance
gnomeExtensions.maximize-to-empty-workspace
gnomeExtensions.no-overview
gnomeExtensions.pip-on-top
gnomeExtensions.rounded-window-corners
gnomeExtensions.sound-output-device-chooser
gnomeExtensions.tweaks-in-system-menu
gnomeExtensions.vitals
])
];
# TODO: Check what gnome-tweaks sets
dconf.settings = with lib.hm.gvariant; {
@ -216,7 +220,7 @@ in {
};
"org/gnome/nautilus/icon-view" = {
captions = [ "size" "date_modified" "none" ];
captions = ["size" "date_modified" "none"];
default-zoom-level = "larger";
};
@ -254,28 +258,29 @@ in {
"drive-menu@gnome-shell-extensions.gcampax.github.com"
"user-theme@gnome-shell-extensions.gcampax.github.com"
];
enabled-extensions = with pkgs; builtins.concatLists [
[
"workspace-indicator@gnome-shell-extensions.gcampax.github.com"
]
enabled-extensions = with pkgs;
builtins.concatLists [
[
"workspace-indicator@gnome-shell-extensions.gcampax.github.com"
]
(optionals cfg.extensions [
gnomeExtensions.appindicator.extensionUuid
gnomeExtensions.auto-activities.extensionUuid
gnomeExtensions.blur-my-shell.extensionUuid
gnomeExtensions.custom-hot-corners-extended.extensionUuid
gnomeExtensions.extensions-sync.extensionUuid
gnomeExtensions.gamemode.extensionUuid
gnomeExtensions.launch-new-instance.extensionUuid
gnomeExtensions.maximize-to-empty-workspace.extensionUuid
gnomeExtensions.no-overview.extensionUuid
gnomeExtensions.pip-on-top.extensionUuid
gnomeExtensions.rounded-window-corners.extensionUuid
gnomeExtensions.sound-output-device-chooser.extensionUuid
gnomeExtensions.tweaks-in-system-menu.extensionUuid
gnomeExtensions.vitals.extensionUuid
])
];
(optionals cfg.extensions [
gnomeExtensions.appindicator.extensionUuid
gnomeExtensions.auto-activities.extensionUuid
gnomeExtensions.blur-my-shell.extensionUuid
gnomeExtensions.custom-hot-corners-extended.extensionUuid
gnomeExtensions.extensions-sync.extensionUuid
gnomeExtensions.gamemode.extensionUuid
gnomeExtensions.launch-new-instance.extensionUuid
gnomeExtensions.maximize-to-empty-workspace.extensionUuid
gnomeExtensions.no-overview.extensionUuid
gnomeExtensions.pip-on-top.extensionUuid
gnomeExtensions.rounded-window-corners.extensionUuid
gnomeExtensions.sound-output-device-chooser.extensionUuid
gnomeExtensions.tweaks-in-system-menu.extensionUuid
gnomeExtensions.vitals.extensionUuid
])
];
};
"org/gnome/shell/app-switcher" = {
@ -310,7 +315,7 @@ in {
fixed-widths = true;
hide-icons = false;
hide-zeros = false;
hot-sensors = [ "__network-rx_max__" ];
hot-sensors = ["__network-rx_max__"];
position-in-panel = 2;
show-battery = false;
show-fan = false;

View File

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

View File

@ -1,9 +1,13 @@
{ config, nixosConfig, lib, mylib, pkgs, ... }:
{
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib;
with mylib.modules;
let
with mylib.modules; let
cfg = config.modules.misc;
in {
options.modules.misc = {
@ -21,11 +25,11 @@ in {
};
config = mkIf cfg.enable {
home.packages = with pkgs; builtins.concatLists [
(optionals cfg.keepass.enable [ keepassxc ])
(optionals cfg.protonmail.enable [ protonmail-bridge ])
];
home.packages = with pkgs;
builtins.concatLists [
(optionals cfg.keepass.enable [keepassxc])
(optionals cfg.protonmail.enable [protonmail-bridge])
];
systemd.user.services = mkMerge [
(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 mylib.modules;
let
with mylib.modules; let
cfg = config.modules.neovim;
in {
options.modules.neovim = {
enable = mkEnableOpt "NeoVim";
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 = ''
lua << EOF
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
# 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
# Nextcloud immediately crashes on start, autostart isn't working either...
{ config, lib, mylib, pkgs, ... }:
{
config,
lib,
mylib,
pkgs,
...
}:
with lib;
with mylib.modules;
let
with mylib.modules; let
cfg = config.modules.nextcloud;
in {
options.modules.nextcloud = {
@ -24,9 +25,9 @@ in {
message = "Can't enable both HM nextcloud and my nextcloud module!";
}
];
# 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
# systemd.user.services = (mkIf cfg.autostart) {

View File

@ -1,21 +1,20 @@
# TODO: KDE Connect config
# TODO: Plasma Configuration (https://github.com/pjones/plasma-manager)
{ config, lib, mylib, pkgs, ... }:
{
config,
lib,
mylib,
pkgs,
...
}:
with lib;
with mylib.modules;
let
with mylib.modules; let
cfg = config.modules.plasma;
in {
options.modules.plasma = {
};
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 mylib.modules;
let
with mylib.modules; let
cfg = config.modules.ranger;
in {
options.modules.ranger = {
enable = mkEnableOpt "Ranger";
preview = mkBoolOpt false "Enable Ranger image preview";
};
config = mkIf cfg.enable {
home.packages = with pkgs; lib.concatLists [
[
ranger
atool
p7zip
zip
unzip
unrar
libarchive
exiftool
mediainfo
]
home.packages = with pkgs;
lib.concatLists [
[
ranger
atool
p7zip
zip
unzip
unrar
libarchive
exiftool
mediainfo
]
(optionals cfg.preview [
# ueberzug # Only X11
python310Packages.pillow
ffmpegthumbnailer
imagemagick
poppler_utils
])
];
(optionals cfg.preview [
# ueberzug # Only X11
# TODO: Conflicts with global python?
python310Packages.pillow
ffmpegthumbnailer
imagemagick
poppler_utils
])
];
home.file = mkMerge [
{
".config/ranger/rc.conf".text = let
# TODO: Why does mkMerge don't work here?
settings = {
column_ratios = "1,1";
vcs_aware = "true";
preview_images_method = "kitty"; # TODO: Only if kitty enabled
unicode_ellipsis = "true";
draw_borders = (if cfg.preview then "none" else "both"); # doesn't work well with preview
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";
});
settings =
{
column_ratios = "1,1";
vcs_aware = "true";
preview_images_method = "kitty"; # TODO: Only if kitty enabled
unicode_ellipsis = "true";
draw_borders =
if cfg.preview
then "none"
else "both"; # doesn't work well with preview
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"; }
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_str = concatStringsSep "\n" settings_list;
in settings_str;
in
settings_str;
}
(optionalAttrs cfg.preview {

View File

@ -1,6 +1,9 @@
{ inputs, pkgs, lib, ... }:
{
nixos = import ./nixos.nix { inherit inputs pkgs lib; };
modules = import ./modules.nix { inherit inputs pkgs lib; };
}
inputs,
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, ... }:
rec {
{
inputs,
pkgs,
lib,
...
}: rec {
# Conveniance wrapper for mkOption with boolean type
mkBoolOpt = def: desc:
lib.mkOption {
type = lib.types.bool;
default = def;
description = desc;
};
lib.mkOption {
type = lib.types.bool;
default = def;
description = desc;
};
# Alias for consistency
mkEnableOpt = lib.mkEnableOption;
# Like mkIf but the predicate is inverted
mkElse = pred: do:
(lib.mkIf (!pred) do);
mkElse = pred: do: (lib.mkIf (!pred) do);
# Creates a symlink if it doesn't exist
# If it exists renew the link
mkLink = src: dest:
''
mkLink = src: dest: ''
if [ -L "${dest}" ]; then
rm ${dest}
fi
@ -27,40 +28,43 @@ rec {
'';
# Removes a symlink if it exists
mkUnlink = dest:
''
mkUnlink = dest: ''
if [ -L "${dest}" ]; then
rm ${dest}
fi
'';
# TODO
mkMultiOptStr = { }:
{
mkMultiOptStr = {}: {
};
# TODO
mkMultiOptPkg = { }:
{
mkMultiOptPkg = {}: {
};
# Returns true if base contains 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
without = base: remove:
lib.filter (x: !(contains remove x)) base;
lib.filter (x: !(contains remove x)) base;
# For use with single element sets
attrName = set: let
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
attrValue = set: let
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, ... }:
let
{
inputs,
pkgs,
lib,
...
}: let
inherit (inputs) home-manager;
in {
mkNixosConfig = { system ? "x86_64-linux", mylib, hostname, username ? "christoph", extraModules ? [ ] }:
lib.nixosSystem {
inherit system;
mkNixosConfig = {
system ? "x86_64-linux",
mylib,
hostname,
username ? "christoph",
extraModules ? [],
}:
lib.nixosSystem {
inherit system;
# Make our inputs available to the configuration.nix (for importing modules)
# specialArgs are propagated to all modules
specialArgs = { inherit inputs hostname username mylib; };
# Make our inputs available to the configuration.nix (for importing modules)
# specialArgs are propagated to all modules
specialArgs = {inherit inputs hostname username mylib;};
modules = builtins.concatLists [
[
# Replace the pkgs to include overlays/unfree
{ nixpkgs.pkgs = pkgs; }
modules = builtins.concatLists [
[
# Replace the pkgs to include overlays/unfree
{nixpkgs.pkgs = pkgs;}
# Main config file for all configs/hosts
../system
]
# Main config file for all configs/hosts
../system
]
extraModules
extraModules
# 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)
# but I failed because nix stopped autoinjecting the required arguments and I didn't
# know how to handle that...
[
home-manager.nixosModules.home-manager {
# extraSpecialArgs are propagated to all hm config modules
home-manager.extraSpecialArgs = { inherit inputs hostname username mylib; };
# 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)
# but I failed because nix stopped autoinjecting the required arguments and I didn't
# know how to handle that...
[
home-manager.nixosModules.home-manager
{
# 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
home-manager.useGlobalPkgs = true;
# Use systems pkgs, disables nixpkgs.* options in home.nix
home-manager.useGlobalPkgs = true;
# Enable installing packages through users.christoph.packages to /etc/profiles instead of ~/.nix-profile
home-manager.useUserPackages = true;
# Enable installing packages through users.christoph.packages to /etc/profiles instead of ~/.nix-profile
home-manager.useUserPackages = true;
# User specific config file
home-manager.users.${username}.imports = [ ../home/${username} ];
}
]
];
};
# User specific config file
home-manager.users.${username}.imports = [../home/${username}];
}
]
];
};
}

View File

@ -1,18 +1,23 @@
{ inputs, nixpkgs, ... }:
let
{
inputs,
nixpkgs,
...
}: let
# 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
additions = final: prev: import ../derivations { inherit inputs; pkgs = final; };
additions = final: prev:
import ../derivations {
inherit inputs;
pkgs = final;
};
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
# Use dconf-editor.nix: { final, prev }: final.<package>.overrideAttrs (oldAttrs: { ... }) or sth similar
};
in
# 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
# in the overlays = [ ... ] section of the pkgs = import nixpkgs { ... } configuration
# 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 {
name = "NixFlake Shell";

View File

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

View File

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

View File

@ -1,10 +1,15 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ inputs, hostname, lib, mylib, config, pkgs, ... }:
{
inputs,
hostname,
lib,
mylib,
config,
pkgs,
...
}: {
imports = [
# Import the host-specific system config
./${hostname}
@ -19,7 +24,7 @@
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)
# 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
# as nix shell nixpkgs#name) consistent with your flake inputs.
# (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
boot = {
kernelPackages = pkgs.linuxPackages_zen;
kernelParams = [ "mitigations=off" ];
kernelParams = ["mitigations=off"];
# plymouth.enable = true;
loader.systemd-boot.enable = true;
@ -63,7 +68,7 @@
sudo.enable = true;
sudo.extraRules = [
{
users = [ "christoph" ];
users = ["christoph"];
commands = [
# 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)
{
command = "/run/current-system/sw/bin/flatpak";
options = [ "SETENV" "NOPASSWD" ];
options = ["SETENV" "NOPASSWD"];
}
];
}
@ -104,7 +109,7 @@
};
# 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...)?
# Open ports in the firewall.
@ -121,10 +126,9 @@
# Enable networking
networkmanager.enable = true;
firewall.enable = true;
firewall.allowedTCPPorts = [ ];
firewall.allowedTCPPortRanges = [ ];
firewall.allowedTCPPorts = [];
firewall.allowedTCPPortRanges = [];
firewall.allowedUDPPorts = [
18000 # Anno 1800
@ -132,8 +136,7 @@
9995 # TelemetryApp
9996 # TelemetryApp
];
firewall.allowedUDPPortRanges = [ ];
firewall.allowedUDPPortRanges = [];
};
# Enable the X11 windowing system.
@ -168,14 +171,14 @@
# XDG
# NOTE: I think only the fitting portal is required
xdg.portal = {
enable = true;
extraPortals = with pkgs; [
# xdg-desktop-portal-wlr # For wlroots based desktops
xdg-desktop-portal-kde # Comes with Plasma
# xdg-desktop-portal-gtk # 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)
enable = true;
extraPortals = with pkgs; [
# xdg-desktop-portal-wlr # For wlroots based desktops
xdg-desktop-portal-kde # Comes with Plasma
# xdg-desktop-portal-gtk # 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)
};
# Enable sound with pipewire.
@ -203,7 +206,7 @@
victor-mono
jetbrains-mono
source-code-pro
(pkgs.nerdfonts.override { fonts = [ "VictorMono" ]; })
(pkgs.nerdfonts.override {fonts = ["VictorMono"];})
# Chinese fonts
source-han-mono
@ -262,7 +265,7 @@
];
shell = pkgs.fish; # TODO: Is this needed if programs.fish.enable = true?
# We do this with HomeManager
packages = with pkgs; [ ];
packages = with pkgs; [];
};
# Generate a list of installed system packages in /etc/current-system-packages
@ -273,10 +276,9 @@
in
formatted;
# 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
environment.systemPackages = with pkgs; [ ];
environment.systemPackages = with pkgs; [];
# NOTE: Gnome
# TODO: Identify all the crap

View File

@ -1,6 +1,11 @@
{ inputs, config, lib, mylib, pkgs, ... }:
rec {
{
inputs,
config,
lib,
mylib,
pkgs,
...
}: rec {
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
@ -20,6 +25,6 @@ rec {
xkbVariant = "altgr-intl";
# 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
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
config,
lib,
pkgs,
modulesPath,
...
}: {
imports = [(modulesPath + "/installer/scan/not-detected.nix")];
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
# 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
# initrd.kernelModules = [ "nvidia" "nvidia_modeset" "nvidia_uvm" "nvidia_drm" ]; # NVIDIA
initrd.kernelModules = [ "amdgpu" ];
kernelModules = [ "kvm-intel" ];
initrd.kernelModules = ["amdgpu"];
kernelModules = ["kvm-intel"];
# Specific to used kernel (currently linux_zen)
extraModulePackages = with pkgs.linuxKernel.packages.linux_zen; [
new-lg4ff # Logitech force feedback
@ -96,7 +100,7 @@
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

View File

@ -1,6 +1,11 @@
{ inputs, config, lib, mylib, pkgs, ... }:
rec {
{
inputs,
config,
lib,
mylib,
pkgs,
...
}: rec {
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
@ -12,6 +17,6 @@ rec {
xkbVariant = "nodeadkeys";
# 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
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
config,
lib,
pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot = {
initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
initrd.kernelModules = [ ];
kernelModules = [ "kvm-intel" ];
extraModulePackages = [ ];
initrd.availableKernelModules = ["xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"];
initrd.kernelModules = [];
kernelModules = ["kvm-intel"];
extraModulePackages = [];
};
fileSystems."/" = {
@ -25,7 +29,7 @@
fsType = "vfat";
};
swapDevices = [ ];
swapDevices = [];
# 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