diff --git a/flake.nix b/flake.nix index ed6374c..13660f9 100644 --- a/flake.nix +++ b/flake.nix @@ -30,5 +30,5 @@ }; }; - outputs = { ... } @ args: import ./outputs.nix args; + outputs = {...} @ args: import ./outputs.nix args; } diff --git a/home/configurations.nix b/home/configurations.nix index 6c2850f..0593981 100644 --- a/home/configurations.nix +++ b/home/configurations.nix @@ -1,31 +1,29 @@ -{ self -, nixpkgs -, home-manager -}@inputs: -let - hmConfiguration = - { homeDirectory ? "/home/dadada" - , extraModules ? [ ] - , system ? "x86_64-linux" - , username ? "dadada" - , stateVersion - }: - (home-manager.lib.homeManagerConfiguration { - configuration = { ... }: { - imports = (nixpkgs.lib.attrValues self.hmModules) ++ extraModules; - nixpkgs = { - config = import ./nixpkgs-config.nix { - pkgs = nixpkgs; - }; - }; - manual.manpages.enable = false; - }; - inherit system homeDirectory username stateVersion; - }); -in { + self, + nixpkgs, + home-manager, +} @ inputs: let + hmConfiguration = { + homeDirectory ? "/home/dadada", + extraModules ? [], + system ? "x86_64-linux", + username ? "dadada", + stateVersion, + }: (home-manager.lib.homeManagerConfiguration { + configuration = {...}: { + imports = (nixpkgs.lib.attrValues self.hmModules) ++ extraModules; + nixpkgs = { + config = import ./nixpkgs-config.nix { + pkgs = nixpkgs; + }; + }; + manual.manpages.enable = false; + }; + inherit system homeDirectory username stateVersion; + }); +in { home = hmConfiguration { - extraModules = [ ./home ]; + extraModules = [./home]; stateVersion = "20.09"; }; } diff --git a/home/home/default.nix b/home/home/default.nix index 92ff392..afcee54 100644 --- a/home/home/default.nix +++ b/home/home/default.nix @@ -1,5 +1,9 @@ -{ config, pkgs, lib, ... }: -let +{ + config, + pkgs, + lib, + ... +}: let useFeatures = [ "alacritty" #"emacs" @@ -14,8 +18,7 @@ let "xdg" "zsh" ]; -in -{ +in { programs.git = { signing = { key = "D68C84695C087E0F733A28D0EEB8D1CE62C4DFEA"; @@ -27,25 +30,27 @@ in programs.gpg.settings.default-key = "99658A3EB5CD7C13"; - dadada.home = lib.attrsets.genAttrs useFeatures (useFeatures: { enable = true; }) // { - session = { - enable = true; - sessionVars = { - EDITOR = "vim"; - PAGER = "less"; - MAILDIR = "\$HOME/.var/mail"; - MBLAZE = "\$HOME/.config/mblaze"; - NOTMUCH_CONFIG = "\$HOME/.config/notmuch/config"; + dadada.home = + lib.attrsets.genAttrs useFeatures (useFeatures: {enable = true;}) + // { + session = { + enable = true; + sessionVars = { + EDITOR = "vim"; + PAGER = "less"; + MAILDIR = "\$HOME/.var/mail"; + MBLAZE = "\$HOME/.config/mblaze"; + NOTMUCH_CONFIG = "\$HOME/.config/notmuch/config"; + }; }; }; - }; # Languagetool server for web extension systemd.user.services."languagetool-http-server" = { Unit = { Description = "Languagetool HTTP server"; - PartOf = [ "graphical-session-pre.target" ]; - After = [ "graphical-session.target" ]; + PartOf = ["graphical-session-pre.target"]; + After = ["graphical-session.target"]; }; Service = { @@ -54,11 +59,11 @@ in Restart = "always"; }; - Install = { WantedBy = [ "graphical-session.target" ]; }; + Install = {WantedBy = ["graphical-session.target"];}; }; # Let Home Manager install and manage itself. programs.home-manager.enable = true; - home.packages = import ./pkgs.nix { pkgs = pkgs; }; + home.packages = import ./pkgs.nix {pkgs = pkgs;}; } diff --git a/home/home/pkgs.nix b/home/home/pkgs.nix index b6b78c3..9ec1fb5 100644 --- a/home/home/pkgs.nix +++ b/home/home/pkgs.nix @@ -1,4 +1,4 @@ -{ pkgs }: +{pkgs}: with pkgs; [ anki aqbanking diff --git a/home/modules/alacritty/default.nix b/home/modules/alacritty/default.nix index 395f5ab..2faace4 100644 --- a/home/modules/alacritty/default.nix +++ b/home/modules/alacritty/default.nix @@ -1,9 +1,12 @@ -{ pkgs, lib, config, ... }: -with lib; -let - cfg = config.dadada.home.alacritty; -in { + pkgs, + lib, + config, + ... +}: +with lib; let + cfg = config.dadada.home.alacritty; +in { options.dadada.home.alacritty = { enable = mkEnableOption "Enable alacritty config"; }; @@ -78,12 +81,30 @@ in }; indexed_colors = [ - { index = 16; color = "0xffa500"; } - { index = 17; color = "0xb03060"; } - { index = 18; color = "0x282828"; } - { index = 19; color = "0x444155"; } - { index = 20; color = "0xb8b8b8"; } - { index = 21; color = "0xe8e8e8"; } + { + index = 16; + color = "0xffa500"; + } + { + index = 17; + color = "0xb03060"; + } + { + index = 18; + color = "0x282828"; + } + { + index = 19; + color = "0x444155"; + } + { + index = 20; + color = "0xb8b8b8"; + } + { + index = 21; + color = "0xe8e8e8"; + } ]; }; }; diff --git a/home/modules/colors.nix b/home/modules/colors.nix index 950fe52..5a2f594 100644 --- a/home/modules/colors.nix +++ b/home/modules/colors.nix @@ -1,6 +1,9 @@ -{ config, lib, ... }: -with lib; { + config, + lib, + ... +}: +with lib; { options.dadada.home.colors = mkOption { type = types.attrs; description = "Color scheme"; diff --git a/home/modules/default.nix b/home/modules/default.nix index c5fe056..4d4eff8 100644 --- a/home/modules/default.nix +++ b/home/modules/default.nix @@ -1,9 +1,12 @@ -{ self, nix-doom-emacs, ... }@inputs: { + self, + nix-doom-emacs, + ... +} @ inputs: { alacritty = import ./alacritty; colors = import ./colors.nix; direnv = import ./direnv.nix; - emacs = import ./emacs { inherit nix-doom-emacs; }; + emacs = import ./emacs {inherit nix-doom-emacs;}; fish = import ./fish.nix; git = import ./git.nix; gpg = import ./gpg.nix; diff --git a/home/modules/direnv.nix b/home/modules/direnv.nix index 997c9e9..acc00ea 100644 --- a/home/modules/direnv.nix +++ b/home/modules/direnv.nix @@ -1,9 +1,12 @@ -{ config, pkgs, lib, ... }: -with lib; -let - cfg = config.dadada.home.direnv; -in { + config, + pkgs, + lib, + ... +}: +with lib; let + cfg = config.dadada.home.direnv; +in { options.dadada.home.direnv = { enable = mkEnableOption "Enable direnv config"; }; diff --git a/home/modules/emacs/default.nix b/home/modules/emacs/default.nix index 7091a37..9d13d78 100644 --- a/home/modules/emacs/default.nix +++ b/home/modules/emacs/default.nix @@ -1,11 +1,13 @@ -{ nix-doom-emacs, ... }: -{ config, pkgs, lib, ... }: -with lib; -let +{nix-doom-emacs, ...}: { + config, + pkgs, + lib, + ... +}: +with lib; let cfg = config.dadada.home.emacs; -in -{ - imports = [ nix-doom-emacs.hmModule ]; +in { + imports = [nix-doom-emacs.hmModule]; options.dadada.home.emacs = { enable = mkEnableOption "Enable dadada emacs config"; }; @@ -13,58 +15,57 @@ in programs.doom-emacs = { enable = true; doomPrivateDir = ./doom.d; - emacsPackagesOverlay = self: super: with pkgs; { - tsc = super.tsc.overrideAttrs (old: - let - libtsc_dyn = rustPlatform.buildRustPackage rec { - pname = "emacs-tree-sitter"; - version = "0.15.1"; - src = fetchFromGitHub { - owner = "ubolonton"; - repo = "emacs-tree-sitter"; - rev = version; - sha256 = "sha256-WgkGtmw63+kRLTRiSEO4bFF2IguH5g4odCujyazkwJc="; + emacsPackagesOverlay = self: super: + with pkgs; { + tsc = super.tsc.overrideAttrs (old: let + libtsc_dyn = rustPlatform.buildRustPackage rec { + pname = "emacs-tree-sitter"; + version = "0.15.1"; + src = fetchFromGitHub { + owner = "ubolonton"; + repo = "emacs-tree-sitter"; + rev = version; + sha256 = "sha256-WgkGtmw63+kRLTRiSEO4bFF2IguH5g4odCujyazkwJc="; + }; + preBuild = '' + export BINDGEN_EXTRA_CLANG_ARGS="$(< ${stdenv.cc}/nix-support/libc-crt1-cflags) \ + $(< ${stdenv.cc}/nix-support/libc-cflags) \ + $(< ${stdenv.cc}/nix-support/cc-cflags) \ + $(< ${stdenv.cc}/nix-support/libcxx-cxxflags) \ + ${lib.optionalString stdenv.cc.isClang "-idirafter ${stdenv.cc.cc}/lib/clang/${lib.getVersion stdenv.cc.cc}/include"} \ + ${lib.optionalString stdenv.cc.isGNU + "-isystem ${stdenv.cc.cc}/lib/gcc/${stdenv.hostPlatform.config}/${lib.getVersion stdenv.cc.cc}/include/"} \ + ${lib.optionalString stdenv.cc.isGNU + "-isystem ${stdenv.cc.cc}/include/c++/${lib.getVersion stdenv.cc.cc} -isystem ${stdenv.cc.cc}/include/c++/${lib.getVersion stdenv.cc.cc}/${stdenv.hostPlatform.config}"} \ + $NIX_CFLAGS_COMPILE" + ''; + LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib"; + cargoHash = "sha256-HB5tFR1slY2D6jb2mt4KrGrGBUUVrxiBjmVycO+qfYY="; }; + in { + inherit (libtsc_dyn) src; preBuild = '' - export BINDGEN_EXTRA_CLANG_ARGS="$(< ${stdenv.cc}/nix-support/libc-crt1-cflags) \ - $(< ${stdenv.cc}/nix-support/libc-cflags) \ - $(< ${stdenv.cc}/nix-support/cc-cflags) \ - $(< ${stdenv.cc}/nix-support/libcxx-cxxflags) \ - ${lib.optionalString stdenv.cc.isClang "-idirafter ${stdenv.cc.cc}/lib/clang/${lib.getVersion stdenv.cc.cc}/include"} \ - ${lib.optionalString stdenv.cc.isGNU - "-isystem ${stdenv.cc.cc}/lib/gcc/${stdenv.hostPlatform.config}/${lib.getVersion stdenv.cc.cc}/include/"} \ - ${lib.optionalString stdenv.cc.isGNU - "-isystem ${stdenv.cc.cc}/include/c++/${lib.getVersion stdenv.cc.cc} -isystem ${stdenv.cc.cc}/include/c++/${lib.getVersion stdenv.cc.cc}/${stdenv.hostPlatform.config}"} \ - $NIX_CFLAGS_COMPILE" + ext=${stdenv.hostPlatform.extensions.sharedLibrary} + dest=$out/share/emacs/site-lisp/elpa/tsc-${old.version} + install -D ${libtsc_dyn}/lib/libtsc_dyn$ext $dest/tsc-dyn$ext + echo -n "0.15.1" > $dest/DYN-VERSION ''; - LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib"; - cargoHash = "sha256-HB5tFR1slY2D6jb2mt4KrGrGBUUVrxiBjmVycO+qfYY="; - }; - in - { - inherit (libtsc_dyn) src; - preBuild = '' - ext=${stdenv.hostPlatform.extensions.sharedLibrary} - dest=$out/share/emacs/site-lisp/elpa/tsc-${old.version} - install -D ${libtsc_dyn}/lib/libtsc_dyn$ext $dest/tsc-dyn$ext - echo -n "0.15.1" > $dest/DYN-VERSION - ''; - }); - tree-sitter-langs = super.tree-sitter-langs.overrideAttrs (old: { - postInstall = '' - dest=$out/share/emacs/site-lisp/elpa/tree-sitter-langs-${old.version} - echo -n "0.10.2" > $dest/BUNDLE-VERSION - ${lib.concatStringsSep "\n" - (lib.mapAttrsToList (name: src: "name=${name}; ln -s ${src}/parser $dest/bin/\${name#tree-sitter-}.so") pkgs.tree-sitter.builtGrammars)}; - ''; - }); - }; + }); + tree-sitter-langs = super.tree-sitter-langs.overrideAttrs (old: { + postInstall = '' + dest=$out/share/emacs/site-lisp/elpa/tree-sitter-langs-${old.version} + echo -n "0.10.2" > $dest/BUNDLE-VERSION + ${lib.concatStringsSep "\n" + (lib.mapAttrsToList (name: src: "name=${name}; ln -s ${src}/parser $dest/bin/\${name#tree-sitter-}.so") pkgs.tree-sitter.builtGrammars)}; + ''; + }); + }; }; - home.file.".tree-sitter".source = (pkgs.runCommand "grammars" {} '' - mkdir -p $out/bin - echo -n "0.10.2" > $out/BUNDLE-VERSION - ${lib.concatStringsSep "\n" + home.file.".tree-sitter".source = pkgs.runCommand "grammars" {} '' + mkdir -p $out/bin + echo -n "0.10.2" > $out/BUNDLE-VERSION + ${lib.concatStringsSep "\n" (lib.mapAttrsToList (name: src: "name=${name}; ln -s ${src}/parser $out/bin/\${name#tree-sitter-}.so") pkgs.tree-sitter.builtGrammars)}; - ''); + ''; }; } diff --git a/home/modules/fish.nix b/home/modules/fish.nix index 89689e8..dcbc5fc 100644 --- a/home/modules/fish.nix +++ b/home/modules/fish.nix @@ -1,9 +1,12 @@ -{ config, pkgs, lib, ... }: -with lib; -let - cfg = config.dadada.home.fish; -in { + config, + pkgs, + lib, + ... +}: +with lib; let + cfg = config.dadada.home.fish; +in { options.dadada.home.fish = { enable = mkEnableOption "Enable fish config"; }; @@ -11,15 +14,17 @@ in config = mkIf cfg.enable { programs.fish = { enable = true; - plugins = with pkgs; [{ - name = "fzf"; - src = pkgs.fetchFromGitHub { - owner = "jethrokuan"; - repo = "fzf"; - rev = "c3defd4a922e97120503b45e26efa775bc672b50"; - sha256 = "1k5b0nva0mbqc9830qhbcwxsi8d9b2p4ws1fq0bw9nkf2ripyp4p"; - }; - }]; + plugins = with pkgs; [ + { + name = "fzf"; + src = pkgs.fetchFromGitHub { + owner = "jethrokuan"; + repo = "fzf"; + rev = "c3defd4a922e97120503b45e26efa775bc672b50"; + sha256 = "1k5b0nva0mbqc9830qhbcwxsi8d9b2p4ws1fq0bw9nkf2ripyp4p"; + }; + } + ]; interactiveShellInit = '' # fish git prompt set __fish_git_prompt_show_informative_status 'yes' @@ -75,6 +80,6 @@ in }; }; - home.packages = [ pkgs.exa ]; + home.packages = [pkgs.exa]; }; } diff --git a/home/modules/git.nix b/home/modules/git.nix index 4c17be5..1df4884 100644 --- a/home/modules/git.nix +++ b/home/modules/git.nix @@ -1,9 +1,12 @@ -{ config, lib, pkgs, ... }: -with lib; -let - cfg = config.dadada.home.git; -in { + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.dadada.home.git; +in { options.dadada.home.git = { enable = mkEnableOption "Enable git config"; }; @@ -16,7 +19,7 @@ in tab-in-indent = true; tabwidth = 4; }; - alias = { }; + alias = {}; pager = "delta"; }; column.ui = "never"; diff --git a/home/modules/gpg.nix b/home/modules/gpg.nix index 4adc636..cfe7acb 100644 --- a/home/modules/gpg.nix +++ b/home/modules/gpg.nix @@ -1,9 +1,11 @@ -{ config, lib, ... }: -with lib; -let - cfg = config.dadada.home.gpg; -in { + config, + lib, + ... +}: +with lib; let + cfg = config.dadada.home.gpg; +in { options.dadada.home.gpg = { enable = mkEnableOption "Enable GnuPG config"; }; @@ -29,7 +31,7 @@ in }; programs.git.extraConfig = { - commit = { gpgSign = true; }; + commit = {gpgSign = true;}; }; }; } diff --git a/home/modules/gtk.nix b/home/modules/gtk.nix index c6b99a7..5128202 100644 --- a/home/modules/gtk.nix +++ b/home/modules/gtk.nix @@ -1,9 +1,12 @@ -{ config, lib, pkgs, ... }: -with lib; -let - cfg = config.dadada.home.gtk; -in { + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.dadada.home.gtk; +in { options.dadada.home.gtk = { enable = mkEnableOption "Enable GTK config"; }; diff --git a/home/modules/keyring.nix b/home/modules/keyring.nix index c7eba12..ff00bd7 100644 --- a/home/modules/keyring.nix +++ b/home/modules/keyring.nix @@ -1,16 +1,18 @@ -{ config, lib, ... }: -with lib; -let - cfg = config.dadada.home.keyring; -in { + config, + lib, + ... +}: +with lib; let + cfg = config.dadada.home.keyring; +in { options.dadada.home.keyring = { enable = mkEnableOption "Enable keyring config"; }; config = mkIf cfg.enable { services.gnome-keyring = { enable = false; - components = [ "pkcs11" "secrets" ]; + components = ["pkcs11" "secrets"]; }; }; } diff --git a/home/modules/kitty/default.nix b/home/modules/kitty/default.nix index 0486988..b90a61f 100644 --- a/home/modules/kitty/default.nix +++ b/home/modules/kitty/default.nix @@ -1,9 +1,12 @@ -{ pkgs, lib, config, ... }: -with lib; -let - cfg = config.dadada.home.kitty; -in { + pkgs, + lib, + config, + ... +}: +with lib; let + cfg = config.dadada.home.kitty; +in { options.dadada.home.kitty = { enable = mkEnableOption "Enable kitty config"; }; @@ -12,6 +15,6 @@ in enable = true; extraConfig = builtins.readFile ./config; }; - home.packages = [ pkgs.source-code-pro ]; + home.packages = [pkgs.source-code-pro]; }; } diff --git a/home/modules/mako.nix b/home/modules/mako.nix index b305311..77d99f7 100644 --- a/home/modules/mako.nix +++ b/home/modules/mako.nix @@ -1,9 +1,13 @@ -{ config, lib, pkgs, colors, ... }: -with lib; -let - cfg = config.dadada.home.mako; -in { + config, + lib, + pkgs, + colors, + ... +}: +with lib; let + cfg = config.dadada.home.mako; +in { options.dadada.home.mako = { enable = mkEnableOption "Enable mako config"; }; diff --git a/home/modules/session.nix b/home/modules/session.nix index 7ea0c1f..61236eb 100644 --- a/home/modules/session.nix +++ b/home/modules/session.nix @@ -1,15 +1,17 @@ -{ config, lib, ... }: -with lib; -let - cfg = config.dadada.home.session; -in { + config, + lib, + ... +}: +with lib; let + cfg = config.dadada.home.session; +in { options.dadada.home.session = { enable = mkEnableOption "Enable session variable management"; sessionVars = mkOption { description = "Session variables"; type = types.attrs; - default = { }; + default = {}; example = '' EDITOR = "vim"; PAGER = "less"; diff --git a/home/modules/ssh.nix b/home/modules/ssh.nix index b468d08..ee4d227 100644 --- a/home/modules/ssh.nix +++ b/home/modules/ssh.nix @@ -1,9 +1,11 @@ -{ config, lib, ... }: -with lib; -let - cfg = config.dadada.home.ssh; -in { + config, + lib, + ... +}: +with lib; let + cfg = config.dadada.home.ssh; +in { options.dadada.home.ssh = { enable = mkEnableOption "Enable SSH config"; }; diff --git a/home/modules/sway/default.nix b/home/modules/sway/default.nix index 45eaee6..e28cc33 100644 --- a/home/modules/sway/default.nix +++ b/home/modules/sway/default.nix @@ -1,9 +1,13 @@ -{ config, pkgs, lib, colors, ... }: -with lib; -let - cfg = config.dadada.home.sway; -in { + config, + pkgs, + lib, + colors, + ... +}: +with lib; let + cfg = config.dadada.home.sway; +in { options.dadada.home.sway = { enable = mkEnableOption "Enable Sway config"; }; @@ -26,7 +30,7 @@ in wayland.windowManager.sway = { enable = true; config = null; - extraConfig = (builtins.readFile ./config); + extraConfig = builtins.readFile ./config; extraSessionCommands = '' export SDL_VIDEODRIVER=wayland # needs qt5.qtwayland in systemPackages diff --git a/home/modules/syncthing.nix b/home/modules/syncthing.nix index a184a13..b8ac74b 100644 --- a/home/modules/syncthing.nix +++ b/home/modules/syncthing.nix @@ -1,9 +1,12 @@ -{ config, pkgs, lib, ... }: -with lib; -let - cfg = config.dadada.home.syncthing; -in { + config, + pkgs, + lib, + ... +}: +with lib; let + cfg = config.dadada.home.syncthing; +in { options.dadada.home.syncthing = { enable = mkEnableOption "Enable Syncthing config"; }; diff --git a/home/modules/termite.nix b/home/modules/termite.nix index 694b34b..a3c43db 100644 --- a/home/modules/termite.nix +++ b/home/modules/termite.nix @@ -1,14 +1,13 @@ -{ config -, lib -, pkgs -, colors ? ../../lib/colors.nix -, ... -}: -with lib; -let - cfg = config.dadada.home.termite; -in { + config, + lib, + pkgs, + colors ? ../../lib/colors.nix, + ... +}: +with lib; let + cfg = config.dadada.home.termite; +in { options.dadada.home.termite = { enable = mkEnableOption "Enable termite config"; }; diff --git a/home/modules/tmux.nix b/home/modules/tmux.nix index 99a28f0..cc68bbe 100644 --- a/home/modules/tmux.nix +++ b/home/modules/tmux.nix @@ -1,9 +1,11 @@ -{ config, lib, ... }: -with lib; -let - cfg = config.dadada.home.tmux; -in { + config, + lib, + ... +}: +with lib; let + cfg = config.dadada.home.tmux; +in { options.dadada.home.tmux = { enable = mkEnableOption "Enable tmux config"; }; diff --git a/home/modules/vim/default.nix b/home/modules/vim/default.nix index 91d5d9c..efc74ab 100644 --- a/home/modules/vim/default.nix +++ b/home/modules/vim/default.nix @@ -1,10 +1,13 @@ -{ config, pkgs, lib, ... }: -with lib; -let - cfg = config.dadada.home.vim; - vimPlugins = pkgs.callPackage ../../../pkgs/vimPlugins { }; -in { + config, + pkgs, + lib, + ... +}: +with lib; let + cfg = config.dadada.home.vim; + vimPlugins = pkgs.callPackage ../../../pkgs/vimPlugins {}; +in { options.dadada.home.vim = { enable = mkEnableOption "Enable VIM config"; }; diff --git a/home/modules/xdg.nix b/home/modules/xdg.nix index f3014b6..85feff5 100644 --- a/home/modules/xdg.nix +++ b/home/modules/xdg.nix @@ -1,6 +1,10 @@ -{ config, pkgs, lib, ... }: -with lib; -let +{ + config, + pkgs, + lib, + ... +}: +with lib; let apps = { "x-scheme-handler/mailto" = "userapp-Thunderbird-PB7NI0.desktop"; "message/rfc822" = "userapp-Thunderbird-PB7NI0.desktop"; @@ -19,8 +23,7 @@ let "application/pdf" = "org.pwmt.zathura.desktop"; }; cfg = config.dadada.home.xdg; -in -{ +in { options.dadada.home.xdg = { enable = mkEnableOption "Enable XDG config"; }; diff --git a/home/modules/zsh.nix b/home/modules/zsh.nix index 068387a..c192094 100644 --- a/home/modules/zsh.nix +++ b/home/modules/zsh.nix @@ -1,9 +1,12 @@ -{ config, pkgs, lib, ... }: -with lib; -let - cfg = config.dadada.home.zsh; -in { + config, + pkgs, + lib, + ... +}: +with lib; let + cfg = config.dadada.home.zsh; +in { options.dadada.home.zsh = { enable = mkEnableOption "Enable ZSH config"; }; diff --git a/home/nixpkgs-config.nix b/home/nixpkgs-config.nix index 24650fe..8939fc5 100644 --- a/home/nixpkgs-config.nix +++ b/home/nixpkgs-config.nix @@ -1,7 +1,6 @@ -{ pkgs }: -{ +{pkgs}: { allowUnfree = true; - allowUnfreePredicate = (pkg: true); + allowUnfreePredicate = pkg: true; allowBroken = false; android_sdk.accept_license = true; } diff --git a/lib/default.nix b/lib/default.nix index 878d2c0..7b055cd 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,5 +1,4 @@ -{ pkgs }: - +{pkgs}: with pkgs.lib; { # TODO } diff --git a/nixos/agares/configuration.nix b/nixos/agares/configuration.nix index 014c2c3..9c31239 100644 --- a/nixos/agares/configuration.nix +++ b/nixos/agares/configuration.nix @@ -1,5 +1,9 @@ -{ config, pkgs, lib, ... }: { + config, + pkgs, + lib, + ... +}: { imports = [ ./hardware-configuration.nix ]; @@ -44,10 +48,10 @@ networking.bridges = { "br-lan" = { - interfaces = [ "lan" ]; + interfaces = ["lan"]; }; "br-backup" = { - interfaces = [ "backup" ]; + interfaces = ["backup"]; }; }; diff --git a/nixos/agares/hardware-configuration.nix b/nixos/agares/hardware-configuration.nix index 5642461..d15b480 100644 --- a/nixos/agares/hardware-configuration.nix +++ b/nixos/agares/hardware-configuration.nix @@ -1,24 +1,28 @@ # 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" "ehci_pci" "usb_storage" "sd_mod" "sdhci_pci" ]; - boot.initrd.kernelModules = [ ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "ehci_pci" "usb_storage" "sd_mod" "sdhci_pci"]; + boot.initrd.kernelModules = []; + boot.extraModulePackages = []; - fileSystems."/" = - { device = "/dev/sda1"; + fileSystems."/" = { + device = "/dev/sda1"; fsType = "btrfs"; - options = [ "subvol=root" ]; + options = ["subvol=root"]; }; - swapDevices = [ ]; + swapDevices = []; # The global useDHCP flag is deprecated, therefore explicitly set to false here. # Per-interface useDHCP will be mandatory in the future, so this generated config diff --git a/nixos/configurations.nix b/nixos/configurations.nix index cf5d829..dadf1f9 100644 --- a/nixos/configurations.nix +++ b/nixos/configurations.nix @@ -1,84 +1,97 @@ -{ self -, admins -, nixpkgs -, nixosSystem -, home-manager -, homePage -, nixos-hardware -, nvd -, scripts -, recipemd -}: -let +{ + self, + admins, + nixpkgs, + nixosSystem, + home-manager, + homePage, + nixos-hardware, + nvd, + scripts, + recipemd, +}: let adapterModule = system: { - nixpkgs.config.allowUnfreePredicate = (pkg: true); - nixpkgs.overlays = (nixpkgs.lib.attrValues self.overlays) ++ [ - (final: prev: { homePage = homePage.defaultPackage.${system}; }) - (final: prev: { s = scripts; }) - (final: prev: { n = nvd; }) - (final: prev: { recipemd = recipemd.defaultPackage.${system}; }) - ]; + nixpkgs.config.allowUnfreePredicate = pkg: true; + nixpkgs.overlays = + (nixpkgs.lib.attrValues self.overlays) + ++ [ + (final: prev: {homePage = homePage.defaultPackage.${system};}) + (final: prev: {s = scripts;}) + (final: prev: {n = nvd;}) + (final: prev: {recipemd = recipemd.defaultPackage.${system};}) + ]; }; lib = nixpkgs.lib; adminConfig = users: { dadada.admin.users = lib.getAttrs users admins; }; -in -{ +in { gorgon = nixosSystem rec { system = "x86_64-linux"; - modules = (nixpkgs.lib.attrValues self.nixosModules) ++ [ - (adapterModule system) - nixos-hardware.nixosModules.lenovo-thinkpad-t14s-amd-gen1 - home-manager.nixosModules.home-manager - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.sharedModules = (nixpkgs.lib.attrValues self.hmModules) ++ [ - { manual.manpages.enable = false;} - ]; - home-manager.users.dadada = import ../home/home; - } - ./modules/profiles/laptop.nix - ./gorgon/configuration.nix - ]; + modules = + (nixpkgs.lib.attrValues self.nixosModules) + ++ [ + (adapterModule system) + nixos-hardware.nixosModules.lenovo-thinkpad-t14s-amd-gen1 + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.sharedModules = + (nixpkgs.lib.attrValues self.hmModules) + ++ [ + {manual.manpages.enable = false;} + ]; + home-manager.users.dadada = import ../home/home; + } + ./modules/profiles/laptop.nix + ./gorgon/configuration.nix + ]; }; ifrit = nixosSystem rec { system = "x86_64-linux"; - modules = (nixpkgs.lib.attrValues self.nixosModules) ++ [ - (adminConfig [ "dadada" ]) - (adapterModule system) - ./modules/profiles/server.nix - ./ifrit/configuration.nix - ]; + modules = + (nixpkgs.lib.attrValues self.nixosModules) + ++ [ + (adminConfig ["dadada"]) + (adapterModule system) + ./modules/profiles/server.nix + ./ifrit/configuration.nix + ]; }; surgat = nixosSystem rec { system = "x86_64-linux"; - modules = (nixpkgs.lib.attrValues self.nixosModules) ++ [ - (adminConfig [ "dadada" ]) - (adapterModule system) - ./modules/profiles/server.nix - ./surgat/configuration.nix - ]; + modules = + (nixpkgs.lib.attrValues self.nixosModules) + ++ [ + (adminConfig ["dadada"]) + (adapterModule system) + ./modules/profiles/server.nix + ./surgat/configuration.nix + ]; }; pruflas = nixosSystem rec { system = "x86_64-linux"; - modules = (nixpkgs.lib.attrValues self.nixosModules) ++ [ - (adminConfig [ "dadada" ]) - (adapterModule system) - ./modules/profiles/laptop.nix - ./pruflas/configuration.nix - ]; + modules = + (nixpkgs.lib.attrValues self.nixosModules) + ++ [ + (adminConfig ["dadada"]) + (adapterModule system) + ./modules/profiles/laptop.nix + ./pruflas/configuration.nix + ]; }; agares = nixosSystem rec { system = "x86_64-linux"; - modules = (nixpkgs.lib.attrValues self.nixosModules) ++ [ - (adminConfig [ "dadada" ]) - (adapterModule system) - ./modules/profiles/server.nix - ./agares/configuration.nix - ]; + modules = + (nixpkgs.lib.attrValues self.nixosModules) + ++ [ + (adminConfig ["dadada"]) + (adapterModule system) + ./modules/profiles/server.nix + ./agares/configuration.nix + ]; }; } diff --git a/nixos/gorgon/configuration.nix b/nixos/gorgon/configuration.nix index 10f8778..00bba50 100644 --- a/nixos/gorgon/configuration.nix +++ b/nixos/gorgon/configuration.nix @@ -1,6 +1,11 @@ -{ config, pkgs, lib, ... }: -let - signHook = pkgs.writeShellScript "/etc/nix/sign-cache.sh" +{ + config, + pkgs, + lib, + ... +}: let + signHook = + pkgs.writeShellScript "/etc/nix/sign-cache.sh" '' set -eu set -f # disable globbing @@ -9,20 +14,19 @@ let echo "Signing paths" $OUT_PATHS nix store sign --key-file /etc/nix/key.private $OUT_PATHS ''; -in -{ +in { imports = [ ./hardware-configuration.nix ]; nix.extraOptions = '' - experimental-features = nix-command flakes - # Prevent garbage collection for nix shell and direnv - keep-outputs = true - keep-derivations = true + experimental-features = nix-command flakes + # Prevent garbage collection for nix shell and direnv + keep-outputs = true + keep-derivations = true ''; - boot.kernelModules = [ "kvm-amd" ]; + boot.kernelModules = ["kvm-amd"]; networking.hostName = "gorgon"; @@ -39,9 +43,9 @@ in networking = { enableBsShare = true; localResolver = { - enable= true; - uwu= true; - s0= true; + enable = true; + uwu = true; + s0 = true; }; vpnExtension = "3"; }; @@ -99,23 +103,23 @@ in users.users = { dadada = { isNormalUser = true; - extraGroups = [ "wheel" "networkmanager" "libvirtd" "adbusers" "kvm" "video" "scanner" "lp" "docker" ]; + extraGroups = ["wheel" "networkmanager" "libvirtd" "adbusers" "kvm" "video" "scanner" "lp" "docker"]; shell = "/run/current-system/sw/bin/zsh"; }; }; networking.hosts = { - "10.1.2.9" = [ "fgprinter.fginfo.tu-bs.de" ]; - "127.0.0.2" = [ "kanboard.dadada.li" ]; + "10.1.2.9" = ["fgprinter.fginfo.tu-bs.de"]; + "127.0.0.2" = ["kanboard.dadada.li"]; }; networking.wireguard.interfaces.uwupn = { - ips = [ "10.11.0.24/32" "fc00:1337:dead:beef::10.11.0.24/128" ]; + ips = ["10.11.0.24/32" "fc00:1337:dead:beef::10.11.0.24/128"]; privateKeyFile = "/var/lib/wireguard/uwu"; peers = [ { publicKey = "tuoiOWqgHz/lrgTcLjX+xIhvxh9jDH6gmDw2ZMvX5T8="; - allowedIPs = [ "10.11.0.0/22" "fc00:1337:dead:beef::10.11.0.0/118" "192.168.178.0/23" ]; + allowedIPs = ["10.11.0.0/22" "fc00:1337:dead:beef::10.11.0.0/118" "192.168.178.0/23"]; endpoint = "53c70r.de:51820"; persistentKeepalive = 25; } diff --git a/nixos/gorgon/hardware-configuration.nix b/nixos/gorgon/hardware-configuration.nix index 7b30b9e..25a7265 100644 --- a/nixos/gorgon/hardware-configuration.nix +++ b/nixos/gorgon/hardware-configuration.nix @@ -1,42 +1,45 @@ # 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 = [ "nvme" "ehci_pci" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; - boot.initrd.kernelModules = [ "dm-snapshot" ]; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["nvme" "ehci_pci" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"]; + boot.initrd.kernelModules = ["dm-snapshot"]; + boot.kernelModules = ["kvm-amd"]; + boot.extraModulePackages = []; - fileSystems."/" = - { device = "/dev/disk/by-uuid/2478e089-e5d6-480c-8530-4ea46988f9f7"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/2478e089-e5d6-480c-8530-4ea46988f9f7"; + fsType = "ext4"; + }; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/5B90-D460"; - fsType = "vfat"; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/5B90-D460"; + fsType = "vfat"; + }; - fileSystems."/home" = - { device = "/dev/disk/by-uuid/a617625e-9325-4612-a086-954fb4b99ee0"; - fsType = "ext4"; - }; + fileSystems."/home" = { + device = "/dev/disk/by-uuid/a617625e-9325-4612-a086-954fb4b99ee0"; + fsType = "ext4"; + }; - fileSystems."/nix" = - { device = "/dev/disk/by-uuid/1f6ab0fb-ef4d-45b1-a731-ad0e7a440eef"; - fsType = "ext4"; - }; + fileSystems."/nix" = { + device = "/dev/disk/by-uuid/1f6ab0fb-ef4d-45b1-a731-ad0e7a440eef"; + fsType = "ext4"; + }; - swapDevices = - [ { device = "/dev/disk/by-uuid/92310a00-7f69-4775-85cb-38e1790f71db"; } - ]; + swapDevices = [ + {device = "/dev/disk/by-uuid/92310a00-7f69-4775-85cb-38e1790f71db";} + ]; nix.settings.max-jobs = lib.mkDefault 16; } diff --git a/nixos/ifrit/configuration.nix b/nixos/ifrit/configuration.nix index 79ce141..5001b9a 100644 --- a/nixos/ifrit/configuration.nix +++ b/nixos/ifrit/configuration.nix @@ -1,13 +1,16 @@ -{ config, pkgs, lib, ... }: -let +{ + config, + pkgs, + lib, + ... +}: let hostAliases = [ "ifrit.dadada.li" "media.dadada.li" "backup0.dadada.li" ]; backups = "/mnt/storage/backup"; -in -{ +in { imports = [ ./hardware-configuration.nix ]; @@ -23,50 +26,50 @@ in services.borgbackup.repos = { "metis" = { allowSubRepos = false; - authorizedKeysAppendOnly = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDnc1gCi8lbhlLmPKvaExtCxVaAni8RrOuHUQO6wTbzR root@metis" ]; - authorizedKeys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJyTgdVPPxQeL5KZo9frZQlDIv2QkelJw3gNGoGtUMfw tim@metis" ]; + authorizedKeysAppendOnly = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDnc1gCi8lbhlLmPKvaExtCxVaAni8RrOuHUQO6wTbzR root@metis"]; + authorizedKeys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJyTgdVPPxQeL5KZo9frZQlDIv2QkelJw3gNGoGtUMfw tim@metis"]; path = "${backups}/metis"; quota = "1T"; }; "gorgon" = { allowSubRepos = false; - authorizedKeysAppendOnly = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP6p9b2D7y2W+9BGee2yk2xsCRewNNaE6oS3CqlW61ti root@gorgon" ]; - authorizedKeys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJyTgdVPPxQeL5KZo9frZQlDIv2QkelJw3gNGoGtUMfw tim@metis" ]; + authorizedKeysAppendOnly = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP6p9b2D7y2W+9BGee2yk2xsCRewNNaE6oS3CqlW61ti root@gorgon"]; + authorizedKeys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJyTgdVPPxQeL5KZo9frZQlDIv2QkelJw3gNGoGtUMfw tim@metis"]; path = "${backups}/gorgon"; quota = "1T"; }; "surgat" = { allowSubRepos = false; - authorizedKeysAppendOnly = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINGhatanrNG+M6jAkU7Yi44mJmTreJkqyZ6Z+qiEgV7O root@surgat" ]; - authorizedKeys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJyTgdVPPxQeL5KZo9frZQlDIv2QkelJw3gNGoGtUMfw tim@metis" ]; + authorizedKeysAppendOnly = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINGhatanrNG+M6jAkU7Yi44mJmTreJkqyZ6Z+qiEgV7O root@surgat"]; + authorizedKeys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJyTgdVPPxQeL5KZo9frZQlDIv2QkelJw3gNGoGtUMfw tim@metis"]; path = "${backups}/surgat"; quota = "50G"; }; "pruflas" = { allowSubRepos = false; - authorizedKeysAppendOnly = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBk7f9DSnXCOIUsxFsjCKG23vHShV4TSzzPJunPOwa1I root@pruflas" ]; - authorizedKeys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJyTgdVPPxQeL5KZo9frZQlDIv2QkelJw3gNGoGtUMfw tim@metis" ]; + authorizedKeysAppendOnly = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBk7f9DSnXCOIUsxFsjCKG23vHShV4TSzzPJunPOwa1I root@pruflas"]; + authorizedKeys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJyTgdVPPxQeL5KZo9frZQlDIv2QkelJw3gNGoGtUMfw tim@metis"]; path = "${backups}/pruflas"; quota = "50G"; }; "wohnzimmerpi" = { allowSubRepos = false; - authorizedKeysAppendOnly = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK6uZ8mPQJWOL984gZKKPyxp7VLcxk42TpTh5iPP6N6k root@wohnzimmerpi" ]; - authorizedKeys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJyTgdVPPxQeL5KZo9frZQlDIv2QkelJw3gNGoGtUMfw tim@metis" ]; + authorizedKeysAppendOnly = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK6uZ8mPQJWOL984gZKKPyxp7VLcxk42TpTh5iPP6N6k root@wohnzimmerpi"]; + authorizedKeys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJyTgdVPPxQeL5KZo9frZQlDIv2QkelJw3gNGoGtUMfw tim@metis"]; path = "${backups}/wohnzimmerpi"; quota = "50G"; }; "fginfo" = { allowSubRepos = false; - authorizedKeysAppendOnly = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCxsyJeZVlVix0FPE8S/Gx0DVutS1ZNESVdYvHBwo36wGlYpSsQoSy/2HSwbpxs88MOGw1QNboxvvpBxCWxZ5HyjxuO5SwYgtmpjPXvmqfVqNXXnLChhSnKgk9b+HesQJCbHyrF9ZAJXEFCOGhOL3YTgd6lTX3lQUXgh/LEDlrPrigUMDNPecPWxpPskP6Vvpe9u+duhL+ihyxXaV+CoPk8nkWrov5jCGPiM48pugbwAfqARyZDgFpmWwL7Xg2UKgVZ1ttHZCWwH+htgioVZMYpdkQW1aq6LLGwN34Hj2VKXzmJN5frh6vQoZr2AFGHNKyJwAMpqnoY//QwuREpZTrh root@fginfo.ibr.cs.tu-bs.de" ]; - authorizedKeys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJyTgdVPPxQeL5KZo9frZQlDIv2QkelJw3gNGoGtUMfw tim@metis" ]; + authorizedKeysAppendOnly = ["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCxsyJeZVlVix0FPE8S/Gx0DVutS1ZNESVdYvHBwo36wGlYpSsQoSy/2HSwbpxs88MOGw1QNboxvvpBxCWxZ5HyjxuO5SwYgtmpjPXvmqfVqNXXnLChhSnKgk9b+HesQJCbHyrF9ZAJXEFCOGhOL3YTgd6lTX3lQUXgh/LEDlrPrigUMDNPecPWxpPskP6Vvpe9u+duhL+ihyxXaV+CoPk8nkWrov5jCGPiM48pugbwAfqARyZDgFpmWwL7Xg2UKgVZ1ttHZCWwH+htgioVZMYpdkQW1aq6LLGwN34Hj2VKXzmJN5frh6vQoZr2AFGHNKyJwAMpqnoY//QwuREpZTrh root@fginfo.ibr.cs.tu-bs.de"]; + authorizedKeys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJyTgdVPPxQeL5KZo9frZQlDIv2QkelJw3gNGoGtUMfw tim@metis"]; path = "${backups}/fginfo"; quota = "10G"; }; "fginfo-git" = { allowSubRepos = false; - authorizedKeysAppendOnly = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDmI6cUv3j0T9ofFB286sDwXwwczqi41cp4MZyGH3VWQnqBPNjICqAdY3CLhgvGBCxSe6ZgKQ+5YLsGSSlU1uhrJXW2UiVKuIPd0kjMF/9e8hmNoTTh0pdk9THfz9LLAdI1vPin1EeVReuDXlZkCI7DFYuTO9yiyZ1uLZUfT1KBRoqiqyypZhut7zT3UaDs2L+Y5hho6WiTdm7INuz6HEB7qYXzrmx93hlcuLZA7fDfyMO9F4APZFUqefcUIEyDI2b+Q/8Q2/rliT2PoC69XLVlj7HyVhfgKsOnopwBDNF3rRcJ6zz4WICPM18i4ZCmfoDTL/cFr5c41Lan1X7wS5wR root@fginfo-git" ]; - authorizedKeys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJyTgdVPPxQeL5KZo9frZQlDIv2QkelJw3gNGoGtUMfw tim@metis" ]; + authorizedKeysAppendOnly = ["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDmI6cUv3j0T9ofFB286sDwXwwczqi41cp4MZyGH3VWQnqBPNjICqAdY3CLhgvGBCxSe6ZgKQ+5YLsGSSlU1uhrJXW2UiVKuIPd0kjMF/9e8hmNoTTh0pdk9THfz9LLAdI1vPin1EeVReuDXlZkCI7DFYuTO9yiyZ1uLZUfT1KBRoqiqyypZhut7zT3UaDs2L+Y5hho6WiTdm7INuz6HEB7qYXzrmx93hlcuLZA7fDfyMO9F4APZFUqefcUIEyDI2b+Q/8Q2/rliT2PoC69XLVlj7HyVhfgKsOnopwBDNF3rRcJ6zz4WICPM18i4ZCmfoDTL/cFr5c41Lan1X7wS5wR root@fginfo-git"]; + authorizedKeys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJyTgdVPPxQeL5KZo9frZQlDIv2QkelJw3gNGoGtUMfw tim@metis"]; path = "${backups}/fginfo-git"; quota = "10G"; }; @@ -98,7 +101,7 @@ in device = "/dev/disk/by-uuid/a34e36fc-d7dd-4ceb-93c4-48f9c2727cb7"; mountPoint = "/mnt/storage"; neededForBoot = false; - options = [ "nofail" ]; + options = ["nofail"]; }; networking.firewall = { @@ -113,7 +116,7 @@ in isNormalUser = true; }; - environment.systemPackages = [ pkgs.curl ]; + environment.systemPackages = [pkgs.curl]; system.stateVersion = "20.03"; } diff --git a/nixos/ifrit/hardware-configuration.nix b/nixos/ifrit/hardware-configuration.nix index 71b7225..07e3b3f 100644 --- a/nixos/ifrit/hardware-configuration.nix +++ b/nixos/ifrit/hardware-configuration.nix @@ -1,26 +1,30 @@ # 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 + "/profiles/qemu-guest.nix" ) - ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + ]; - boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "ehci_pci" "sd_mod" "sr_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "ehci_pci" "sd_mod" "sr_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = []; + boot.extraModulePackages = []; - fileSystems."/" = - { device = "/dev/disk/by-uuid/0b4f5f01-5849-4f05-9822-b648abbc2485"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/0b4f5f01-5849-4f05-9822-b648abbc2485"; + fsType = "ext4"; + }; - swapDevices = - [ { device = "/dev/disk/by-uuid/53b5715e-2724-4800-9cfc-f892115681b6"; } - ]; + swapDevices = [ + {device = "/dev/disk/by-uuid/53b5715e-2724-4800-9cfc-f892115681b6";} + ]; nix.settings.max-jobs = lib.mkDefault 2; } diff --git a/nixos/modules/admin.nix b/nixos/modules/admin.nix index 56174b8..90123e7 100644 --- a/nixos/modules/admin.nix +++ b/nixos/modules/admin.nix @@ -1,9 +1,12 @@ -{ config, pkgs, lib, ... }: - -with lib; -let +{ + config, + pkgs, + lib, + ... +}: +with lib; let cfg = config.dadada.admin; - extraGroups = [ "wheel" "libvirtd" ]; + extraGroups = ["wheel" "libvirtd"]; shells = { "bash" = pkgs.bashInteractive; @@ -13,11 +16,15 @@ let shellNames = builtins.attrNames shells; - adminOpts = { name, config, ... }: { + adminOpts = { + name, + config, + ... + }: { options = { keys = mkOption { type = types.listOf types.str; - default = [ ]; + default = []; apply = x: assert (builtins.length x > 0 || abort "Please specify at least one key to be able to log in"); x; description = '' The keys that should be able to access the account. @@ -35,15 +42,14 @@ let }; }; }; -in -{ +in { options = { dadada.admin = { enable = mkEnableOption "Enable admin access"; users = mkOption { type = with types; attrsOf (submodule adminOpts); - default = { }; + default = {}; description = '' Admin users with root access machine. ''; @@ -68,14 +74,14 @@ in security.sudo.wheelNeedsPassword = false; services.openssh.openFirewall = true; - users.users = mapAttrs - (user: keys: ( - { + users.users = + mapAttrs + (user: keys: { shell = shells."${keys.shell}"; extraGroups = extraGroups; isNormalUser = true; openssh.authorizedKeys.keys = keys.keys; - })) + }) cfg.users; nix.trustedUsers = builtins.attrNames cfg.users; @@ -90,7 +96,7 @@ in services.tor.relay.onionServices = { "rat" = mkIf cfg.rat.enable { name = "rat"; - map = [{ port = 22; }]; + map = [{port = 22;}]; }; }; }; diff --git a/nixos/modules/backup.nix b/nixos/modules/backup.nix index c741663..8bfe8bb 100644 --- a/nixos/modules/backup.nix +++ b/nixos/modules/backup.nix @@ -1,6 +1,10 @@ -{ config, pkgs, lib, ... }: -with lib; -let +{ + config, + pkgs, + lib, + ... +}: +with lib; let backupExcludes = [ "/backup" "/dev" @@ -20,87 +24,87 @@ let "/var/tmp" ]; cfg = config.dadada.backupClient; -in - { - options = { - dadada.backupClient = { - gs = { - enable = mkEnableOption "Enable backup to GS location"; - passphrasePath = mkOption { - type = with types; nullOr str; - description = '' - The path to the passphrase file. - ''; - default = "/var/lib/borgbackup/gs/passphrase"; - }; +in { + options = { + dadada.backupClient = { + gs = { + enable = mkEnableOption "Enable backup to GS location"; + passphrasePath = mkOption { + type = with types; nullOr str; + description = '' + The path to the passphrase file. + ''; + default = "/var/lib/borgbackup/gs/passphrase"; }; - bs = { - enable = mkEnableOption "Enable backup to BS location"; - passphrasePath = mkOption { - type = types.str; - description = '' - The path to the passphrase file. - ''; - default = "/var/lib/borgbackup/bs/passphrase"; - }; - sshIdentityFile = mkOption { - type = types.str; - description = '' - Path to the SSH key that is used to transmit the backup. - ''; - default = "/var/lib/borgbackup/bs/id_ed25519"; - }; + }; + bs = { + enable = mkEnableOption "Enable backup to BS location"; + passphrasePath = mkOption { + type = types.str; + description = '' + The path to the passphrase file. + ''; + default = "/var/lib/borgbackup/bs/passphrase"; + }; + sshIdentityFile = mkOption { + type = types.str; + description = '' + Path to the SSH key that is used to transmit the backup. + ''; + default = "/var/lib/borgbackup/bs/id_ed25519"; }; }; }; + }; config = mkIf cfg.gs.enable { fileSystems = mkIf cfg.gs { "/backup" = { device = "/dev/disk/by-uuid/0fdab735-cc3e-493a-b4ec-cbf6a77d48d5"; fsType = "ext4"; - options = [ "x-systemd.automount" "noauto" "x-systemd.idle-timeout=600" ]; + options = ["x-systemd.automount" "noauto" "x-systemd.idle-timeout=600"]; }; }; - services.borgbackup.jobs.gs = { - paths = "/"; - exclude = backupExcludes; - repo = "/backup/${config.networking.hostName}"; - doInit = false; - encryption = { - mode = "repokey"; - passCommand = "cat ${cfg.gs.passphrasePath}"; + services.borgbackup.jobs.gs = + { + paths = "/"; + exclude = backupExcludes; + repo = "/backup/${config.networking.hostName}"; + doInit = false; + encryption = { + mode = "repokey"; + passCommand = "cat ${cfg.gs.passphrasePath}"; + }; + compression = "auto,lz4"; + prune.keep = { + within = "1d"; # Keep all archives from the last day + daily = 7; + weekly = 2; + monthly = -1; # Keep at least one archive for each month + yearly = -1; # Keep at least one archive for each year + }; + startAt = "monthly"; + } + // mkIf cfg.bs.enable { + services.borgbackup.jobs.bs = { + paths = "/"; + exclude = backupExcludes; + repo = "borg@backup0.dadada.li:/mnt/storage/backup/${config.networking.hostName}"; + doInit = false; + environment = { + BORG_RSH = "ssh -i ${cfg.bs.sshIdentityFile} -o 'StrictHostKeyChecking accept-new' -o 'TCPKeepAlive=yes'"; + }; + encryption = { + mode = "repokey"; + passCommand = "cat ${cfg.bs.passphrasePath}"; + }; + compression = "auto,lz4"; + startAt = "daily"; + environment = { + BORG_RELOCATED_REPO_ACCESS_IS_OK = "yes"; + }; + }; }; - compression = "auto,lz4"; - prune.keep = { - within = "1d"; # Keep all archives from the last day - daily = 7; - weekly = 2; - monthly = -1; # Keep at least one archive for each month - yearly = -1; # Keep at least one archive for each year - }; - startAt = "monthly"; - } // mkIf cfg.bs.enable { - - services.borgbackup.jobs.bs = { - paths = "/"; - exclude = backupExcludes; - repo = "borg@backup0.dadada.li:/mnt/storage/backup/${config.networking.hostName}"; - doInit = false; - environment = { - BORG_RSH = "ssh -i ${cfg.bs.sshIdentityFile} -o 'StrictHostKeyChecking accept-new' -o 'TCPKeepAlive=yes'"; - }; - encryption = { - mode = "repokey"; - passCommand = "cat ${cfg.bs.passphrasePath}"; - }; - compression = "auto,lz4"; - startAt = "daily"; - environment = { - BORG_RELOCATED_REPO_ACCESS_IS_OK = "yes"; - }; - }; - }; }; } diff --git a/nixos/modules/ddns.nix b/nixos/modules/ddns.nix index 9247fb8..b27dd97 100644 --- a/nixos/modules/ddns.nix +++ b/nixos/modules/ddns.nix @@ -1,40 +1,46 @@ -{ config, pkgs, lib, ... }: -with lib; -let +{ + config, + pkgs, + lib, + ... +}: +with lib; let cfg = config.dadada.ddns; ddnsConfig = hostNames: { - systemd.timers = listToAttrs (forEach hostNames (hostname: nameValuePair "ddns-${hostname}" - { - wantedBy = [ "timers.target" ]; - partOf = [ "ddns-${hostname}.service" ]; - timerConfig.OnCalendar = "hourly"; - })); + systemd.timers = listToAttrs (forEach hostNames (hostname: + nameValuePair "ddns-${hostname}" + { + wantedBy = ["timers.target"]; + partOf = ["ddns-${hostname}.service"]; + timerConfig.OnCalendar = "hourly"; + })); - systemd.services = listToAttrs (forEach hostNames (hostname: nameValuePair "ddns-${hostname}" - { - serviceConfig.Type = "oneshot"; - script = '' - function url() { - echo "https://svc.joker.com/nic/update?username=$1&password=$2&hostname=$3" - } + systemd.services = listToAttrs (forEach hostNames (hostname: + nameValuePair "ddns-${hostname}" + { + serviceConfig.Type = "oneshot"; + script = '' + function url() { + echo "https://svc.joker.com/nic/update?username=$1&password=$2&hostname=$3" + } - IFS=':' - read -r user password < /var/lib/ddns/credentials - unset IFS + IFS=':' + read -r user password < /var/lib/ddns/credentials + unset IFS - curl_url=$(url "$user" "$password" ${hostname}) + curl_url=$(url "$user" "$password" ${hostname}) - ${pkgs.curl}/bin/curl -4 "$curl_url" - ${pkgs.curl}/bin/curl -6 "$curl_url" - ''; - })); + ${pkgs.curl}/bin/curl -4 "$curl_url" + ${pkgs.curl}/bin/curl -6 "$curl_url" + ''; + })); }; in { options = { dadada.ddns.domains = mkOption { type = types.listOf types.str; description = '' - Enables DDNS for these domains. + Enables DDNS for these domains. ''; example = '' [ "example.com" ] diff --git a/nixos/modules/default.nix b/nixos/modules/default.nix index 44d1125..72bff58 100644 --- a/nixos/modules/default.nix +++ b/nixos/modules/default.nix @@ -1,5 +1,4 @@ -{ ... }@inputs: -{ +{...} @ inputs: { admin = import ./admin.nix; backup = import ./backup.nix; ddns = import ./ddns.nix; diff --git a/nixos/modules/element.nix b/nixos/modules/element.nix index 101e17e..052b0b4 100644 --- a/nixos/modules/element.nix +++ b/nixos/modules/element.nix @@ -1,8 +1,11 @@ -{ config, pkgs, lib, ... }: -let - cfg = config.dadada.element; -in { + config, + pkgs, + lib, + ... +}: let + cfg = config.dadada.element; +in { options.dadada.element = { enable = lib.mkEnableOption "Enable element webapp"; }; diff --git a/nixos/modules/fido2.nix b/nixos/modules/fido2.nix index a24d906..7ec354d 100644 --- a/nixos/modules/fido2.nix +++ b/nixos/modules/fido2.nix @@ -1,10 +1,13 @@ -{ config, pkgs, lib, ... }: -with lib; -let +{ + config, + pkgs, + lib, + ... +}: +with lib; let luks = config.dadada.luks; fido2 = config.dadada.fido2; -in -{ +in { options = { dadada.luks = { uuid = mkOption { @@ -52,5 +55,4 @@ in cue = true; }; }; - } diff --git a/nixos/modules/fileShare.nix b/nixos/modules/fileShare.nix index d8b36d9..7cd7849 100644 --- a/nixos/modules/fileShare.nix +++ b/nixos/modules/fileShare.nix @@ -1,12 +1,14 @@ -{ config, lib, ... }: -with lib; -let +{ + config, + lib, + ... +}: +with lib; let cfg = config.dadada.fileShare; sharePath = "/mnt/storage/share"; ipv6 = "fd42:dead:beef::/48"; ipv4 = "192.168.42.0/24"; -in -{ +in { options.dadada.fileShare = { enable = mkEnableOption "Enable file share server"; }; diff --git a/nixos/modules/gitea.nix b/nixos/modules/gitea.nix index 4581cde..ef40b83 100644 --- a/nixos/modules/gitea.nix +++ b/nixos/modules/gitea.nix @@ -1,9 +1,12 @@ -{ config, pkgs, lib, ... }: -let +{ + config, + pkgs, + lib, + ... +}: let redisSocket = "127.0.0.1:6379"; cfg = config.dadada.gitea; -in -{ +in { options.dadada.gitea = { enable = lib.mkEnableOption "Enable gitea"; }; diff --git a/nixos/modules/headphones.nix b/nixos/modules/headphones.nix index a8c4a16..105e67b 100644 --- a/nixos/modules/headphones.nix +++ b/nixos/modules/headphones.nix @@ -1,9 +1,12 @@ -{ config, pkgs, lib, ... }: -with lib; -let - cfg = config.dadada.headphones; -in { + config, + pkgs, + lib, + ... +}: +with lib; let + cfg = config.dadada.headphones; +in { options = { dadada.headphones = { enable = mkEnableOption "Enable bluetooth headphones with more audio codecs."; @@ -14,7 +17,7 @@ in bluetooth.enable = true; pulseaudio = { enable = true; - extraModules = [ pkgs.pulseaudio-modules-bt ]; + extraModules = [pkgs.pulseaudio-modules-bt]; extraConfig = '' set-source-volume 1 10000 ''; diff --git a/nixos/modules/homepage.nix b/nixos/modules/homepage.nix index ed03c0b..cd68876 100644 --- a/nixos/modules/homepage.nix +++ b/nixos/modules/homepage.nix @@ -1,18 +1,22 @@ -{ config, pkgs, lib, ... }: -let +{ + config, + pkgs, + lib, + ... +}: let cfg = config.dadada.homePage; in -with lib; { - options.dadada.homePage = { - enable = mkEnableOption "Enable home page"; - }; - config = mkIf cfg.enable { - services.nginx.enable = true; - - services.nginx.virtualHosts."dadada.li" = { - enableACME = true; - forceSSL = true; - root = "${pkgs.homePage}"; + with lib; { + options.dadada.homePage = { + enable = mkEnableOption "Enable home page"; }; - }; -} + config = mkIf cfg.enable { + services.nginx.enable = true; + + services.nginx.virtualHosts."dadada.li" = { + enableACME = true; + forceSSL = true; + root = "${pkgs.homePage}"; + }; + }; + } diff --git a/nixos/modules/kanboard/default.nix b/nixos/modules/kanboard/default.nix index 086a656..f9063d2 100644 --- a/nixos/modules/kanboard/default.nix +++ b/nixos/modules/kanboard/default.nix @@ -1,6 +1,10 @@ # Source https://github.com/NixOS/nixpkgs/issues/113384 -{ config, lib, pkgs, ... }: -let +{ + config, + lib, + pkgs, + ... +}: let cfg = config.dadada.kanboard; in { options = { @@ -32,27 +36,30 @@ in { name = "kanboard-configured"; paths = [ (pkgs.runCommand "kanboard-over" {meta.priority = 0;} '' - mkdir -p $out - for f in index.php jsonrpc.php ; do - echo " $out/$f - tail -n+2 ${pkgs.kanboard}/share/kanboard/$f \ - | sed 's^__DIR__^"${pkgs.kanboard}/share/kanboard"^' >> $out/$f - done - ln -s /var/lib/kanboard $out/data - ln -s ${./kanboard-config.php} $out/config.php + mkdir -p $out + for f in index.php jsonrpc.php ; do + echo " $out/$f + tail -n+2 ${pkgs.kanboard}/share/kanboard/$f \ + | sed 's^__DIR__^"${pkgs.kanboard}/share/kanboard"^' >> $out/$f + done + ln -s /var/lib/kanboard $out/data + ln -s ${./kanboard-config.php} $out/config.php '') - { outPath = "${pkgs.kanboard}/share/kanboard"; meta.priority = 10; } - ]; - }; - locations = { - "/".index = "index.php"; - "~ \\.php$" = { - tryFiles = "$uri =404"; - extraConfig = '' - fastcgi_pass unix:${config.services.phpfpm.pools.kanboard.socket}; - ''; - }; + { + outPath = "${pkgs.kanboard}/share/kanboard"; + meta.priority = 10; + } + ]; + }; + locations = { + "/".index = "index.php"; + "~ \\.php$" = { + tryFiles = "$uri =404"; + extraConfig = '' + fastcgi_pass unix:${config.services.phpfpm.pools.kanboard.socket}; + ''; }; + }; }; }; }; diff --git a/nixos/modules/networking.nix b/nixos/modules/networking.nix index cc50064..5cf00bd 100644 --- a/nixos/modules/networking.nix +++ b/nixos/modules/networking.nix @@ -1,10 +1,13 @@ -{ config, pkgs, lib, ... }: -with lib; -let +{ + config, + pkgs, + lib, + ... +}: +with lib; let cfg = config.dadada.networking; vpnPubKey = "x/y6I59buVzv9Lfzl+b17mGWbzxU+3Ke9mQNa1DLsDI="; -in -{ +in { options = { dadada.networking = { localResolver = { @@ -15,7 +18,7 @@ in wanInterfaces = mkOption { type = with types; listOf str; description = "WAN network interfaces"; - default = [ ]; + default = []; }; vpnExtension = mkOption { type = with types; nullOr str; @@ -83,20 +86,22 @@ in "149.112.112.112@853#dns.quad9.net" ]; } - (mkIf cfg.localResolver.uwu { - name = "uwu."; - forward-addr = [ - "fc00:1337:dead:beef::10.11.0.1" - "10.11.0.1" - ]; - } + ( + mkIf cfg.localResolver.uwu { + name = "uwu."; + forward-addr = [ + "fc00:1337:dead:beef::10.11.0.1" + "10.11.0.1" + ]; + } ) - (mkIf cfg.localResolver.s0 { - name = "s0."; - forward-addr = [ - "192.168.178.1" - ]; - } + ( + mkIf cfg.localResolver.s0 { + name = "s0."; + forward-addr = [ + "192.168.178.1" + ]; + } ) { name = "dyn.dadada.li."; @@ -110,13 +115,14 @@ in networking.useDHCP = false; - networking.interfaces = listToAttrs (forEach cfg.wanInterfaces (i: nameValuePair i { - useDHCP = true; - })); + networking.interfaces = listToAttrs (forEach cfg.wanInterfaces (i: + nameValuePair i { + useDHCP = true; + })); networking.wireguard.interfaces = mkIf (cfg.vpnExtension != null) { dadada = { - ips = [ "fd42:9c3b:f96d:201::${cfg.vpnExtension}/64" ]; + ips = ["fd42:9c3b:f96d:201::${cfg.vpnExtension}/64"]; listenPort = 51234; privateKeyFile = "/var/lib/wireguard/privkey"; @@ -124,7 +130,7 @@ in peers = [ { publicKey = vpnPubKey; - allowedIPs = [ "fd42:9c3b:f96d::/48" ]; + allowedIPs = ["fd42:9c3b:f96d::/48"]; endpoint = "vpn.dadada.li:51234"; persistentKeepalive = 25; } @@ -134,8 +140,8 @@ in # https://lists.zx2c4.com/pipermail/wireguard/2017-November/002028.html systemd.timers.wg-reresolve-dns = mkIf (cfg.vpnExtension != null) { - wantedBy = [ "timers.target" ]; - partOf = [ "wg-reresolve-dns.service" ]; + wantedBy = ["timers.target"]; + partOf = ["wg-reresolve-dns.service"]; timerConfig.OnCalendar = "hourly"; }; systemd.services.wg-reresolve-dns = mkIf (cfg.vpnExtension != null) { diff --git a/nixos/modules/nix.nix b/nixos/modules/nix.nix index bf60194..e674a4a 100644 --- a/nixos/modules/nix.nix +++ b/nixos/modules/nix.nix @@ -1,9 +1,14 @@ -{ self -, home-manager -, nixpkgs -, ... +{ + self, + home-manager, + nixpkgs, + ... +}: { + config, + pkgs, + lib, + ... }: -{ config, pkgs, lib, ... }: # Global settings for nix daemon { nix.nixPath = [ diff --git a/nixos/modules/profiles/laptop.nix b/nixos/modules/profiles/laptop.nix index 2ad80ec..eae911a 100644 --- a/nixos/modules/profiles/laptop.nix +++ b/nixos/modules/profiles/laptop.nix @@ -1,6 +1,10 @@ -{ config, pkgs, lib, ... }: -with lib; { + config, + pkgs, + lib, + ... +}: +with lib; { networking.domain = mkDefault "dadada.li"; services.fwupd.enable = mkDefault true; @@ -25,7 +29,7 @@ with lib; vteIntegration = true; syntaxHighlighting = { enable = true; - highlighters = [ "main" "brackets" "pattern" "root" "line" ]; + highlighters = ["main" "brackets" "pattern" "root" "line"]; }; }; diff --git a/nixos/modules/profiles/server.nix b/nixos/modules/profiles/server.nix index b2e48dd..ce55e42 100644 --- a/nixos/modules/profiles/server.nix +++ b/nixos/modules/profiles/server.nix @@ -1,6 +1,10 @@ -{ config, pkgs, lib, ... }: -with lib; { + config, + pkgs, + lib, + ... +}: +with lib; { networking.domain = mkDefault "dadada.li"; networking.tempAddresses = "disabled"; diff --git a/nixos/modules/share.nix b/nixos/modules/share.nix index abac5c7..914ff14 100644 --- a/nixos/modules/share.nix +++ b/nixos/modules/share.nix @@ -1,10 +1,12 @@ -{ config, pkgs, lib, ... }: - -with lib; -let - cfg = config.dadada.share; -in { + config, + pkgs, + lib, + ... +}: +with lib; let + cfg = config.dadada.share; +in { options.dadada.share = { enable = mkEnableOption "Enable file share"; }; diff --git a/nixos/modules/steam.nix b/nixos/modules/steam.nix index 4784c0c..8c83444 100644 --- a/nixos/modules/steam.nix +++ b/nixos/modules/steam.nix @@ -1,9 +1,12 @@ -{ config, pkgs, lib, ... }: -with lib; -let - cfg = config.dadada.steam; -in { + config, + pkgs, + lib, + ... +}: +with lib; let + cfg = config.dadada.steam; +in { options = { dadada.steam = { enable = mkEnableOption "Enable Steam config"; @@ -15,7 +18,7 @@ in hardware.opengl = { enable = true; driSupport32Bit = true; - extraPackages32 = with pkgs.pkgsi686Linux; [ libva ]; + extraPackages32 = with pkgs.pkgsi686Linux; [libva]; }; hardware.pulseaudio.support32Bit = true; diff --git a/nixos/modules/update.nix b/nixos/modules/update.nix index 6194e8a..023bfbc 100644 --- a/nixos/modules/update.nix +++ b/nixos/modules/update.nix @@ -1,10 +1,12 @@ -{ config, pkgs, lib, ... }: -with lib; -let - cfg = config.dadada.autoUpgrade; -in { - + config, + pkgs, + lib, + ... +}: +with lib; let + cfg = config.dadada.autoUpgrade; +in { options.dadada.autoUpgrade = { enable = mkEnableOption "Enable automatic upgrades"; }; diff --git a/nixos/modules/vpnServer.nix b/nixos/modules/vpnServer.nix index 690ab39..ef0d3ad 100644 --- a/nixos/modules/vpnServer.nix +++ b/nixos/modules/vpnServer.nix @@ -1,9 +1,12 @@ -{ config, pkgs, lib, ... }: - -with lib; -let +{ + config, + pkgs, + lib, + ... +}: +with lib; let cfg = config.dadada.vpnServer; - wgPeer = { name, ... }: { + wgPeer = {name, ...}: { options = { name = mkOption { internal = true; @@ -21,14 +24,13 @@ let }; }; }; -in -{ +in { options.dadada.vpnServer = { enable = mkEnableOption "Enable wireguard gateway"; peers = mkOption { description = "Set of extensions and public keys of peers"; type = with types; attrsOf (submodule wgPeer); - default = { }; + default = {}; }; }; config = mkIf cfg.enable { @@ -37,14 +39,14 @@ in interfaces."wg0" = { allowedIPsAsRoutes = true; privateKeyFile = "/var/lib/wireguard/wg0-key"; - ips = [ "fd42:9c3b:f96d:0201::0/64" ]; + ips = ["fd42:9c3b:f96d:0201::0/64"]; listenPort = 51234; - peers = map - (peer: ( - { - allowedIPs = [ "fd42:9c3b:f96d:0201::${peer.id}/128" ]; - publicKey = peer.key; - })) + peers = + map + (peer: { + allowedIPs = ["fd42:9c3b:f96d:0201::${peer.id}/128"]; + publicKey = peer.key; + }) (attrValues cfg.peers); postSetup = '' wg set wg0 fwmark 51234 diff --git a/nixos/modules/weechat.nix b/nixos/modules/weechat.nix index a32455a..a5667ef 100644 --- a/nixos/modules/weechat.nix +++ b/nixos/modules/weechat.nix @@ -1,10 +1,12 @@ -{ config, pkgs, lib, ... }: - -with lib; -let - cfg = config.dadada.weechat; -in { + config, + pkgs, + lib, + ... +}: +with lib; let + cfg = config.dadada.weechat; +in { options.dadada.weechat = { enable = mkEnableOption "Enable weechat relay"; }; diff --git a/nixos/modules/zsh.nix b/nixos/modules/zsh.nix index f63b932..585aa0d 100644 --- a/nixos/modules/zsh.nix +++ b/nixos/modules/zsh.nix @@ -1,5 +1,9 @@ -{ config, pkgs, lib, ... }: { + config, + pkgs, + lib, + ... +}: { programs.zsh = { enable = true; autosuggestions.enable = true; @@ -8,7 +12,7 @@ vteIntegration = true; syntaxHighlighting = { enable = true; - highlighters = [ "main" "brackets" "pattern" "root" "line" ]; + highlighters = ["main" "brackets" "pattern" "root" "line"]; }; }; } diff --git a/nixos/pruflas/configuration.nix b/nixos/pruflas/configuration.nix index d1c3c45..b7d3b54 100644 --- a/nixos/pruflas/configuration.nix +++ b/nixos/pruflas/configuration.nix @@ -1,7 +1,11 @@ -{ config, pkgs, lib, ... }: -with lib; { - imports = [ ./hardware-configuration.nix ]; + config, + pkgs, + lib, + ... +}: +with lib; { + imports = [./hardware-configuration.nix]; networking.hostName = "pruflas"; @@ -12,7 +16,7 @@ with lib; package = pkgs.hydra-unstable; hydraURL = "https://hydra.dadada.li"; notificationSender = "hydra@localhost"; - buildMachinesFiles = [ ]; + buildMachinesFiles = []; useSubstitutes = true; listenHost = "hydra.dadada.li"; port = 3000; @@ -22,7 +26,7 @@ with lib; { hostName = "localhost"; system = "x86_64-linux"; - supportedFeatures = [ "kvm" "nixos-test" "big-parallel" "benchmark" ]; + supportedFeatures = ["kvm" "nixos-test" "big-parallel" "benchmark"]; maxJobs = 8; } ]; @@ -61,7 +65,7 @@ with lib; ]; }; - boot.kernelModules = [ "kvm-intel" ]; + boot.kernelModules = ["kvm-intel"]; # Use the systemd-boot EFI boot loader. boot.loader.systemd-boot.enable = true; @@ -91,12 +95,12 @@ with lib; hardware.pulseaudio.enable = false; - environment.systemPackages = [ pkgs.spotify pkgs.mpv ]; + environment.systemPackages = [pkgs.spotify pkgs.mpv]; users.users."media" = { isNormalUser = true; description = "Media playback user"; - extraGroups = [ "users" "video" ]; + extraGroups = ["users" "video"]; }; networking.domain = "dadada.li"; diff --git a/nixos/pruflas/hardware-configuration.nix b/nixos/pruflas/hardware-configuration.nix index c80f1f0..d26a55a 100644 --- a/nixos/pruflas/hardware-configuration.nix +++ b/nixos/pruflas/hardware-configuration.nix @@ -1,34 +1,38 @@ # 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" "ehci_pci" "ahci" "usb_storage" "sd_mod" "sr_mod" "sdhci_pci" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "sr_mod" "sdhci_pci"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-intel"]; + boot.extraModulePackages = []; - fileSystems."/" = - { device = "/dev/disk/by-uuid/6d7ea470-1909-4e84-82a6-d5d5e9eecf78"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/6d7ea470-1909-4e84-82a6-d5d5e9eecf78"; + fsType = "ext4"; + }; - fileSystems."/nix" = - { device = "/dev/disk/by-uuid/337f04a7-4fe9-49a2-8a58-07dd4bc85168"; - fsType = "ext4"; - }; + fileSystems."/nix" = { + device = "/dev/disk/by-uuid/337f04a7-4fe9-49a2-8a58-07dd4bc85168"; + fsType = "ext4"; + }; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/0494-CB52"; - fsType = "vfat"; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/0494-CB52"; + fsType = "vfat"; + }; - swapDevices = [ ]; + swapDevices = []; powerManagement.cpuFreqGovernor = lib.mkDefault "performance"; } diff --git a/nixos/surgat/configuration.nix b/nixos/surgat/configuration.nix index d734ae8..1352303 100644 --- a/nixos/surgat/configuration.nix +++ b/nixos/surgat/configuration.nix @@ -1,8 +1,11 @@ -{ config, pkgs, lib, ... }: -let - hostName = "surgat"; -in { + config, + pkgs, + lib, + ... +}: let + hostName = "surgat"; +in { imports = [ ./hardware-configuration.nix ]; @@ -72,10 +75,12 @@ in boot.loader.grub.version = 2; boot.loader.grub.device = "/dev/sda"; - networking.interfaces."ens3".ipv6.addresses = [{ - address = "2a01:4f8:c17:1d70::"; - prefixLength = 64; - }]; + networking.interfaces."ens3".ipv6.addresses = [ + { + address = "2a01:4f8:c17:1d70::"; + prefixLength = 64; + } + ]; networking.defaultGateway6 = { address = "fe80::1"; @@ -98,7 +103,7 @@ in ]; networking.wireguard.interfaces."hydra" = { - ips = [ "10.3.3.1/24" ]; + ips = ["10.3.3.1/24"]; listenPort = 51235; privateKeyFile = "/var/lib/wireguard/hydra"; @@ -106,7 +111,7 @@ in peers = [ { publicKey = "CTKwL6+SJIqKXr1DIHejMDgjoxlWPaT78Pz3+JqcNlw="; - allowedIPs = [ "10.3.3.3/32" ]; + allowedIPs = ["10.3.3.3/32"]; persistentKeepalive = 25; } ]; diff --git a/nixos/surgat/hardware-configuration.nix b/nixos/surgat/hardware-configuration.nix index c3c4c45..8363cbc 100644 --- a/nixos/surgat/hardware-configuration.nix +++ b/nixos/surgat/hardware-configuration.nix @@ -1,30 +1,33 @@ # 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 + "/profiles/qemu-guest.nix") - ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + ]; - boot.initrd.availableKernelModules = [ "ata_piix" "virtio_pci" "xhci_pci" "sd_mod" "sr_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["ata_piix" "virtio_pci" "xhci_pci" "sd_mod" "sr_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = []; + boot.extraModulePackages = []; - fileSystems."/" = - { device = "/dev/disk/by-uuid/bd0b4d2d-37e5-444b-82ba-d7629114bf11"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/bd0b4d2d-37e5-444b-82ba-d7629114bf11"; + fsType = "ext4"; + }; boot.initrd.luks.devices."surgat".device = "/dev/disk/by-uuid/5aa2b4d3-5711-451c-bd35-7c33b5019093"; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/472bc34f-3803-44ee-ad2a-f0080c0a44d3"; - fsType = "ext2"; - }; - - swapDevices = [ ]; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/472bc34f-3803-44ee-ad2a-f0080c0a44d3"; + fsType = "ext2"; + }; + swapDevices = []; } diff --git a/outputs.nix b/outputs.nix index 5a4c13e..27f4730 100644 --- a/outputs.nix +++ b/outputs.nix @@ -1,57 +1,62 @@ # Adapted from Mic92/dotfiles -{ self -, flake-utils -, homePage -, nixpkgs -, home-manager -, nix-doom-emacs -, nixos-hardware -, nvd -, scripts -, recipemd -, ... -}@inputs: -(flake-utils.lib.eachDefaultSystem (system: - let - pkgs = nixpkgs.legacyPackages.${system}; - selfPkgs = self.packages.${system}; - in - { - apps.nixos-switch = { - type = "app"; - program = toString (pkgs.writeScript "deploy" '' - #!${pkgs.runtimeShell} - flake=$(nix flake metadata --json ${./.} | jq -r .url) - nixos-rebuild switch --flake ".#$1" --use-remote-sudo - ''); - }; - apps.deploy = { - type = "app"; - program = toString (pkgs.writeScript "deploy" '' - #!${pkgs.runtimeShell} - domain='dadada.li' - flake=$(nix flake metadata --json ${./.} | jq -r .url) - nixos-rebuild switch --upgrade --flake "''${flake}#$1" --target-host "''${1}.$domain" --build-host localhost --use-remote-sudo - ''); - }; - apps.hm-switch = { - type = "app"; - program = toString (pkgs.writeScript "hm-switch" '' - #!${pkgs.runtimeShell} - set -eu -o pipefail -x - tmpdir=$(mktemp -d) - export PATH=${pkgs.lib.makeBinPath [ pkgs.coreutils pkgs.nixFlakes pkgs.jq ]} - trap "rm -rf $tmpdir" EXIT - declare -A profiles=(["gorgon"]="home") - profile=''${profiles[$HOSTNAME]:-common} - flake=$(nix flake metadata --json ${./.} | jq -r .url) - nix build --out-link "$tmpdir/result" "$flake#hmConfigurations.''${profile}.activationPackage" "$@" - link=$(realpath $tmpdir/result) - $link/activate - ''); - }; - devShell = pkgs.callPackage ./shell.nix { }; - })) // { +{ + self, + flake-utils, + homePage, + nixpkgs, + home-manager, + nix-doom-emacs, + nixos-hardware, + nvd, + scripts, + recipemd, + ... +} @ inputs: +(flake-utils.lib.eachDefaultSystem (system: let + pkgs = nixpkgs.legacyPackages.${system}; + selfPkgs = self.packages.${system}; + formatter = self.formatter.${system}; +in { + apps.nixos-switch = { + type = "app"; + program = toString (pkgs.writeScript "deploy" '' + #!${pkgs.runtimeShell} + flake=$(nix flake metadata --json ${./.} | jq -r .url) + nixos-rebuild switch --flake ".#$1" --use-remote-sudo + ''); + }; + apps.deploy = { + type = "app"; + program = toString (pkgs.writeScript "deploy" '' + #!${pkgs.runtimeShell} + domain='dadada.li' + flake=$(nix flake metadata --json ${./.} | jq -r .url) + nixos-rebuild switch --upgrade --flake "''${flake}#$1" --target-host "''${1}.$domain" --build-host localhost --use-remote-sudo + ''); + }; + apps.hm-switch = { + type = "app"; + program = toString (pkgs.writeScript "hm-switch" '' + #!${pkgs.runtimeShell} + set -eu -o pipefail -x + tmpdir=$(mktemp -d) + export PATH=${pkgs.lib.makeBinPath [pkgs.coreutils pkgs.nixFlakes pkgs.jq]} + trap "rm -rf $tmpdir" EXIT + declare -A profiles=(["gorgon"]="home") + profile=''${profiles[$HOSTNAME]:-common} + flake=$(nix flake metadata --json ${./.} | jq -r .url) + nix build --out-link "$tmpdir/result" "$flake#hmConfigurations.''${profile}.activationPackage" "$@" + link=$(realpath $tmpdir/result) + $link/activate + ''); + }; + devShell = pkgs.callPackage ./shell.nix {}; + formatter = nixpkgs.legacyPackages."${system}".alejandra; + checks = { + format = pkgs.runCommand "check-format" {buildInputs = [formatter];} "${formatter}/bin/alejandra -c ${./.} && touch $out"; + }; +})) +// { hmConfigurations = import ./home/configurations.nix { inherit self nixpkgs home-manager; }; @@ -63,12 +68,16 @@ }; nixosModules = import ./nixos/modules inputs; overlays = import ./overlays; - hydraJobs = ( - nixpkgs.lib.mapAttrs' + hydraJobs = + ( + nixpkgs.lib.mapAttrs' (name: config: nixpkgs.lib.nameValuePair name config.config.system.build.toplevel) self.nixosConfigurations - ) // (nixpkgs.lib.mapAttrs' - (name: config: nixpkgs.lib.nameValuePair name config.activation-script) - self.hmConfigurations - ) // (let tests = import ./tests; in flake-utils.lib.eachDefaultSystem tests); + ) + // ( + nixpkgs.lib.mapAttrs' + (name: config: nixpkgs.lib.nameValuePair name config.activation-script) + self.hmConfigurations + ) + // (let tests = import ./tests; in flake-utils.lib.eachDefaultSystem tests); } diff --git a/overlays/default.nix b/overlays/default.nix index 8507ceb..491a5a3 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,7 +1,6 @@ let python3Packages = import ./python3-packages.nix; -in -{ +in { kanboard = final: prev: { kanboard = prev.kanboard.overrideAttrs (oldAttrs: { src = prev.fetchFromGitHub { diff --git a/overlays/python3-packages.nix b/overlays/python3-packages.nix index 9d3ddde..5e2371c 100644 --- a/overlays/python3-packages.nix +++ b/overlays/python3-packages.nix @@ -1,6 +1,7 @@ -self: super: -{ - python3Packages = super.python3Packages // super.recurseIntoAttrs ( - super.python3Packages.callPackage ../pkgs/python-pkgs { } - ); +self: super: { + python3Packages = + super.python3Packages + // super.recurseIntoAttrs ( + super.python3Packages.callPackage ../pkgs/python-pkgs {} + ); } diff --git a/overlays/tubslatex.nix b/overlays/tubslatex.nix index ba2a1a7..220029a 100644 --- a/overlays/tubslatex.nix +++ b/overlays/tubslatex.nix @@ -1,26 +1,28 @@ -self: super: -{ +self: super: { # Based on https://gist.github.com/clefru/9ed1186bf0b76d27e0ad20cbd9966b87 - tubslatex = super.lib.overrideDerivation + tubslatex = + super.lib.overrideDerivation (super.texlive.combine { inherit (super.texlive) scheme-full; - tubslatex.pkgs = [ (super.callPackage ../pkgs/tubslatex { }) ]; + tubslatex.pkgs = [(super.callPackage ../pkgs/tubslatex {})]; }) (oldAttrs: { - postBuild = '' - # Save the udpmap.cfg because texlive.combine removes it. - cat $out/share/texmf/web2c/updmap.cfg > $out/share/texmf/web2c/updmap.cfg.1 - '' + oldAttrs.postBuild + '' - # Move updmap.cfg into its original place and rerun mktexlsr, so that kpsewhich finds it - rm $out/share/texmf/web2c/updmap.cfg || true - cat $out/share/texmf/web2c/updmap.cfg.1 > $out/share/texmf/web2c/updmap.cfg - rm $out/share/texmf/web2c/updmap.cfg.1 - perl `type -P mktexlsr.pl` $out/share/texmf - yes | perl `type -P updmap.pl` --sys --syncwithtrees --force || true - perl `type -P updmap.pl` --sys --enable Map=NexusProSerif.map --enable Map=NexusProSans.map - # Regenerate .map files. - perl `type -P updmap.pl` --sys - ''; + postBuild = + '' + # Save the udpmap.cfg because texlive.combine removes it. + cat $out/share/texmf/web2c/updmap.cfg > $out/share/texmf/web2c/updmap.cfg.1 + '' + + oldAttrs.postBuild + + '' + # Move updmap.cfg into its original place and rerun mktexlsr, so that kpsewhich finds it + rm $out/share/texmf/web2c/updmap.cfg || true + cat $out/share/texmf/web2c/updmap.cfg.1 > $out/share/texmf/web2c/updmap.cfg + rm $out/share/texmf/web2c/updmap.cfg.1 + perl `type -P mktexlsr.pl` $out/share/texmf + yes | perl `type -P updmap.pl` --sys --syncwithtrees --force || true + perl `type -P updmap.pl` --sys --enable Map=NexusProSerif.map --enable Map=NexusProSans.map + # Regenerate .map files. + perl `type -P updmap.pl` --sys + ''; }); - } diff --git a/pkgs/python-pkgs/default.nix b/pkgs/python-pkgs/default.nix index b9e7043..e4c33e6 100644 --- a/pkgs/python-pkgs/default.nix +++ b/pkgs/python-pkgs/default.nix @@ -1,3 +1,2 @@ -{ callPackage }: -{ +{callPackage}: { } diff --git a/pkgs/scripts.nix b/pkgs/scripts.nix index dd18070..c7471be 100644 --- a/pkgs/scripts.nix +++ b/pkgs/scripts.nix @@ -1,9 +1,14 @@ -{ pkgs, stdenv, lib }: - -(import +{ + pkgs, + stdenv, + lib, +}: (import (pkgs.fetchgit { url = "https://git.dadada.li/dadada/scripts.git"; sha256 = "sha256-Kdwb34XXLOl4AaiVmOZ3nlu/KdENMqvH+UwISv8Pyiw="; rev = "065ff0f0ee9e44234678f0fefbba7961ea42518c"; }) - { stdenv = stdenv; lib = lib; }) + { + stdenv = stdenv; + lib = lib; + }) diff --git a/pkgs/tubslatex/default.nix b/pkgs/tubslatex/default.nix index 2ca8542..e7bb963 100644 --- a/pkgs/tubslatex/default.nix +++ b/pkgs/tubslatex/default.nix @@ -1,9 +1,13 @@ -{ stdenv, fetchzip, unzip }: +{ + stdenv, + fetchzip, + unzip, +}: stdenv.mkDerivation rec { src = ./tubslatex_1.3.2.tds.zip; sourceRoot = "."; - nativeBuildInputs = [ unzip ]; - buildInputs = [ unzip ]; + nativeBuildInputs = [unzip]; + buildInputs = [unzip]; installPhase = '' mkdir -p $out cp -r * $out/ diff --git a/pkgs/vimPlugins/default.nix b/pkgs/vimPlugins/default.nix index 85d4c3b..f9eece2 100644 --- a/pkgs/vimPlugins/default.nix +++ b/pkgs/vimPlugins/default.nix @@ -1,6 +1,10 @@ -{ pkgs, lib, fetchFromGitHub, ... }: -with lib; { + pkgs, + lib, + fetchFromGitHub, + ... +}: +with lib; { filetype = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "dadadaVimFiletype"; version = "0.2"; diff --git a/shell.nix b/shell.nix index 805620f..a297003 100644 --- a/shell.nix +++ b/shell.nix @@ -1,6 +1,4 @@ -{ mkShell -}: - +{mkShell}: mkShell { buildInputs = [ ]; diff --git a/tests/default.nix b/tests/default.nix index a8b9a52..15769d2 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -1,3 +1,2 @@ -system: -{ +system: { }