diff --git a/base/gui-programs.nix b/base/gui-programs.nix index c1dbbc6..2925b64 100644 --- a/base/gui-programs.nix +++ b/base/gui-programs.nix @@ -1,18 +1,11 @@ { pkgs, lib, config, options, ... }: -let - inherit (lib) - mkEnableOption - mkIf - optional - ; -in { options.my.gui = { - enable = mkEnableOption "System has some kind of screen attached"; - isNvidia = mkEnableOption "System a NVIDIA GPU"; + enable = lib.mkEnableOption "System has some kind of screen attached"; + isNvidia = lib.mkEnableOption "System a NVIDIA GPU"; }; - config = mkIf config.my.gui.enable { + config = lib.mkIf config.my.gui.enable { my.displayManager.sddm.enable = true; services = { @@ -28,30 +21,27 @@ in }; }; - environment.systemPackages = builtins.attrValues { - inherit (pkgs) - element-desktop - feh - firefox - ffmpeg - gimp - imagemagick - mpv - obs-studio - pavucontrol - slack - spotify - tdesktop - teams - thunderbird - virt-manager - zathura - ; + environment.systemPackages = with pkgs; [ + element-desktop + feh + firefox + ffmpeg + gimp + gnome.nautilus + imagemagick + mpv + obs-studio + pavucontrol + slack + spotify + tdesktop + teams + thunderbird + virt-manager + zathura - inherit (pkgs.gnome) nautilus; - - inherit (pkgs.unstable) discord; - }; + unstable.discord + ]; networking.networkmanager.enable = true; programs.nm-applet.enable = true; diff --git a/base/networking.nix b/base/networking.nix index e059f5e..c17ed76 100644 --- a/base/networking.nix +++ b/base/networking.nix @@ -1,12 +1,6 @@ { lib, ... }: -let - inherit (lib) - mkOption - types - ; -in { - options.my.networking.externalInterface = mkOption { + options.my.networking.externalInterface = with lib; mkOption { type = types.nullOr types.str; default = null; example = "eth0"; diff --git a/base/programs.nix b/base/programs.nix index 86a0668..b573d97 100644 --- a/base/programs.nix +++ b/base/programs.nix @@ -19,45 +19,40 @@ bandwhich.enable = true; }; - environment.systemPackages = builtins.attrValues { - inherit (pkgs) - # shell usage - fd - ripgrep - sd - tmux - tokei - tree - wget + environment.systemPackages = with pkgs; [ + # shell usage + fd + ripgrep + sd + tmux + tokei + tree + wget - # development - git - git-crypt - git-lfs - gnumake - gnupg - kakoune - pinentry-curses - python3 - vim + # development + git + git-crypt + git-lfs + gnumake + gnupg + kakoune + pinentry-curses + python3 + vim + clang_11 + llvmPackages_11.bintools - # terminal utilities - bottom - dogdns - du-dust - htop - ldns # drill - tealdeer - unzip - zip + # terminal utilities + bottom + dogdns + du-dust + htop + ldns # drill + tealdeer + unzip + zip - # nix pkgs lookup - nix-index - ; - - inherit (pkgs.llvmPackages_11) - bintools - clang - ; - }; + # nix pkgs lookup + nix-index + ]; } diff --git a/flake.lock b/flake.lock index 778ccad..7f78079 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "emacs-overlay": { "locked": { - "lastModified": 1641901534, - "narHash": "sha256-Nvm6Zj80fVtzmGsUFYlz9XGFyLnyAe9VoduPmDBu+js=", + "lastModified": 1641149178, + "narHash": "sha256-Mt+oT5YZ6G9zHctDKV5pY+3vIdsMmAg0HMvz6rxsIc0=", "owner": "nix-community", "repo": "emacs-overlay", - "rev": "57378ea2f62e9f450f420dc9d01cc06e0d3dd15e", + "rev": "f3c435a5e5cfa3ce1b2f50ba37b9cacfec4139d9", "type": "github" }, "original": { @@ -39,11 +39,11 @@ ] }, "locked": { - "lastModified": 1641915897, - "narHash": "sha256-C5Vw7B8BKA/kr9tWVYjEdD3AjstXFqoxkkzrOwfQZxk=", + "lastModified": 1641121012, + "narHash": "sha256-svaOMxNMQgFHjcxdmLojOxTxfqSENtnO+S3kb+npIwY=", "owner": "nix-community", "repo": "home-manager", - "rev": "5209ea0d8c77399ec4987590e9738953f15f8d80", + "rev": "8e7a10602d1eb1d242c9d3f9b822203d5751a8c6", "type": "github" }, "original": { @@ -71,11 +71,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1641710811, - "narHash": "sha256-yVJ+CtwWZY8BnkNIJ/ue5a28yrRM6CkDF1LvmGmqqwM=", + "lastModified": 1640959792, + "narHash": "sha256-zYSR//06FU2TDOpKKj0Hkff6unsxk3NwwNFuB1loU6E=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "0ecf7d414811f831060cf55707c374d54fbb1dec", + "rev": "59bfda72480496f32787cec8c557182738b1bd3f", "type": "github" }, "original": { @@ -87,11 +87,11 @@ }, "nixpkgs-unstable-small": { "locked": { - "lastModified": 1641865627, - "narHash": "sha256-B3b7KCThCx5bcDtWCX9ZZIl/EVs/lB8iDdI277/tvNA=", + "lastModified": 1641125298, + "narHash": "sha256-oNIG2UsyMk/osOmnjxHp53d8nJMudpW5a2+dcgsJzmE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3fe528dec572a26404f130893d2c22a35646247c", + "rev": "c1d8e77ac2ca4248886632c597debea233700b2b", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 9bc927c..a30b5d8 100644 --- a/flake.nix +++ b/flake.nix @@ -60,8 +60,6 @@ }; }; - overlays = import ./overlays; - nixosConfigurations = let system = "x86_64-linux"; @@ -75,7 +73,7 @@ config.allowUnfree = true; }; }) - ] ++ builtins.attrValues self.overlays; + ]; sharedModules = [ home-manager.nixosModule { nixpkgs.overlays = shared_overlays; } diff --git a/home/alacritty.nix b/home/alacritty.nix index bf9665b..44f08cb 100644 --- a/home/alacritty.nix +++ b/home/alacritty.nix @@ -1,17 +1,12 @@ { config, lib, pkgs, ... }: let - inherit (lib) - mkEnableOption - mkIf - ; - cfg = config.my.home.alacritty; alacrittyTheme = config.my.theme.alacrittyTheme; in { - options.my.home.alacritty.enable = (mkEnableOption "Alacritty terminal") // { default = config.my.home.x.enable; }; + options.my.home.alacritty.enable = (lib.mkEnableOption "Alacritty terminal") // { default = config.my.home.x.enable; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { programs.alacritty = { enable = true; @@ -39,8 +34,9 @@ in }; }; - home.packages = [ pkgs.iosevka-bin ]; - + home.packages = with pkgs; [ + iosevka-bin + ]; # make sure font is discoverable fonts.fontconfig.enable = true; }; diff --git a/home/bat.nix b/home/bat.nix index 2349985..6d496e8 100644 --- a/home/bat.nix +++ b/home/bat.nix @@ -1,19 +1,14 @@ { config, lib, ... }: let - inherit (lib) - mkEnableOption - mkIf - ; - cfg = config.my.home.bat; batTheme = config.my.theme.batTheme; in { - options.my.home.bat = { + options.my.home.bat = with lib; { enable = (mkEnableOption "bat code display tool") // { default = true; }; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { programs.bat = { enable = true; diff --git a/home/emacs.nix b/home/emacs.nix index c9ed8f6..154e79b 100644 --- a/home/emacs.nix +++ b/home/emacs.nix @@ -1,31 +1,23 @@ { config, lib, pkgs, ... }: -let - inherit (lib) - mkEnableOption - mkIf - ; -in { - options.my.home.emacs = { + options.my.home.emacs = with lib; { enable = mkEnableOption "Emacs daemon configuration"; }; - config = mkIf config.my.home.emacs.enable { + config = lib.mkIf config.my.home.emacs.enable { home.sessionPath = [ "${config.xdg.configHome}/emacs/bin" ]; home.sessionVariables = { EDITOR = "emacsclient -t"; }; - home.packages = builtins.attrValues { - inherit (pkgs) - sqlite # needed by org-roam + home.packages = with pkgs; [ + sqlite # needed by org-roam - # fonts used by my config - emacs-all-the-icons-fonts - iosevka-bin - ; - }; + # fonts used by my config + emacs-all-the-icons-fonts + iosevka-bin + ]; # make sure above fonts are discoverable fonts.fontconfig.enable = true; diff --git a/home/firefox.nix b/home/firefox.nix index 1cfce8a..6bfe377 100644 --- a/home/firefox.nix +++ b/home/firefox.nix @@ -1,18 +1,13 @@ { config, lib, pkgs, ... }: let - inherit (lib) - mkEnableOption - mkIf - ; - cfg = config.my.home.firefox; in { - options.my.home.firefox = { + options.my.home.firefox = with lib; { enable = (mkEnableOption "firefox config") // { default = config.my.home.x.enable; }; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { programs.firefox = { enable = true; package = pkgs.firefox.override { diff --git a/home/fish/default.nix b/home/fish/default.nix index 3f50c71..9175f57 100644 --- a/home/fish/default.nix +++ b/home/fish/default.nix @@ -1,16 +1,11 @@ { config, lib, ... }: let - inherit (lib) - mkEnableOption - mkIf - ; - cfg = config.my.home.fish; in { - options.my.home.fish.enable = (mkEnableOption "Fish shell") // { default = true; }; + options.my.home.fish.enable = (lib.mkEnableOption "Fish shell") // { default = true; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { programs.fish = { enable = true; }; diff --git a/home/flameshot.nix b/home/flameshot.nix index 043d2ce..359fc8c 100644 --- a/home/flameshot.nix +++ b/home/flameshot.nix @@ -1,18 +1,13 @@ { config, lib, ... }: let - inherit (lib) - mkEnableOption - mkIf - ; - cfg = config.my.home.flameshot; in { - options.my.home.flameshot = { + options.my.home.flameshot = with lib; { enable = mkEnableOption "flameshot autolaunch"; }; - config.services.flameshot = mkIf cfg.enable { + config.services.flameshot = lib.mkIf cfg.enable { enable = true; }; } diff --git a/home/git.nix b/home/git.nix index 61e8171..1b5adb5 100644 --- a/home/git.nix +++ b/home/git.nix @@ -1,16 +1,11 @@ { config, lib, pkgs, ... }: let - inherit (lib) - mkEnableOption - mkIf - ; - cfg = config.my.home.git; in { - options.my.home.git.enable = (mkEnableOption "Git configuration") // { default = true; }; + options.my.home.git.enable = (lib.mkEnableOption "Git configuration") // { default = true; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { programs.git = { enable = true; diff --git a/home/laptop.nix b/home/laptop.nix index 8d30003..ef4d266 100644 --- a/home/laptop.nix +++ b/home/laptop.nix @@ -1,11 +1,6 @@ { config, lib, ... }: -let - inherit (lib) - mkEnableOption - ; -in { - options.my.home.laptop = { + options.my.home.laptop = with lib; { enable = mkEnableOption "Laptop settings"; }; } diff --git a/home/lorri.nix b/home/lorri.nix index e2c5ebb..df4d23d 100644 --- a/home/lorri.nix +++ b/home/lorri.nix @@ -1,18 +1,13 @@ { config, lib, ... }: let - inherit (lib) - mkEnableOption - mkIf - ; - cfg = config.my.home.lorri; in { - options.my.home.lorri = { + options.my.home.lorri = with lib; { enable = (mkEnableOption "lorri daemon setup") // { default = true; }; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { services.lorri.enable = true; programs.direnv = { enable = true; diff --git a/home/rofi.nix b/home/rofi.nix index b5a9e91..30022d7 100644 --- a/home/rofi.nix +++ b/home/rofi.nix @@ -1,18 +1,13 @@ { config, lib, pkgs, ... }: let - inherit (lib) - mkEnableOption - mkIf - ; - cfg = config.my.home.rofi; in { - options.my.home.rofi = { + options.my.home.rofi = with lib; { enable = (mkEnableOption "rofi configuration") // { default = config.my.home.x.enable; }; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { programs.rofi = { enable = true; diff --git a/home/secrets/default.nix b/home/secrets/default.nix index b149dde..71b63a9 100644 --- a/home/secrets/default.nix +++ b/home/secrets/default.nix @@ -1,11 +1,5 @@ { lib, ... }: -let - inherit (lib) - fileContents - mkOption - types - ; -in +with lib; { options.my.secrets = mkOption { type = types.attrs; diff --git a/home/ssh.nix b/home/ssh.nix index fc5884e..cf8d877 100644 --- a/home/ssh.nix +++ b/home/ssh.nix @@ -1,18 +1,13 @@ { config, lib, ... }: let - inherit (lib) - mkEnableOption - mkIf - ; - cfg = config.my.home.ssh; in { - options.my.home.ssh = { + options.my.home.ssh = with lib; { enable = (mkEnableOption "ssh configuration") // { default = true; }; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { programs.ssh = { enable = true; diff --git a/home/themes/alacritty.nix b/home/themes/alacritty.nix index cc6943b..0e1aeb3 100644 --- a/home/themes/alacritty.nix +++ b/home/themes/alacritty.nix @@ -1,10 +1,6 @@ { lib }: +with lib; let - inherit (lib) - mkOption - types - ; - mkColorOption = import ./color.nix { inherit lib; }; primaryColorModule = types.submodule { diff --git a/home/themes/bat.nix b/home/themes/bat.nix index df9565e..5c14c5f 100644 --- a/home/themes/bat.nix +++ b/home/themes/bat.nix @@ -1,10 +1,5 @@ { lib }: -let - inherit (lib) - mkOption - types - ; -in +with lib; types.submodule { options = { name = mkOption { diff --git a/home/themes/color.nix b/home/themes/color.nix index 5c63963..46ce77e 100644 --- a/home/themes/color.nix +++ b/home/themes/color.nix @@ -1,11 +1,6 @@ { lib }: let - inherit (lib) - mkOption - types - ; - - mkColorOption = {default ? "#000000", description ? "" }: mkOption { + mkColorOption = with lib; {default ? "#000000", description ? "" }: mkOption { inherit description default; example = "#abcdef"; type = types.strMatching "#[0-9a-f]{6}"; diff --git a/home/themes/default.nix b/home/themes/default.nix index e19a474..96fc994 100644 --- a/home/themes/default.nix +++ b/home/themes/default.nix @@ -1,10 +1,6 @@ { config, lib, ... }: +with lib; let - inherit (lib) - mkOption - types - ; - themeType = types.submodule { options = { alacrittyTheme = mkOption { @@ -33,7 +29,7 @@ in }; options.my.themes = mkOption { - type = types.attrsOf themeType; + type = with types; attrsOf themeType; }; config.my.themes = { diff --git a/home/themes/i3.nix b/home/themes/i3.nix index 6e5b3eb..450f26a 100644 --- a/home/themes/i3.nix +++ b/home/themes/i3.nix @@ -1,10 +1,6 @@ { lib }: +with lib; let - inherit (lib) - mkOption - types - ; - mkColorOption = import ./color.nix { inherit lib; }; barColorSetModule = types.submodule { diff --git a/home/themes/i3bar.nix b/home/themes/i3bar.nix index 3701116..990c6d5 100644 --- a/home/themes/i3bar.nix +++ b/home/themes/i3bar.nix @@ -1,10 +1,6 @@ { lib }: +with lib; let - inherit (lib) - mkOption - types - ; - mkColorOption = import ./color.nix { inherit lib; }; in types.submodule { diff --git a/home/themes/solarizedLight/alacritty.nix b/home/themes/solarizedLight/alacritty.nix index fb22436..9f2149f 100644 --- a/home/themes/solarizedLight/alacritty.nix +++ b/home/themes/solarizedLight/alacritty.nix @@ -1,23 +1,7 @@ let - inherit (import ./colors.nix) - base0 - base00 - base01 - base02 - base03 - base1 - base2 - base3 - blue - cyan - green - magenta - orange - red - violet - yellow - ; + colors = import ./colors.nix; in +with colors; { primary = { background = base3; diff --git a/home/themes/solarizedLight/i3.nix b/home/themes/solarizedLight/i3.nix index df9634a..3eab85d 100644 --- a/home/themes/solarizedLight/i3.nix +++ b/home/themes/solarizedLight/i3.nix @@ -1,15 +1,7 @@ let - inherit (import ./colors.nix) - base00 - base2 - base3 - blue - magenta - orange - red - yellow - ; + colors = import ./colors.nix; in +with colors; { bar = { background = base3; diff --git a/home/themes/solarizedLight/i3bar.nix b/home/themes/solarizedLight/i3bar.nix index 5b37775..69594f4 100644 --- a/home/themes/solarizedLight/i3bar.nix +++ b/home/themes/solarizedLight/i3bar.nix @@ -1,14 +1,7 @@ let - inherit (import ./colors.nix) - base00 - base2 - base3 - blue - green - red - yellow - ; + colors = import ./colors.nix; in +with colors; { theme = { name = "solarized-light"; diff --git a/home/tmux.nix b/home/tmux.nix index 86d6995..cff3070 100644 --- a/home/tmux.nix +++ b/home/tmux.nix @@ -1,25 +1,20 @@ { config, lib, pkgs, ... }: let - inherit (lib) - mkEnableOption - mkIf - ; - cfg = config.my.home.tmux; in { - options.my.home.tmux = { + options.my.home.tmux = with lib; { enable = (mkEnableOption "tmux dotfiles") // { default = true; }; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { programs.tmux = { enable = true; baseIndex = 1; terminal = "screen-256color"; clock24 = true; - plugins = let inherit (pkgs) tmuxPlugins; in [ + plugins = with pkgs; [ { plugin = tmuxPlugins.cpu; extraConfig = '' diff --git a/home/tridactyl.nix b/home/tridactyl.nix index 9be9906..b179812 100644 --- a/home/tridactyl.nix +++ b/home/tridactyl.nix @@ -1,18 +1,13 @@ { config, lib, ... }: let - inherit (lib) - mkEnableOption - mkIf - ; - cfg = config.my.home.tridactyl; in { - options.my.home.tridactyl = { + options.my.home.tridactyl = with lib; { enable = (mkEnableOption "tridactyl code display tool") // { default = config.my.home.firefox.enable; }; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { xdg.configFile."tridactyl/tridactylrc".source = ./tridactylrc; }; } diff --git a/home/x/cursor.nix b/home/x/cursor.nix index aa4ead7..76226b4 100644 --- a/home/x/cursor.nix +++ b/home/x/cursor.nix @@ -1,16 +1,11 @@ { config, lib, pkgs, ... }: let - inherit (lib) - mkEnableOption - mkIf - ; - cfg = config.my.home.x.cursor; in { - options.my.home.x.cursor.enable = (mkEnableOption "X cursor") // { default = config.my.home.x.enable; }; + options.my.home.x.cursor.enable = (lib.mkEnableOption "X cursor") // { default = config.my.home.x.enable; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { xsession.pointerCursor = { package = pkgs.capitaine-cursors; name = "capitaine-cursors"; diff --git a/home/x/default.nix b/home/x/default.nix index 4953b9a..9473fc3 100644 --- a/home/x/default.nix +++ b/home/x/default.nix @@ -1,9 +1,4 @@ { config, lib, pkgs, ... }: -let - inherit (lib) - mkEnableOption - ; -in { imports = [ ./cursor.nix @@ -11,7 +6,7 @@ in ./i3bar.nix ]; - options.my.home.x = { + options.my.home.x = with lib; { enable = mkEnableOption "X server configuration"; }; } diff --git a/home/x/i3.nix b/home/x/i3.nix index 4dde0c4..9827bc2 100644 --- a/home/x/i3.nix +++ b/home/x/i3.nix @@ -1,10 +1,5 @@ { config, lib, pkgs, ... }: let - inherit (lib) - mkIf - mkOptionDefault - ; - isEnabled = config.my.home.x.enable; myTerminal = @@ -22,12 +17,14 @@ let i3Theme = config.my.theme.i3Theme; in { - config = mkIf isEnabled { + config = lib.mkIf isEnabled { my.home = { flameshot.enable = true; }; - home.packages = [ pkgs.betterlockscreen ]; + home.packages = with pkgs; [ + betterlockscreen + ]; xsession.windowManager.i3 = { enable = true; @@ -80,7 +77,7 @@ in size = 8.0; }; - keybindings = mkOptionDefault { + keybindings = lib.mkOptionDefault { "${modifier}+Shift+e" = ''mode "${logoutMode}"''; "${modifier}+i" = "exec emacsclient -c"; @@ -109,7 +106,7 @@ in "Return" = "mode default"; }; in - mkOptionDefault { + lib.mkOptionDefault { "${logoutMode}" = makeModeBindings { "l" = "exec --no-startup-id i3-msg exit, mode default"; "s" = "exec --no-startup-id betterlockscreen --suspend, mode default"; diff --git a/home/x/i3bar.nix b/home/x/i3bar.nix index 335ba68..e3f0af7 100644 --- a/home/x/i3bar.nix +++ b/home/x/i3bar.nix @@ -1,19 +1,11 @@ { config, lib, pkgs, ... }: let - inherit (lib) - lists - mkIf - mkOption - optional - types - ; - isEnabled = config.my.home.x.enable; i3BarTheme = config.my.theme.i3BarTheme; cfg = config.my.home.x.i3bar; in { - options.my.home.x.i3bar = { + options.my.home.x.i3bar = with lib; { temperature.chip = mkOption { type = types.str; example = "coretemp-isa-*"; @@ -32,14 +24,12 @@ in }; }; - config = mkIf isEnabled { - home.packages = builtins.attrValues { - inherit (pkgs) - iw # Used by `net` block - lm_sensors # Used by `temperature` block - font-awesome - ; - }; + config = lib.mkIf isEnabled { + home.packages = with pkgs; [ + iw # Used by `net` block + lm_sensors # Used by `temperature` block + font-awesome + ]; programs.i3status-rust = { enable = true; @@ -89,7 +79,7 @@ in chip = cfg.temperature.chip; inputs = cfg.temperature.inputs; } - ] ++ (lists.optionals ((builtins.length cfg.networking.throughput_interfaces) != 0) + ] ++ (lib.lists.optionals ((builtins.length cfg.networking.throughput_interfaces) != 0) (map (interface: { @@ -115,11 +105,11 @@ in block = "sound"; driver = "pulseaudio"; } - ] ++ (optional config.my.home.laptop.enable + ] ++ (lib.lists.optionals config.my.home.laptop.enable [ { block = "battery"; } - ) ++ [ + ]) ++ [ # { # block = "notify"; # } diff --git a/hosts/boreal/default.nix b/hosts/boreal/default.nix index f1b3d81..e41608f 100644 --- a/hosts/boreal/default.nix +++ b/hosts/boreal/default.nix @@ -105,7 +105,9 @@ in "rfkill-release" ]; - services.udev.packages = [ pkgs.packages.kaleidoscope-udev-rules ]; + services.udev.packages = with pkgs; [ + packages.kaleidoscope-udev-rules + ]; hardware.bluetooth = { enable = true; diff --git a/hosts/boreal/home.nix b/hosts/boreal/home.nix index aabbe6d..6dd86d3 100644 --- a/hosts/boreal/home.nix +++ b/hosts/boreal/home.nix @@ -10,8 +10,7 @@ my.theme = config.home-manager.users.alarsyo.my.themes.solarizedLight; - home.packages = builtins.attrValues { - inherit (pkgs) + home.packages = with pkgs; [ # some websites only work there :( chromium @@ -20,9 +19,8 @@ # keyboard goodness chrysalis - ; - inherit (pkgs.packages) spot; - }; + packages.spot + ]; }; } diff --git a/hosts/poseidon/hardware-configuration.nix b/hosts/poseidon/hardware-configuration.nix index 847f37a..bd2bc7a 100644 --- a/hosts/poseidon/hardware-configuration.nix +++ b/hosts/poseidon/hardware-configuration.nix @@ -2,11 +2,7 @@ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. { config, lib, pkgs, modulesPath, ... }: -let - inherit (lib) - mkDefault - ; -in + { imports = [ (modulesPath + "/installer/scan/not-detected.nix") @@ -36,5 +32,5 @@ in [ { device = "/dev/disk/by-uuid/381a9c5e-4d71-45b4-ac62-e7414b3768fc"; } ]; - powerManagement.cpuFreqGovernor = mkDefault "ondemand"; + powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; } diff --git a/hosts/zephyrus/default.nix b/hosts/zephyrus/default.nix index 231692f..659a6bb 100644 --- a/hosts/zephyrus/default.nix +++ b/hosts/zephyrus/default.nix @@ -56,7 +56,9 @@ in }; my.gui.enable = true; - environment.systemPackages = [ pkgs.arandr ]; + environment.systemPackages = with pkgs; [ + arandr + ]; hardware.bluetooth = { enable = true; diff --git a/hosts/zephyrus/hardware-configuration.nix b/hosts/zephyrus/hardware-configuration.nix index 48d6162..cc55acf 100644 --- a/hosts/zephyrus/hardware-configuration.nix +++ b/hosts/zephyrus/hardware-configuration.nix @@ -2,11 +2,7 @@ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. { config, lib, pkgs, modulesPath, ... }: -let - inherit (lib) - mkDefault - ; -in + { imports = [ (modulesPath + "/installer/scan/not-detected.nix") @@ -44,7 +40,7 @@ in swapDevices = [ ]; - powerManagement.cpuFreqGovernor = mkDefault "powersave"; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; hardware.enableRedistributableFirmware = true; } diff --git a/hosts/zephyrus/home.nix b/hosts/zephyrus/home.nix index 4618fe3..1b38985 100644 --- a/hosts/zephyrus/home.nix +++ b/hosts/zephyrus/home.nix @@ -12,20 +12,18 @@ my.theme = config.home-manager.users.alarsyo.my.themes.solarizedLight; - home.packages = builtins.attrValues { - inherit (pkgs) - # some websites only work there :( - chromium + home.packages = with pkgs; [ + # some websites only work there :( + chromium - darktable + wineWowPackages.stable - # dev - rustup - ; + darktable - inherit (pkgs.packages) spot; + # dev + rustup - inherit (pkgs.wineWowPackages) stable; - }; + packages.spot + ]; }; } diff --git a/modules/sddm.nix b/modules/sddm.nix index 9c66ddc..785a681 100644 --- a/modules/sddm.nix +++ b/modules/sddm.nix @@ -1,31 +1,23 @@ { config, lib, pkgs, ... }: let - inherit (lib) - mkEnableOption - mkIf - ; - cfg = config.my.displayManager.sddm; in { - options.my.displayManager.sddm.enable = mkEnableOption "SDDM setup"; + options.my.displayManager.sddm.enable = lib.mkEnableOption "SDDM setup"; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { services.xserver.displayManager.sddm = { enable = true; theme = "sugar-candy"; }; - environment.systemPackages = builtins.attrValues { - inherit (pkgs.packages) - sddm-sugar-candy - ; + environment.systemPackages = with pkgs; [ + packages.sddm-sugar-candy - inherit (pkgs.libsForQt5.qt5) - qtgraphicaleffects - qtquickcontrols2 - qtsvg - ; - }; + # dependencies for sugar-candy theme + libsForQt5.qt5.qtgraphicaleffects + libsForQt5.qt5.qtquickcontrols2 + libsForQt5.qt5.qtsvg + ]; }; } diff --git a/modules/wakeonwlan.nix b/modules/wakeonwlan.nix index 096515d..8243671 100644 --- a/modules/wakeonwlan.nix +++ b/modules/wakeonwlan.nix @@ -1,15 +1,8 @@ { config, lib, pkgs, ... }: -let - inherit (lib) - concatStringsSep - literalExample - mapAttrs' - mkIf - mkOption - nameValuePair - ; +with lib; +let cfg = config.my.wakeonwlan; mkWowlanService = name: cfg: @@ -27,7 +20,7 @@ let }; in { - options.my.wakeonwlan = let inherit (lib) types; in { + options.my.wakeonwlan = { interfaces = mkOption { default = { }; description = "Wireless interfaces where you want to enable WoWLAN"; diff --git a/overlays/default.nix b/overlays/default.nix deleted file mode 100644 index 1f747a6..0000000 --- a/overlays/default.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - i3status-rust = import ./i3status-rust; -} diff --git a/overlays/i3status-rust/default.nix b/overlays/i3status-rust/default.nix deleted file mode 100644 index 1b78021..0000000 --- a/overlays/i3status-rust/default.nix +++ /dev/null @@ -1,19 +0,0 @@ -final: prev: -{ - # overlay created because nixpkgs's `i3status-rust` depended on `notmuch`, and - # `notmuch`'s tests were briefly broken. the features I'm disabling, I don't - # need anyway: (at the time of writing) - # - # - notmuch - # - maildir - i3status-rust = prev.i3status-rust.overrideAttrs (oldAttrs: { - buildInputs = builtins.attrValues { - inherit (final) - dbus - openssl - pulseaudio - ; - }; - cargoBuildFeatures = [ "pulseaudio" ]; - }); -} diff --git a/pkgs/grafana-dashboards/nginx.nix b/pkgs/grafana-dashboards/nginx.nix index e707159..5e7c4bd 100644 --- a/pkgs/grafana-dashboards/nginx.nix +++ b/pkgs/grafana-dashboards/nginx.nix @@ -1,9 +1,5 @@ { stdenv, fetchFromGitHub, lib, ... }: let - inherit (lib) - licenses - ; - version = "0.9.0"; in stdenv.mkDerivation { @@ -24,7 +20,7 @@ stdenv.mkDerivation { cp grafana/dashboard.json $out/dashboard.json ''; - meta = { + meta = with lib; { description = "grafana dashboard for NGINX exporter"; homepage = "https://github.com/nginxinc/nginx-prometheus-exporter"; license = licenses.asl20; diff --git a/pkgs/grafana-dashboards/node-exporter.nix b/pkgs/grafana-dashboards/node-exporter.nix index 55fbb6d..98054a0 100644 --- a/pkgs/grafana-dashboards/node-exporter.nix +++ b/pkgs/grafana-dashboards/node-exporter.nix @@ -1,9 +1,5 @@ { stdenv, fetchFromGitHub, lib, ... }: let - inherit (lib) - licenses - ; - version = "7d61c79619e5749e629758ecd96748c010028120"; in stdenv.mkDerivation { @@ -24,7 +20,7 @@ stdenv.mkDerivation { cp prometheus/node-exporter-full.json $out/node-exporter-full.json ''; - meta = { + meta = with lib; { description = "grafana dashboard for node exporter"; homepage = "https://github.com/rfrail3/grafana-dashboards"; license = licenses.lgpl3Only; diff --git a/pkgs/kaleidoscope-udev-rules/default.nix b/pkgs/kaleidoscope-udev-rules/default.nix index aaeaea9..2ab2118 100644 --- a/pkgs/kaleidoscope-udev-rules/default.nix +++ b/pkgs/kaleidoscope-udev-rules/default.nix @@ -1,10 +1,6 @@ { stdenv, lib, fetchFromGitHub }: let - inherit (lib) - licenses - ; - version = "1.99.3"; in stdenv.mkDerivation { @@ -25,7 +21,7 @@ stdenv.mkDerivation { cp etc/60-kaleidoscope.rules $out/lib/udev/rules.d/ ''; - meta = { + meta = with lib; { description = "udev rules for kaleidoscope firmware keyboards"; homepage = "https://github.com/keyboardio/Kaleidoscope"; license = licenses.gpl3Only; diff --git a/secrets/borg-backup/default.nix b/secrets/borg-backup/default.nix index b611715..11dad25 100644 --- a/secrets/borg-backup/default.nix +++ b/secrets/borg-backup/default.nix @@ -1,10 +1,5 @@ { lib }: -let - inherit (lib) - fileContents - ; -in { - boreal-repo = fileContents ./boreal-repo.secret; - poseidon-repo = fileContents ./poseidon-repo.secret; + boreal-repo = lib.fileContents ./boreal-repo.secret; + poseidon-repo = lib.fileContents ./poseidon-repo.secret; } diff --git a/secrets/default.nix b/secrets/default.nix index 12f8a19..4b7baca 100644 --- a/secrets/default.nix +++ b/secrets/default.nix @@ -1,24 +1,20 @@ { pkgs, lib, config, ... }: -let - inherit (lib) - fileContents - mkOption - ; -in { - options.my.secrets = let inherit (lib) types; in mkOption { +with lib; +{ + options.my.secrets = mkOption { type = types.attrs; }; config.my.secrets = { - matrix-registration-shared-secret = fileContents ./matrix-registration-shared-secret.secret; - shadow-hashed-password-alarsyo = fileContents ./shadow-hashed-password-alarsyo.secret; - shadow-hashed-password-root = fileContents ./shadow-hashed-password-root.secret; - miniflux-admin-credentials = fileContents ./miniflux-admin-credentials.secret; - transmission-password = fileContents ./transmission.secret; + matrix-registration-shared-secret = lib.fileContents ./matrix-registration-shared-secret.secret; + shadow-hashed-password-alarsyo = lib.fileContents ./shadow-hashed-password-alarsyo.secret; + shadow-hashed-password-root = lib.fileContents ./shadow-hashed-password-root.secret; + miniflux-admin-credentials = lib.fileContents ./miniflux-admin-credentials.secret; + transmission-password = lib.fileContents ./transmission.secret; nextcloud-admin-pass = ./nextcloud-admin-pass.secret; - nextcloud-admin-user = fileContents ./nextcloud-admin-user.secret; - lohr-shared-secret = fileContents ./lohr-shared-secret.secret; - gandiKey = fileContents ./gandi-api-key.secret; + nextcloud-admin-user = lib.fileContents ./nextcloud-admin-user.secret; + lohr-shared-secret = lib.fileContents ./lohr-shared-secret.secret; + gandiKey = lib.fileContents ./gandi-api-key.secret; borg-backup = import ./borg-backup { inherit lib; }; paperless = import ./paperless { inherit lib; }; diff --git a/secrets/paperless/default.nix b/secrets/paperless/default.nix index 69c4008..968404d 100644 --- a/secrets/paperless/default.nix +++ b/secrets/paperless/default.nix @@ -1,10 +1,5 @@ { lib }: -let - inherit (lib) - fileContents - ; -in { - secretKey = fileContents ./secret-key-file.secret; - adminPassword = fileContents ./admin-password.secret; + secretKey = lib.fileContents ./secret-key-file.secret; + adminPassword = lib.fileContents ./admin-password.secret; } diff --git a/secrets/restic-backup/default.nix b/secrets/restic-backup/default.nix index e9a3e7a..1d6b630 100644 --- a/secrets/restic-backup/default.nix +++ b/secrets/restic-backup/default.nix @@ -1,9 +1,4 @@ { lib }: -let - inherit (lib) - fileContents - ; -in { - poseidon-repo = fileContents ./poseidon-repo.secret; + poseidon-repo = lib.fileContents ./poseidon-repo.secret; } diff --git a/services/borg-backup.nix b/services/borg-backup.nix index 92b91b0..23300a4 100644 --- a/services/borg-backup.nix +++ b/services/borg-backup.nix @@ -1,14 +1,10 @@ { config, lib, pkgs, ... }: -let - inherit (lib) - mkEnableOption - mkIf - mkOption - ; - cfg = config.my.services.borg-backup; +with lib; + +let cfg = config.my.services.borg-backup; in { - options.my.services.borg-backup = let inherit (lib) types; in { + options.my.services.borg-backup = { enable = mkEnableOption "Enable Borg backups for this host"; repo = mkOption { diff --git a/services/fail2ban.nix b/services/fail2ban.nix index ccc12f2..8f61796 100644 --- a/services/fail2ban.nix +++ b/services/fail2ban.nix @@ -1,11 +1,7 @@ { config, lib, pkgs, ... }: +with lib; let - inherit (lib) - mkEnableOption - mkIf - ; - cfg = config.my.services.fail2ban; in { options.my.services.fail2ban = { diff --git a/services/fava.nix b/services/fava.nix index e283022..de0d2d9 100644 --- a/services/fava.nix +++ b/services/fava.nix @@ -1,20 +1,16 @@ { config, lib, pkgs, ... }: -let - inherit (lib) - mkEnableOption - mkIf - mkOption - ; +with lib; +let cfg = config.my.services.fava; my = config.my; domain = config.networking.domain; secrets = config.my.secrets; in { - options.my.services.fava = let inherit (lib) types; in { - enable = mkEnableOption "Fava"; + options.my.services.fava = { + enable = lib.mkEnableOption "Fava"; home = mkOption { type = types.str; @@ -47,6 +43,7 @@ in User = "fava"; Group = "fava"; }; + path = with pkgs; []; }; users.users.fava = { diff --git a/services/gitea/default.nix b/services/gitea/default.nix index 408d29d..fc6b501 100644 --- a/services/gitea/default.nix +++ b/services/gitea/default.nix @@ -1,18 +1,14 @@ { config, lib, pkgs, ... }: -let - inherit (lib) - mkEnableOption - mkIf - mkOption - ; +with lib; +let cfg = config.my.services.gitea; my = config.my; domain = config.networking.domain; in { - options.my.services.gitea = let inherit (lib) types; in { + options.my.services.gitea = { enable = mkEnableOption "Personal Git hosting with Gitea"; privatePort = mkOption { diff --git a/services/jellyfin.nix b/services/jellyfin.nix index f485d65..8a4df98 100644 --- a/services/jellyfin.nix +++ b/services/jellyfin.nix @@ -1,11 +1,8 @@ { config, lib, pkgs, ... }: -let - inherit (lib) - mkEnableOption - mkIf - ; +with lib; +let cfg = config.my.services.jellyfin; my = config.my; @@ -18,7 +15,7 @@ in { enable = mkEnableOption "Jellyfin"; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { services.jellyfin = { enable = true; group = "media"; diff --git a/services/lohr.nix b/services/lohr.nix index d7442e8..6d760a3 100644 --- a/services/lohr.nix +++ b/services/lohr.nix @@ -1,12 +1,8 @@ { config, lib, pkgs, ... }: -let - inherit (lib) - mkEnableOption - mkIf - mkOption - ; +with lib; +let cfg = config.my.services.lohr; my = config.my; domain = config.networking.domain; @@ -18,8 +14,8 @@ let flake.defaultPackage."x86_64-linux"; # FIXME: use correct system in { - options.my.services.lohr = let inherit (lib) types; in { - enable = mkEnableOption "Lohr Mirroring Daemon"; + options.my.services.lohr = { + enable = lib.mkEnableOption "Lohr Mirroring Daemon"; home = mkOption { type = types.str; @@ -53,7 +49,9 @@ in User = "lohr"; Group = "lohr"; }; - path = [ pkgs.git ]; + path = with pkgs; [ + git + ]; }; users.users.lohr = { diff --git a/services/matrix.nix b/services/matrix.nix index d5780b6..dea5a4c 100644 --- a/services/matrix.nix +++ b/services/matrix.nix @@ -9,13 +9,9 @@ # { config, lib, pkgs, ... }: -let - inherit (lib) - mkEnableOption - mkIf - mkOption - ; +with lib; +let cfg = config.my.services.matrix; my = config.my; @@ -23,10 +19,10 @@ let clientPort = { public = 443; private = 11339; }; domain = config.networking.domain; in { - options.my.services.matrix = let inherit (lib) types; in { - enable = mkEnableOption "Matrix Synapse"; + options.my.services.matrix = { + enable = lib.mkEnableOption "Matrix Synapse"; - registration_shared_secret = mkOption { + registration_shared_secret = lib.mkOption { type = types.str; default = null; example = "deadbeef"; @@ -65,7 +61,7 @@ in { }; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { services.postgresql = { enable = true; }; diff --git a/services/media.nix b/services/media.nix index 175319e..5b6b9ae 100644 --- a/services/media.nix +++ b/services/media.nix @@ -1,17 +1,11 @@ { config, lib, ... }: let - inherit (lib) - mkIf - ; - - mediaServices = builtins.attrValues { - inherit (config.my.services) - jellyfin - transmission - ; - }; + mediaServices = with config.my.services; [ + jellyfin + transmission + ]; needed = builtins.any (service: service.enable) mediaServices; in { - config.users.groups.media = mkIf needed { }; + config.users.groups.media = lib.mkIf needed { }; } diff --git a/services/miniflux.nix b/services/miniflux.nix index 0670711..43e51ca 100644 --- a/services/miniflux.nix +++ b/services/miniflux.nix @@ -1,18 +1,14 @@ { config, lib, pkgs, ... }: -let - inherit (lib) - mkEnableOption - mkIf - mkOption - ; +with lib; +let cfg = config.my.services.miniflux; my = config.my; domain = config.networking.domain; in { - options.my.services.miniflux = let inherit (lib) types; in { + options.my.services.miniflux = { enable = mkEnableOption "Serve a Miniflux instance"; adminCredentialsFile = mkOption { diff --git a/services/monitoring.nix b/services/monitoring.nix index 82e20fd..930743e 100644 --- a/services/monitoring.nix +++ b/services/monitoring.nix @@ -1,16 +1,12 @@ { config, lib, pkgs, ... }: -let - inherit (lib) - mkEnableOption - mkIf - mkOption - ; +with lib; +let cfg = config.my.services.monitoring; domain = config.networking.domain; in { - options.my.services.monitoring = let inherit (lib) types; in { + options.my.services.monitoring = { enable = mkEnableOption "Enable monitoring"; domain = mkOption { diff --git a/services/navidrome.nix b/services/navidrome.nix index bb350ff..b245ed5 100644 --- a/services/navidrome.nix +++ b/services/navidrome.nix @@ -1,17 +1,12 @@ { config, lib, pkgs, ... }: -let - inherit (lib) - mkEnableOption - mkIf - mkOption - optional - ; +with lib; +let cfg = config.my.services.navidrome; domain = config.networking.domain; in { - options.my.services.navidrome = let inherit (lib) types; in { + options.my.services.navidrome = { enable = mkEnableOption "Navidrome"; musicFolder = { path = mkOption { @@ -22,7 +17,7 @@ in { }; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { services.navidrome = { enable = true; settings = { diff --git a/services/nextcloud.nix b/services/nextcloud.nix index 89a6bf5..ec7627a 100644 --- a/services/nextcloud.nix +++ b/services/nextcloud.nix @@ -3,11 +3,6 @@ # TODO: setup prometheus exporter let - inherit (lib) - mkEnableOption - mkIf - ; - cfg = config.my.services.nextcloud; my = config.my; domain = config.networking.domain; @@ -15,10 +10,10 @@ let in { options.my.services.nextcloud = { - enable = mkEnableOption "NextCloud"; + enable = lib.mkEnableOption "NextCloud"; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { services.postgresql = { enable = true; @@ -78,7 +73,7 @@ in my.services.restic-backup = let nextcloudHome = config.services.nextcloud.home; - in mkIf cfg.enable { + in lib.mkIf cfg.enable { paths = [ nextcloudHome ]; exclude = [ # borg can fail if *.part files disappear during backup diff --git a/services/nginx.nix b/services/nginx.nix index c765643..cfb7da1 100644 --- a/services/nginx.nix +++ b/services/nginx.nix @@ -2,15 +2,10 @@ # # https://github.com/delroth/infra.delroth.net { config, lib, pkgs, ... }: -let - inherit (lib) - mkIf - ; -in { # Whenever something defines an nginx vhost, ensure that nginx defaults are # properly set. - config = mkIf ((builtins.attrNames config.services.nginx.virtualHosts) != [ "localhost" ]) { + config = lib.mkIf ((builtins.attrNames config.services.nginx.virtualHosts) != [ "localhost" ]) { services.nginx = { enable = true; statusPage = true; # For monitoring scraping. diff --git a/services/nuage.nix b/services/nuage.nix index 4c2e65a..42aa36f 100644 --- a/services/nuage.nix +++ b/services/nuage.nix @@ -1,17 +1,14 @@ { config, lib, ... }: -let - inherit (lib) - mkEnableOption - mkIf - ; +with lib; +let cfg = config.my.services.nuage; my = config.my; in { options.my.services.nuage = { - enable = mkEnableOption "Nuage redirect"; + enable = lib.mkEnableOption "Nuage redirect"; }; config = mkIf cfg.enable { diff --git a/services/paperless.nix b/services/paperless.nix index 142ee13..b56450d 100644 --- a/services/paperless.nix +++ b/services/paperless.nix @@ -1,12 +1,8 @@ { config, lib, pkgs, ... }: -let - inherit (lib) - mkEnableOption - mkIf - mkOption - ; +with lib; +let cfg = config.my.services.paperless; my = config.my; domain = config.networking.domain; @@ -14,8 +10,8 @@ let secretKeyFile = pkgs.writeText "paperless-secret-key-file.env" my.secrets.paperless.secretKey; in { - options.my.services.paperless = let inherit (lib) types; in { - enable = mkEnableOption "Paperless"; + options.my.services.paperless = { + enable = lib.mkEnableOption "Paperless"; port = mkOption { type = types.port; diff --git a/services/pipewire.nix b/services/pipewire.nix index 7f9a162..e48ec2c 100644 --- a/services/pipewire.nix +++ b/services/pipewire.nix @@ -1,18 +1,14 @@ { config, lib, pkgs, options, ... }: -let - inherit (lib) - mkEnableOption - mkIf - optionalAttrs - ; +with lib; +let cfg = config.my.services.pipewire; my = config.my; in { options.my.services.pipewire = { - enable = mkEnableOption "Pipewire sound backend"; + enable = lib.mkEnableOption "Pipewire sound backend"; }; # HACK: services.pipewire.alsa doesn't exist on 20.09, avoid evaluating this @@ -73,6 +69,6 @@ in # FIXME: a shame pactl isn't available by itself, eventually this should be # replaced by pw-cli or a wrapper, I guess? - environment.systemPackages = [ pkgs.pulseaudio ]; + environment.systemPackages = with pkgs; [ pulseaudio ]; }); } diff --git a/services/postgresql-backup.nix b/services/postgresql-backup.nix index c3642b7..94a60ef 100644 --- a/services/postgresql-backup.nix +++ b/services/postgresql-backup.nix @@ -1,11 +1,8 @@ { config, lib, pkgs, ... }: -let - inherit (lib) - mkEnableOption - mkIf - ; +with lib; +let cfg = config.my.services.postgresql-backup; in { options.my.services.postgresql-backup = { diff --git a/services/restic-backup.nix b/services/restic-backup.nix index a4ee271..e83fdbc 100644 --- a/services/restic-backup.nix +++ b/services/restic-backup.nix @@ -1,22 +1,16 @@ { config, lib, pkgs, ... }: -let - inherit (lib) - attrsets - concatStringsSep - mkEnableOption - mkIf - mkOption - optional - ; +with lib; +let cfg = config.my.services.restic-backup; secrets = config.my.secrets; - excludeArg = "--exclude-file=" + (pkgs.writeText "excludes.txt" (concatStringsSep "\n" cfg.exclude)); + excludeArg = with builtins; with pkgs; + "--exclude-file=" + (writeText "excludes.txt" (concatStringsSep "\n" cfg.exclude)); makePruneOpts = pruneOpts: attrsets.mapAttrsToList (name: value: "--keep-${name} ${toString value}") pruneOpts; in { - options.my.services.restic-backup = let inherit (lib) types; in { + options.my.services.restic-backup = { enable = mkEnableOption "Enable Restic backups for this host"; repo = mkOption { @@ -28,7 +22,7 @@ in { }; paths = mkOption { - type = types.listOf types.str; + type = with types; listOf str; default = [ ]; example = [ "/var/lib" @@ -38,7 +32,7 @@ in { }; exclude = mkOption { - type = types.listOf types.str; + type = with types; listOf str; default = [ ]; example = [ # very large paths @@ -77,7 +71,7 @@ in { environmentFile = "/root/restic/creds"; extraBackupArgs = [ "--verbose=2" ] - ++ optional (builtins.length cfg.exclude != 0) excludeArg; + ++ optional (builtins.length cfg.exclude != 0) excludeArg; timerConfig = { OnCalendar = "daily"; diff --git a/services/tailscale.nix b/services/tailscale.nix index 4da1d6b..d97af62 100644 --- a/services/tailscale.nix +++ b/services/tailscale.nix @@ -1,19 +1,16 @@ { config, lib, pkgs, ... }: -let - inherit (lib) - mkEnableOption - mkIf - ; +with lib; +let cfg = config.my.services.tailscale; in { options.my.services.tailscale = { - enable = mkEnableOption "Tailscale"; + enable = lib.mkEnableOption "Tailscale"; # NOTE: still have to do `tailscale up --advertise-exit-node` - exitNode = mkEnableOption "Use as exit node"; + exitNode = lib.mkEnableOption "Use as exit node"; }; config = mkIf cfg.enable { diff --git a/services/tgv.nix b/services/tgv.nix index 295a672..eb6107e 100644 --- a/services/tgv.nix +++ b/services/tgv.nix @@ -1,17 +1,14 @@ { config, lib, ... }: -let - inherit (lib) - mkEnableOption - mkIf - ; +with lib; +let cfg = config.my.services.tgv; my = config.my; in { options.my.services.tgv = { - enable = mkEnableOption "TGV redirect"; + enable = lib.mkEnableOption "TGV redirect"; }; config = mkIf cfg.enable { diff --git a/services/transmission.nix b/services/transmission.nix index 5c6826b..b55e0b8 100644 --- a/services/transmission.nix +++ b/services/transmission.nix @@ -1,11 +1,5 @@ { config, lib, ... }: let - inherit (lib) - mkEnableOption - mkIf - mkOption - ; - cfg = config.my.services.transmission; domain = config.networking.domain; @@ -17,7 +11,7 @@ let downloadBase = "/media/torrents/"; in { - options.my.services.transmission = let inherit (lib) types; in { + options.my.services.transmission = with lib; { enable = mkEnableOption "Transmission torrent client"; username = mkOption { @@ -34,7 +28,7 @@ in }; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { services.transmission = { enable = true; group = "media"; diff --git a/services/vaultwarden.nix b/services/vaultwarden.nix index 505678c..751f51d 100644 --- a/services/vaultwarden.nix +++ b/services/vaultwarden.nix @@ -1,18 +1,14 @@ { config, lib, pkgs, ... }: -let - inherit (lib) - mkEnableOption - mkIf - mkOption - ; +with lib; +let cfg = config.my.services.vaultwarden; my = config.my; domain = config.networking.domain; in { - options.my.services.vaultwarden = let inherit (lib) types; in { + options.my.services.vaultwarden = { enable = mkEnableOption "Vaultwarden"; privatePort = mkOption {