1

reformat using alejandra

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

View File

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

View File

@ -1,6 +1,8 @@
{ stdenv, lib, pkgs }: {
stdenv,
let lib,
pkgs,
}: let
inherit (pkgs.python310Packages) buildPythonPackage buildPythonApplication fetchPypi; inherit (pkgs.python310Packages) buildPythonPackage buildPythonApplication fetchPypi;
# Too old in nixpkgs # Too old in nixpkgs
@ -82,40 +84,32 @@ let
propagatedBuildInputs = with pkgs.python310Packages; [requests pycryptodome]; propagatedBuildInputs = with pkgs.python310Packages; [requests pycryptodome];
doCheck = false; doCheck = false;
}; };
# TODO: When new version is in nixpkgs update this derivation # TODO: When new version is in nixpkgs update this derivation
# Too old in nixpkgs # Too old in nixpkgs
# my-setuptools = buildPythonPackage rec { # my-setuptools = buildPythonPackage rec {
# version = "65.5.0"; # version = "65.5.0";
# pname = "setuptools"; # pname = "setuptools";
# src = fetchPypi { # src = fetchPypi {
# inherit version pname; # inherit version pname;
# sha256 = "512e5536220e38146176efb833d4a62aa726b7bbff82cfbc8ba9eaa3996e0b17"; # sha256 = "512e5536220e38146176efb833d4a62aa726b7bbff82cfbc8ba9eaa3996e0b17";
# }; # };
# # From https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/development/python-modules/setuptools/default.nix#L75 # # From https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/development/python-modules/setuptools/default.nix#L75
# # nativeBuildInputs = [ # # nativeBuildInputs = [
# # bootstrapped-pip # # bootstrapped-pip
# # (pipInstallHook.override{pip=null;}) # # (pipInstallHook.override{pip=null;})
# # (setuptoolsBuildHook.override{setuptools=null; wheel=null;}) # # (setuptoolsBuildHook.override{setuptools=null; wheel=null;})
# # ]; # # ];
# # preBuild = lib.optionalString (!stdenv.hostPlatform.isWindows) '' # # preBuild = lib.optionalString (!stdenv.hostPlatform.isWindows) ''
# # export SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES=0 # # export SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES=0
# # ''; # # '';
# pipInstallFlags = [ "--ignore-installed" ]; # pipInstallFlags = [ "--ignore-installed" ];
# # Adds setuptools to nativeBuildInputs causing infinite recursion. # # Adds setuptools to nativeBuildInputs causing infinite recursion.
# # catchConflicts = false; # # catchConflicts = false;
# propagatedBuildInputs = with pkgs.python310Packages; [ ]; # propagatedBuildInputs = with pkgs.python310Packages; [ ];
# doCheck = false; # doCheck = false;
# }; # };
in
buildPythonApplication rec {
in buildPythonApplication rec {
version = "3.4.14"; version = "3.4.14";
pname = "cyberdrop-dl"; pname = "cyberdrop-dl";

View File

@ -3,10 +3,7 @@
# /nix/store/z3gxkwakzgiswvakfrpbirhpcach509j-mutter-42.3/share/gsettings-schemas/mutter-42.3 # /nix/store/z3gxkwakzgiswvakfrpbirhpcach509j-mutter-42.3/share/gsettings-schemas/mutter-42.3
# but this is the wrong path for dconf-editor to find the schema, correct one would be # but this is the wrong path for dconf-editor to find the schema, correct one would be
# /nix/store/z3gxkwakzgiswvakfrpbirhpcach509j-mutter-42.3/share/gsettings-schemas/mutter-42.3/glib-2.0/schemas # /nix/store/z3gxkwakzgiswvakfrpbirhpcach509j-mutter-42.3/share/gsettings-schemas/mutter-42.3/glib-2.0/schemas
{pkgs}: let
{ pkgs }:
let
find-gsettings-schemas = pkgs.callPackage ./find-gsettings-schemas.nix {}; find-gsettings-schemas = pkgs.callPackage ./find-gsettings-schemas.nix {};
dconf-editor-wrapped = pkgs.writeShellScriptBin "dconf-editor-wrapped" '' dconf-editor-wrapped = pkgs.writeShellScriptBin "dconf-editor-wrapped" ''

View File

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

View File

@ -1,6 +1,7 @@
{ inputs, pkgs }:
{ {
inputs,
pkgs,
}: {
# vital-synth = pkgs.callPackage ./vital-synth {}; # Kept as an example, don't know if I will fix this or keep using distrho # vital-synth = pkgs.callPackage ./vital-synth {}; # Kept as an example, don't know if I will fix this or keep using distrho
cyberdrop-dl = pkgs.callPackage ./cyberdrop-dl {}; cyberdrop-dl = pkgs.callPackage ./cyberdrop-dl {};
firefox-gnome-theme = pkgs.callPackage ./firefox-gnome-theme {src = inputs.firefox-gnome-theme;}; firefox-gnome-theme = pkgs.callPackage ./firefox-gnome-theme {src = inputs.firefox-gnome-theme;};

View File

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

View File

@ -1,8 +1,23 @@
# Taken from https://github.com/NixOS/nixpkgs/pull/176779/files # Taken from https://github.com/NixOS/nixpkgs/pull/176779/files
{
{ lib, stdenv, meson, ninja, pkg-config, gettext, cmake, udev, fetchFromGitHub, python3 lib,
, wrapGAppsHook, gtk3, glib, gnome, appstream-glib, gobject-introspection, desktop-file-utils }: stdenv,
meson,
ninja,
pkg-config,
gettext,
cmake,
udev,
fetchFromGitHub,
python3,
wrapGAppsHook,
gtk3,
glib,
gnome,
appstream-glib,
gobject-introspection,
desktop-file-utils,
}:
python3.pkgs.buildPythonApplication rec { python3.pkgs.buildPythonApplication rec {
pname = "oversteer"; pname = "oversteer";
version = "0.7.1"; version = "0.7.1";

View File

@ -1,33 +1,30 @@
# Has a problem with vertically offset UI, replaced by distrho for now but kept as an example # Has a problem with vertically offset UI, replaced by distrho for now but kept as an example
# TODO: Flake derivation # TODO: Flake derivation
# Damn I hate this style # Damn I hate this style
{ lib {
, stdenv lib,
, fetchurl stdenv,
, dpkg fetchurl,
, autoPatchelfHook dpkg,
, alsa-lib autoPatchelfHook,
, freetype alsa-lib,
, gcc freetype,
, glib gcc,
, glibc glib,
, curlWithGnuTls glibc,
, libGL curlWithGnuTls,
, libglvnd libGL,
, libsecret libglvnd,
libsecret,
}: }:
# Adapted from https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=vital-synth # Adapted from https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=vital-synth
# Example https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/audio/bitwig-studio/bitwig-studio4.nix # Example https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/audio/bitwig-studio/bitwig-studio4.nix
let let
# Variables from AUR pkgbuild # Variables from AUR pkgbuild
maintainer = "jackreeds"; maintainer = "jackreeds";
pkgname_deb = "VitalInstaller"; pkgname_deb = "VitalInstaller";
in
in stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "vital-synth"; pname = "vital-synth";
version = "1.0.8"; version = "1.0.8";
@ -63,7 +60,16 @@ in stdenv.mkDerivation rec {
# depends=('alsa-lib>=1.0.16' 'freetype2>=2.2.1' 'gcc-libs' 'gcc>=3.3.1' 'glib2>=2.12.0' 'glibc>=2.17' # 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') # 'libcurl-gnutls>=7.16.2' 'libgl' 'libglvnd' 'libsecret>=0.7')
buildInputs = [ buildInputs = [
alsa-lib freetype gcc.cc.lib gcc.cc glib glibc curlWithGnuTls libGL libglvnd libsecret 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 # Copy the contents of the .deb package to the $out directory that nix creates for built derivations

10
env/c_cxx.nix vendored
View File

@ -5,9 +5,13 @@
inputs.flake-utils.url = "github:numtide/flake-utils"; inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.devshell.url = "github:numtide/devshell"; inputs.devshell.url = "github:numtide/devshell";
outputs = { self, nixpkgs, flake-utils, devshell }: outputs = {
flake-utils.lib.eachDefaultSystem (system: self,
let nixpkgs,
flake-utils,
devshell,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
config.allowUnfree = true; # For clion config.allowUnfree = true; # For clion

13
env/python.nix vendored
View File

@ -5,16 +5,21 @@
inputs.flake-utils.url = "github:numtide/flake-utils"; inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.devshell.url = "github:numtide/devshell"; inputs.devshell.url = "github:numtide/devshell";
outputs = { self, nixpkgs, flake-utils, devshell }: outputs = {
flake-utils.lib.eachDefaultSystem (system: self,
let nixpkgs,
flake-utils,
devshell,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
config.allowUnfree = true; config.allowUnfree = true;
overlays = [devshell.overlay]; overlays = [devshell.overlay];
}; };
myPython = pkgs.python310.withPackages (p: with p; [ myPython = pkgs.python310.withPackages (p:
with p; [
rich rich
numpy numpy
scipy scipy

View File

@ -5,9 +5,13 @@
inputs.flake-utils.url = "github:numtide/flake-utils"; inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.devshell.url = "github:numtide/devshell"; inputs.devshell.url = "github:numtide/devshell";
outputs = { self, nixpkgs, flake-utils, devshell }: outputs = {
flake-utils.lib.eachDefaultSystem (system: self,
let nixpkgs,
flake-utils,
devshell,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
config.allowUnfree = true; config.allowUnfree = true;
@ -37,7 +41,8 @@
}; };
})); }));
myPython = pkgs.python310.withPackages (p: with p; [ myPython = pkgs.python310.withPackages (p:
with p; [
# Basic # Basic
rich rich

11
env/rust.nix vendored
View File

@ -6,9 +6,14 @@
inputs.devshell.url = "github:numtide/devshell"; inputs.devshell.url = "github:numtide/devshell";
inputs.rust-overlay.url = "github:oxalica/rust-overlay"; inputs.rust-overlay.url = "github:oxalica/rust-overlay";
outputs = { self, nixpkgs, flake-utils, devshell, rust-overlay }: outputs = {
flake-utils.lib.eachDefaultSystem (system: self,
let nixpkgs,
flake-utils,
devshell,
rust-overlay,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
config.allowUnfree = true; # For clion config.allowUnfree = true; # For clion

View File

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

View File

@ -1,17 +1,22 @@
# This is your home-manager configuration file # This is your home-manager configuration file
# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix) # Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix)
# The nixosConfig allows to access the toplevel system configuration from within home manager # The nixosConfig allows to access the toplevel system configuration from within home manager
# https://github.com/nix-community/home-manager/blob/586ac1fd58d2de10b926ce3d544b3179891e58cb/nixos/default.nix#L19 # https://github.com/nix-community/home-manager/blob/586ac1fd58d2de10b926ce3d544b3179891e58cb/nixos/default.nix#L19
{ inputs, hostname, username, lib, mylib, config, nixosConfig, pkgs, ... }: {
inputs,
hostname,
username,
lib,
mylib,
config,
nixosConfig,
pkgs,
...
}:
# This is a module # This is a module
# Because no imports/options/config is defined explicitly, everything is treated as config # Because no imports/options/config is defined explicitly, everything is treated as config
# { inputs, lib, ... }: { ... } gets turned into { inputs, lib, ... }: { config = { ... }; } implicitly # { inputs, lib, ... }: { ... } gets turned into { inputs, lib, ... }: { config = { ... }; } implicitly
let rec {
in rec {
# Every module is a nix expression, specifically a function { inputs, lib, ... }: { ... } # Every module is a nix expression, specifically a function { inputs, lib, ... }: { ... }
# Every module (/function) is called with the same arguments as this module (home.nix) # Every module (/function) is called with the same arguments as this module (home.nix)
# Arguments with matching names are "plugged in" into the right slots, # Arguments with matching names are "plugged in" into the right slots,
@ -241,6 +246,8 @@ in rec {
texlive.combined.scheme-full texlive.combined.scheme-full
pandoc # document converting madness pandoc # document converting madness
lm_sensors lm_sensors
alejandra # nix code formatter
nil # nix language server
# Xooooorg/Desktop environment stuff # Xooooorg/Desktop environment stuff
xclip xclip
@ -302,7 +309,6 @@ in rec {
# jetbrains.idea-ultimate # jetbrains.idea-ultimate
# jetbrains.clion # jetbrains.clion
# TODO: LaTeX module # TODO: LaTeX module
texlab texlab
@ -342,6 +348,8 @@ in rec {
# Use NixCommunity binary cache # Use NixCommunity binary cache
cachix cachix
# tor-browser-bundle-bin
]; ];
# Packages with extra options managed by HomeManager natively # Packages with extra options managed by HomeManager natively
@ -424,7 +432,10 @@ in rec {
package = pkgs.wrapMpv (pkgs.mpv-unwrapped.override {vapoursynthSupport = true;}) { package = pkgs.wrapMpv (pkgs.mpv-unwrapped.override {vapoursynthSupport = true;}) {
youtubeSupport = true; youtubeSupport = true;
extraMakeWrapperArgs = [ extraMakeWrapperArgs = [
"--prefix" "LD_LIBRARY_PATH" ":" "${pkgs.vapoursynth-mvtools}/lib" "--prefix"
"LD_LIBRARY_PATH"
":"
"${pkgs.vapoursynth-mvtools}/lib"
]; ];
}; };
}; };

View File

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

View File

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

View File

@ -1,9 +1,13 @@
{ config, nixosConfig, lib, mylib, pkgs, ... }: {
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib; with lib;
with mylib.modules; with mylib.modules; let
let
cfg = config.modules.audio; cfg = config.modules.audio;
cfgfp = config.modules.flatpak; cfgfp = config.modules.flatpak;
in { in {
@ -64,8 +68,8 @@ in {
# Use builtins.concatLists instead of mkMerge as this is more safe as the type is specified, # Use builtins.concatLists instead of mkMerge as this is more safe as the type is specified,
# also mkMerge doesn't work in every case as it yields a set # also mkMerge doesn't work in every case as it yields a set
home.packages = with pkgs; builtins.concatLists [ home.packages = with pkgs;
builtins.concatLists [
# lib.optional is preferred over mkIf or if...then...else by nix coding standards # lib.optional is preferred over mkIf or if...then...else by nix coding standards
# lib.optional wraps its argument in a list, lib.optionals doesn't # lib.optional wraps its argument in a list, lib.optionals doesn't
# This means that lib.optional can be used for single packages/arguments # This means that lib.optional can be used for single packages/arguments
@ -147,11 +151,13 @@ in {
home.activation = mkMerge [ home.activation = mkMerge [
# The module includes the default carla project with ArchetypePetrucci + ArchetypeGojira # The module includes the default carla project with ArchetypePetrucci + ArchetypeGojira
(mkIf cfg.carla.enable { (mkIf cfg.carla.enable {
linkCarlaConfig = hm.dag.entryAfter [ "writeBoundary" ] linkCarlaConfig =
hm.dag.entryAfter ["writeBoundary"]
(mkLink "${config.home.homeDirectory}/NixFlake/config/carla" "${config.home.homeDirectory}/.config/carla"); (mkLink "${config.home.homeDirectory}/NixFlake/config/carla" "${config.home.homeDirectory}/.config/carla");
}) })
(mkElse cfg.carla.enable { (mkElse cfg.carla.enable {
unlinkCarlaConfig = hm.dag.entryAfter [ "writeBoundary" ] unlinkCarlaConfig =
hm.dag.entryAfter ["writeBoundary"]
(mkUnlink "${config.home.homeDirectory}/.config/carla"); (mkUnlink "${config.home.homeDirectory}/.config/carla");
}) })
@ -166,19 +172,25 @@ in {
# }) # })
(mkIf cfg.distrho.enable { (mkIf cfg.distrho.enable {
linkDistrhoLV2 = hm.dag.entryAfter [ "writeBoundary" ] linkDistrhoLV2 =
hm.dag.entryAfter ["writeBoundary"]
(mkLink "${pkgs.distrho}/lib/lv2" "${config.home.homeDirectory}/.lv2/distrho"); (mkLink "${pkgs.distrho}/lib/lv2" "${config.home.homeDirectory}/.lv2/distrho");
linkDistrhoVST = hm.dag.entryAfter [ "writeBoundary" ] linkDistrhoVST =
hm.dag.entryAfter ["writeBoundary"]
(mkLink "${pkgs.distrho}/lib/vst" "${config.home.homeDirectory}/.vst/distrho"); (mkLink "${pkgs.distrho}/lib/vst" "${config.home.homeDirectory}/.vst/distrho");
linkDistrhoVST3 = hm.dag.entryAfter [ "writeBoundary" ] linkDistrhoVST3 =
hm.dag.entryAfter ["writeBoundary"]
(mkLink "${pkgs.distrho}/lib/vst3" "${config.home.homeDirectory}/.vst3/distrho"); (mkLink "${pkgs.distrho}/lib/vst3" "${config.home.homeDirectory}/.vst3/distrho");
}) })
(mkElse cfg.distrho.enable { (mkElse cfg.distrho.enable {
unlinkDistrhoLV2 = hm.dag.entryAfter [ "writeBoundary" ] unlinkDistrhoLV2 =
hm.dag.entryAfter ["writeBoundary"]
(mkUnlink "${config.home.homeDirectory}/.lv2/distrho"); (mkUnlink "${config.home.homeDirectory}/.lv2/distrho");
unlinkDistrhoVST = hm.dag.entryAfter [ "writeBoundary" ] unlinkDistrhoVST =
hm.dag.entryAfter ["writeBoundary"]
(mkUnlink "${config.home.homeDirectory}/.vst/distrho"); (mkUnlink "${config.home.homeDirectory}/.vst/distrho");
unlinkDistrhoVST3 = hm.dag.entryAfter [ "writeBoundary" ] unlinkDistrhoVST3 =
hm.dag.entryAfter ["writeBoundary"]
(mkUnlink "${config.home.homeDirectory}/.vst3/distrho"); (mkUnlink "${config.home.homeDirectory}/.vst3/distrho");
}) })

View File

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

View File

@ -1,13 +1,15 @@
# https://nixos.org/manual/nixos/stable/index.html#sec-writing-modules # https://nixos.org/manual/nixos/stable/index.html#sec-writing-modules
# This is a function with arguments # This is a function with arguments
{ config, lib, mylib, pkgs, ... }: {
config,
lib,
mylib,
pkgs,
...
}:
# We add stuff from lib to our namespace (mkOption...) # We add stuff from lib to our namespace (mkOption...)
with lib; with lib;
with mylib.modules; with mylib.modules; let
let
# This is the current state of the option that this module defines # This is the current state of the option that this module defines
# We use it to determine if the config should be changed below # We use it to determine if the config should be changed below
cfg = config.modules.emacs; cfg = config.modules.emacs;
@ -56,7 +58,8 @@ in {
]; ];
# What home packages should be enabled # What home packages should be enabled
home.packages = with pkgs; builtins.concatLists [ home.packages = with pkgs;
builtins.concatLists [
(optionals cfg.nativeComp [((emacsPackagesFor emacsNativeComp).emacsWithPackages (epkgs: [epkgs.vterm epkgs.pdf-tools]))]) (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.pgtkNativeComp [((emacsPackagesFor emacsPgtkNativeComp).emacsWithPackages (epkgs: [epkgs.vterm epkgs.pdf-tools]))])
(optionals cfg.nixpkgs [((emacsPackagesFor emacs).emacsWithPackages (epkgs: [epkgs.vterm epkgs.pdf-tools]))]) (optionals cfg.nixpkgs [((emacsPackagesFor emacs).emacsWithPackages (epkgs: [epkgs.vterm epkgs.pdf-tools]))])
@ -78,8 +81,11 @@ in {
# TODO: I don't want to have this here permanently, maybe put in a shell.nix if compilation is needed? # TODO: I don't want to have this here permanently, maybe put in a shell.nix if compilation is needed?
gcc # Need this for org roam gcc # Need this for org roam
# 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 # 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 (python310.withPackages (ppkgs: [ppkgs.pygments])) # Latex minted
# TODO: Does it work like this aswell?
# python310Packages.pygments
# nixfmt # This belongs in specific flake.nix # nixfmt # This belongs in specific flake.nix
# shellcheck # This belongs in specific flake.nix # shellcheck # This belongs in specific flake.nix
@ -99,10 +105,8 @@ in {
# }; # };
home.activation = mkMerge [ home.activation = mkMerge [
# The parantheses around mkIf are needed for precedence in this case # The parantheses around mkIf are needed for precedence in this case
(mkIf cfg.doom.enable { (mkIf cfg.doom.enable {
# If doom is enabled we want to clone the framework # If doom is enabled we want to clone the framework
# The activation script is being run when home-manager rebuilds # The activation script is being run when home-manager rebuilds
# Because we write to the filesystem, this script has to be run after HomeManager's writeBoundary # Because we write to the filesystem, this script has to be run after HomeManager's writeBoundary
@ -113,11 +117,13 @@ in {
''; '';
# With this approach we keep the config mutable as it is not copied and linked from store # With this approach we keep the config mutable as it is not copied and linked from store
linkDoomConfig = hm.dag.entryAfter [ "writeBoundary" "installDoomEmacs" ] linkDoomConfig =
hm.dag.entryAfter ["writeBoundary" "installDoomEmacs"]
(mkLink "${config.home.homeDirectory}/NixFlake/config/doom" "${config.home.homeDirectory}/.config/doom"); (mkLink "${config.home.homeDirectory}/NixFlake/config/doom" "${config.home.homeDirectory}/.config/doom");
}) })
(mkElse cfg.doom.enable { (mkElse cfg.doom.enable {
unlinkDoomConfig = hm.dag.entryAfter [ "writeBoundary" "installDoomEmacs" ] unlinkDoomConfig =
hm.dag.entryAfter ["writeBoundary" "installDoomEmacs"]
(mkUnlink "${config.home.homeDirectory}/.config/doom"); (mkUnlink "${config.home.homeDirectory}/.config/doom");
}) })

View File

@ -1,18 +1,19 @@
# Example: https://beb.ninja/post/email/ # Example: https://beb.ninja/post/email/
# Example: https://sbr.pm/configurations/mails.html # Example: https://sbr.pm/configurations/mails.html
# NOTE: The passwords must exist in kwallet # NOTE: The passwords must exist in kwallet
# TODO: Emacs mail config # TODO: Emacs mail config
{
{ config, nixosConfig, lib, mylib, pkgs, ... }: config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib; with lib;
with mylib.modules; with mylib.modules; let
let
cfg = config.modules.email; cfg = config.modules.email;
in { in {
options.modules.email = { options.modules.email = {
enable = mkEnableOpt "Email"; enable = mkEnableOpt "Email";
autosync = mkEnableOpt "Automatically call \"notmuch new\" via systemd timer"; autosync = mkEnableOpt "Automatically call \"notmuch new\" via systemd timer";
@ -26,7 +27,8 @@ in {
# TODO: Add Maildir to nextcloud sync # TODO: Add Maildir to nextcloud sync
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = with pkgs; builtins.concatLists [ home.packages = with pkgs;
builtins.concatLists [
(optionals cfg.kmail.enable [kmail]) (optionals cfg.kmail.enable [kmail])
]; ];
@ -84,7 +86,8 @@ in {
passwordCommand = "kwallet-query -f email -r urpost kdewallet"; passwordCommand = "kwallet-query -f email -r urpost kdewallet";
mbsync = { # Imap mbsync = {
# Imap
enable = true; enable = true;
create = "maildir"; create = "maildir";
}; };
@ -111,7 +114,8 @@ in {
passwordCommand = "kwallet-query -f email -r hhu kdewallet"; passwordCommand = "kwallet-query -f email -r hhu kdewallet";
mbsync = { # Imap mbsync = {
# Imap
enable = true; enable = true;
create = "maildir"; create = "maildir";
}; };
@ -137,7 +141,8 @@ in {
# NOTE: Uses Gmail app password # NOTE: Uses Gmail app password
passwordCommand = "kwallet-query -f email -r gmail kdewallet"; passwordCommand = "kwallet-query -f email -r gmail kdewallet";
mbsync = { # Imap mbsync = {
# Imap
enable = true; enable = true;
create = "maildir"; create = "maildir";
patterns = ["*" "![Gmail]*" "[Gmail]/Sent Mail" "[Gmail]/Starred" "[Gmail]/All Mail"]; # Only sync inbox patterns = ["*" "![Gmail]*" "[Gmail]/Sent Mail" "[Gmail]/Starred" "[Gmail]/All Mail"]; # Only sync inbox

View File

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

View File

@ -1,12 +1,15 @@
{ config, nixosConfig, lib, mylib, pkgs, ... }: {
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib; with lib;
with mylib.modules; with mylib.modules; let
let
cfg = config.modules.fish; cfg = config.modules.fish;
in { in {
options.modules.fish = { options.modules.fish = {
enable = mkEnableOpt "Fish"; enable = mkEnableOpt "Fish";
}; };
@ -31,7 +34,8 @@ in {
hasHomePackage = package: (contains config.home.packages package); hasHomePackage = package: (contains config.home.packages package);
# Only add fish abbr if package is installed # Only add fish abbr if package is installed
abbrify = package: abbr: (optionalAttrs (hasHomePackage package) abbr); abbrify = package: abbr: (optionalAttrs (hasHomePackage package) abbr);
in mkMerge [ in
mkMerge [
# Default abbrs, always available # Default abbrs, always available
{ {
# Shell basic # Shell basic

View File

@ -1,12 +1,16 @@
{ config, nixosConfig, lib, mylib, pkgs, ... }: {
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib; with lib;
with mylib.modules; with mylib.modules;
# NOTE: The module is also used by other modules (gaming, audio). # NOTE: The module is also used by other modules (gaming, audio).
# It is important that every flatpak interaction is handled through this module # It is important that every flatpak interaction is handled through this module
# to prevent that anything is removed by a module although it is required by another one # to prevent that anything is removed by a module although it is required by another one
let let
cfg = config.modules.flatpak; cfg = config.modules.flatpak;
in { in {
@ -74,13 +78,11 @@ in {
# TODO: Also only filesystem overrides are applied # TODO: Also only filesystem overrides are applied
home.file = let home.file = let
# Specific overrides # Specific overrides
# This generates the set { "<filename>" = "<overrides>"; } # This generates the set { "<filename>" = "<overrides>"; }
concat_override = name: value: concat_override = name: value: (optionalAttrs (name != null) {".local/share/flatpak/overrides/${name}".text = "[Context]\nfilesystems=${value}";});
(optionalAttrs (name != null) { ".local/share/flatpak/overrides/${name}".text = "[Context]\nfilesystems=${value}"; });
# This is a list of sets: [ { "<filename>" = "<overrides>"; } { "<filename>" = "<overrides>"; } ] # This is a list of sets: [ { "<filename>" = "<overrides>"; } { "<filename>" = "<overrides>"; } ]
extra_overrides = (map (set: concat_override (attrName set) (attrValue set)) cfg.extraOverride); extra_overrides = map (set: concat_override (attrName set) (attrValue set)) cfg.extraOverride;
# Global overrides # Global overrides
@ -103,32 +105,38 @@ in {
global_overrides = builtins.concatLists [global_default_overrides cfg.extraGlobalOverride]; global_overrides = builtins.concatLists [global_default_overrides cfg.extraGlobalOverride];
str_global_overrides = builtins.concatStringsSep ";" global_overrides; str_global_overrides = builtins.concatStringsSep ";" global_overrides;
in mkMerge ([ in
mkMerge ([
{ {
".local/share/flatpak/overrides/global".text = "[Context]\nfilesystems=${str_global_overrides}"; ".local/share/flatpak/overrides/global".text = "[Context]\nfilesystems=${str_global_overrides}";
} }
] ++ extra_overrides); ]
++ extra_overrides);
home.activation = mkMerge [ home.activation = mkMerge [
# We link like this to be able to address the absolute location, also the fonts won't get copied to store # 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 # NOTE: This path contains all the fonts because fonts.fontDir.enable is true
(mkIf cfg.fontFix { (mkIf cfg.fontFix {
linkFontDir = lib.hm.dag.entryAfter [ "writeBoundary" ] linkFontDir =
lib.hm.dag.entryAfter ["writeBoundary"]
(mkLink "/run/current-system/sw/share/X11/fonts" "${config.home.homeDirectory}/.local/share/fonts"); (mkLink "/run/current-system/sw/share/X11/fonts" "${config.home.homeDirectory}/.local/share/fonts");
}) })
(mkElse cfg.fontFix { (mkElse cfg.fontFix {
unlinkFontDir = lib.hm.dag.entryAfter [ "writeBoundary" ] unlinkFontDir =
lib.hm.dag.entryAfter ["writeBoundary"]
(mkUnlink "${config.home.homeDirectory}/.local/share/fonts"); (mkUnlink "${config.home.homeDirectory}/.local/share/fonts");
}) })
# Fixes missing icons + cursor # Fixes missing icons + cursor
# NOTE: This path works because we have homeManager.useUserPackages = true (everything is stored in /etc/profiles/) # NOTE: This path works because we have homeManager.useUserPackages = true (everything is stored in /etc/profiles/)
(mkIf cfg.iconFix { (mkIf cfg.iconFix {
linkIconDir = lib.hm.dag.entryAfter [ "writeBoundary" ] linkIconDir =
lib.hm.dag.entryAfter ["writeBoundary"]
(mkLink "/etc/profiles/per-user/christoph/share/icons" "${config.home.homeDirectory}/.local/share/icons"); (mkLink "/etc/profiles/per-user/christoph/share/icons" "${config.home.homeDirectory}/.local/share/icons");
}) })
(mkElse cfg.iconFix { (mkElse cfg.iconFix {
unlinkIconDir = lib.hm.dag.entryAfter [ "writeBoundary" ] unlinkIconDir =
lib.hm.dag.entryAfter ["writeBoundary"]
(mkUnlink "${config.home.homeDirectory}/.local/share/icons"); (mkUnlink "${config.home.homeDirectory}/.local/share/icons");
}) })

View File

@ -1,9 +1,12 @@
{ config, lib, mylib, pkgs, ... }: {
config,
lib,
mylib,
pkgs,
...
}:
with lib; with lib;
with mylib.modules; with mylib.modules; let
let
cfg = config.modules.gaming; cfg = config.modules.gaming;
cfgfp = config.modules.flatpak; cfgfp = config.modules.flatpak;
in { in {
@ -50,7 +53,8 @@ in {
}) })
]; ];
home.packages = with pkgs; builtins.concatLists [ home.packages = with pkgs;
builtins.concatLists [
[ [
gamemode # gamemode should be always enabled (could also be enabled by audio module) gamemode # gamemode should be always enabled (could also be enabled by audio module)
oversteer # TODO: Make option oversteer # TODO: Make option

View File

@ -1,12 +1,15 @@
{ config, nixosConfig, lib, mylib, pkgs, ... }: {
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib; with lib;
with mylib.modules; with mylib.modules; let
let
cfg = config.modules.gnome; cfg = config.modules.gnome;
in { in {
options.modules.gnome = { options.modules.gnome = {
enable = mkEnableOpt "Gnome Desktop"; enable = mkEnableOpt "Gnome Desktop";
# TODO: Add option for dash-to-dock # TODO: Add option for dash-to-dock
@ -60,7 +63,8 @@ in {
}) })
]; ];
home.packages = with pkgs; builtins.concatLists [ home.packages = with pkgs;
builtins.concatLists [
[ [
# gnome.gnome-session # Allow to start gnome from tty (sadly this is not usable, many things don't work) # gnome.gnome-session # Allow to start gnome from tty (sadly this is not usable, many things don't work)
gnome.gnome-boxes # VM gnome.gnome-boxes # VM
@ -254,7 +258,8 @@ in {
"drive-menu@gnome-shell-extensions.gcampax.github.com" "drive-menu@gnome-shell-extensions.gcampax.github.com"
"user-theme@gnome-shell-extensions.gcampax.github.com" "user-theme@gnome-shell-extensions.gcampax.github.com"
]; ];
enabled-extensions = with pkgs; builtins.concatLists [ enabled-extensions = with pkgs;
builtins.concatLists [
[ [
"workspace-indicator@gnome-shell-extensions.gcampax.github.com" "workspace-indicator@gnome-shell-extensions.gcampax.github.com"
] ]

View File

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

View File

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

View File

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

View File

@ -1,15 +1,16 @@
# Changed from https://github.com/nix-community/home-manager/blob/master/modules/services/nextcloud-client.nix # Changed from https://github.com/nix-community/home-manager/blob/master/modules/services/nextcloud-client.nix
# I use this instead of the HM module as the autostart wasn't working there # I use this instead of the HM module as the autostart wasn't working there
# TODO: Check the HM module again if anything changed, as this has also stopped working # TODO: Check the HM module again if anything changed, as this has also stopped working
# Nextcloud immediately crashes on start, autostart isn't working either... # Nextcloud immediately crashes on start, autostart isn't working either...
{
{ config, lib, mylib, pkgs, ... }: config,
lib,
mylib,
pkgs,
...
}:
with lib; with lib;
with mylib.modules; with mylib.modules; let
let
cfg = config.modules.nextcloud; cfg = config.modules.nextcloud;
in { in {
options.modules.nextcloud = { options.modules.nextcloud = {

View File

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

View File

@ -1,19 +1,23 @@
{ config, nixosConfig, lib, mylib, pkgs, ... }: {
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib; with lib;
with mylib.modules; with mylib.modules; let
let
cfg = config.modules.ranger; cfg = config.modules.ranger;
in { in {
options.modules.ranger = { options.modules.ranger = {
enable = mkEnableOpt "Ranger"; enable = mkEnableOpt "Ranger";
preview = mkBoolOpt false "Enable Ranger image preview"; preview = mkBoolOpt false "Enable Ranger image preview";
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = with pkgs; lib.concatLists [ home.packages = with pkgs;
lib.concatLists [
[ [
ranger ranger
atool atool
@ -28,6 +32,7 @@ in {
(optionals cfg.preview [ (optionals cfg.preview [
# ueberzug # Only X11 # ueberzug # Only X11
# TODO: Conflicts with global python?
python310Packages.pillow python310Packages.pillow
ffmpegthumbnailer ffmpegthumbnailer
imagemagick imagemagick
@ -39,16 +44,27 @@ in {
{ {
".config/ranger/rc.conf".text = let ".config/ranger/rc.conf".text = let
# TODO: Why does mkMerge don't work here? # TODO: Why does mkMerge don't work here?
settings = { settings =
{
column_ratios = "1,1"; column_ratios = "1,1";
vcs_aware = "true"; vcs_aware = "true";
preview_images_method = "kitty"; # TODO: Only if kitty enabled preview_images_method = "kitty"; # TODO: Only if kitty enabled
unicode_ellipsis = "true"; unicode_ellipsis = "true";
draw_borders = (if cfg.preview then "none" else "both"); # doesn't work well with preview draw_borders =
if cfg.preview
then "none"
else "both"; # doesn't work well with preview
line_numbers = "relative"; line_numbers = "relative";
preview_images = (if cfg.preview then "true" else "false"); preview_images =
use_preview_script = (if cfg.preview then "true" else "false"); if cfg.preview
} // (optionalAttrs 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"; preview_script = "${config.home.homeDirectory}/.config/ranger/scope.sh";
}); });
@ -56,8 +72,8 @@ in {
settings_in_values = mapAttrs (name: value: concatStringsSep " " ["set" name value]) settings; settings_in_values = mapAttrs (name: value: concatStringsSep " " ["set" name value]) settings;
settings_list = attrValues settings_in_values; # Results in [ "set column_rations = 1,1" ] settings_list = attrValues settings_in_values; # Results in [ "set column_rations = 1,1" ]
settings_str = concatStringsSep "\n" settings_list; settings_str = concatStringsSep "\n" settings_list;
in
in settings_str; settings_str;
} }
(optionalAttrs cfg.preview { (optionalAttrs cfg.preview {

View File

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

View File

@ -1,6 +1,9 @@
{ inputs, pkgs, lib, ... }: {
inputs,
rec { pkgs,
lib,
...
}: rec {
# Conveniance wrapper for mkOption with boolean type # Conveniance wrapper for mkOption with boolean type
mkBoolOpt = def: desc: mkBoolOpt = def: desc:
lib.mkOption { lib.mkOption {
@ -13,13 +16,11 @@ rec {
mkEnableOpt = lib.mkEnableOption; mkEnableOpt = lib.mkEnableOption;
# Like mkIf but the predicate is inverted # Like mkIf but the predicate is inverted
mkElse = pred: do: mkElse = pred: do: (lib.mkIf (!pred) do);
(lib.mkIf (!pred) do);
# Creates a symlink if it doesn't exist # Creates a symlink if it doesn't exist
# If it exists renew the link # If it exists renew the link
mkLink = src: dest: mkLink = src: dest: ''
''
if [ -L "${dest}" ]; then if [ -L "${dest}" ]; then
rm ${dest} rm ${dest}
fi fi
@ -27,23 +28,18 @@ rec {
''; '';
# Removes a symlink if it exists # Removes a symlink if it exists
mkUnlink = dest: mkUnlink = dest: ''
''
if [ -L "${dest}" ]; then if [ -L "${dest}" ]; then
rm ${dest} rm ${dest}
fi fi
''; '';
# TODO # TODO
mkMultiOptStr = { }: mkMultiOptStr = {}: {
{
}; };
# TODO # TODO
mkMultiOptPkg = { }: mkMultiOptPkg = {}: {
{
}; };
# Returns true if base contains element # Returns true if base contains element
@ -57,10 +53,18 @@ rec {
# For use with single element sets # For use with single element sets
attrName = set: let attrName = set: let
names = lib.attrNames set; names = lib.attrNames set;
in (if (names != [ ]) then (lib.head names) else null); in (
if (names != [])
then (lib.head names)
else null
);
# For use with single element sets # For use with single element sets
attrValue = set: let attrValue = set: let
values = lib.attrValues set; values = lib.attrValues set;
in (if (values != [ ]) then (lib.head values) else null); in (
if (values != [])
then (lib.head values)
else null
);
} }

View File

@ -1,10 +1,18 @@
{ inputs, pkgs, lib, ... }: {
inputs,
let pkgs,
lib,
...
}: let
inherit (inputs) home-manager; inherit (inputs) home-manager;
in { in {
mkNixosConfig = { system ? "x86_64-linux", mylib, hostname, username ? "christoph", extraModules ? [ ] }: mkNixosConfig = {
system ? "x86_64-linux",
mylib,
hostname,
username ? "christoph",
extraModules ? [],
}:
lib.nixosSystem { lib.nixosSystem {
inherit system; inherit system;
@ -28,7 +36,8 @@ in {
# but I failed because nix stopped autoinjecting the required arguments and I didn't # but I failed because nix stopped autoinjecting the required arguments and I didn't
# know how to handle that... # know how to handle that...
[ [
home-manager.nixosModules.home-manager { home-manager.nixosModules.home-manager
{
# extraSpecialArgs are propagated to all hm config modules # extraSpecialArgs are propagated to all hm config modules
home-manager.extraSpecialArgs = {inherit inputs hostname username mylib;}; home-manager.extraSpecialArgs = {inherit inputs hostname username mylib;};

View File

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

View File

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

View File

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

View File

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

View File

@ -1,10 +1,15 @@
# Edit this configuration file to define what should be installed on # Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help). # and in the NixOS manual (accessible by running nixos-help).
{ inputs, hostname, lib, mylib, config, pkgs, ... }:
{ {
inputs,
hostname,
lib,
mylib,
config,
pkgs,
...
}: {
imports = [ imports = [
# Import the host-specific system config # Import the host-specific system config
./${hostname} ./${hostname}
@ -121,7 +126,6 @@
# Enable networking # Enable networking
networkmanager.enable = true; networkmanager.enable = true;
firewall.enable = true; firewall.enable = true;
firewall.allowedTCPPorts = []; firewall.allowedTCPPorts = [];
firewall.allowedTCPPortRanges = []; firewall.allowedTCPPortRanges = [];
@ -133,7 +137,6 @@
9996 # TelemetryApp 9996 # TelemetryApp
]; ];
firewall.allowedUDPPortRanges = []; firewall.allowedUDPPortRanges = [];
}; };
# Enable the X11 windowing system. # Enable the X11 windowing system.
@ -273,7 +276,6 @@
in in
formatted; formatted;
# We want these packages to be available even when no user profile is active # We want these packages to be available even when no user profile is active
# Empty since we basically only need git + editor which is enabled below # Empty since we basically only need git + editor which is enabled below
environment.systemPackages = with pkgs; []; environment.systemPackages = with pkgs; [];

View File

@ -1,6 +1,11 @@
{ inputs, config, lib, mylib, pkgs, ... }: {
inputs,
rec { config,
lib,
mylib,
pkgs,
...
}: rec {
imports = [ imports = [
# Include the results of the hardware scan. # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix

View File

@ -1,9 +1,13 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{ {
config,
lib,
pkgs,
modulesPath,
...
}: {
imports = [(modulesPath + "/installer/scan/not-detected.nix")]; imports = [(modulesPath + "/installer/scan/not-detected.nix")];
boot = { boot = {

View File

@ -1,6 +1,11 @@
{ inputs, config, lib, mylib, pkgs, ... }: {
inputs,
rec { config,
lib,
mylib,
pkgs,
...
}: rec {
imports = [ imports = [
# Include the results of the hardware scan. # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix

View File

@ -1,9 +1,13 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{ {
config,
lib,
pkgs,
modulesPath,
...
}: {
imports = [ imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];