diff options
Diffstat (limited to '')
-rw-r--r-- | modules/alacritty.nix (renamed from modules/common/alacritty.nix) | 0 | ||||
-rw-r--r-- | modules/aria2.nix (renamed from modules/common/aria2.nix) | 0 | ||||
-rw-r--r-- | modules/bat.nix (renamed from modules/common/bat.nix) | 0 | ||||
-rw-r--r-- | modules/common/ark.nix (renamed from modules/nixos/common/ark.nix) | 2 | ||||
-rw-r--r-- | modules/common/common/default.nix | 14 | ||||
-rw-r--r-- | modules/common/common/documentation.nix | 28 | ||||
-rw-r--r-- | modules/common/common/locale.nix | 6 | ||||
-rw-r--r-- | modules/common/common/networking.nix | 4 | ||||
-rw-r--r-- | modules/common/common/nix.nix | 125 | ||||
-rw-r--r-- | modules/common/common/stylix.nix | 61 | ||||
-rw-r--r-- | modules/common/common/users.nix | 15 | ||||
-rw-r--r-- | modules/common/console.nix (renamed from modules/nixos/common/console.nix) | 0 | ||||
-rw-r--r-- | modules/common/default.nix | 29 | ||||
-rw-r--r-- | modules/common/documentation.nix (renamed from modules/nixos/common/documentation.nix) | 11 | ||||
-rw-r--r-- | modules/common/git.nix | 173 | ||||
-rw-r--r-- | modules/common/gnupg.nix | 72 | ||||
-rw-r--r-- | modules/common/home-manager.nix (renamed from modules/common/common/home-manager.nix) | 11 | ||||
-rw-r--r-- | modules/common/kernel.nix (renamed from modules/nixos/common/kernel.nix) | 0 | ||||
-rw-r--r-- | modules/common/locale.nix (renamed from modules/nixos/common/locale.nix) | 5 | ||||
-rw-r--r-- | modules/common/networking.nix (renamed from modules/nixos/common/networking.nix) | 1 | ||||
-rw-r--r-- | modules/common/nix.nix | 150 | ||||
-rw-r--r-- | modules/common/openssh.nix | 72 | ||||
-rw-r--r-- | modules/common/profiles/dev/containers.nix | 57 | ||||
-rw-r--r-- | modules/common/profiles/headful.nix | 57 | ||||
-rw-r--r-- | modules/common/profiles/headless.nix | 25 | ||||
-rw-r--r-- | modules/common/secrets.nix (renamed from modules/common/common/secrets.nix) | 1 | ||||
-rw-r--r-- | modules/common/security.nix (renamed from modules/nixos/common/security.nix) | 0 | ||||
-rw-r--r-- | modules/common/services.nix (renamed from modules/nixos/common/services.nix) | 0 | ||||
-rw-r--r-- | modules/common/shell/default.nix (renamed from modules/common/common/shell/default.nix) | 2 | ||||
-rw-r--r-- | modules/common/shell/functions.bash (renamed from modules/common/common/shell/functions.bash) | 0 | ||||
-rw-r--r-- | modules/common/stylix.nix | 105 | ||||
-rw-r--r-- | modules/common/systemd.nix (renamed from modules/nixos/common/systemd.nix) | 0 | ||||
-rw-r--r-- | modules/common/tmp.nix (renamed from modules/nixos/common/tmp.nix) | 0 | ||||
-rw-r--r-- | modules/common/users.nix (renamed from modules/nixos/common/users.nix) | 18 | ||||
-rw-r--r-- | modules/common/vim/default.nix | 47 | ||||
-rw-r--r-- | modules/common/xdg.nix (renamed from modules/common/common/xdg.nix) | 39 | ||||
-rw-r--r-- | modules/curl.nix (renamed from modules/common/curl.nix) | 0 | ||||
-rw-r--r-- | modules/direnv.nix (renamed from modules/common/direnv.nix) | 0 | ||||
-rw-r--r-- | modules/editorconfig.nix (renamed from modules/common/editorconfig.nix) | 0 | ||||
-rw-r--r-- | modules/emacs/default.nix (renamed from modules/common/emacs/default.nix) | 204 | ||||
-rw-r--r-- | modules/emacs/doom/config.el (renamed from modules/common/emacs/doom/config.el) | 5 | ||||
-rw-r--r-- | modules/emacs/doom/init.el (renamed from modules/common/emacs/doom/init.el) | 0 | ||||
-rw-r--r-- | modules/emacs/doom/packages.el (renamed from modules/common/emacs/doom/packages.el) | 0 | ||||
-rw-r--r-- | modules/eza.nix (renamed from modules/common/eza.nix) | 0 | ||||
-rw-r--r-- | modules/htop.nix (renamed from modules/common/htop.nix) | 0 | ||||
-rw-r--r-- | modules/mpv.nix (renamed from modules/common/mpv.nix) | 84 | ||||
-rw-r--r-- | modules/nmap.nix (renamed from modules/common/nmap.nix) | 0 | ||||
-rw-r--r-- | modules/password-store.nix (renamed from modules/common/password-store.nix) | 0 | ||||
-rw-r--r-- | modules/profiles/default.nix (renamed from modules/common/profiles/default.nix) | 22 | ||||
-rw-r--r-- | modules/profiles/dev/default.nix (renamed from modules/common/profiles/dev/default.nix) | 22 | ||||
-rw-r--r-- | modules/profiles/dev/gdbinit (renamed from modules/common/profiles/dev/gdbinit) | 0 | ||||
-rw-r--r-- | modules/profiles/dev/ghci.conf (renamed from modules/common/profiles/dev/ghci.conf) | 0 | ||||
-rw-r--r-- | modules/profiles/dev/pystartup.py (renamed from modules/common/profiles/dev/pystartup.py) | 0 | ||||
-rw-r--r-- | modules/profiles/dev/sql.nix (renamed from modules/common/profiles/dev/sql.nix) | 0 | ||||
-rw-r--r-- | modules/profiles/email.nix (renamed from modules/common/profiles/email.nix) | 4 | ||||
-rw-r--r-- | modules/qutebrowser.nix (renamed from modules/common/qutebrowser.nix) | 0 | ||||
-rw-r--r-- | modules/subversion.nix (renamed from modules/common/subversion.nix) | 0 | ||||
-rw-r--r-- | modules/tmux.nix (renamed from modules/common/tmux.nix) | 0 | ||||
-rw-r--r-- | modules/vim/rc.vim (renamed from modules/common/vim/rc.vim) | 0 | ||||
-rw-r--r-- | modules/vscode.nix (renamed from modules/common/vscode.nix) | 0 | ||||
-rw-r--r-- | modules/wget.nix (renamed from modules/common/wget.nix) | 0 | ||||
-rw-r--r-- | modules/zathura.nix (renamed from modules/common/zathura.nix) | 5 |
62 files changed, 555 insertions, 921 deletions
diff --git a/modules/common/alacritty.nix b/modules/alacritty.nix index 704ce79..704ce79 100644 --- a/modules/common/alacritty.nix +++ b/modules/alacritty.nix diff --git a/modules/common/aria2.nix b/modules/aria2.nix index cdf1c4f..cdf1c4f 100644 --- a/modules/common/aria2.nix +++ b/modules/aria2.nix diff --git a/modules/common/bat.nix b/modules/bat.nix index a95d67d..a95d67d 100644 --- a/modules/common/bat.nix +++ b/modules/bat.nix diff --git a/modules/nixos/common/ark.nix b/modules/common/ark.nix index 6c7148f..84ff6db 100644 --- a/modules/nixos/common/ark.nix +++ b/modules/common/ark.nix @@ -10,12 +10,12 @@ let in { imports = [ + inputs.impermanence.nixosModules.impermanence (mkAliasOptionModule [ "ark" ] [ "nixfiles" "modules" "ark" ]) - inputs.impermanence.nixosModules.impermanence ]; options.nixfiles.modules.ark = diff --git a/modules/common/common/default.nix b/modules/common/common/default.nix deleted file mode 100644 index 62e4a95..0000000 --- a/modules/common/common/default.nix +++ /dev/null @@ -1,14 +0,0 @@ -_: { - imports = [ - ./documentation.nix - ./home-manager.nix - ./locale.nix - ./networking.nix - ./nix.nix - ./secrets.nix - ./shell - ./stylix.nix - ./users.nix - ./xdg.nix - ]; -} diff --git a/modules/common/common/documentation.nix b/modules/common/common/documentation.nix deleted file mode 100644 index 2202e11..0000000 --- a/modules/common/common/documentation.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ - config, - lib, - this, - ... -}: -with lib; -{ - config = mkMerge [ - (mkIf this.isHeadful { - hm.manual = { - html.enable = false; - json.enable = false; - manpages.enable = true; - }; - - documentation = { - enable = true; - doc.enable = false; - info.enable = false; - }; - }) - (mkIf this.isHeadless { - hm.manual.manpages.enable = false; - documentation.enable = false; - }) - ]; -} diff --git a/modules/common/common/locale.nix b/modules/common/common/locale.nix deleted file mode 100644 index bcb577a..0000000 --- a/modules/common/common/locale.nix +++ /dev/null @@ -1,6 +0,0 @@ -_: { - hm.home.language = { - collate = "C"; - messages = "C"; - }; -} diff --git a/modules/common/common/networking.nix b/modules/common/common/networking.nix deleted file mode 100644 index 2e19162..0000000 --- a/modules/common/common/networking.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ pkgs, ... }: -{ - environment.systemPackages = with pkgs; [ myip ]; -} diff --git a/modules/common/common/nix.nix b/modules/common/common/nix.nix deleted file mode 100644 index fdb0125..0000000 --- a/modules/common/common/nix.nix +++ /dev/null @@ -1,125 +0,0 @@ -{ - config, - inputs, - lib, - localUsername ? lib.my.username, - pkgs, - this, - ... -}: -with lib; -{ - _module.args = - let - importNixpkgs = - nixpkgs: - import nixpkgs { - inherit (config.nixpkgs) config; - inherit (this) system; - }; - in - rec { - pkgsLocal = importNixpkgs "${config.my.home}/src/nixpkgs"; # Impure! - pkgsMaster = importNixpkgs inputs.nixpkgs-master; - pkgsStable = importNixpkgs inputs.nixpkgs-stable; - pkgsRev = - rev: hash: - importNixpkgs ( - pkgs.fetchFromGitHub { - owner = "NixOS"; - repo = "nixpkgs"; - inherit rev hash; - } - ); - pkgsPr = pr: pkgsRev "refs/pull/${toString pr}/head"; - }; - - nixpkgs.overlays = with inputs; [ - self.overlays.default - (_: _: { }) - ]; - - nix = - let - notSelfInputs = filterAttrs (n: _: n != "self") inputs; - in - { - settings = { - # https://nixos.org/manual/nix/unstable/contributing/experimental-features.html#currently-available-experimental-features - # https://github.com/NixOS/nix/blob/master/src/libutil/experimental-features.cc - experimental-features = concatStringsSep " " [ - "flakes" - "nix-command" - "recursive-nix" - "repl-flake" - ]; - - keep-derivations = if this.isHeadful then "true" else "false"; - keep-outputs = if this.isHeadful then "true" else "false"; - - flake-registry = "${inputs.flake-registry}/flake-registry.json"; - - warn-dirty = false; - - keep-going = true; - - substituters = [ - "https://azahi.cachix.org" - "https://nix-community.cachix.org" - ]; - trusted-public-keys = [ - "azahi.cachix.org-1:2bayb+iWYMAVw3ZdEpVg+NPOHCXncw7WMQ0ElX1GO3s=" - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; - - trusted-users = [ - "root" - localUsername - ]; - }; - - nixPath = mapAttrsToList (n: v: "${n}=${v}") notSelfInputs ++ [ - "nixfiles=${config.my.home}/src/nixfiles" - ]; - - registry = mapAttrs (_: flake: { inherit flake; }) notSelfInputs // { - nixfiles.flake = inputs.self; - }; - }; - - environment = { - systemPackages = - with pkgs; - optionals this.isHeadful [ - nix-top - nix-tree - nixfiles - ]; - variables.NIXFILES = "${config.my.home}/src/nixfiles"; - }; - - hm = { - # Used primarily in conjunction with the "nixfiles" script. - home.file.".nix-defexpr/default.nix".text = - let - hostname = strings.escapeNixIdentifier this.hostname; - in - optionalString this.isHeadful '' - let - self = builtins.getFlake "nixfiles"; - configurations = self.nixosConfigurations; - local = configurations.${hostname}; - in rec { - inherit self; - inherit (self) inputs lib; - inherit (lib) my; - this = my.configurations.${hostname}; - inherit (local) config; - inherit (local.config.system.build) toplevel vm vmWithBootLoader manual; - pretty = expr: lib.trace (lib.generators.toPretty {} expr) {}; - } // configurations // local._module.args - ''; - - programs.bash.shellAliases.nix = "nix --verbose --print-build-logs"; - }; -} diff --git a/modules/common/common/stylix.nix b/modules/common/common/stylix.nix deleted file mode 100644 index f1b8f81..0000000 --- a/modules/common/common/stylix.nix +++ /dev/null @@ -1,61 +0,0 @@ -{ lib, pkgs, ... }: -with lib; -{ - imports = [ - (mkAliasOptionModule [ "colors" ] [ - "lib" - "stylix" - "colors" - ]) - ]; - - options.nixfiles.modules.common.stylix.fonts.extraPackages = mkOption { - description = "Font packages."; - default = with pkgs; [ - font-awesome - noto-fonts - noto-fonts-emoji - sarasa-gothic - source-han-mono - source-han-sans - source-han-serif - twitter-color-emoji - ]; - readOnly = true; - }; - - # Styling and color binding can be sourced from here[1]. - # - # [1]: https://github.com/tinted-theming/base24/blob/master/styling.md - config.stylix = { - image = pkgs.fetchurl { - url = "https://upload.wikimedia.org/wikipedia/commons/a/a5/Bonaparte_ante_la_Esfinge%2C_por_Jean-Léon_Gérôme.jpg"; - sha256 = "sha256-qWv52oT8cF9K4ZoeawmR3jgoGB2ARfjbKKc12IljUcM="; - }; - - base16Scheme = "${pkgs.base16-schemes}/share/themes/tomorrow.yaml"; - - fonts = { - monospace = { - package = pkgs.iosevka; - name = "Iosevka"; - }; - - serif = { - package = pkgs.iosevka-bin.override { variant = "Etoile"; }; - name = "Iosevka Etoile"; - }; - - sansSerif = { - package = pkgs.iosevka-bin.override { variant = "Aile"; }; - name = "Iosevka Aile"; - }; - - sizes = { - desktop = 10; - applications = 10; - terminal = 12; - }; - }; - }; -} diff --git a/modules/common/common/users.nix b/modules/common/common/users.nix deleted file mode 100644 index dc1b32e..0000000 --- a/modules/common/common/users.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ - lib, - localUsername ? lib.my.username, - ... -}: -with lib; -{ - imports = [ - (mkAliasOptionModule [ "my" ] [ - "users" - "users" - localUsername - ]) - ]; -} diff --git a/modules/nixos/common/console.nix b/modules/common/console.nix index 330310c..330310c 100644 --- a/modules/nixos/common/console.nix +++ b/modules/common/console.nix diff --git a/modules/common/default.nix b/modules/common/default.nix index 92f719d..ef9fb18 100644 --- a/modules/common/default.nix +++ b/modules/common/default.nix @@ -1,28 +1 @@ -_: { - imports = [ - ./alacritty.nix - ./aria2.nix - ./bat.nix - ./common - ./curl.nix - ./direnv.nix - ./editorconfig.nix - ./emacs - ./eza.nix - ./git.nix - ./gnupg.nix - ./htop.nix - ./mpv.nix - ./nmap.nix - ./openssh.nix - ./password-store.nix - ./profiles - ./qutebrowser.nix - ./subversion.nix - ./tmux.nix - ./vim - ./vscode.nix - ./wget.nix - ./zathura.nix - ]; -} +{ lib, ... }: with lib; { imports = attrValues (modulesIn ./.); } diff --git a/modules/nixos/common/documentation.nix b/modules/common/documentation.nix index f7d1585..20856cb 100644 --- a/modules/nixos/common/documentation.nix +++ b/modules/common/documentation.nix @@ -7,9 +7,18 @@ }: with lib; { - config = mkIf this.isHeadful { + config = { + hm.manual = { + manpages.enable = this.isHeadful; + html.enable = false; + json.enable = false; + }; + documentation = { + enable = this.isHeadful; dev.enable = true; + doc.enable = false; + info.enable = false; nixos.enable = true; man.man-db.manualPages = diff --git a/modules/common/git.nix b/modules/common/git.nix deleted file mode 100644 index fbe190e..0000000 --- a/modules/common/git.nix +++ /dev/null @@ -1,173 +0,0 @@ -{ - config, - inputs, - lib, - localUsername ? lib.my.username, - pkgs, - ... -}: -with lib; -let - cfg = config.nixfiles.modules.git; -in -{ - options.nixfiles.modules.git.client.enable = mkEnableOption "Git client"; - - config = mkIf cfg.client.enable { - secrets = { - glab-cli-config = { - file = "${inputs.self}/secrets/glab-cli-config"; - path = "${config.dirs.config}/glab-cli/config.yml"; - owner = localUsername; - }; - gh-hosts = { - file = "${inputs.self}/secrets/gh-hosts"; - path = "${config.dirs.config}/gh/hosts.yml"; - owner = localUsername; - }; - hut = { - file = "${inputs.self}/secrets/hut"; - path = "${config.dirs.config}/hut/config"; - owner = localUsername; - }; - }; - - nixfiles.modules.common.shell.aliases = { - gl = "glab"; - ht = "hut"; - }; - - hm = { - home.packages = with pkgs; [ - git-extras - glab - hut - ]; - - programs = { - git = { - enable = true; - - package = pkgs.git.override { - doInstallCheck = false; - pythonSupport = false; - sendEmailSupport = true; - withLibsecret = false; - withSsh = true; - }; - - userName = my.fullname; - userEmail = my.email; - signing = { - inherit (my.pgp) key; - signByDefault = true; - }; - - extraConfig = - { - color.ui = true; - core.whitespace = "trailing-space"; - init.defaultBranch = "master"; - status.submoduleSummary = true; - commit.verbose = true; - push.autoSetupRemote = true; - pull.rebase = true; - rebase = { - autoStash = true; - autoSquash = true; - }; - rerere.enabled = true; - branch.sort = "-committerdate"; - diff = { - mnemonicPrefix = true; - renames = "copies"; - submodule = "log"; - }; - submodule.recurse = true; - sendemail = rec { - smtpServer = my.domain.shire; - smtpUser = "${my.username}@${smtpServer}"; - smtpEncryption = "ssl"; - smtpServerPort = 465; - annotate = true; - confirm = "always"; - }; - column.ui = "auto"; - github.user = my.username; - gitlab.user = my.username; - } - // mapAttrs' (name: value: nameValuePair ''url "git@${value}:"'' { insteadOf = "${name}:"; }) { - "bitbucket" = "bitbucket.com"; - "codeberg" = "codeberg.org"; - "github" = "github.com"; - "gitlab" = "gitlab.com"; - "sourcehut" = "git.sr.ht"; - } - // - mapAttrs' (name: values: nameValuePair ''url "https://${values}/"'' { insteadOf = "${name}:"; }) - { - "alpine" = "gitlab.alpinelinux.org"; - "debian" = "salsa.debian.org"; - "freedesktop" = "gitlab.freedesktop.org"; - "gnome" = "gitlab.gnome.org"; - "haskell" = "gitlab.haskell.org"; - "homotopic" = "gitlab.homotopic.tech"; - "horizon" = "gitlab.horizon-haskell.net"; - "kde" = "invent.kde.org"; - "nixca" = "gitlab.nixca.dev"; - "notabug" = "notabug.org"; - "opencode" = "opencode.net"; - "torproject" = "gitlab.torproject.org"; - "videolan" = "code.videolan.org"; - }; - - aliases = - let - git = getExe config.hm.programs.git.package; - curl = getExe pkgs.curl; - in - { - amend = "commit --amend"; - cat = "cat-file -p"; - fast = "clone --depth=1"; - fixup = "commit --fixup"; - fuck = "!${git} reset --hard && ${git} clean --force -dx"; - get = "pull --all --recurse-submodules --autostash"; - gud = ''commit -m "git gud"''; - refresh = "clean --force -dx"; - tree = "log --graph --date=relative --pretty=tformat:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%an %ad)%Creset'"; - uncommit = "reset --soft HEAD~1"; - untrack = "rm --cache --"; - wtc = "!${curl} -sq whatthecommit.com/index.txt | ${git} commit -F -"; - }; - - # All helper tools/editor generated files should go here. This must be - # kept void of any project-specific or residual files. - ignores = [ - "*~" - ".DS_Store" - ".cache/clangd/" - ".ccls-cache/" - ".gdb_history" - ".netrwhist" - ".projectile" - "[._]*.s[a-v][a-z]" - "[._]*.sw[a-p]" - "[._]s[a-rt-v][a-z]" - "[._]ss[a-gi-z]" - "[._]sw[a-p]" - "\#*\#" - "compile_commands*.json" - "cscope.*" - "vgcore.*" - ]; - }; - - gh = { - enable = true; - settings.git_protocol = "ssh"; - }; - }; - }; - }; -} diff --git a/modules/common/gnupg.nix b/modules/common/gnupg.nix deleted file mode 100644 index b32d94c..0000000 --- a/modules/common/gnupg.nix +++ /dev/null @@ -1,72 +0,0 @@ -{ config, lib, ... }: -with lib; -let - cfg = config.nixfiles.modules.gnupg; -in -{ - options.nixfiles.modules.gnupg.enable = mkEnableOption "GnuPG"; - - config = mkIf cfg.enable { - hm.programs.gpg = { - enable = true; - - settings = - { - display-charset = "utf-8"; - enable-progress-filter = true; - fixed-list-mode = true; - keyid-format = "0xlong"; - no-comments = true; - no-emit-version = true; - no-greeting = true; - with-fingerprint = true; - throw-keyids = false; - - use-agent = true; - - armor = true; - - no-random-seed-file = true; - - list-options = "show-uid-validity"; - verify-options = "show-uid-validity"; - } - // ( - let - cipherAlgos = [ - "AES256" - "AES192" - "AES" - ]; - digestAlgos = [ - "SHA512" - "SHA384" - "SHA256" - "SHA224" - ]; - compressionAlgos = [ - "ZLIB" - "BZIP2" - "ZIP" - "Uncompressed" - ]; - - cs = concatStringsSep " "; - in - { - default-preference-list = cs (cipherAlgos ++ digestAlgos ++ compressionAlgos); - - personal-cipher-preferences = cs cipherAlgos; - personal-digest-preferences = cs digestAlgos; - personal-compress-preferences = cs compressionAlgos; - - s2k-cipher-algo = head cipherAlgos; - s2k-digest-algo = head digestAlgos; - - digest-algo = head digestAlgos; - cert-digest-algo = head digestAlgos; - } - ); - }; - }; -} diff --git a/modules/common/common/home-manager.nix b/modules/common/home-manager.nix index 3c9fa0e..9c4cbeb 100644 --- a/modules/common/common/home-manager.nix +++ b/modules/common/home-manager.nix @@ -1,24 +1,25 @@ { + config, inputs, lib, - localUsername ? lib.my.username, ... }: with lib; { imports = [ + inputs.home-manager.nixosModule (mkAliasOptionModule [ "hm" ] [ "home-manager" "users" - localUsername + my.username ]) ]; hm = { news.display = "silent"; - # NOTE Inheriting directly from `system.stateVersion` does not work with - # nix-darwin for some reason. - home.stateVersion = with builtins; head (split "\n" (readFile "${inputs.nixpkgs}/.version")); + home = { + inherit (config.system) stateVersion; + }; }; home-manager = { diff --git a/modules/nixos/common/kernel.nix b/modules/common/kernel.nix index 5c45b5d..5c45b5d 100644 --- a/modules/nixos/common/kernel.nix +++ b/modules/common/kernel.nix diff --git a/modules/nixos/common/locale.nix b/modules/common/locale.nix index 8b91a5a..7e8eefb 100644 --- a/modules/nixos/common/locale.nix +++ b/modules/common/locale.nix @@ -6,6 +6,11 @@ }: with lib; { + hm.home.language = { + collate = "C"; + messages = "C"; + }; + i18n = { defaultLocale = mkDefault "en_GB.UTF-8"; supportedLocales = [ diff --git a/modules/nixos/common/networking.nix b/modules/common/networking.nix index ecadf6e..727def4 100644 --- a/modules/nixos/common/networking.nix +++ b/modules/common/networking.nix @@ -123,6 +123,7 @@ in systemPackages = with pkgs; [ ethtool + myip nethogs ]; }; diff --git a/modules/common/nix.nix b/modules/common/nix.nix new file mode 100644 index 0000000..db46336 --- /dev/null +++ b/modules/common/nix.nix @@ -0,0 +1,150 @@ +{ + config, + inputs, + lib, + pkgs, + this, + ... +}: +with lib; +let + cfg = config.nixfiles.modules.common.nix; +in +{ + options.nixfiles.modules.common.nix.allowedUnfreePackages = mkOption { + description = "A list of allowed unfree packages."; + type = with types; listOf str; + default = [ ]; + }; + + config = { + _module.args = + let + importNixpkgs = + nixpkgs: + import nixpkgs { + inherit (config.nixpkgs) config; + inherit (this) system; + }; + in + rec { + pkgsLocal = importNixpkgs "${config.my.home}/src/nixpkgs"; # Impure! + pkgsMaster = importNixpkgs inputs.nixpkgs-master; + pkgsStable = importNixpkgs inputs.nixpkgs-stable; + pkgsRev = + rev: hash: + importNixpkgs ( + pkgs.fetchFromGitHub { + owner = "NixOS"; + repo = "nixpkgs"; + inherit rev hash; + } + ); + pkgsPr = pr: pkgsRev "refs/pull/${toString pr}/head"; + }; + + hm = { + # Used primarily in conjunction with the "nixfiles" script. + home.file.".nix-defexpr/default.nix".text = + let + hostname = strings.escapeNixIdentifier this.hostname; + in + optionalString this.isHeadful '' + let + self = builtins.getFlake "nixfiles"; + configurations = self.nixosConfigurations; + local = configurations.${hostname}; + in rec { + inherit self; + inherit (self) inputs lib; + inherit (lib) my; + this = my.configurations.${hostname}; + inherit (local) config; + inherit (local.config.system.build) toplevel vm vmWithBootLoader manual; + pretty = expr: lib.trace (lib.generators.toPretty {} expr) {}; + } // configurations // local._module.args + ''; + + programs.bash.shellAliases.nix = "nix --verbose --print-build-logs"; + }; + + nix = + let + notSelfInputs = filterAttrs (n: _: n != "self") inputs; + in + { + daemonCPUSchedPolicy = "idle"; + daemonIOSchedClass = "idle"; + daemonIOSchedPriority = 7; + + settings = { + # https://nixos.org/manual/nix/unstable/contributing/experimental-features.html#currently-available-experimental-features + # https://github.com/NixOS/nix/blob/master/src/libutil/experimental-features.cc + experimental-features = concatStringsSep " " [ + "flakes" + "nix-command" + "recursive-nix" + "repl-flake" + ]; + + keep-derivations = if this.isHeadful then "true" else "false"; + keep-outputs = if this.isHeadful then "true" else "false"; + + flake-registry = "${inputs.flake-registry}/flake-registry.json"; + + warn-dirty = false; + + keep-going = true; + + substituters = [ + "https://azahi.cachix.org" + "https://nix-community.cachix.org" + ]; + trusted-public-keys = [ + "azahi.cachix.org-1:2bayb+iWYMAVw3ZdEpVg+NPOHCXncw7WMQ0ElX1GO3s=" + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + + trusted-users = [ + "root" + my.username + ]; + }; + + nixPath = mapAttrsToList (n: v: "${n}=${v}") notSelfInputs ++ [ + "nixfiles=${config.my.home}/src/nixfiles" + ]; + + registry = mapAttrs (_: flake: { inherit flake; }) notSelfInputs // { + nixfiles.flake = inputs.self; + }; + }; + + nixpkgs = { + config.allowUnfreePredicate = p: elem (getName p) cfg.allowedUnfreePackages; + + overlays = with inputs; [ + self.overlays.default + (_: _: { }) + ]; + }; + + environment = { + localBinInPath = true; + defaultPackages = mkForce [ ]; + systemPackages = + with pkgs; + optionals this.isHeadful [ + nix-top + nix-tree + nixfiles + ]; + sessionVariables = { + NIXFILES = "${config.my.home}/src/nixfiles"; + NIX_SHELL_PRESERVE_PROMPT = "1"; + }; + }; + + system.stateVersion = with builtins; head (split "\n" (readFile "${inputs.nixpkgs}/.version")); + }; +} diff --git a/modules/common/openssh.nix b/modules/common/openssh.nix deleted file mode 100644 index f60a1ef..0000000 --- a/modules/common/openssh.nix +++ /dev/null @@ -1,72 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; -let - cfg = config.nixfiles.modules.openssh; -in -{ - options.nixfiles.modules.openssh.client.enable = mkEnableOption "OpenSSH client"; - - config = mkIf cfg.client.enable { - hm = { - home.packages = with pkgs; [ - mosh - sshfs - sshpass - ]; - - programs.ssh = { - enable = true; - - hashKnownHosts = true; - - controlMaster = "auto"; - controlPersist = "24H"; - - serverAliveCountMax = 30; - serverAliveInterval = 60; - - matchBlocks = - let - mkBlock = - name: - { - hostname ? name, - port ? 22022, # NOTE This is not the default OpenSSH port. - user ? my.username, - identityFile ? "${config.my.home}/.ssh/${my.username}_${my.ssh.type}", - extraAttrs ? { }, - }: - nameValuePair name ( - { - inherit - hostname - port - user - identityFile - ; - } - // extraAttrs - ); - - internalServers = mapAttrs' mkBlock ( - mapAttrs (name: _: { hostname = "${name}.${my.domain.shire}"; }) ( - filterAttrs (_: attr: hasAttr "wireguard" attr && attr.isHeadless) my.configurations - ) - ); - in - internalServers - // (mapAttrs' mkBlock { - gitolite = { - user = "git"; - hostname = "git.${my.domain.shire}"; - }; - }); - }; - }; - }; -} diff --git a/modules/common/profiles/dev/containers.nix b/modules/common/profiles/dev/containers.nix deleted file mode 100644 index 8f3bfc6..0000000 --- a/modules/common/profiles/dev/containers.nix +++ /dev/null @@ -1,57 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; -let - cfg = config.nixfiles.modules.profiles.dev.containers; -in -{ - options.nixfiles.modules.profiles.dev.containers.enable = - mkEnableOption "Tools for working with containers and container orchestration" - // { - default = config.nixfiles.modules.profiles.dev.enable; - }; - - config = mkIf cfg.enable { - nixfiles.modules.common.shell.aliases = { - h = "helm"; - k = "kubectl"; - kns = "kubens"; - ktx = "kubectx"; - }; - - hm.home = { - sessionVariables = { - MINIKUBE_IN_STYLE = "false"; - WERF_DEV = "true"; - WERF_INSECURE_REGISTRY = "true"; - WERF_LOG_DEBUG = "true"; - WERF_LOG_PRETTY = "false"; - WERF_LOG_VERBOSE = "true"; - WERF_SYNCHRONIZATION = ":local"; - WERF_TELEMETRY = "false"; - }; - - packages = with pkgs; [ - k9s - kubectl - kubectl-doctor - kubectl-images - kubectl-tree - kubectx - kubelogin-oidc - kubent - kubernetes-helm - kubespy - minikube - skopeo - stern - telepresence2 - werf - ]; - }; - }; -} diff --git a/modules/common/profiles/headful.nix b/modules/common/profiles/headful.nix deleted file mode 100644 index cd29225..0000000 --- a/modules/common/profiles/headful.nix +++ /dev/null @@ -1,57 +0,0 @@ -{ - config, - lib, - pkgs, - this, - ... -}: -with lib; -let - cfg = config.nixfiles.modules.profiles.headful; -in -{ - options.nixfiles.modules.profiles.headful.enable = mkEnableOption "headful profile" // { - default = this.isHeadful; - }; - - config = mkIf cfg.enable { - nixfiles.modules = { - profiles.dev.enable = true; - - alacritty.enable = true; - aria2.enable = true; - emacs.enable = true; - mpv.enable = true; - openssh.client.enable = true; - password-store.enable = true; - vscode.enable = true; - zathura.enable = true; - }; - - hm = { - home = { - file.".digrc".text = '' - +answer - +multiline - +recurse - ''; - - packages = with pkgs; [ - fd - ripgrep - sd - tldr - ]; - }; - }; - - environment.systemPackages = with pkgs; [ - arping - dnsutils - inetutils - ldns - socat - tcpdump - ]; - }; -} diff --git a/modules/common/profiles/headless.nix b/modules/common/profiles/headless.nix deleted file mode 100644 index 1f8096c..0000000 --- a/modules/common/profiles/headless.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ - config, - lib, - pkgs, - this, - ... -}: -with lib; -let - cfg = config.nixfiles.modules.profiles.headless; -in -{ - options.nixfiles.modules.profiles.headless.enable = mkEnableOption "headless profile" // { - default = this.isHeadless; - }; - - config = mkIf cfg.enable { - hm.home.file = { - ".hushlogin".text = ""; - ".bash_history".source = config.hm.lib.file.mkOutOfStoreSymlink "/dev/null"; - }; - - environment.systemPackages = with pkgs; [ alacritty.terminfo ]; - }; -} diff --git a/modules/common/common/secrets.nix b/modules/common/secrets.nix index 3c05c09..03a2eeb 100644 --- a/modules/common/common/secrets.nix +++ b/modules/common/secrets.nix @@ -9,6 +9,7 @@ with lib; { imports = [ + inputs.agenix.nixosModules.default (mkAliasOptionModule [ "secrets" ] [ "age" "secrets" diff --git a/modules/nixos/common/security.nix b/modules/common/security.nix index c635cdc..c635cdc 100644 --- a/modules/nixos/common/security.nix +++ b/modules/common/security.nix diff --git a/modules/nixos/common/services.nix b/modules/common/services.nix index 12e4bf7..12e4bf7 100644 --- a/modules/nixos/common/services.nix +++ b/modules/common/services.nix diff --git a/modules/common/common/shell/default.nix b/modules/common/shell/default.nix index 883bfae..437ce57 100644 --- a/modules/common/common/shell/default.nix +++ b/modules/common/shell/default.nix @@ -191,6 +191,8 @@ in home.packages = with pkgs; [ grc ]; }; + programs.command-not-found.enable = false; + environment = { etc."grc.conf".source = "${pkgs.grc}/etc/grc.conf"; diff --git a/modules/common/common/shell/functions.bash b/modules/common/shell/functions.bash index f354adb..f354adb 100644 --- a/modules/common/common/shell/functions.bash +++ b/modules/common/shell/functions.bash diff --git a/modules/common/stylix.nix b/modules/common/stylix.nix new file mode 100644 index 0000000..953685e --- /dev/null +++ b/modules/common/stylix.nix @@ -0,0 +1,105 @@ +{ + config, + inputs, + lib, + pkgs, + ... +}: +with lib; +{ + imports = [ + inputs.stylix.nixosModules.stylix + (mkAliasOptionModule [ "colors" ] [ + "lib" + "stylix" + "colors" + ]) + ]; + + options.nixfiles.modules.common.stylix.fonts.extraPackages = mkOption { + description = "Font packages."; + default = with pkgs; [ + font-awesome + noto-fonts + noto-fonts-emoji + sarasa-gothic + source-han-mono + source-han-sans + source-han-serif + twitter-color-emoji + ]; + readOnly = true; + }; + + # Styling and color binding can be sourced from here[1]. + # + # [1]: https://github.com/tinted-theming/base24/blob/master/styling.md + config = { + stylix = { + image = pkgs.fetchurl { + url = "https://upload.wikimedia.org/wikipedia/commons/a/a5/Bonaparte_ante_la_Esfinge%2C_por_Jean-Léon_Gérôme.jpg"; + sha256 = "sha256-qWv52oT8cF9K4ZoeawmR3jgoGB2ARfjbKKc12IljUcM="; + }; + + base16Scheme = "${pkgs.base16-schemes}/share/themes/tomorrow.yaml"; + + fonts = { + monospace = { + package = pkgs.iosevka; + name = "Iosevka"; + }; + + serif = { + package = pkgs.iosevka-bin.override { variant = "Etoile"; }; + name = "Iosevka Etoile"; + }; + + sansSerif = { + package = pkgs.iosevka-bin.override { variant = "Aile"; }; + name = "Iosevka Aile"; + }; + + sizes = { + desktop = 10; + applications = 10; + terminal = 12; + }; + }; + + cursor = { + name = "phinger-cursors-light"; + package = pkgs.phinger-cursors; + size = 32; + }; + }; + + fonts = { + packages = mkAfter config.nixfiles.modules.common.stylix.fonts.extraPackages; + + fontconfig.defaultFonts = with config.stylix.fonts; { + serif = mkForce [ + serif.name + "Sarasa Gothic" + "Source Han Serif" + "Noto Serif" + ]; + sansSerif = mkForce [ + sansSerif.name + "Sarasa Gothic" + "Source Han Sans" + "Noto Sans" + ]; + monospace = mkForce [ + monospace.name + "Sarasa Mono" + "Source Han Mono" + "Noto Sans Mono" + ]; + emoji = mkForce [ + "Twitter Color Emoji" + "Noto Color Emoji" + ]; + }; + }; + }; +} diff --git a/modules/nixos/common/systemd.nix b/modules/common/systemd.nix index b393d9f..b393d9f 100644 --- a/modules/nixos/common/systemd.nix +++ b/modules/common/systemd.nix diff --git a/modules/nixos/common/tmp.nix b/modules/common/tmp.nix index d56e2b6..d56e2b6 100644 --- a/modules/nixos/common/tmp.nix +++ b/modules/common/tmp.nix diff --git a/modules/nixos/common/users.nix b/modules/common/users.nix index a92a38e..ba1a89b 100644 --- a/modules/nixos/common/users.nix +++ b/modules/common/users.nix @@ -1,13 +1,17 @@ -{ - lib, - localUsername ? lib.my.username, - ... -}: +{ lib, ... }: with lib; let - home = "/home/${localUsername}"; + home = "/home/${my.username}"; in { + imports = [ + (mkAliasOptionModule [ "my" ] [ + "users" + "users" + my.username + ]) + ]; + ark.directories = [ home ]; users = { @@ -16,7 +20,7 @@ in users = { root.hashedPassword = "@HASHED_PASSWORD@"; - ${localUsername} = { + ${my.username} = { isNormalUser = true; uid = 1000; description = my.fullname; diff --git a/modules/common/vim/default.nix b/modules/common/vim/default.nix deleted file mode 100644 index 93729bc..0000000 --- a/modules/common/vim/default.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; -let - cfg = config.nixfiles.modules.vim; -in -{ - options.nixfiles.modules.vim = { - enable = mkEnableOption "Vim"; - - rc = mkOption { - type = types.str; - default = readFile ./rc.vim; - description = "Configuration file."; - }; - - plugins = mkOption { - type = with types; listOf package; - default = with pkgs.vimPlugins; [ - editorconfig-vim - vim-eunuch - vim-nix - vim-sensible - vim-sleuth - vim-surround - vim-unimpaired - ]; - description = "Plugins."; - }; - }; - - config = mkIf cfg.enable { - hm.stylix.targets.vim.enable = false; - - environment = with config.programs.vim; { - systemPackages = [ package ]; - variables = rec { - EDITOR = mkOverride 15 (getExe' package "vim"); - VISUAL = EDITOR; - }; - }; - }; -} diff --git a/modules/common/common/xdg.nix b/modules/common/xdg.nix index 4463c15..c581369 100644 --- a/modules/common/common/xdg.nix +++ b/modules/common/xdg.nix @@ -1,5 +1,13 @@ -{ config, lib, ... }: +{ + config, + lib, + this, + ... +}: with lib; +let + cfg = config.nixfiles.modules.common.xdg; +in { imports = let @@ -68,5 +76,34 @@ with lib; videos = tmp; }; }; + defaultApplications = mkOption { + description = "Default applications."; + type = with types; attrsOf (listOf str); + default = { }; + }; + }; + + config = { + xdg.portal = mkIf this.isHeadful { enable = true; }; + + hm.xdg = mkMerge [ + (with cfg; { + enable = true; + + inherit cacheHome; + inherit configHome; + inherit dataHome; + inherit stateHome; + inherit userDirs; + }) + (mkIf this.isHeadful { + mimeApps = { + enable = true; + defaultApplications = mkMerge ( + mapAttrsToList (n: v: genAttrs v (_: [ "${n}.desktop" ])) cfg.defaultApplications + ); + }; + }) + ]; }; } diff --git a/modules/common/curl.nix b/modules/curl.nix index 6895262..6895262 100644 --- a/modules/common/curl.nix +++ b/modules/curl.nix diff --git a/modules/common/direnv.nix b/modules/direnv.nix index ececad8..ececad8 100644 --- a/modules/common/direnv.nix +++ b/modules/direnv.nix diff --git a/modules/common/editorconfig.nix b/modules/editorconfig.nix index 5dfe845..5dfe845 100644 --- a/modules/common/editorconfig.nix +++ b/modules/editorconfig.nix diff --git a/modules/common/emacs/default.nix b/modules/emacs/default.nix index 4c43fd5..2230ee0 100644 --- a/modules/common/emacs/default.nix +++ b/modules/emacs/default.nix @@ -2,9 +2,7 @@ config, inputs, lib, - localUsername ? lib.my.username, pkgs, - this, ... }: with lib; @@ -17,10 +15,20 @@ in config = mkIf cfg.enable { secrets.authinfo = { file = "${inputs.self}/secrets/authinfo"; - owner = localUsername; + owner = my.username; }; nixfiles.modules = { + common.xdg.defaultApplications.emacsclient = [ + "application/atom+xml" + "application/json" + "application/rss+xml" + "application/schema+json" + "application/xhtml+xml" + "application/xml" + "text/csv" + "text/plain" + ]; git.client.enable = true; gnupg.enable = true; password-store.enable = true; @@ -69,108 +77,92 @@ in text = concatLines [ ( let - extraBins = - with pkgs; - [ - (aspellWithDicts ( - p: with p; [ - en - ru - ] - )) # :checkers (spell +aspell) - asmfmt # :editor format - cargo # :lang rust - clang-tools # :lang (cc +lsp) :editor format - cmake-format # :lang cc :editor format - cmigemo # :lang japanese - config.hm.programs.emacs.package # !doom - config.nix.package # !doom - delve # :lang go :tools debugger - dockerfile-language-server-nodejs # :tools (docker +lsp) - dockfmt # :tools docker :editor format - editorconfig-core-c # :tools editorconfig - fd # doom! - gcc # :lang cc - ghc # :lang haskell - gnuplot # :lang (org +gnuplot) - gnutar # :tools tree-sitter - gnutls # doom! :app irc - go # :lang go - godef # :lang go - gomodifytags # :lang go - gopls # :lang (go +lsp) - gore # :lang go - gotests # :lang go - gotools # :lang go - graphviz # :lang (org +roam2) :lang plantuml - gzip # :tools tree-sitter - haskellPackages.cabal-fmt # :lang haskell :editor format - haskellPackages.cabal-install # :lang haskell - haskellPackages.haskell-language-server # :lang (haskell +lsp) - haskellPackages.hoogle # :lang haskell - haskellPackages.ormolu # :lang haskell :editor format - html-tidy # :lang web :editor format - jdk # :lang java :lang plantuml :checkers grammar - languagetool # :checkers grammar - libxml2 # :lang data :editor format - markdownlint-cli # :lang markdown - nil # :lang (nix +lsp) - nixfmt # :lang nix :editor format - nls # :lang (nickel +lsp) - nodePackages.bash-language-server # :lang (sh +lsp) - nodePackages.eslint # :lang (json +lsp) - nodePackages.js-beautify # :lang web - nodePackages.prettier # :editor format - nodePackages.stylelint # :lang web - nodePackages.vscode-css-languageserver-bin # lang (web +lsp) - nodePackages.vscode-html-languageserver-bin # lang (web +lsp) - nodePackages.vscode-json-languageserver-bin # lang (json +lsp) - nodejs # :tools debugger - pandoc # :lang org markdown latex - pinentry-emacs # doom! - pipenv # :lang python - poetry # :lang python - pre-commit # :tools magit - python3 # :lang python - python3Packages.black # :lang python :editor format - python3Packages.isort # :lang python :editor format - python3Packages.nose # :lang python - python3Packages.pyflakes # :lang python :editor format - python3Packages.pytest # :lang python - python3Packages.python-lsp-server # :lang python :editor format - ripgrep # doom! - rust-analyzer # :lang (rust +lsp) - rustc # :lang rust - rustfmt # :lang rust - shellcheck # :lang sh - shfmt # :lang sh :editor format - sops - sqlite # :lang (org +roam2) :tools lookup - terraform-ls # :tools (terraform +lsp) - texlab # lang (tex +lsp) - texlive.combined.scheme-full # :lang org tex - unzip # :tools debugger - wordnet # :tools (lookup +dictionary +offline) - yaml-language-server # :lang (yaml +lsp) - zig # :lang zig :editor format - zls # :lang (zig +lsp) - zstd # :emacs undo - ] - ++ ( - # GDB doesn't support[1] Apple Silicon. - # - # [1]: https://inbox.sourceware.org/gdb/6b48224b-9e2e-518d-793b-df4fc5514884@arm.com/ - if (this.system != "aarch64-darwin") then - [ gdb ] # :tools debugger - else - [ lldb ] # :tools debugger - ); - - parinferRustLibrary = - if (hasSuffix "linux" this.system) then - "${pkgs.parinfer-rust}/lib/libparinfer_rust.so" - else - "${pkgs.parinfer-rust}/lib/libparinfer_rust.dylib"; + extraBins = with pkgs; [ + (aspellWithDicts ( + p: with p; [ + en + ru + ] + )) # :checkers (spell +aspell) + asmfmt # :editor format + cargo # :lang rust + clang-tools # :lang (cc +lsp) :editor format + cmake-format # :lang cc :editor format + cmigemo # :lang japanese + config.hm.programs.emacs.package # !doom + config.nix.package # !doom + delve # :lang go :tools debugger + dockerfile-language-server-nodejs # :tools (docker +lsp) + dockfmt # :tools docker :editor format + editorconfig-core-c # :tools editorconfig + fd # doom! + gcc # :lang cc + ghc # :lang haskell + gnuplot # :lang (org +gnuplot) + gnutar # :tools tree-sitter + gnutls # doom! :app irc + go # :lang go + godef # :lang go + gomodifytags # :lang go + gopls # :lang (go +lsp) + gore # :lang go + gotests # :lang go + gotools # :lang go + graphviz # :lang (org +roam2) :lang plantuml + gzip # :tools tree-sitter + haskellPackages.cabal-fmt # :lang haskell :editor format + haskellPackages.cabal-install # :lang haskell + haskellPackages.haskell-language-server # :lang (haskell +lsp) + haskellPackages.hoogle # :lang haskell + haskellPackages.ormolu # :lang haskell :editor format + html-tidy # :lang web :editor format + jdk # :lang java :lang plantuml :checkers grammar + languagetool # :checkers grammar + libxml2 # :lang data :editor format + markdownlint-cli # :lang markdown + nil # :lang (nix +lsp) + nixfmt # :lang nix :editor format + nls # :lang (nickel +lsp) + nodePackages.bash-language-server # :lang (sh +lsp) + nodePackages.eslint # :lang (json +lsp) + nodePackages.js-beautify # :lang web + nodePackages.prettier # :editor format + nodePackages.stylelint # :lang web + nodePackages.vscode-css-languageserver-bin # lang (web +lsp) + nodePackages.vscode-html-languageserver-bin # lang (web +lsp) + nodePackages.vscode-json-languageserver-bin # lang (json +lsp) + nodejs # :tools debugger + pandoc # :lang org markdown latex + pinentry-emacs # doom! + pipenv # :lang python + poetry # :lang python + pre-commit # :tools magit + python3 # :lang python + python3Packages.black # :lang python :editor format + python3Packages.isort # :lang python :editor format + python3Packages.nose # :lang python + python3Packages.pyflakes # :lang python :editor format + python3Packages.pytest # :lang python + python3Packages.python-lsp-server # :lang python :editor format + ripgrep # doom! + rust-analyzer # :lang (rust +lsp) + rustc # :lang rust + rustfmt # :lang rust + shellcheck # :lang sh + shfmt # :lang sh :editor format + sops + sqlite # :lang (org +roam2) :tools lookup + terraform-ls # :tools (terraform +lsp) + texlab # lang (tex +lsp) + texlive.combined.scheme-full # :lang org tex + unzip # :tools debugger + wordnet # :tools (lookup +dictionary +offline) + yaml-language-server # :lang (yaml +lsp) + zig # :lang zig :editor format + zls # :lang (zig +lsp) + zstd # :emacs undo + gdb # :tools debugger + ]; in '' ;; Integrate packages which are required by various modules @@ -194,7 +186,7 @@ in ;; :editor parinfer (setq parinfer-rust-auto-download nil - parinfer-rust-library "${parinferRustLibrary}") + parinfer-rust-library "${pkgs.parinfer-rust}/lib/libparinfer_rust.so") ;; :lang (org +roam2) :email mu4e (setq emacsql-sqlite-executable "${getExe pkgs.emacsql-sqlite}") diff --git a/modules/common/emacs/doom/config.el b/modules/emacs/doom/config.el index c893e7f..79c0156 100644 --- a/modules/common/emacs/doom/config.el +++ b/modules/emacs/doom/config.el @@ -9,9 +9,8 @@ scroll-margin 10 hscroll-margin 10) -(when (featurep :system 'linux) - (setq browse-url-generic-program (executable-find "firefox") - browse-url-browser-function 'browse-url-generic)) +(setq browse-url-generic-program (executable-find "firefox") + browse-url-browser-function 'browse-url-generic) ;; ;;; Doom-specific diff --git a/modules/common/emacs/doom/init.el b/modules/emacs/doom/init.el index 571993b..571993b 100644 --- a/modules/common/emacs/doom/init.el +++ b/modules/emacs/doom/init.el diff --git a/modules/common/emacs/doom/packages.el b/modules/emacs/doom/packages.el index 2ed0e4c..2ed0e4c 100644 --- a/modules/common/emacs/doom/packages.el +++ b/modules/emacs/doom/packages.el diff --git a/modules/common/eza.nix b/modules/eza.nix index 96b7d4c..96b7d4c 100644 --- a/modules/common/eza.nix +++ b/modules/eza.nix diff --git a/modules/common/htop.nix b/modules/htop.nix index 647abf7..647abf7 100644 --- a/modules/common/htop.nix +++ b/modules/htop.nix diff --git a/modules/common/mpv.nix b/modules/mpv.nix index 9cd1e91..9b26b08 100644 --- a/modules/common/mpv.nix +++ b/modules/mpv.nix @@ -12,6 +12,90 @@ in options.nixfiles.modules.mpv.enable = mkEnableOption "mpv"; config = mkIf cfg.enable { + nixfiles.modules.common = { + shell.aliases.cam = "mpv av://v4l2:/dev/video0"; + + xdg.defaultApplications.mpv = + let + audio = [ + "audio/aac" + "audio/ac3" + "audio/basic" + "audio/flac" + "audio/midi" + "audio/mp4" + "audio/mpeg" + "audio/ogg" + "audio/opus" + "audio/vnd.dts" + "audio/vnd.dts.hd" + "audio/webm" + "audio/x-adpcm" + "audio/x-aifc" + "audio/x-aiff" + "audio/x-ape" + "audio/x-flac+ogg" + "audio/x-m4b" + "audio/x-m4r" + "audio/x-matroska" + "audio/x-mpegurl" + "audio/x-musepack" + "audio/x-opus+ogg" + "audio/x-speex" + "audio/x-speex+ogg" + "audio/x-vorbis+ogg" + "audio/x-wav" + "audio/x-wavpack" + "x-content/audio-cdda" + "x-content/audio-dvd" + ]; + video = [ + "video/3gpp" + "video/3gpp2" + "video/mkv" + "video/mp2t" + "video/mp4" + "video/mpeg" + "video/ogg" + "video/quicktime" + "video/vnd.mpegurl" + "video/vnd.radgamettools.bink" + "video/vnd.radgamettools.smacker" + "video/wavelet" + "video/webm" + "video/x-matroska" + "video/x-matroska-3d" + "video/x-mjpeg" + "video/x-msvideo" + "video/x-ogm+ogg" + "video/x-theora+ogg" + "x-content/video-bluray" + "x-content/video-dvd" + "x-content/video-hddvd" + "x-content/video-svcd" + "x-content/video-vcd" + ]; + image = [ + "image/avif" + "image/bmp" + "image/gif" + "image/jp2" + "image/jpeg" + "image/jpg" + "image/jpm" + "image/jpx" + "image/jxl" + "image/png" + "image/tiff" + "image/vnd.microsoft.icon" + "image/webp" + "image/webp" + "image/x-tga" + ]; + in + audio ++ video ++ image; + }; + hm.programs.mpv = { enable = true; diff --git a/modules/common/nmap.nix b/modules/nmap.nix index 71b3d0b..71b3d0b 100644 --- a/modules/common/nmap.nix +++ b/modules/nmap.nix diff --git a/modules/common/password-store.nix b/modules/password-store.nix index e5cd756..e5cd756 100644 --- a/modules/common/password-store.nix +++ b/modules/password-store.nix diff --git a/modules/common/profiles/default.nix b/modules/profiles/default.nix index 79ce39d..e3002b0 100644 --- a/modules/common/profiles/default.nix +++ b/modules/profiles/default.nix @@ -10,12 +10,7 @@ let cfg = config.nixfiles.modules.profiles.default; in { - imports = [ - ./dev - ./email.nix - ./headful.nix - ./headless.nix - ]; + imports = attrValues (modulesIn ./.); options.nixfiles.modules.profiles.default.enable = mkEnableOption "The most default profile of them all." @@ -34,6 +29,8 @@ in } ]; + ark.directories = [ "/var/log" ]; + nixfiles.modules = { bat.enable = true; eza.enable = true; @@ -42,11 +39,24 @@ in vim.enable = true; }; + programs.less = { + enable = true; + envVariables.LESSHISTFILE = "-"; + }; + time.timeZone = "Europe/Moscow"; environment.systemPackages = with pkgs; [ + cryptsetup file + lshw + lsof + pciutils + psmisc + sysstat tree + usbutils + util-linux ]; }; } diff --git a/modules/common/profiles/dev/default.nix b/modules/profiles/dev/default.nix index 6ac1fe6..eab447c 100644 --- a/modules/common/profiles/dev/default.nix +++ b/modules/profiles/dev/default.nix @@ -9,11 +9,7 @@ let cfg = config.nixfiles.modules.profiles.dev; in { - imports = [ - ./containers.nix - ./hidden.nix - ./sql.nix - ]; + imports = attrValues (modulesIn ./.); options.nixfiles.modules.profiles.dev.enable = mkEnableOption "Catch-all profile for stuff related to software development and etc."; @@ -24,7 +20,6 @@ in direnv.enable = true; editorconfig.enable = true; git.client.enable = true; - gnupg.enable = true; nmap.enable = true; wget.enable = true; }; @@ -73,6 +68,11 @@ in sops yq ]; + + language = { + collate = "C"; + messages = "C"; + }; }; xdg.configFile = { @@ -80,5 +80,15 @@ in "ghc/ghci.conf".source = ./ghci.conf; }; }; + + programs.wireshark = { + enable = true; + package = pkgs.wireshark; + }; + + my.extraGroups = [ + "kvm" + "wireshark" + ]; }; } diff --git a/modules/common/profiles/dev/gdbinit b/modules/profiles/dev/gdbinit index e266236..e266236 100644 --- a/modules/common/profiles/dev/gdbinit +++ b/modules/profiles/dev/gdbinit diff --git a/modules/common/profiles/dev/ghci.conf b/modules/profiles/dev/ghci.conf index d672167..d672167 100644 --- a/modules/common/profiles/dev/ghci.conf +++ b/modules/profiles/dev/ghci.conf diff --git a/modules/common/profiles/dev/pystartup.py b/modules/profiles/dev/pystartup.py index adde66c..adde66c 100644 --- a/modules/common/profiles/dev/pystartup.py +++ b/modules/profiles/dev/pystartup.py diff --git a/modules/common/profiles/dev/sql.nix b/modules/profiles/dev/sql.nix index c2d4894..c2d4894 100644 --- a/modules/common/profiles/dev/sql.nix +++ b/modules/profiles/dev/sql.nix diff --git a/modules/common/profiles/email.nix b/modules/profiles/email.nix index cf4169c..b2ef02f 100644 --- a/modules/common/profiles/email.nix +++ b/modules/profiles/email.nix @@ -15,6 +15,8 @@ in }; config = mkIf cfg.enable { + nixfiles.modules.gnupg.enable = true; + hm = { accounts.email = { maildirBasePath = "${config.my.home}/doc/mail"; @@ -34,7 +36,7 @@ in msmtp.enable = true; mu.enable = true; thunderbird = { - enable = hasSuffix "linux" this.system; + enable = true; settings = id: { "mail.identity.id_${id}.compose_html" = false; "mail.identity.id_${id}.reply_on_top" = 0; diff --git a/modules/common/qutebrowser.nix b/modules/qutebrowser.nix index 8fdcf48..8fdcf48 100644 --- a/modules/common/qutebrowser.nix +++ b/modules/qutebrowser.nix diff --git a/modules/common/subversion.nix b/modules/subversion.nix index 9398592..9398592 100644 --- a/modules/common/subversion.nix +++ b/modules/subversion.nix diff --git a/modules/common/tmux.nix b/modules/tmux.nix index a754222..a754222 100644 --- a/modules/common/tmux.nix +++ b/modules/tmux.nix diff --git a/modules/common/vim/rc.vim b/modules/vim/rc.vim index 3bd9eb7..3bd9eb7 100644 --- a/modules/common/vim/rc.vim +++ b/modules/vim/rc.vim diff --git a/modules/common/vscode.nix b/modules/vscode.nix index bd840d8..bd840d8 100644 --- a/modules/common/vscode.nix +++ b/modules/vscode.nix diff --git a/modules/common/wget.nix b/modules/wget.nix index 0e8ee64..0e8ee64 100644 --- a/modules/common/wget.nix +++ b/modules/wget.nix diff --git a/modules/common/zathura.nix b/modules/zathura.nix index bc92258..cef841c 100644 --- a/modules/common/zathura.nix +++ b/modules/zathura.nix @@ -7,6 +7,11 @@ in options.nixfiles.modules.zathura.enable = mkEnableOption "Zathura PDF reader"; config = mkIf cfg.enable { + nixfiles.modules.common.xdg.defaultApplications."org.pwmt.zathura" = [ + "application/pdf" + "application/epub+zip" + ]; + hm.programs.zathura = { enable = true; |