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
@ -82,40 +84,32 @@ let
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 {
in
buildPythonApplication rec {
version = "3.4.14";
pname = "cyberdrop-dl";

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" ''

View File

@ -1,5 +1,4 @@
{pkgs, ...}:
pkgs.writeShellScriptBin "find-gsettings-schemas" ''
schemas=""
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
cyberdrop-dl = pkgs.callPackage ./cyberdrop-dl {};
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
# 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";

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";

View File

@ -1,33 +1,30 @@
# 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 {
in
stdenv.mkDerivation rec {
pname = "vital-synth";
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'
# '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
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

10
env/c_cxx.nix vendored
View File

@ -5,9 +5,13 @@
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
outputs = {
self,
nixpkgs,
flake-utils,
devshell,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
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.devshell.url = "github:numtide/devshell";
outputs = { self, nixpkgs, flake-utils, devshell }:
flake-utils.lib.eachDefaultSystem (system:
let
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

View File

@ -5,9 +5,13 @@
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
outputs = {
self,
nixpkgs,
flake-utils,
devshell,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
@ -37,7 +41,8 @@
};
}));
myPython = pkgs.python310.withPackages (p: with p; [
myPython = pkgs.python310.withPackages (p:
with p; [
# Basic
rich

11
env/rust.nix vendored
View File

@ -6,9 +6,14 @@
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
outputs = {
self,
nixpkgs,
flake-utils,
devshell,
rust-overlay,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true; # For clion

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,8 +38,11 @@
# 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";
@ -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
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.
# It is a shorthand for recursive and allows to use the values defined in this set from its own scope.
in rec {
# 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

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,
@ -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
@ -424,7 +432,10 @@ in rec {
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

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,8 +68,8 @@ 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
@ -147,11 +151,13 @@ in {
home.activation = mkMerge [
# The module includes the default carla project with ArchetypePetrucci + ArchetypeGojira
(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");
})
(mkElse cfg.carla.enable {
unlinkCarlaConfig = hm.dag.entryAfter [ "writeBoundary" ]
unlinkCarlaConfig =
hm.dag.entryAfter ["writeBoundary"]
(mkUnlink "${config.home.homeDirectory}/.config/carla");
})
@ -166,19 +172,25 @@ in {
# })
(mkIf cfg.distrho.enable {
linkDistrhoLV2 = hm.dag.entryAfter [ "writeBoundary" ]
linkDistrhoLV2 =
hm.dag.entryAfter ["writeBoundary"]
(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");
linkDistrhoVST3 = hm.dag.entryAfter [ "writeBoundary" ]
linkDistrhoVST3 =
hm.dag.entryAfter ["writeBoundary"]
(mkLink "${pkgs.distrho}/lib/vst3" "${config.home.homeDirectory}/.vst3/distrho");
})
(mkElse cfg.distrho.enable {
unlinkDistrhoLV2 = hm.dag.entryAfter [ "writeBoundary" ]
unlinkDistrhoLV2 =
hm.dag.entryAfter ["writeBoundary"]
(mkUnlink "${config.home.homeDirectory}/.lv2/distrho");
unlinkDistrhoVST = hm.dag.entryAfter [ "writeBoundary" ]
unlinkDistrhoVST =
hm.dag.entryAfter ["writeBoundary"]
(mkUnlink "${config.home.homeDirectory}/.vst/distrho");
unlinkDistrhoVST3 = hm.dag.entryAfter [ "writeBoundary" ]
unlinkDistrhoVST3 =
hm.dag.entryAfter ["writeBoundary"]
(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 = [
./audio.nix
./emacs.nix

View File

@ -1,13 +1,15 @@
# 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;
@ -56,7 +58,8 @@ in {
];
# 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.pgtkNativeComp [((emacsPackagesFor emacsPgtkNativeComp).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?
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
(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
@ -99,10 +105,8 @@ 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
@ -113,11 +117,13 @@ in {
'';
# 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");
})
(mkElse cfg.doom.enable {
unlinkDoomConfig = hm.dag.entryAfter [ "writeBoundary" "installDoomEmacs" ]
unlinkDoomConfig =
hm.dag.entryAfter ["writeBoundary" "installDoomEmacs"]
(mkUnlink "${config.home.homeDirectory}/.config/doom");
})

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,7 +27,8 @@ in {
# TODO: Add Maildir to nextcloud sync
config = mkIf cfg.enable {
home.packages = with pkgs; builtins.concatLists [
home.packages = with pkgs;
builtins.concatLists [
(optionals cfg.kmail.enable [kmail])
];
@ -84,7 +86,8 @@ in {
passwordCommand = "kwallet-query -f email -r urpost kdewallet";
mbsync = { # Imap
mbsync = {
# Imap
enable = true;
create = "maildir";
};
@ -111,7 +114,8 @@ in {
passwordCommand = "kwallet-query -f email -r hhu kdewallet";
mbsync = { # Imap
mbsync = {
# Imap
enable = true;
create = "maildir";
};
@ -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

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,7 +22,8 @@ in {
};
config = mkIf cfg.enable {
home.packages = with pkgs; builtins.concatLists [
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...
@ -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,7 +34,8 @@ 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 [
in
mkMerge [
# Default abbrs, always available
{
# Shell basic

View File

@ -1,12 +1,16 @@
{ 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 {
@ -74,13 +78,11 @@ in {
# 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}"; });
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);
extra_overrides = map (set: concat_override (attrName set) (attrValue set)) cfg.extraOverride;
# Global overrides
@ -103,32 +105,38 @@ in {
global_overrides = builtins.concatLists [global_default_overrides cfg.extraGlobalOverride];
str_global_overrides = builtins.concatStringsSep ";" global_overrides;
in mkMerge ([
in
mkMerge ([
{
".local/share/flatpak/overrides/global".text = "[Context]\nfilesystems=${str_global_overrides}";
}
] ++ extra_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" ]
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" ]
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" ]
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" ]
unlinkIconDir =
lib.hm.dag.entryAfter ["writeBoundary"]
(mkUnlink "${config.home.homeDirectory}/.local/share/icons");
})

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,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)
oversteer # TODO: Make option

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
@ -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-boxes # VM
@ -254,7 +258,8 @@ in {
"drive-menu@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"
]

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";

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,8 +25,8 @@ in {
};
config = mkIf cfg.enable {
home.packages = with pkgs; builtins.concatLists [
home.packages = with pkgs;
builtins.concatLists [
(optionals cfg.keepass.enable [keepassxc])
(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 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 = {

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; [];
};
}

View File

@ -1,19 +1,23 @@
{ 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 [
home.packages = with pkgs;
lib.concatLists [
[
ranger
atool
@ -28,6 +32,7 @@ in {
(optionals cfg.preview [
# ueberzug # Only X11
# TODO: Conflicts with global python?
python310Packages.pillow
ffmpegthumbnailer
imagemagick
@ -39,16 +44,27 @@ in {
{
".config/ranger/rc.conf".text = let
# TODO: Why does mkMerge don't work here?
settings = {
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
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_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";
});
@ -56,8 +72,8 @@ in {
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, ... }:
{
inputs,
pkgs,
lib,
...
}: {
nixos = import ./nixos.nix {inherit inputs pkgs lib;};
modules = import ./modules.nix {inherit inputs pkgs lib;};
}

View File

@ -1,6 +1,9 @@
{ inputs, pkgs, lib, ... }:
rec {
{
inputs,
pkgs,
lib,
...
}: rec {
# Conveniance wrapper for mkOption with boolean type
mkBoolOpt = def: desc:
lib.mkOption {
@ -13,13 +16,11 @@ rec {
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,23 +28,18 @@ 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
@ -57,10 +53,18 @@ rec {
# 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,10 +1,18 @@
{ inputs, pkgs, lib, ... }:
let
{
inputs,
pkgs,
lib,
...
}: let
inherit (inputs) home-manager;
in {
mkNixosConfig = { system ? "x86_64-linux", mylib, hostname, username ? "christoph", extraModules ? [ ] }:
mkNixosConfig = {
system ? "x86_64-linux",
mylib,
hostname,
username ? "christoph",
extraModules ? [],
}:
lib.nixosSystem {
inherit system;
@ -28,7 +36,8 @@ in {
# but I failed because nix stopped autoinjecting the required arguments and I didn't
# know how to handle that...
[
home-manager.nixosModules.home-manager {
home-manager.nixosModules.home-manager
{
# extraSpecialArgs are propagated to all hm config modules
home-manager.extraSpecialArgs = {inherit inputs hostname username mylib;};

View File

@ -1,15 +1,20 @@
{ 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

View File

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

View File

@ -1,11 +1,14 @@
# 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;

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}
@ -121,7 +126,6 @@
# Enable networking
networkmanager.enable = true;
firewall.enable = true;
firewall.allowedTCPPorts = [];
firewall.allowedTCPPortRanges = [];
@ -133,7 +137,6 @@
9996 # TelemetryApp
];
firewall.allowedUDPPortRanges = [];
};
# Enable the X11 windowing system.
@ -273,7 +276,6 @@
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; [];

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

View File

@ -1,9 +1,13 @@
# 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 = {

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

View File

@ -1,9 +1,13 @@
# 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")
];