From 8637b0818211b30039325d4ecbec572403fdba05 Mon Sep 17 00:00:00 2001 From: Erwin Boskma Date: Sat, 19 Nov 2022 20:00:54 +0100 Subject: [PATCH] Add pre-commit hooks and fix style issues --- .gitignore | 1 + flake.lock | 85 +++++++------------ flake.nix | 35 ++++++-- home-manager/modules/bat/default.nix | 3 +- home-manager/modules/dropbox/default.nix | 1 - home-manager/modules/electron/default.nix | 3 +- home-manager/modules/emacs/default.nix | 9 -- home-manager/modules/foot/default.nix | 6 +- home-manager/modules/hyprland/default.nix | 2 +- home-manager/modules/i3/powermenu.sh | 56 ++++++------ home-manager/modules/mpd/default.nix | 2 +- home-manager/modules/picom/default.nix | 3 +- home-manager/modules/polybar/default.nix | 2 +- .../modules/polybar/scripts/polybar-playerctl | 38 +++++---- home-manager/modules/ssh/default.nix | 7 +- home-manager/modules/sway/powermenu.sh | 64 +++++++------- home-manager/modules/vscode/default.nix | 1 - home-manager/modules/wallpapers/default.nix | 2 +- home-manager/modules/waybar/default.nix | 8 -- home-manager/modules/xbanish/default.nix | 2 +- home-manager/modules/zathura/default.nix | 3 +- home-manager/modules/zellij/default.nix | 4 +- krops.nix | 2 +- machines/default.nix | 20 ++--- machines/drone/hardware-configuration.nix | 5 +- machines/eitri/configuration.nix | 2 +- machines/gitea/hardware-configuration.nix | 7 +- machines/heimdall/hardware-configuration.nix | 7 +- machines/loki/configuration.nix | 10 ++- machines/loki/hardware-configuration.nix | 2 - machines/mimir/configuration.nix | 2 +- machines/mimir/hardware-configuration.nix | 2 +- machines/proxy/hardware-configuration.nix | 5 +- machines/vm1/configuration.nix | 2 +- machines/vm1/hardware-configuration.nix | 5 +- machines/vm2/configuration.nix | 2 +- machines/vm2/hardware-configuration.nix | 10 +-- modules/base/blink1-udev/default.nix | 4 - modules/bluetooth/default.nix | 3 +- modules/desktop/default.nix | 2 - modules/drone/default.nix | 6 +- modules/greetd/default.nix | 11 +-- modules/lightdm/default.nix | 2 +- modules/livebook/default.nix | 3 +- modules/nginx-proxy-manager/default.nix | 3 +- modules/nix-serve/default.nix | 2 +- modules/options/default.nix | 21 ++--- modules/systemd/default.nix | 3 +- modules/tablet/default.nix | 2 +- overlays/default.nix | 2 +- pkgs/bl3auto/default.nix | 2 +- statix.toml | 2 +- users/builder/default.nix | 2 +- users/erwin/default.nix | 14 ++- users/erwin/home.nix | 21 +---- users/erwin/work.nix | 6 +- 56 files changed, 229 insertions(+), 302 deletions(-) diff --git a/.gitignore b/.gitignore index 9421db7..f54b070 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /result /secrets.nix /.direnv +/.pre-commit-config.yaml \ No newline at end of file diff --git a/flake.lock b/flake.lock index 6b09e62..fa853ec 100644 --- a/flake.lock +++ b/flake.lock @@ -38,31 +38,20 @@ "type": "github" } }, - "flake-utils_2": { - "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "ha-now-playing": { "inputs": { - "flake-utils": "flake-utils_2", + "flake-utils": [ + "flake-utils" + ], "naersk": [ "naersk" ], "nixpkgs": [ "nixpkgs" ], - "pre-commit-hooks": "pre-commit-hooks", + "pre-commit-hooks": [ + "pre-commit-hooks" + ], "rust-overlay": [ "rust-overlay" ] @@ -111,11 +100,11 @@ "wlroots": "wlroots" }, "locked": { - "lastModified": 1668863695, - "narHash": "sha256-PFNI4C5W5GjTwwnewSbTTSg7NTrBYcwBFR8RgxJb0t4=", + "lastModified": 1668879337, + "narHash": "sha256-Lm9054CdFfOvHTLTtktSuOFri3k5wuEXb2LDDg44tb8=", "owner": "Hyprwm", "repo": "Hyprland", - "rev": "0ffaa8d6673c02e9360865c8cde69a606c036af7", + "rev": "5530cf6e7939365ef6197a50c59bed20a64e3e11", "type": "github" }, "original": { @@ -167,11 +156,11 @@ ] }, "locked": { - "lastModified": 1668790324, - "narHash": "sha256-WPPvwnzY+RLqBC7TESfRbvfnKN4v5Sjz3MY7BD7nm3E=", + "lastModified": 1668876315, + "narHash": "sha256-7zGrnFju+sDuH5xkiyQomR1UROtmLI+UvR2zJG4vEi0=", "owner": "nix-community", "repo": "nixos-generators", - "rev": "02e332e8d01c5901dafaef15555384add24630cd", + "rev": "87f6494e9daedaa583eb2b61d25e6d925193fb57", "type": "github" }, "original": { @@ -197,16 +186,18 @@ }, "nixpkgs": { "locked": { - "lastModified": 1667292599, - "narHash": "sha256-7ISOUI1aj6UKMPIL+wwthENL22L3+A9V+jS8Is3QsRo=", - "owner": "NixOS", + "lastModified": 1668765800, + "narHash": "sha256-rC40+/W6Hio7b/RsY8SvQPKNx4WqNcTgfYv8cUMAvJk=", + "owner": "nixos", "repo": "nixpkgs", - "rev": "ef2f213d9659a274985778bff4ca322f3ef3ac68", + "rev": "52b2ac8ae18bbad4374ff0dd5aeee0fdf1aea739", "type": "github" }, "original": { - "id": "nixpkgs", - "type": "indirect" + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" } }, "nixpkgs-22_05": { @@ -225,22 +216,6 @@ "type": "github" } }, - "nixpkgs_2": { - "locked": { - "lastModified": 1668765800, - "narHash": "sha256-rC40+/W6Hio7b/RsY8SvQPKNx4WqNcTgfYv8cUMAvJk=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "52b2ac8ae18bbad4374ff0dd5aeee0fdf1aea739", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "pamedia": { "inputs": { "naersk": [ @@ -271,17 +246,18 @@ "pre-commit-hooks": { "inputs": { "flake-utils": [ - "ha-now-playing", "flake-utils" ], - "nixpkgs": "nixpkgs" + "nixpkgs": [ + "nixpkgs" + ] }, "locked": { - "lastModified": 1667992213, - "narHash": "sha256-8Ens8ozllvlaFMCZBxg6S7oUyynYx2v7yleC5M0jJsE=", + "lastModified": 1668880995, + "narHash": "sha256-1pohNJx6MIVeYpXmsugZG3fUKPSIKpQouttWFVfqsNU=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "ebcbfe09d2bd6d15f68de3a0ebb1e4dcb5cd324b", + "rev": "364568e63556045ea9d08d29fafa46febbdb015b", "type": "github" }, "original": { @@ -300,8 +276,9 @@ "naersk": "naersk", "nixos-generators": "nixos-generators", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs", "pamedia": "pamedia", + "pre-commit-hooks": "pre-commit-hooks", "rust-overlay": "rust-overlay", "sops": "sops", "sunshine": "sunshine" @@ -394,11 +371,11 @@ "flake": false, "locked": { "host": "gitlab.freedesktop.org", - "lastModified": 1668292512, - "narHash": "sha256-lCMnIguyZgAGq7W2IwIVPoQS8fAfZ/XFwz/1TQ53eI8=", + "lastModified": 1668785720, + "narHash": "sha256-CX+PYJP2PxZWL380WzyMNsrfRgIb/78brdwvDg/zj28=", "owner": "wlroots", "repo": "wlroots", - "rev": "627a5c511278e67c3c308cdc6a639cbb490f48c3", + "rev": "4ff46e6cf9463e594605928feeb7c55cf323b5e7", "type": "gitlab" }, "original": { diff --git a/flake.nix b/flake.nix index d55c07a..4070a00 100644 --- a/flake.nix +++ b/flake.nix @@ -13,6 +13,12 @@ nixos-hardware.url = "github:NixOS/nixos-hardware"; + pre-commit-hooks = { + url = "github:cachix/pre-commit-hooks.nix"; + inputs.flake-utils.follows = "flake-utils"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nixos-generators = { url = "github:nix-community/nixos-generators"; inputs.nixpkgs.follows = "nixpkgs"; @@ -48,9 +54,10 @@ ha-now-playing = { url = "git+https://git.datarift.nl/erwin/ha-now-playing.git?ref=main"; inputs.nixpkgs.follows = "nixpkgs"; - inputs.utils.follows = "flake-utils"; + inputs.flake-utils.follows = "flake-utils"; inputs.naersk.follows = "naersk"; inputs.rust-overlay.follows = "rust-overlay"; + inputs.pre-commit-hooks.follows = "pre-commit-hooks"; }; pamedia = { @@ -69,7 +76,6 @@ outputs = { self - , nixos-hardware , sops , ha-now-playing , pamedia @@ -94,8 +100,9 @@ self.overlays.default ha-now-playing.overlays.${system} pamedia.overlays.${system} + inputs.emacs-overlay.overlay ] ++ nixpkgs.lib.optional (system == "aarch64-linux") - (final: super: { + (_final: super: { makeModulesClosure = x: super.makeModulesClosure (x // { allowMissing = true; }); }); @@ -140,11 +147,11 @@ nixosConfigurations = builtins.listToAttrs (map (machine: { name = machine; - value = (defSystem (machines.${machine}.system or "x86_64-linux") { + value = defSystem (machines.${machine}.system or "x86_64-linux") { imports = [ machines.${machine}.config ]; - }); + }; }) (builtins.attrNames machines)); } @@ -180,8 +187,26 @@ backscrub = flake-utils.lib.mkApp { drv = packages.backscrub; }; }; + checks = { + pre-commit-check = pre-commit-hooks.lib.${system}.run { + src = ./.; + hooks = { + nixpkgs-fmt.enable = true; + deadnix.enable = true; + statix.enable = true; + black.enable = true; + shellcheck = { + enable = true; + types_or = [ "executable" ]; + }; + shfmt.enable = true; + }; + }; + }; + devShells.default = with pkgs; mkShell { + inherit (self.checks.${system}.pre-commit-check) shellHook; name = "dotfiles"; nativeBuildInputs = [ pkgs.sops diff --git a/home-manager/modules/bat/default.nix b/home-manager/modules/bat/default.nix index 713afd3..f4c43a2 100644 --- a/home-manager/modules/bat/default.nix +++ b/home-manager/modules/bat/default.nix @@ -1,5 +1,4 @@ -{ pkgs -, config +{ config , lib , ... }: diff --git a/home-manager/modules/dropbox/default.nix b/home-manager/modules/dropbox/default.nix index 0cccf9d..c68b32d 100644 --- a/home-manager/modules/dropbox/default.nix +++ b/home-manager/modules/dropbox/default.nix @@ -1,5 +1,4 @@ { lib -, pkgs , config , ... }: diff --git a/home-manager/modules/electron/default.nix b/home-manager/modules/electron/default.nix index fa0d023..d2c4c73 100644 --- a/home-manager/modules/electron/default.nix +++ b/home-manager/modules/electron/default.nix @@ -1,5 +1,4 @@ -{ pkgs -, config +{ config , lib , ... }: diff --git a/home-manager/modules/emacs/default.nix b/home-manager/modules/emacs/default.nix index 61a9dba..f7fd60a 100644 --- a/home-manager/modules/emacs/default.nix +++ b/home-manager/modules/emacs/default.nix @@ -18,15 +18,6 @@ with lib; let mimeTypes = [ "x-scheme-handler/org-protocol" ]; startupWMClass = "Emacs"; }; - - valeToINI = generators.toINIWithGlobalSection { - mkKeyValue = generators.mkKeyValueDefault - { - mkValueString = v: - if builtins.isList v then builtins.concatStringsSep ", " v - else generators.mkValueStringDefault { } v; - } " = "; - }; in { options.eboskma.programs.emacs = { diff --git a/home-manager/modules/foot/default.nix b/home-manager/modules/foot/default.nix index 765b82b..9ecac67 100644 --- a/home-manager/modules/foot/default.nix +++ b/home-manager/modules/foot/default.nix @@ -1,8 +1,4 @@ -{ lib -, pkgs -, config -, ... -}: +{ lib, config, ... }: with lib; let cfg = config.eboskma.programs.foot; in diff --git a/home-manager/modules/hyprland/default.nix b/home-manager/modules/hyprland/default.nix index 08f3e36..a05d120 100644 --- a/home-manager/modules/hyprland/default.nix +++ b/home-manager/modules/hyprland/default.nix @@ -20,7 +20,7 @@ in { options.eboskma.programs.hyprland = { enable = mkEnableOption "Hyprland"; }; - config = mkIf (cfg.enable) { + config = mkIf cfg.enable { wayland.windowManager.hyprland = { enable = true; diff --git a/home-manager/modules/i3/powermenu.sh b/home-manager/modules/i3/powermenu.sh index 306a80e..9299d4e 100755 --- a/home-manager/modules/i3/powermenu.sh +++ b/home-manager/modules/i3/powermenu.sh @@ -1,11 +1,11 @@ -#!/bin/bash +# shellcheck disable=SC2148 confirm() { - rofi -dmenu \ - -i \ - -no-fixed-num-lines \ - -p "Are you sure? [y/n]: " \ - -theme power + rofi -dmenu \ + -i \ + -no-fixed-num-lines \ + -p "Are you sure? [y/n]: " \ + -theme power } # Options @@ -22,33 +22,33 @@ lockcmd="i3lock --ignore-empty-password --show-failed-attempts --clock --color=3 chosen="$(echo -e "${options}" | rofi -theme power -p "Uptime: ${uptime}" -dmenu -selected-row 2)" -if [[ "${chosen}" == "" ]]; then - exit 0 +if [[ ${chosen} == "" ]]; then + exit 0 fi -if [[ "${chosen}" == "${lock}" ]]; then - ${lockcmd} - exit 0 +if [[ ${chosen} == "${lock}" ]]; then + ${lockcmd} + exit 0 fi answer=$(confirm) -if [[ "${answer}" == "y" ]]; then - case "${chosen}" in - "${shutdown}") - systemctl poweroff - ;; - "${reboot}") - systemctl reboot - ;; - "${hibernate}") - ${lockcmd} - systemctl hibernate - ;; - "${exit_wm}") - i3-msg exit - ;; - *) ;; +if [[ ${answer} == "y" ]]; then + case "${chosen}" in + "${shutdown}") + systemctl poweroff + ;; + "${reboot}") + systemctl reboot + ;; + "${hibernate}") + ${lockcmd} + systemctl hibernate + ;; + "${exit_wm}") + i3-msg exit + ;; + *) ;; - esac + esac fi diff --git a/home-manager/modules/mpd/default.nix b/home-manager/modules/mpd/default.nix index 0fbc3a5..0530fd5 100644 --- a/home-manager/modules/mpd/default.nix +++ b/home-manager/modules/mpd/default.nix @@ -9,7 +9,7 @@ in { options.eboskma.programs.mpd = { enable = mkEnableOption "mpd"; }; - config = mkIf (cfg.enable) { + config = mkIf cfg.enable { services.mpd = { enable = true; network = { diff --git a/home-manager/modules/picom/default.nix b/home-manager/modules/picom/default.nix index 63d12ef..7c1152d 100644 --- a/home-manager/modules/picom/default.nix +++ b/home-manager/modules/picom/default.nix @@ -1,7 +1,6 @@ { pkgs , config , lib -, inputs , ... }: with lib; let @@ -13,7 +12,7 @@ in { options.eboskma.programs.picom = { enable = mkEnableOption "activate picom"; }; - config = mkIf (cfg.enable) { + config = mkIf cfg.enable { # home.packages = [pkgs.nixgl.auto.nixGLDefault]; services.picom = { diff --git a/home-manager/modules/polybar/default.nix b/home-manager/modules/polybar/default.nix index 1de2364..3d0e66f 100644 --- a/home-manager/modules/polybar/default.nix +++ b/home-manager/modules/polybar/default.nix @@ -65,7 +65,7 @@ in { options.eboskma.programs.polybar = { enable = mkEnableOption "activate polybar"; }; - config = mkIf (cfg.enable) { + config = mkIf cfg.enable { # systemd.user.services.polybar = { # Install = { WantedBy = [ "graphical-session.target" ]; }; # }; diff --git a/home-manager/modules/polybar/scripts/polybar-playerctl b/home-manager/modules/polybar/scripts/polybar-playerctl index a6eef26..ede1f6a 100755 --- a/home-manager/modules/polybar/scripts/polybar-playerctl +++ b/home-manager/modules/polybar/scripts/polybar-playerctl @@ -6,27 +6,29 @@ import gi from gi.repository import GLib # Check Playerctl version -gi.require_version('Playerctl', '2.0') +gi.require_version("Playerctl", "2.0") from gi.repository import Playerctl def player_status_str(status): if status == Playerctl.PlaybackStatus.PLAYING: - return 'Playing' + return "Playing" elif status == Playerctl.PlaybackStatus.PAUSED: - return 'Paused' + return "Paused" elif status == Playerctl.PlaybackStatus.STOPPED: - return 'Stopped' + return "Stopped" else: - return 'Unknown' + return "Unknown" + def now_playing_str(artist, title): if artist == None and title == None: - return 'No music information' + return "No music information" elif artist == None: return title else: - return f'{artist} - {title}' + return f"{artist} - {title}" + players = Playerctl.list_players() @@ -34,12 +36,12 @@ if len(players) == 0: print("No players found") exit(0) -homedir = os.environ['HOME'] -player_file = f'{homedir}/.playerctl_player' -current_player_name = '' +homedir = os.environ["HOME"] +player_file = f"{homedir}/.playerctl_player" +current_player_name = "" if os.path.isfile(player_file): - with open(player_file, mode='r') as file: + with open(player_file, mode="r") as file: current_player_name = file.read() player_found = False @@ -61,24 +63,24 @@ if len(sys.argv) == 1: if player.props.playback_status == Playerctl.PlaybackStatus.PLAYING: out += now_playing_str(player.get_artist(), player.get_title()) else: - out += player_status_str(player.get_property('playback_status')) + out += player_status_str(player.get_property("playback_status")) print(out) -elif sys.argv[1] == 'next-player': +elif sys.argv[1] == "next-player": player_changed = True player_index += 1 if player_index == len(players): player_index = 0 player = Playerctl.Player.new_from_name(players[player_index]) -elif sys.argv[1] == 'play-pause': +elif sys.argv[1] == "play-pause": player.play_pause() -elif sys.argv[1] == 'next': +elif sys.argv[1] == "next": player.next() -elif sys.argv[1] == 'previous': +elif sys.argv[1] == "previous": player.previous() if player_changed or not player_found: - with open(player_file, mode='w') as file: - file.write(player.get_property('player-instance')) + with open(player_file, mode="w") as file: + file.write(player.get_property("player-instance")) file.flush() diff --git a/home-manager/modules/ssh/default.nix b/home-manager/modules/ssh/default.nix index 1de120f..8f6409e 100644 --- a/home-manager/modules/ssh/default.nix +++ b/home-manager/modules/ssh/default.nix @@ -1,5 +1,4 @@ -{ pkgs -, config +{ config , lib , ... }: @@ -18,7 +17,7 @@ in hashKnownHosts = true; matchBlocks = { "*" = { - identityFile = (if var.workSystem then horusKey else personalKey); + identityFile = if var.workSystem then horusKey else personalKey; identitiesOnly = true; extraOptions = { Ciphers = "chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr"; @@ -63,7 +62,7 @@ in }; "git.datarift.nl" = { - hostname = (if var.workSystem then "direct.datarift.nl" else "10.0.0.201"); + hostname = if var.workSystem then "direct.datarift.nl" else "10.0.0.201"; }; fluiddpi = mkIf (!var.workSystem) { diff --git a/home-manager/modules/sway/powermenu.sh b/home-manager/modules/sway/powermenu.sh index 4c858a1..dbf6439 100755 --- a/home-manager/modules/sway/powermenu.sh +++ b/home-manager/modules/sway/powermenu.sh @@ -1,9 +1,11 @@ +# shellcheck disable=SC2148 + confirm() { - rofi -dmenu \ - -i \ - -no-fixed-num-lines \ - -p "Are you sure? [y/n]: " \ - -theme power + rofi -dmenu \ + -i \ + -no-fixed-num-lines \ + -p "Are you sure? [y/n]: " \ + -theme power } # Options @@ -25,37 +27,37 @@ lockcmd="swaylock --ignore-empty-password --daemonize --show-failed-attempts --i chosen="$(echo -e "${options}" | rofi -theme power -p "Uptime: ${uptime}" -dmenu -selected-row 2)" -if [[ "${chosen}" == "" ]]; then - exit 0 +if [[ ${chosen} == "" ]]; then + exit 0 fi -if [[ "${chosen}" == "${lock}" ]]; then - ${lockcmd} - exit 0 +if [[ ${chosen} == "${lock}" ]]; then + ${lockcmd} + exit 0 fi answer=$(confirm) -if [[ "${answer}" == "y" ]]; then - case "${chosen}" in - "${shutdown}") - systemctl poweroff - ;; - "${reboot}") - systemctl reboot - ;; - "${hibernate}") - ${lockcmd} - systemctl hibernate - ;; - "${exit_wm}") - if [[ ${XDG_CURRENT_DESKTOP} = "sway" ]]; then - swaymsg exit - elif [[ ${XDG_CURRENT_DESKTOP} = "Hyprland" ]]; then - hyprctl dispatch exit - fi - ;; - *) ;; +if [[ ${answer} == "y" ]]; then + case "${chosen}" in + "${shutdown}") + systemctl poweroff + ;; + "${reboot}") + systemctl reboot + ;; + "${hibernate}") + ${lockcmd} + systemctl hibernate + ;; + "${exit_wm}") + if [[ ${XDG_CURRENT_DESKTOP} == "sway" ]]; then + swaymsg exit + elif [[ ${XDG_CURRENT_DESKTOP} == "Hyprland" ]]; then + hyprctl dispatch exit + fi + ;; + *) ;; - esac + esac fi diff --git a/home-manager/modules/vscode/default.nix b/home-manager/modules/vscode/default.nix index 0b57937..fd2c268 100644 --- a/home-manager/modules/vscode/default.nix +++ b/home-manager/modules/vscode/default.nix @@ -1,7 +1,6 @@ { lib , pkgs , config -, flake-inputs , ... }: with lib; let diff --git a/home-manager/modules/wallpapers/default.nix b/home-manager/modules/wallpapers/default.nix index 7e878a5..fdb1b6d 100644 --- a/home-manager/modules/wallpapers/default.nix +++ b/home-manager/modules/wallpapers/default.nix @@ -20,7 +20,7 @@ in enable = mkEnableOption "wallpapers"; backgroundColor = mkOption { description = "Hex value of the background color"; - type = (types.strMatching "#[[:xdigit:]]{6}"); + type = types.strMatching "#[[:xdigit:]]{6}"; default = "#000000"; example = "#ff0000"; }; diff --git a/home-manager/modules/waybar/default.nix b/home-manager/modules/waybar/default.nix index ff50bba..ac1bba7 100644 --- a/home-manager/modules/waybar/default.nix +++ b/home-manager/modules/waybar/default.nix @@ -5,14 +5,6 @@ }: with lib; let cfg = config.eboskma.programs.waybar; - - wb-dunst = pkgs.writeShellScriptBin "wb-dunst" '' - COUNT=$(${pkgs.dunst}/bin/dunstctl count waiting) - ENABLED=" " - DISABLED=" " - if [[ ''${COUNT} != 0 ]]; then DISABLED=" ''${COUNT}"; fi - if ${pkgs.dunst}/bin/dunstctl is-paused | grep -q "false" ; then ${pkgs.coreutils}/bin/echo "''${ENABLED}"; else ${pkgs.coreutils}/bin/echo "''${DISABLED}"; fi - ''; in { options.eboskma.programs.waybar.enable = mkEnableOption "Enable waybar"; diff --git a/home-manager/modules/xbanish/default.nix b/home-manager/modules/xbanish/default.nix index 5d2ffd7..4600ef8 100644 --- a/home-manager/modules/xbanish/default.nix +++ b/home-manager/modules/xbanish/default.nix @@ -15,7 +15,7 @@ in }; }; - config = mkIf (cfg.enable) { + config = mkIf cfg.enable { systemd.user.services.xbanish = { Unit = { Description = "xbanish hides the mouse pointer when typing"; diff --git a/home-manager/modules/zathura/default.nix b/home-manager/modules/zathura/default.nix index cc42466..7363efe 100644 --- a/home-manager/modules/zathura/default.nix +++ b/home-manager/modules/zathura/default.nix @@ -1,5 +1,4 @@ -{ pkgs -, config +{ config , lib , ... }: diff --git a/home-manager/modules/zellij/default.nix b/home-manager/modules/zellij/default.nix index 264065c..03cacc2 100644 --- a/home-manager/modules/zellij/default.nix +++ b/home-manager/modules/zellij/default.nix @@ -1,4 +1,4 @@ -{ pkgs, config, lib, ... }: +{ config, lib, ... }: with lib; let cfg = config.eboskma.programs.zellij; @@ -13,7 +13,7 @@ in }; }; - config = mkIf (cfg.enable) { + config = mkIf cfg.enable { programs.zellij = { enable = true; settings = { diff --git a/krops.nix b/krops.nix index c41bef9..5b02dfc 100644 --- a/krops.nix +++ b/krops.nix @@ -5,7 +5,7 @@ let lib = import "${krops}/lib"; pkgs = import "${krops}/pkgs" { }; - source = name: + source = _name: lib.evalSource [ { machine-config.file = toString ./.; diff --git a/machines/default.nix b/machines/default.nix index 7702fec..bc63bd3 100644 --- a/machines/default.nix +++ b/machines/default.nix @@ -1,30 +1,30 @@ -{ ... }@inputs: { +inputs: { drone = { - config = (import ./drone/configuration.nix inputs); + config = import ./drone/configuration.nix inputs; }; eitri = { system = "aarch64-linux"; - config = (import ./eitri/configuration.nix inputs); + config = import ./eitri/configuration.nix inputs; }; gitea = { - config = (import ./gitea/configuration.nix inputs); + config = import ./gitea/configuration.nix inputs; }; heimdall = { - config = (import ./heimdall/configuration.nix inputs); + config = import ./heimdall/configuration.nix inputs; }; loki = { - config = (import ./loki/configuration.nix inputs); + config = import ./loki/configuration.nix inputs; }; mimir = { - config = (import ./mimir/configuration.nix inputs); + config = import ./mimir/configuration.nix inputs; }; proxy = { - config = (import ./proxy/configuration.nix inputs); + config = import ./proxy/configuration.nix inputs; }; vm1 = { - config = (import ./vm1/configuration.nix inputs); + config = import ./vm1/configuration.nix inputs; }; vm2 = { - config = (import ./vm2/configuration.nix inputs); + config = import ./vm2/configuration.nix inputs; }; } diff --git a/machines/drone/hardware-configuration.nix b/machines/drone/hardware-configuration.nix index 356ff26..c2c38a9 100644 --- a/machines/drone/hardware-configuration.nix +++ b/machines/drone/hardware-configuration.nix @@ -1,7 +1,4 @@ -{ config -, lib -, pkgs -, modulesPath +{ modulesPath , ... }: { imports = [ diff --git a/machines/eitri/configuration.nix b/machines/eitri/configuration.nix index 74b485f..cc1d308 100644 --- a/machines/eitri/configuration.nix +++ b/machines/eitri/configuration.nix @@ -1,4 +1,4 @@ -{ self, nixpkgs, nixos-hardware, ... }: +{ nixpkgs, nixos-hardware, ... }: let pkgs = import nixpkgs { system = "aarch64-linux"; diff --git a/machines/gitea/hardware-configuration.nix b/machines/gitea/hardware-configuration.nix index 356ff26..c5c8602 100644 --- a/machines/gitea/hardware-configuration.nix +++ b/machines/gitea/hardware-configuration.nix @@ -1,9 +1,4 @@ -{ config -, lib -, pkgs -, modulesPath -, ... -}: { +{ modulesPath, ... }: { imports = [ (modulesPath + "/virtualisation/lxc-container.nix") ]; diff --git a/machines/heimdall/hardware-configuration.nix b/machines/heimdall/hardware-configuration.nix index 0a2e91d..5437eb4 100644 --- a/machines/heimdall/hardware-configuration.nix +++ b/machines/heimdall/hardware-configuration.nix @@ -1,9 +1,4 @@ -{ config -, lib -, pkgs -, modulesPath -, ... -}: { +{ modulesPath, ... }: { imports = [ (modulesPath + "/virtualisation/proxmox-image.nix") ]; diff --git a/machines/loki/configuration.nix b/machines/loki/configuration.nix index 7a8850f..e2dcb26 100644 --- a/machines/loki/configuration.nix +++ b/machines/loki/configuration.nix @@ -1,5 +1,5 @@ -{ self, nixpkgs, nixos-hardware, hyprland, ... }: -{ pkgs, config, ... }: +{ nixos-hardware, ... }: +{ pkgs, ... }: { imports = [ nixos-hardware.nixosModules.common-cpu-amd @@ -44,7 +44,11 @@ element-web.enable = false; fonts.enable = true; gnome.enable = true; - greetd.enable = true; + greetd = { + enable = true; + sway = true; + hyprland = false; + }; # home-manager = { # inherit (users) users; # enable = true; diff --git a/machines/loki/hardware-configuration.nix b/machines/loki/hardware-configuration.nix index 5648e1c..287cad6 100644 --- a/machines/loki/hardware-configuration.nix +++ b/machines/loki/hardware-configuration.nix @@ -1,7 +1,5 @@ { config , lib -, pkgs -, modulesPath , ... }: { boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; diff --git a/machines/mimir/configuration.nix b/machines/mimir/configuration.nix index 87a5bf1..3e5661c 100644 --- a/machines/mimir/configuration.nix +++ b/machines/mimir/configuration.nix @@ -2,7 +2,7 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). -{ self, nixpkgs, nixos-hardware, ... }: +{ nixos-hardware, ... }: { pkgs, ... }: { imports = diff --git a/machines/mimir/hardware-configuration.nix b/machines/mimir/hardware-configuration.nix index 995eb74..3adc75e 100644 --- a/machines/mimir/hardware-configuration.nix +++ b/machines/mimir/hardware-configuration.nix @@ -1,7 +1,7 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: +{ config, pkgs, ... }: { boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" ]; diff --git a/machines/proxy/hardware-configuration.nix b/machines/proxy/hardware-configuration.nix index 356ff26..c2c38a9 100644 --- a/machines/proxy/hardware-configuration.nix +++ b/machines/proxy/hardware-configuration.nix @@ -1,7 +1,4 @@ -{ config -, lib -, pkgs -, modulesPath +{ modulesPath , ... }: { imports = [ diff --git a/machines/vm1/configuration.nix b/machines/vm1/configuration.nix index 07e758d..46db933 100644 --- a/machines/vm1/configuration.nix +++ b/machines/vm1/configuration.nix @@ -1,4 +1,4 @@ -{ self, ... }: { +{ ... }: { imports = [ ./hardware-configuration.nix ]; eboskma = { diff --git a/machines/vm1/hardware-configuration.nix b/machines/vm1/hardware-configuration.nix index 602d381..4cba081 100644 --- a/machines/vm1/hardware-configuration.nix +++ b/machines/vm1/hardware-configuration.nix @@ -1,10 +1,7 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config -, lib -, pkgs -, modulesPath +{ modulesPath , ... }: { imports = [ diff --git a/machines/vm2/configuration.nix b/machines/vm2/configuration.nix index c12c739..4a8af39 100644 --- a/machines/vm2/configuration.nix +++ b/machines/vm2/configuration.nix @@ -1,4 +1,4 @@ -{ self, ... }: { +{ ... }: { imports = [ ./hardware-configuration.nix ]; eboskma = { diff --git a/machines/vm2/hardware-configuration.nix b/machines/vm2/hardware-configuration.nix index df33836..07d2edc 100644 --- a/machines/vm2/hardware-configuration.nix +++ b/machines/vm2/hardware-configuration.nix @@ -1,12 +1,4 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. -{ config -, lib -, pkgs -, modulesPath -, ... -}: { +{ modulesPath, ... }: { imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; diff --git a/modules/base/blink1-udev/default.nix b/modules/base/blink1-udev/default.nix index da40991..6377094 100644 --- a/modules/base/blink1-udev/default.nix +++ b/modules/base/blink1-udev/default.nix @@ -1,8 +1,4 @@ { mkDerivation, lib }: -let - udevRules = '' -''; -in mkDerivation { pname = "blink1-udev-rules"; diff --git a/modules/bluetooth/default.nix b/modules/bluetooth/default.nix index ebc73b7..dddab43 100644 --- a/modules/bluetooth/default.nix +++ b/modules/bluetooth/default.nix @@ -1,5 +1,4 @@ -{ pkgs -, config +{ config , lib , ... }: diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix index 1c08e64..58796ab 100644 --- a/modules/desktop/default.nix +++ b/modules/desktop/default.nix @@ -1,8 +1,6 @@ { lib , pkgs , config -, inputs -, self-overlay , ... }: with lib; let diff --git a/modules/drone/default.nix b/modules/drone/default.nix index 95bf9e5..5417b26 100644 --- a/modules/drone/default.nix +++ b/modules/drone/default.nix @@ -1,8 +1,4 @@ -{ pkgs -, config -, lib -, ... -}: +{ config, lib, ... }: with lib; let cfg = config.eboskma.drone; in diff --git a/modules/greetd/default.nix b/modules/greetd/default.nix index 11efc0d..36d41aa 100644 --- a/modules/greetd/default.nix +++ b/modules/greetd/default.nix @@ -14,6 +14,8 @@ in { options.eboskma.greetd = { enable = mkEnableOption "enable greetd"; + sway = mkEnableOption "sway"; + hyprland = mkEnableOption "hyprland"; }; config = @@ -46,11 +48,10 @@ in group = "greeter"; }; "greetd/environments" = { - text = '' - ${pkgs.sway}/bin/sway - ${hyprland}/bin/Hyprland - ${pkgs.bash}/bin/bash - ''; + text = concatStringsSep "\n" ([ ] + ++ (optional cfg.sway "${pkgs.sway}/bin/sway") + ++ (optional cfg.hyprland "${hyprland}/bin/Hyprland") + ++ [ "${pkgs.bash}/bin/bash" ]); user = "greeter"; group = "greeter"; }; diff --git a/modules/lightdm/default.nix b/modules/lightdm/default.nix index 73765bb..e2e43a8 100644 --- a/modules/lightdm/default.nix +++ b/modules/lightdm/default.nix @@ -1,4 +1,4 @@ -{ pkgs, config, lib, ... }: +{ config, lib, ... }: with lib; let cfg = config.eboskma.lightdm; diff --git a/modules/livebook/default.nix b/modules/livebook/default.nix index 21b4f21..8dfbfdb 100644 --- a/modules/livebook/default.nix +++ b/modules/livebook/default.nix @@ -1,5 +1,4 @@ -{ pkgs -, config +{ config , lib , ... }: diff --git a/modules/nginx-proxy-manager/default.nix b/modules/nginx-proxy-manager/default.nix index 7a52b08..a3d0e22 100644 --- a/modules/nginx-proxy-manager/default.nix +++ b/modules/nginx-proxy-manager/default.nix @@ -1,5 +1,4 @@ -{ pkgs -, config +{ config , lib , ... }: diff --git a/modules/nix-serve/default.nix b/modules/nix-serve/default.nix index e03f8cc..aacfbf7 100644 --- a/modules/nix-serve/default.nix +++ b/modules/nix-serve/default.nix @@ -1,4 +1,4 @@ -{ pkgs, config, lib, ... }: +{ config, lib, ... }: with lib; let cfg = config.eboskma.nix-serve; diff --git a/modules/options/default.nix b/modules/options/default.nix index c315a92..f816eda 100644 --- a/modules/options/default.nix +++ b/modules/options/default.nix @@ -1,19 +1,12 @@ -{ lib -, pkgs -, config -, ... -}: -with lib; let - cfg = config.eboskma.var; -in -{ +{ lib, ... }: +with lib; { options.eboskma.var = { mainUser = lib.mkOption { - type = lib.types.str; - default = "erwin"; - description = '' - The main system user - ''; + type = lib.types.str; + default = "erwin"; + description = '' + The main system user + ''; }; workSystem = lib.mkOption { diff --git a/modules/systemd/default.nix b/modules/systemd/default.nix index 1ef8669..5cc1b8c 100644 --- a/modules/systemd/default.nix +++ b/modules/systemd/default.nix @@ -1,5 +1,4 @@ -{ pkgs -, config +{ config , lib , ... }: diff --git a/modules/tablet/default.nix b/modules/tablet/default.nix index b5f23f1..b7f7ac1 100644 --- a/modules/tablet/default.nix +++ b/modules/tablet/default.nix @@ -1,4 +1,4 @@ -{ pkgs, config, lib, ... }: +{ config, lib, ... }: with lib; let cfg = config.eboskma.tablet; diff --git a/overlays/default.nix b/overlays/default.nix index 4fd00be..79227da 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,4 +1,4 @@ -final: prev: rec { +_final: prev: rec { rofi-wayland = prev.pkgs.callPackage ../pkgs/rofi-wayland { }; nix-plugins = prev.pkgs.callPackage ../pkgs/nix-plugins { }; lunarvim = prev.pkgs.callPackage ../pkgs/lunarvim { }; diff --git a/pkgs/bl3auto/default.nix b/pkgs/bl3auto/default.nix index d0541b6..22815dc 100644 --- a/pkgs/bl3auto/default.nix +++ b/pkgs/bl3auto/default.nix @@ -1,4 +1,4 @@ -{ lib, buildGoModule, fetchFromGitHub }: +{ buildGoModule, fetchFromGitHub, ... }: let version = "2.2.18"; in diff --git a/statix.toml b/statix.toml index 34a3691..696a153 100644 --- a/statix.toml +++ b/statix.toml @@ -1,5 +1,5 @@ disabled = [ "manual_inherit_from" ] -nix_version = "2.8" +nix_version = "2.11" ignore = [".direnv"] diff --git a/users/builder/default.nix b/users/builder/default.nix index 6248a7f..a5719d5 100644 --- a/users/builder/default.nix +++ b/users/builder/default.nix @@ -1,4 +1,4 @@ -{ pkgs, config, lib, ... }: +{ config, lib, ... }: with lib; let cfg = config.eboskma.users.builder; diff --git a/users/erwin/default.nix b/users/erwin/default.nix index f5a5c7b..af409e6 100644 --- a/users/erwin/default.nix +++ b/users/erwin/default.nix @@ -4,7 +4,19 @@ let cfg = config.eboskma.users.erwin; in { - options.eboskma.users.erwin = { enable = mkEnableOption "user account for Erwin"; }; + options.eboskma.users.erwin = { + enable = mkEnableOption "user account for Erwin"; + + home = mkEnableOption "home profile"; + work = mkEnableOption "work profile"; + terminal = mkOption { + type = types.str; + default = "foot"; + description = "Terminal emulator to use. Specify the .desktop filename, e.g. 'foot' or 'Alacritty'"; + }; + }; + + imports = [ ./home.nix ./work.nix ]; diff --git a/users/erwin/home.nix b/users/erwin/home.nix index 0977d6e..8291bb3 100644 --- a/users/erwin/home.nix +++ b/users/erwin/home.nix @@ -1,24 +1,9 @@ -{ pkgs -, config -, lib -, inputs -, self-overlay -, ... -}: +{ pkgs, config, lib, inputs, self-overlay, ... }: with lib; let cfg = config.eboskma.users.erwin; bt = config.eboskma.bluetooth; in { - options.eboskma.users.erwin = { - home = mkEnableOption "home profile"; - terminal = mkOption { - type = types.str; - default = "foot"; - description = "Terminal emulator to use. Specify the .desktop filename, e.g. 'foot' or 'Alacritty'"; - }; - }; - config = mkIf cfg.home { home-manager.users.erwin = { @@ -35,7 +20,7 @@ in EDITOR = "${pkgs.neovim}/bin/nvim"; }; - nixpkgs.config = { allowUnfree = true; }; + nixpkgs.config.allowUnfree = true; home.stateVersion = "21.11"; @@ -69,7 +54,7 @@ in signingKeyFormat = "ssh"; }; gpg.enable = true; - hyprland.enable = true; + hyprland.enable = false; neovim.enable = true; obs-studio.enable = true; rclone = { diff --git a/users/erwin/work.nix b/users/erwin/work.nix index 8712e72..7a65490 100644 --- a/users/erwin/work.nix +++ b/users/erwin/work.nix @@ -4,11 +4,7 @@ let cfg = config.eboskma.users.erwin; in { - options.eboskma.users.erwin = { - work = mkEnableOption "work profile"; - }; - - config = mkIf (cfg.work) { + config = mkIf cfg.work { home-manager.users.erwin = { _module.args.flake-inputs = inputs;