From 6e52a06201ec1db8309eaa85a5f592c31ca16d3f Mon Sep 17 00:00:00 2001 From: Swarsel Date: Wed, 31 Jul 2024 01:14:42 +0200 Subject: [PATCH] feat: add gammastep --- SwarselSystems.org | 15 + index.html | 1349 +++++++++++++++++----------- profiles/common/gammastep.nix | 9 + profiles/common/home/default.nix | 1 + profiles/common/home/gammastep.nix | 9 + 5 files changed, 847 insertions(+), 536 deletions(-) create mode 100644 profiles/common/gammastep.nix create mode 100644 profiles/common/home/gammastep.nix diff --git a/SwarselSystems.org b/SwarselSystems.org index 6ec76e5..73da2c5 100644 --- a/SwarselSystems.org +++ b/SwarselSystems.org @@ -6004,6 +6004,7 @@ This section sets up all the imports that are used in the home-manager section. ./mako.nix ./sway.nix ./gpg-agent.nix + ./gammastep.nix ]; nix = { @@ -7877,6 +7878,20 @@ Currently, I am too lazy to explain every option here, but most of it is very se } #+end_src +**** gammastep + +#+begin_src nix :tangle profiles/common/home/gammastep.nix + _: + { + services.gammastep = { + enable = true; + provider = "manual"; + latitude = 48.210033; + longitude = 16.363449; + }; + } +#+end_src + *** Optional **** Gaming diff --git a/index.html b/index.html index 3bb32c2..5e566af 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + SwarselSystems: NixOS + Emacs Configuration @@ -223,7 +223,7 @@ -
  • 3.2. Overlays, packages, and modules +
  • 3.2. Overlays, packages, and modules
  • -
  • 3.3. NixOS +
  • 3.3. NixOS
  • -
  • 3.4. Home-manager +
  • 3.4. Home-manager
  • 3.5. flake.nix template @@ -310,7 +310,7 @@ @@ -993,20 +993,20 @@ pkgsFor = lib.genAttrs (import systems) ( ); # pkgs for home-manager builds -homepkgs = import nixpkgs { system = "x86_64-linux"; - overlays = [ inputs.emacs-overlay.overlay - inputs.nur.overlay - inputs.nixgl.overlay - (final: _prev: { - stable = import inputs.nixpkgs-stable { - inherit (final) system config; - }; - }) - ]; - config.allowUnfree = true; - }; +# homepkgs = import nixpkgs { system = "x86_64-linux"; +# overlays = [ inputs.emacs-overlay.overlay +# inputs.nur.overlay +# inputs.nixgl.overlay +# (final: _prev: { +# stable = import inputs.nixpkgs-stable { +# inherit (final) system config; +# }; +# }) +# ]; +# config.allowUnfree = true; +# }; -# NixOS modules that can only be used on NixOS systems +# # NixOS modules that can only be used on NixOS systems nixModules = [ inputs.stylix.nixosModules.stylix inputs.sops-nix.nixosModules.sops @@ -1030,8 +1030,8 @@ mixedModules = [ -
    -

    2.3.3. General (outputs)

    +
    +

    2.3.3. General (outputs)

    @@ -1215,9 +1215,10 @@ In contrast, this defines home-manager systems, which I only have one of.
     
     "swarsel@home-manager" = inputs.home-manager.lib.homeManagerConfiguration {
    - pkgs = homepkgs;
    + pkgs = pkgsFor.x86_64-linux;
    + extraSpecialArgs = { inherit inputs outputs; };
       modules = homeModules ++ mixedModules ++ [
    -    ./profiles/home-manager/home.nix
    +    ./profiles/home-manager
       ];
     };
     
    @@ -2410,122 +2411,28 @@ in
     
  • -
  • Home-manager only
    -
      -
    1. Home manager
      -
      -

      -Special things to note here: We are running xcape to allow CAPS to act as CTRL and ESC. Also we are using nixGL in most places. -

      - +
    2. Home-manager only
      +
      -{ config, pkgs, ... }:
      -
      +{ inputs, outputs, config, ... }:
       {
      -  programs.home-manager.enable = true;
      -  home.username = "swarsel";
      -  home.homeDirectory = "/home/swarsel";
      -
      -  home.stateVersion = "23.05"; # Please read the comment before changing.
      -
      -  stylix.image = ../../wallpaper/surfacewp.png;
      -
      -  enable = true;
      -  base16Scheme = ../../../wallpaper/swarsel.yaml;
      -  # base16Scheme = "${pkgs.base16-schemes}/share/themes/shapeshifter.yaml";
      -  polarity = "dark";
      -  opacity.popups = 0.5;
      -  cursor = {
      -    package = pkgs.capitaine-cursors;
      -    name = "capitaine-cursors";
      -    size = 16;
      -  };
      -  fonts = {
      -    sizes = {
      -      terminal = 10;
      -      applications = 11;
      -    };
      -    serif = {
      -      # package = (pkgs.nerdfonts.override { fonts = [ "FiraMono" "FiraCode"]; });
      -      package = pkgs.cantarell-fonts;
      -      # package = pkgs.montserrat;
      -      name = "Cantarell";
      -      # name = "FiraCode Nerd Font Propo";
      -      # name = "Montserrat";
      -    };
      -
      -    sansSerif = {
      -      # package = (pkgs.nerdfonts.override { fonts = [ "FiraMono" "FiraCode"]; });
      -      package = pkgs.cantarell-fonts;
      -      # package = pkgs.montserrat;
      -      name = "Cantarell";
      -      # name = "FiraCode Nerd Font Propo";
      -      # name = "Montserrat";
      -    };
      -
      -    monospace = {
      -      package = pkgs.nerdfonts.override { fonts = [ "FiraCode" ]; };
      -      name = "FiraCode Nerd Font Mono";
      -    };
      -
      -    emoji = {
      -      package = pkgs.noto-fonts-emoji;
      -      name = "Noto Color Emoji";
      -    };
      -  };
       
      +  imports = builtins.attrValues outputs.homeManagerModules;
       
         nixpkgs = {
      +    inherit (outputs) overlays;
           config = {
             allowUnfree = true;
      -      allowUnfreePredicate = _: true;
           };
         };
      +
         services.xcape = {
           enable = true;
           mapExpression = {
             Control_L = "Escape";
           };
         };
      -  #keyboard config
      -  home.keyboard.layout = "us";
      -
      -  sops.age.sshKeyPaths = [ "${config.home.homeDirectory}/.ssh/sops" ];
      -
      -  # waybar config
      -  programs.waybar.settings.mainBar.cpu.format = "{icon0} {icon1} {icon2} {icon3}";
      -
      -  programs.waybar.settings.mainBar.temperature.hwmon-path = "/sys/devices/platform/coretemp.0/hwmon/hwmon3/temp3_input";
      -  programs.waybar.settings.mainBar.modules-right = ["custom/outer-left-arrow-dark" "mpris" "custom/left-arrow-light"
      -                                                    "network"
      -                                                    "custom/left-arrow-dark"
      -                                                    "pulseaudio"
      -                                                    "custom/left-arrow-light"
      -                                                    "battery"
      -                                                    "custom/left-arrow-dark"
      -                                                    "temperature"
      -                                                    "custom/left-arrow-light"
      -                                                    "disk"
      -                                                    "custom/left-arrow-dark"
      -                                                    "memory"
      -                                                    "custom/left-arrow-light"
      -                                                    "cpu"
      -                                                    "custom/left-arrow-dark"
      -                                                    "tray"
      -                                                    "custom/left-arrow-light"
      -                                                    "clock#2"
      -                                                    "custom/left-arrow-dark"
      -                                                    "clock#1" ];
      -  services.blueman-applet.enable = true;
      -  home.packages = with pkgs; [
      -    # nixgl.auto.nixGLDefault
      -    evince
      -    # nodejs_20
      -
      -    # messaging
      -    # we use gomuks for RAM preservation, but keep schildi around for files and images
      -  ];
       
         programs.zsh.initExtra = "
       export GPG_TTY=\"$(tty)\"
      @@ -2533,50 +2440,43 @@ export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
       gpgconf --launch gpg-agent
             ";
       
      -  # sway config
      -  wayland.windowManager.sway= {
      -    config = rec {
      -      input = {
      -        "*" = {
      -          xkb_layout = "us";
      -          xkb_options = "ctrl:nocaps,grp:win_space_toggle";
      -          xkb_variant = "altgr-intl";
      -        };
      -        "type:touchpad" = {
      -          dwt = "enabled";
      -          tap = "enabled";
      -          natural_scroll = "enabled";
      -          middle_emulation = "enabled";
      -        };
      -      };
      -
      -      output = {
      -        eDP-1 = {
      -          mode = "2160x1440@59.955Hz";
      -          scale = "1";
      -          bg = "~/.dotfiles/wallpaper/surfacewp.png fill";
      -        };
      -      };
      -
      -      keybindings = let
      -        inherit (config.wayland.windowManager.sway.config) modifier;
      -      in {
      -      };
      -
      -      startup = [
      -      ];
      -
      +  swarselsystems = {
      +    isLaptop = true;
      +    isNixos = false;
      +    wallpaper = ../../wallpaper/surfacewp.png;
      +    temperatureHwmon = {
      +      isAbsolutePath = true;
      +      path = "/sys/devices/platform/thinkpad_hwmon/hwmon/";
      +      input-filename = "temp1_input";
      +    };
      +    monitors = {
      +      main = {
      +        name = "California Institute of Technology 0x1407 Unknown";
      +        mode = "1920x1080"; # TEMPLATE
      +        scale = "1";
      +        position = "2560,0";
      +        workspace = "2:二";
      +        output = "eDP-1";
      +      };
      +    };
      +    inputs =  {
      +      "1:1:AT_Translated_Set_2_keyboard" = {
      +        xkb_layout = "us";
      +        xkb_options = "grp:win_space_toggle";
      +        xkb_variant = "altgr-intl";
      +      };
      +    };
      +    keybindings = {
           };
      -
         };
      +
       }
       
      +
       
    3. -
    -
  • Threed (Surface Pro 3)

    @@ -2810,17 +2710,18 @@ This is basically just adjusted to the core count, path to the hwmon

    -{ inputs, outputs, config, ... }:
    +{ inputs, outputs, config, pkgs, ... }:
     {
     
       imports = [
         inputs.nixos-hardware.nixosModules.lenovo-thinkpad-p14s-amd-gen2
     
         ./hardware-configuration.nix
    -    ./nixos.nix
     
         ../optional/nixos/steam.nix
         ../optional/nixos/virtualbox.nix
    +    ../optional/nixos/autologin.nix
    +    ../optional/nixos/nswitch-rcm.nix
     
         inputs.home-manager.nixosModules.home-manager
         {
    @@ -2832,18 +2733,43 @@ This is basically just adjusted to the core count, path to the hwmonhwmonhwmonhwmon
     
    -
      -
    1. NixOS
      -
      -

      -Mostly just sets some opened ports for several games, enables virtualbox (which I do not want everywhere because of resource considerations) and enables thinkfan, which allows for better fan control on Lenovo Thinkpad machines. -

      - -
      -
      { config, pkgs, ... }:
      -
      -{
      -
      -
      -  boot = {
      -    loader.systemd-boot.enable = true;
      -    loader.efi.canTouchEfiVariables = true;
      -    # kernelPackages = pkgs.linuxPackages_latest;
      -  };
      -
      -
      -  networking = {
      -    hostName = "fourside"; # Define your hostname.
      -    nftables.enable = true;
      -    enableIPv6 = false;
      -    firewall.checkReversePath = false;
      -    firewall = {
      -      enable = true;
      -      allowedUDPPorts = [ 4380 27036 14242 34197 51820 ]; # 34197: factorio; 4380 27036 14242: barotrauma; 51820: wireguard
      -      allowedTCPPorts = [ ]; # 34197: factorio; 4380 27036 14242: barotrauma; 51820: wireguard
      -      allowedTCPPortRanges = [
      -        { from = 27015; to = 27030; } # barotrauma
      -        { from = 27036; to = 27037; } # barotrauma
      -      ];
      -      allowedUDPPortRanges = [
      -        { from = 27000; to = 27031; } # barotrauma
      -        { from = 58962; to = 58964; } # barotrauma
      -      ];
      -    };
      -  };
      -
      -
      -
      -  hardware = {
      -    graphics = {
      -      enable = true;
      -      enable32Bit = true;
      -      extraPackages = with pkgs; [
      -        vulkan-loader
      -        vulkan-validation-layers
      -        vulkan-extension-layer
      -      ];
      -    };
      -    bluetooth.enable = true;
      -    trackpoint = {
      -      enable = true;
      -      device = "TPPS/2 Elan TrackPoint";
      -    };
      -  };
      -
      -
      -  # Configure keymap in X11 (only used for login)
      -
      -  services.thinkfan = {
      -    enable = false;
      -  };
      -  services.power-profiles-daemon.enable = true;
      -  services.fprintd.enable = true;
      -  services.fwupd.enable = true;
      -
      -  services.nswitch-rcm = {
      -    enable = true;
      -    package = pkgs.fetchurl {
      -      url = "https://github.com/Atmosphere-NX/Atmosphere/releases/download/1.3.2/fusee.bin";
      -      hash = "sha256-5AXzNsny45SPLIrvWJA9/JlOCal5l6Y++Cm+RtlJppI=";
      -    };
      -  };
      -
      -
      -  environment.systemPackages = with pkgs; [
      -  ];
      -
      -  system.stateVersion = "23.05";
      -
      -
      -}
      -
      -
      -
      -
      -
    2. -
  • Winters (Framwork Laptop 16)
    @@ -5371,8 +5203,8 @@ in
    -
    -

    3.2. Overlays, packages, and modules

    +
    +

    3.2. Overlays, packages, and modules

    In this section I define packages that I manually want to nixpkgs. This can be useful for packages that are currently awaiting a PR or public packages that I do not want to maintain. @@ -5391,19 +5223,430 @@ These are for packages that are on nixpkgs, but do not fit my usecase, meaning I This is simply a mirror of the most recent stable branch of nixpkgs. Useful for packages that are broken on nixpkgs, but do not need to be on bleeding edge anyways.

  • -
    -

    3.2.1. Packages

    +
    +

    3.2.1. Packages

    -_ : rec { }
    +{pkgs, ...}:
    +let
    +  inherit (pkgs) callPackage;
    +in
    +{
    +  pass-fuzzel = callPackage ./pass-fuzzel { };
    +  cura5 = callPackage ./cura5 { };
    +  cdw = callPackage ./cdw { };
    +  cdb = callPackage ./cdb { };
    +  bak = callPackage ./bak { };
    +  timer = callPackage ./timer { };
    +  e = callPackage ./e { };
    +  swarselcheck = callPackage ./swarselcheck { };
    +  waybarupdate = callPackage ./waybarupdate { };
    +  opacitytoggle = callPackage ./opacitytoggle { };
    +}
     
     
    +
      +
    1. pass-fuzzel
      +
      +
      +
      # Adapted from https://code.kulupu.party/thesuess/home-manager/src/branch/main/modules/river.nix
      +shopt -s nullglob globstar
      +
      +otp=0
      +typeit=0
      +while :; do
      +    case ${1:-} in
      +        -t|--type) typeit=1
      +                   ;;
      +        -o|--otp) otp=1
      +                  ;;
      +        *) break
      +    esac
      +    shift
      +done
      +
      +export PASSWORD_STORE_DIR=~/.local/share/password-store
      +prefix=${PASSWORD_STORE_DIR-~/.local/share/password-store}
      +if [[ $otp -eq 0 ]]; then
      +    password_files=( "$prefix"/**/*.gpg )
      +else
      +    password_files=( "$prefix"/otp/**/*.gpg )
      +fi
      +password_files=( "${password_files[@]#"$prefix"/}" )
      +password_files=( "${password_files[@]%.gpg}" )
      +
      +password=$(printf '%s\n' "${password_files[@]}" | fuzzel --dmenu "$@")
      +
      +[[ -n $password ]] || exit
      +if [[ $otp -eq 0 ]]; then
      +    if [[ $typeit -eq 0 ]]; then
      +        pass show -c "$password" &>/tmp/pass-fuzzel
      +    else
      +        pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } | wtype -
      +    fi
      +else
      +    if [[ $typeit -eq 0 ]]; then
      +        pass otp -c "$password" &>/tmp/pass-fuzzel
      +    else
      +        pass otp "$password" | { IFS= read -r pass; printf %s "$pass"; } | wtype -
      +    fi
      +fi
      +notify-send -u critical -a pass -t 1000 "Copied/Typed Password"
      +
      -
      -

      3.2.2. Overlays

      + +
      +
      {writeShellApplication, libnotify, pass, fuzzel, wtype}:
      +
      +writeShellApplication {
      +  name = "pass-fuzzel";
      +  runtimeInputs = [ libnotify (pass.withExtensions (exts: [ exts.pass-otp ])) fuzzel wtype ];
      +  text = builtins.readFile ../../scripts/pass-fuzzel.sh;
      +}
      +
      +
      +
      +
      +
    2. +
    3. cura5
      +
      +
      +
      +{appimageTools, fetchurl, writeScriptBin, pkgs}:
      +
      +
      +let
      +  cura5 = appimageTools.wrapType2 rec {
      +    name = "cura5";
      +    version = "5.4.0";
      +    src = fetchurl {
      +      url = "https://github.com/Ultimaker/Cura/releases/download/${version}/UltiMaker-Cura-${version}-linux-modern.AppImage";
      +      hash = "sha256-QVv7Wkfo082PH6n6rpsB79st2xK2+Np9ivBg/PYZd74=";
      +    };
      +    extraPkgs = pkgs: with pkgs; [ ];
      +  };
      +in
      +writeScriptBin "cura" ''
      +    #! ${pkgs.bash}/bin/bash
      +    # AppImage version of Cura loses current working directory and treats all paths relative to $HOME.
      +    # So we convert each of the files passed as argument to an absolute path.
      +    # This fixes use cases like `cd /path/to/my/files; cura mymodel.stl anothermodel.stl`.
      +    args=()
      +    for a in "$@"; do
      +        if [ -e "$a" ]; then
      +           a="$(realpath "$a")"
      +        fi
      +        args+=("$a")
      +    done
      +    exec "${cura5}/bin/cura5" "''${args[@]}"
      +  ''
      +
      +
      +
      +
      +
    4. +
    5. cdw
      +
      +
      +
      +{writeShellApplication, fzf}:
      +
      +writeShellApplication {
      +  name = "cdw";
      +  runtimeInputs = [ fzf ];
      +  text = ''
      +        cd "$(git worktree list | fzf | awk '{print $1}')"
      +      '';
      +}
      +
      +
      +
      +
      +
      +
    6. +
    7. cdb
      +
      +
      +
      +{writeShellApplication, fzf}:
      +
      +writeShellApplication {
      +  name = "cdb";
      +  runtimeInputs = [ fzf ];
      +  text = ''
      +        git checkout "$(git branch --list | grep -v "^\*" | fzf | awk '{print $1}')"
      +      '';
      +}
      +
      +
      +
      +
      +
    8. +
    9. bak
      +
      +
      +
      +{writeShellApplication}:
      +
      +writeShellApplication {
      +  name = "bak";
      +  text = ''
      +        cp "$1"{,.bak}
      +      '';
      +}
      +
      +
      +
      +
      +
      +
    10. +
    11. timer
      +
      +
      +
      +{writeShellApplication, speechd}:
      +
      +writeShellApplication {
      +  name = "timer";
      +  runtimeInputs = [ speechd ];
      +  text = ''
      +    sleep "$1"; while true; do spd-say "$2"; sleep 0.5; done;
      +      '';
      +}
      +
      +
      +
      +
      +
    12. +
    13. e
      +
      +
      +
      wait=0
      +while :; do
      +    case ${1:-} in
      +        -w|--wait) wait=1
      +                   ;;
      +        *) break
      +    esac
      +    shift
      +done
      +
      +STR=$(swaymsg -t get_tree | jq -r 'recurse(.nodes[]) | select(.name == "__i3_scratch")' | grep kittyterm || true )
      +if [ "$STR" == "" ]; then
      +    swaymsg '[title="kittyterm"]' scratchpad show
      +    emacsclient -c -a "" "$@"
      +    swaymsg '[title="kittyterm"]' scratchpad show
      +else
      +    if [[ $wait -eq 0 ]]; then
      +        emacsclient -n -c -a "" "$@"
      +    else
      +        emacsclient -c -a "" "$@"
      +    fi
      +fi
      +
      +
      + +
      +
      { writeShellApplication, emacs-pgtk, sway, jq}:
      +
      +writeShellApplication {
      +  name = "e";
      +  runtimeInputs = [ emacs-pgtk sway jq ];
      +  text = builtins.readFile ../../scripts/e.sh;
      +}
      +
      +
      +
      +
      +
    14. +
    15. command-not-found
      +
      +
      +
      # Adapted from https://github.com/bennofs/nix-index/blob/master/command-not-found.sh
      +command_not_found_handle () {
      +    if [ -n "${MC_SID-}" ] || ! [ -t 1 ]; then
      +        >&2 echo "$1: command not found"
      +        return 127
      +    fi
      +
      +    echo -n "searching nix-index..."
      +    ATTRS=$(@nix-locate@ --minimal --no-group --type x --type s --top-level --whole-name --at-root "/bin/$1")
      +
      +    case $(echo -n "$ATTRS" | grep -c "^") in
      +        0)
      +            >&2 echo -ne "$(@tput@ el1)\r"
      +            >&2 echo "$1: command not found"
      +            ;;
      +        *)
      +            >&2 echo -ne "$(@tput@ el1)\r"
      +            >&2 echo "The program ‘$(@tput@ setaf 4)$1$(@tput@ sgr0)’ is currently not installed."
      +            >&2 echo "It is provided by the following derivation(s):"
      +            while read -r ATTR; do
      +                ATTR=${ATTR%.out}
      +                >&2 echo "  $(@tput@ setaf 12)nixpkgs#$(@tput@ setaf 4)$ATTR$(@tput@ sgr0)"
      +            done <<< "$ATTRS"
      +    esac
      +
      +    return 127
      +}
      +
      +command_not_found_handler () {
      +    command_not_found_handle "$@"
      +    return $?
      +}
      +
      +
      +
      +
    16. +
    17. swarselcheck
      +
      +
      +
      kitty=0
      +element=0
      +discord=0
      +spotifyplayer=0
      +while :; do
      +    case ${1:-} in
      +        -k|--kitty) kitty=1
      +                   ;;
      +        -e|--element) element=1
      +                   ;;
      +        -d|--discord) discord=1
      +                   ;;
      +        -s|--spotifyplayer) spotifyplayer=1
      +                   ;;
      +        *) break
      +    esac
      +    shift
      +done
      +
      +if [[ $kitty -eq 1 ]]; then
      +    STR=$(swaymsg -t get_tree | jq -r 'recurse(.nodes[]) | select(.name == "__i3_scratch")' | grep kittyterm || true)
      +    CHECK=$(swaymsg -t get_tree | grep kittyterm || true)
      +    if [ "$CHECK" == "" ]; then
      +        exec kitty -T kittyterm & sleep 1
      +    fi
      +    if [ "$STR" == "" ]; then
      +        exec swaymsg '[title="kittyterm"]' scratchpad show
      +    else
      +        exec swaymsg '[title="kittyterm"]' scratchpad show
      +    fi
      +elif [[ $element -eq 1 ]]; then
      +    STR=$(swaymsg -t get_tree | grep Element || true)
      +    if [ "$STR" == "" ]; then
      +        exec element-desktop
      +    else
      +        exec swaymsg '[app_id=Element]' kill
      +    fi
      +elif [[ $discord -eq 1 ]]; then
      +    STR=$(swaymsg -t get_tree | grep discord || true)
      +    if [ "$STR" == "" ]; then
      +        exec discord
      +    else
      +        exec swaymsg '[app_id=discord]' kill
      +    fi
      +elif [[ $spotifyplayer -eq 1 ]]; then
      +    STR=$(swaymsg -t get_tree | jq -r 'recurse(.nodes[]) | select(.name == "__i3_scratch")' | grep spotifytui || true)
      +    CHECK=$(swaymsg -t get_tree | grep spotifytui || true)
      +    if [ "$CHECK" == "" ]; then
      +        exec kitty -T spotifytui -o confirm_os_window_close=0 spotify_player & sleep 1
      +    fi
      +    if [ "$STR" == "" ]; then
      +        exec swaymsg '[title="spotifytui"]' scratchpad show
      +    else
      +        exec swaymsg '[title="spotifytui"]' scratchpad show
      +    fi
      +fi
      +
      +
      + +
      +
      { writeShellApplication, kitty, element-desktop-wayland, discord, spotify-player, sway, jq}:
      +
      +writeShellApplication {
      +  name = "swarselcheck";
      +  runtimeInputs = [ kitty element-desktop-wayland discord spotify-player jq ];
      +  text = builtins.readFile ../../scripts/swarselcheck.sh;
      +}
      +
      +
      +
      +
      +
    18. +
    19. waybarupdate
      +
      +
      +
      CFG=$(git --git-dir="$HOME"/.dotfiles/.git --work-tree="$HOME"/.dotfiles/ status -s | wc -l)
      +CSE=$(git --git-dir="$HOME"/Documents/GitHub/CSE_TUWIEN/.git --work-tree="$HOME"/Documents/GitHub/CSE_TUWIEN/ status -s | wc -l)
      +PASS=$(( $(git --git-dir="$HOME"/.local/share/password-store/.git --work-tree="$HOME"/.local/share/password-store/ status -s | wc -l) + $(git --git-dir="$HOME"/.local/share/password-store/.git --work-tree="$HOME"/.local/share/password-store/ diff origin/main..HEAD | wc -l) ))
      +
      +if [[ $CFG != 0 ]]; then
      +    CFG_STR='CONFIG'
      +else
      +    CFG_STR=''
      +fi
      +
      +if [[ $CSE != 0 ]]; then
      +    CSE_STR=' CSE'
      +else
      +    CSE_STR=''
      +fi
      +
      +if [[ $PASS != 0 ]]; then
      +    PASS_STR=' PASS'
      +else
      +    PASS_STR=''
      +fi
      +
      +OUT="$CFG_STR""$CSE_STR""$PASS_STR"
      +echo "$OUT"
      +
      +
      +
      + +
      +
      { writeShellApplication, git}:
      +
      +writeShellApplication {
      +  name = "waybarupdate";
      +  runtimeInputs = [ git ];
      +  text = builtins.readFile ../../scripts/waybarupdate.sh;
      +}
      +
      +
      +
      +
      +
    20. +
    21. opacitytoggle
      +
      +
      +
      if swaymsg opacity plus 0.01 -q; then
      +        swaymsg opacity 1
      +else
      +        swaymsg opacity 0.95
      +fi
      +
      +
      + +
      +
      { writeShellApplication, sway}:
      +
      +writeShellApplication {
      +  name = "opacitytoggle";
      +  runtimeInputs = [ sway ];
      +  text = builtins.readFile ../../scripts/opacitytoggle.sh;
      +}
      +
      +
      +
      +
    22. +
    +
    +
    +

    3.2.2. Overlays

    @@ -5436,15 +5679,15 @@ _ : rec { }
     
    -
    -

    3.2.3. Modules

    +
    +

    3.2.3. Modules

    In this section I define custom modules under the swarsel attribute. These are mostly used to define settings specific to a host. I keep these settings confined to either home-manager or nixos to maintain compatibility with non-NixOS machines.

      -
    1. NixOS
      +
    2. NixOS

      Modules that need to be loaded on the NixOS level. Note that these will not be available on systems that are not running NixOS @@ -5453,12 +5696,13 @@ Modules that need to be loaded on the NixOS level. Note that these will not be a

      {
         wallpaper = import ./wallpaper.nix;
      +  hardware = import ./hardware.nix;
       }
       
        -
      1. Wallpaper
        +
      2. Wallpaper
        { lib, ... }:
        @@ -5474,9 +5718,27 @@ Modules that need to be loaded on the NixOS level. Note that these will not be a
         
      3. +
      4. Hardware
        +
        +
        +
        { lib, ... }:
        +
        +{
        +  options.swarselsystems.hasBluetooth = lib.mkEnableOption "bluetooth availability";
        +  options.swarselsystems.hasFingerprint = lib.mkEnableOption "fingerprint sensor availability";
        +  options.swarselsystems.trackpoint.isAvailable = lib.mkEnableOption "trackpoint availability";
        +  options.swarselsystems.trackpoint.device = lib.mkOption {
        +    type = lib.types.str;
        +    default = "";
        +  };
        +  }
        +
        +
        +
        +
    3. -
    4. home-manager
      +
    5. home-manager
      {
      @@ -5493,7 +5755,7 @@ Modules that need to be loaded on the NixOS level. Note that these will not be a
       
        -
      1. Laptop
        +
      2. Laptop
        { lib, config, ... }:
        @@ -5528,7 +5790,7 @@ Modules that need to be loaded on the NixOS level. Note that these will not be a
         
      3. -
      4. Hardware
        +
      5. Hardware
        { lib, ... }:
        @@ -5552,7 +5814,7 @@ Modules that need to be loaded on the NixOS level. Note that these will not be a
         
      6. -
      7. Waybar
        +
      8. Waybar
          { lib, config, ... }:
        @@ -5592,10 +5854,10 @@ in
         
      9. -
      10. Monitors
        +
      11. Monitors
        -
        { lib, config, ... }:
        +
        { lib, ... }:
         let
           inherit (lib) mkOption types;
         in
        @@ -5609,12 +5871,12 @@ in
         
      12. -
      13. Input
        +
      14. Input
        { lib, config, ... }:
         let
        -  inherit (lib) mkIf mkOption types;
        +  inherit (lib) mkOption types;
         in
         {
           options.swarselsystems.inputs = mkOption {
        @@ -5644,13 +5906,12 @@ in
             default = { };
           };
         
        -
         }
         
      15. -
      16. Nixos
        +
      17. Nixos
        { lib, config, ... }:
        @@ -5666,18 +5927,32 @@ in
             { command = "sleep 60 && OBSIDIAN_USE_WAYLAND=1 nixGL obsidian -enable-features=UseOzonePlatform -ozone-platform=wayland"; }
             { command = "sleep 60 && element-desktop --hidden  -enable-features=UseOzonePlatform -ozone-platform=wayland --disable-gpu-driver-bug-workarounds"; }
             ];
        -
        +  options.swarselsystems.swayfxConfig = lib.mkOption {
        +    type = lib.types.str;
        +    default = "
        +          blur enable
        +          blur_xray disable
        +          blur_passes 1
        +          blur_radius 1
        +          shadows enable
        +          corner_radius 2
        +          titlebar_separator disable
        +          default_dim_inactive 0.02
        +      ";
        +    internal = true;
        +  };
        +  config.swarselsystems.swayfxConfig = lib.mkIf (!config.swarselsystems.isNixos) " ";
         }
         
      18. -
      19. System startup
        +
      20. System startup
        -
        { lib, config, ... }:
        +
        { lib, ... }:
         let
        -  inherit (lib) mkIf mkOption types;
        +  inherit (lib) mkOption types;
         in
         {
         
        @@ -5697,7 +5972,7 @@ in
         
      21. -
      22. Wallpaper
        +
      23. Wallpaper
        { lib, ... }:
        @@ -5718,8 +5993,8 @@ in
         
    -
    -

    3.3. NixOS

    +
    +

    3.3. NixOS

    @@ -5730,15 +6005,19 @@ These are system-level settings specific to NixOS machines. All settings that ar

      -
    1. Imports, enable home-manager module
      -
      +
    2. Imports, enable home-manager module, stateVersion
      +
      +

      +:CUSTOMID: h:45e4315b-0929-4c47-b65a-c8f0a685f4df +

      +

      First, we enable the use of home-manager as a NixoS module

      -{ ... }:
      +{ lib, ... }:
       {
         imports = [
           ./xserver.nix
      @@ -5764,13 +6043,17 @@ First, we enable the use of home-manager as a NixoS module
           ./hardwarecompatibility.nix
           ./login.nix
           ./stylix.nix
      +    ./power-profiles-daemon.nix
         ];
       
      +  nix.settings.trusted-users = [ "swarsel" ];
       
         home-manager = {
           useGlobalPkgs = true;
           useUserPackages = true;
         };
      +
      +  system.stateVersion = lib.mkDefault "23.05";
       }
       
       
      @@ -5788,7 +6071,7 @@ Next, we setup the keymap in case we are not in a graphical session. At this poi

      -
      { ... }:
      +
      _ :
       {
         services.xserver = {
           xkb = {
      @@ -5859,7 +6142,7 @@ Needed for control over system-wide privileges etc.
       

      -
      { ... }:
      +
      _ :
       {
         security.polkit.enable = true;
       }
      @@ -5874,7 +6157,7 @@ The nix store fills up over time, until /boot/efi is filled. This s
       

      -
      { ... }:
      +
      _ :
       {
         nix.gc = {
           automatic = true;
      @@ -5894,7 +6177,7 @@ This enables hardlinking identical files in the nix store, to save on disk space
       

      -
      { ... }:
      +
      _ :
       {
         nix.optimise = {
           automatic = true;
      @@ -5913,7 +6196,7 @@ There is a persistent bug over Linux kernels that makes the user wait 1m30s on s
       

      -
      { ... }:
      +
      _ :
       {
         # systemd
         systemd.extraConfig = ''
      @@ -5932,7 +6215,7 @@ Enable OpenGL, Sound, Bluetooth and various drivers.
       

      -
      { pkgs, ...}:
      +
      { pkgs, config, lib, ...}:
       {
       
         hardware = {
      @@ -5941,6 +6224,13 @@ Enable OpenGL, Sound, Bluetooth and various drivers.
             enable32Bit = true;
           };
       
      +    trackpoint = lib.mkIf config.swarselsystems.trackpoint.isAvailable {
      +      enable = true;
      +      inherit (config.swarselsystems.trackpoint) device;
      +    };
      +
      +    keyboard.qmk.enable = true;
      +
           pulseaudio= {
             enable = true;
             package = pkgs.pulseaudioFull;
      @@ -5948,7 +6238,8 @@ Enable OpenGL, Sound, Bluetooth and various drivers.
       
           enableAllFirmware = true;
       
      -    bluetooth = {
      +    bluetooth = lib.mkIf config.swarselsystems.hasBluetooth {
      +      enable = true;
             powerOnBoot = true;
             settings = {
               General = {
      @@ -5957,6 +6248,8 @@ Enable OpenGL, Sound, Bluetooth and various drivers.
             };
           };
         };
      +
      +  services.fprintd.enable = lib.mkIf config.swarselsystems.hasFingerprint true;
       }
       
      @@ -5969,9 +6262,18 @@ Here I only enable networkmanager. Most of the 'real' network confi

      -
      { config, ...}:
      +
      { lib, config, ...}:
       {
      -  networking.networkmanager = {
      +  networking = {
      +    nftables.enable = lib.mkDefault true;
      +    enableIPv6 = lib.mkDefault true;
      +    firewall = {
      +      checkReversePath = lib.mkDefault false;
      +      enable = lib.mkDefault true;
      +      allowedUDPPorts = [ 51820 ]; # 34197: factorio; 4380 27036 14242: barotrauma; 51820: wireguard
      +    };
      +
      +    networkmanager = {
           enable = true;
           ensureProfiles = {
             environmentFiles = [
      @@ -6173,6 +6475,7 @@ Here I only enable networkmanager. Most of the 'real' network confi
             };
           };
         };
      +  };
       
         systemd.services.NetworkManager-ensure-profiles.after = [ "NetworkManager.service" ];
       }
      @@ -6187,7 +6490,7 @@ Setup timezone and locale. I want to use the US layout, but have the rest adapte
       

      -
      { ... }:
      +
      _ :
       {
         time = {
           timeZone = "Europe/Vienna";
      @@ -6266,7 +6569,7 @@ I use sops-nix to handle secrets that I want to have available on my machines at
       
    3. -
    4. Theme (stylix)
      +
    5. Theme (stylix)

      By default, stylix wants to style GRUB as well. However, I think that looks horrible. @@ -6274,7 +6577,7 @@ By default, stylix wants to style

      -
      { inputs, pkgs, home-manager, config, ... }:
      +
      { pkgs, home-manager, config, ... }:
       {
         stylix = {
       
      @@ -6366,6 +6669,11 @@ Mostly used to install some compilers and lsp's that I want to have available wh
       
           # pinentry
       
      +    # keyboards
      +    qmk
      +    vial
      +    via
      +
           # theme related
           adwaita-icon-theme
       
      @@ -6437,7 +6745,7 @@ Some programs profit from being installed through dedicated NixOS settings on sy
       

      -
      { ... }:
      +
      _ :
       {
         programs = {
           dconf.enable = true;
      @@ -6449,7 +6757,7 @@ Some programs profit from being installed through dedicated NixOS settings on sy
       
        -
      1. zsh
        +
      2. zsh

        Do not touch this. @@ -6467,11 +6775,11 @@ Do not touch this.

    6. -
    7. syncthing
      +
    8. syncthing
      -{ ... }:
      +_ :
       {
         services.syncthing = {
           enable = true;
      @@ -6536,7 +6844,7 @@ Enables the blueman service including the nice system tray icon.
       

      -
      { ... }:
      +
      _ :
       {
         services.blueman.enable = true;
       }
      @@ -6544,7 +6852,7 @@ Enables the blueman service including the nice system tray icon.
       
    9. -
    10. Network devices
      +
    11. Network devices

      In this section we enable compatibility with several network devices I have at home, mainly printers and scanners. @@ -6596,7 +6904,7 @@ services.printing = {

    -
  • Avahi (device discovery)
    +
  • Avahi (device discovery)

    Avahi is the service used for the network discovery. @@ -6623,7 +6931,7 @@ This is being set to allow myself to use all functions of nautilus in NixOS

    -
    { ... }:
    +
    _ :
     {
       services.gvfs.enable = true;
     }
    @@ -6672,9 +6980,20 @@ This is a super-convenient package that lets my remap my CAPS key t
     
  • +
  • power-profiles-daemon
    +
    +
    +
    _ :
    +{
    +  services.power-profiles-daemon.enable = true;
    +}
    +
    +
    +
    +
  • -
  • Hardware compatibility settings (Yubikey, Ledger) - udev rules
    +
  • Hardware compatibility settings (Yubikey, Ledger, Keyboards) - udev rules

    It makes sense to house these settings in their own section, since they are all needed really. Note that the starting of the gpg-agent is done in the sway settings, to also perform this step of the setup for non NixOS-machines at the same time. @@ -6705,6 +7024,9 @@ Also, this is a good place to setup the udev rules. services.udev.packages = with pkgs; [ yubikey-personalization ledger-udev-rules + qmk-udev-rules + vial + via ]; } @@ -6745,16 +7067,30 @@ This section houses the greetd related settings. I do not really want to use a d

  • -
    -

    3.3.2. Optional

    +
    +

    3.3.2. Optional

      -
    1. steam
      +
    2. gaming
      { pkgs, ... }:
       {
      +  networking = {
      +    firewall = {
      +      allowedUDPPorts = [ 4380 27036 14242 34197 ]; # 34197: factorio; 4380 27036 14242: barotrauma;
      +      allowedTCPPorts = [ ]; # 34197: factorio; 4380 27036 14242: barotrauma; 51820: wireguard
      +      allowedTCPPortRanges = [
      +        { from = 27015; to = 27030; } # barotrauma
      +        { from = 27036; to = 27037; } # barotrauma
      +      ];
      +      allowedUDPPortRanges = [
      +        { from = 27000; to = 27031; } # barotrauma
      +        { from = 58962; to = 58964; } # barotrauma
      +      ];
      +    };
      +  };
       
         programs.steam = {
           enable = true;
      @@ -6769,10 +7105,10 @@ This section houses the greetd related settings. I do not really want to use a d
       
    3. -
    4. VirtualBox
      +
    5. VirtualBox
      -
        { ... }:
      +
        _ :
         {
             virtualisation.virtualbox = {
               host = {
      @@ -6789,12 +7125,42 @@ This section houses the greetd related settings. I do not really want to use a d
       
    6. -
    7. Auto-login
    8. +
    9. Auto-login
      +
      +
      +
      _ :
      +{
      +  services = {
      +    getty.autologinUser = "swarsel";
      +    greetd.settings.initial_session.user = "swarsel";
      +  };
      +}
      +
      +
      +
      +
    10. +
    11. nswitch-rcm
      +
      +
      +
      { pkgs, ... }:
      +{
      +  services.nswitch-rcm = {
      +    enable = true;
      +    package = pkgs.fetchurl {
      +      url = "https://github.com/Atmosphere-NX/Atmosphere/releases/download/1.3.2/fusee.bin";
      +      hash = "sha256-5AXzNsny45SPLIrvWJA9/JlOCal5l6Y++Cm+RtlJppI=";
      +    };
      +  };
      +}
      +
      +
      +
      +
    -
    -

    3.4. Home-manager

    +
    +

    3.4. Home-manager

    @@ -6802,14 +7168,14 @@ This section houses the greetd related settings. I do not really want to use a d
      -
    1. Imports
      +
    2. Imports

      This section sets up all the imports that are used in the home-manager section.

      -
      { lib, pkgs, config, outputs, ... }:
      +
      { lib, pkgs, config, ... }:
       {
         imports = [
           ./packages.nix
      @@ -6838,6 +7204,7 @@ This section sets up all the imports that are used in the home-manager section.
           ./mako.nix
           ./sway.nix
           ./gpg-agent.nix
      +    ./gammastep.nix
         ];
       
         nix = {
      @@ -6848,19 +7215,16 @@ This section sets up all the imports that are used in the home-manager section.
               "flakes"
               "ca-derivations"
             ];
      -      warn-dirty = false;
           };
         };
       
      -  programs = {
      -    git.enable = true;
      -  };
      +  programs.home-manager.enable = lib.mkIf (!config.swarselsystems.isNixos) true;
       
         home = {
           username = lib.mkDefault "swarsel";
           homeDirectory = lib.mkDefault "/home/${config.home.username}";
           stateVersion = lib.mkDefault "23.05";
      -    keyboard.layout = "us"; # TEMPLATE
      +    keyboard.layout = "us";
           sessionVariables = {
             FLAKE = "$HOME/.dotfiles";
           };
      @@ -7044,42 +7408,17 @@ Programming languages and default lsp's are defined here: Self-defined
      -
      # cura
      -(
      -  let
      -    cura5 = appimageTools.wrapType2 rec {
      -      name = "cura5";
      -      version = "5.4.0";
      -      src = fetchurl {
      -        url = "https://github.com/Ultimaker/Cura/releases/download/${version}/UltiMaker-Cura-${version}-linux-modern.AppImage";
      -        hash = "sha256-QVv7Wkfo082PH6n6rpsB79st2xK2+Np9ivBg/PYZd74=";
      -      };
      -      extraPkgs = pkgs: with pkgs; [ ];
      -    };
      -  in
      -  writeScriptBin "cura" ''
      -    #! ${pkgs.bash}/bin/bash
      -    # AppImage version of Cura loses current working directory and treats all paths relateive to $HOME.
      -    # So we convert each of the files passed as argument to an absolute path.
      -    # This fixes use cases like `cd /path/to/my/files; cura mymodel.stl anothermodel.stl`.
      -    args=()
      -    for a in "$@"; do
      -        if [ -e "$a" ]; then
      -           a="$(realpath "$a")"
      -        fi
      -        args+=("$a")
      -    done
      -    exec "${cura5}/bin/cura5" "''${args[@]}"
      -  ''
      -)
      -
      -  #E: hides scratchpad depending on state, calls emacsclient for edit and then restores the scratchpad state
      -  (pkgs.writeShellScriptBin "e" ''
      -    bash ~/.dotfiles/scripts/editor_nowait.sh "$@"
      -  '')
      -  (pkgs.writeShellScriptBin "timer" ''
      -    sleep "$1"; while true; do spd-say "$2"; sleep 0.5; done;
      -  '')
      +
      +  pass-fuzzel
      +  cura5
      +  cdw
      +  cdb
      +  bak
      +  timer
      +  e
      +  swarselcheck
      +  waybarupdate
      +  opacitytoggle
       
         (pkgs.writeScriptBin "project" ''
           #! ${pkgs.bash}/bin/bash
      @@ -7109,94 +7448,13 @@ Programming languages and default lsp's are defined here: 
       
      @@ -7249,7 +7507,7 @@ It is very convenient to have SSH aliases in place for machines that I use. This

    -
  • nix-index
    +
  • nix-index

    nix-index provides a way to find out which packages are provided by which derivations. By default it also comes with a replacement for command-not-found.sh, however, the implementation is based on a channel based setup. I like consistency, so I replace the command with one that provides a flakes-based output. @@ -7601,8 +7859,8 @@ nix-index provides a way to find out which packages are provided by which deriva

    {pkgs, ...}:
     {
       programs.nix-index =
    -    let
    -      command-not-found = pkgs.runCommandLocal "command-not-found.sh" { } ''
    +  let
    +      commandNotFound = pkgs.runCommandLocal "command-not-found.sh" { } ''
             mkdir -p $out/etc/profile.d
             substitute ${../../../scripts/command-not-found.sh}                  \
               $out/etc/profile.d/command-not-found.sh             \
    @@ -7610,11 +7868,12 @@ nix-index provides a way to find out which packages are provided by which deriva
               --replace @tput@ ${pkgs.ncurses}/bin/tput
           '';
         in
    +
         {
           enable = true;
           package = pkgs.symlinkJoin {
             name = "nix-index";
    -        paths = [ command-not-found ];
    +        paths = [ commandNotFound ];
           };
         };
     }
    @@ -7650,7 +7909,7 @@ Enables direnv, which I use for nearly all of my nix dev flakes.
     

    -
    { ... }:
    +
    _ :
     {
       programs.direnv = {
         enable = true;
    @@ -7668,7 +7927,7 @@ Eza provides me with a better ls command and some other useful alia
     

    -
    { ... }:
    +
    _ :
     {
       programs.eza = {
         enable = true;
    @@ -7691,7 +7950,7 @@ Here I set up my git config, automatic signing of commits, useful aliases for my
     

    -
    { ... }:
    +
    _ :
     {
       programs.git = {
         enable = true;
    @@ -7741,7 +8000,7 @@ Here I only need to set basic layout options - the rest is being managed by styl
     

    -
    { ... }:
    +
    _ :
     {
       programs.fuzzel = {
         enable = true;
    @@ -7766,7 +8025,7 @@ Starship makes my zsh look cooler! I have symbols for most programm
     

    -
      { ... }:
    +
      _ :
       {
         programs.starship = {
           enable = true;
    @@ -7887,7 +8146,7 @@ The theme is handled by stylix.
     

    -
    { ... }:
    +
    _ :
     {
       programs.kitty = {
         enable = true;
    @@ -7922,7 +8181,7 @@ Here we set some aliases (some of them should be shellApplications instead) as w
           hg = "history | grep";
           hmswitch = "cd ~/.dotfiles; home-manager --flake .#$(whoami)@$(hostname) switch; cd -;";
           nswitch = "cd ~/.dotfiles; sudo nixos-rebuild --flake .#$(hostname) switch; cd -;";
    -      edithome = "bash ~/.dotfiles/scripts/editor.sh ~/.dotfiles/Nix.org";
    +      edithome = "e -w ~/.dotfiles/SwarselSystems.org";
           magit = "emacsclient -nc -e \"(magit-status)\"";
           config = "git --git-dir=$HOME/.cfg/ --work-tree=$HOME";
           g = "git";
    @@ -8223,7 +8482,7 @@ programs.waybar = {
           };
     
           "custom/configwarn" = {
    -        exec = "bash ~/.dotfiles/scripts/checkconfigstatus.sh";
    +        exec = "waybarupdate";
             interval = 60;
           };
     
    @@ -8342,6 +8601,7 @@ programs.waybar = {
             on-click = "pamixer -t";
             on-click-right = "pavucontrol";
           };
    +
           memory = {
             interval = 5;
             format = " {}%";
    @@ -8543,7 +8803,7 @@ Used for storing sessions in e.g. Nextcloud
     
     
    -{ ... }:
    +_ :
     {
     services.gnome-keyring = {
       enable = true;
    @@ -8560,7 +8820,7 @@ This enables phone/computer communication, including sending clipboard, files et
     

    -
    { ... }:
    +
    _ :
     {
       services.kdeconnect = {
         enable = true;
    @@ -8582,7 +8842,7 @@ The `extraConfig` section here CANNOT be reindented. This has something to do wi
     

    -
    { ... }:
    +
    _ :
     {
       services.mako = {
         enable = true;
    @@ -8630,25 +8890,25 @@ Currently, I am too lazy to explain every option here, but most of it is very se
     

    -
    { config, pkgs, lib, ... }: with lib;
    +
    { config, pkgs, lib, ... }:
       let
    -    monitors = config.swarselsystems.monitors;
    +    inherit (config.swarselsystems) monitors;
         eachMonitor = _name: monitor: {
    -      name = monitor.name;
    +      inherit (monitor) name;
           value = builtins.removeAttrs monitor [ "workspace" "name" "output" ];
         };
         eachOutput = _name: monitor: {
    -      name = monitor.name;
    +      inherit (monitor) name;
           value = builtins.removeAttrs monitor [ "mode" "name" "scale" "position" ];
         };
    -    workplaceSets = (mapAttrs' eachOutput monitors);
    -    workplaceOutputs = (map (key: getAttr key workplaceSets) (attrNames workplaceSets));
    +    workplaceSets = lib.mapAttrs' eachOutput monitors;
    +    workplaceOutputs = map (key: lib.getAttr key workplaceSets) (lib.attrNames workplaceSets);
       in
     {
       wayland.windowManager.sway = {
         enable = true;
         checkConfig = false; # delete this line once SwayFX is fixed upstream
    -    package = pkgs.swayfx;
    +    package = lib.mkIf config.swarselsystems.isNixos pkgs.swayfx;
         systemd = {
           enable = true;
           xdgAutostart = true;
    @@ -8663,7 +8923,7 @@ Currently, I am too lazy to explain every option here, but most of it is very se
             let
               inherit (config.wayland.windowManager.sway.config) modifier;
             in
    -        recursiveUpdate {
    +        lib.recursiveUpdate {
               "${modifier}+q" = "kill";
               "${modifier}+f" = "exec firefox";
               "${modifier}+Space" = "exec fuzzel";
    @@ -8671,24 +8931,21 @@ Currently, I am too lazy to explain every option here, but most of it is very se
               "${modifier}+e" = "exec emacsclient -nquc -a emacs -e \"(dashboard-open)\"";
               "${modifier}+Shift+m" = "exec emacsclient -nquc -a emacs -e \"(mu4e)\"";
               "${modifier}+Shift+c" = "exec emacsclient -nquc -a emacs -e \"(swarsel/open-calendar)\"";
    -          "${modifier}+Shift+s" = "exec \"bash ~/.dotfiles/scripts/checkspotify.sh\"";
    -          "${modifier}+m" = "exec \"bash ~/.dotfiles/scripts/checkspotifytui.sh\"";
    -          "${modifier}+x" = "exec \"bash ~/.dotfiles/scripts/checkkitty.sh\"";
    -          "${modifier}+d" = "exec \"bash ~/.dotfiles/scripts/checkdiscord.sh\"";
    -          "${modifier}+Shift+r" = "exec \"bash ~/.dotfiles/scripts/restart.sh\"";
    -          "${modifier}+Shift+t" = "exec \"bash ~/.dotfiles/scripts/toggle_opacity.sh\"";
    +          "${modifier}+m" = "exec swarselcheck -s";
    +          "${modifier}+x" = "exec swarselcheck -k";
    +          "${modifier}+d" = "exec swarselcheck -d";
    +          "${modifier}+w" = "exec swarselcheck -e";
    +          "${modifier}+Shift+t" = "exec opacitytoggle";
               "${modifier}+Shift+F12" = "move scratchpad";
               "${modifier}+F12" = "scratchpad show";
               "${modifier}+c" = "exec qalculate-gtk";
               "${modifier}+p" = "exec pass-fuzzel";
    -          "${modifier}+o" = "exec pass-fuzzel-otp";
    +          "${modifier}+o" = "exec pass-fuzzel --otp";
               "${modifier}+Shift+p" = "exec pass-fuzzel --type";
    -          "${modifier}+Shift+o" = "exec pass-fuzzel-otp --type";
    +          "${modifier}+Shift+o" = "exec pass-fuzzel --otp --type";
               "${modifier}+Escape" = "mode $exit";
    -          # "${modifier}+Shift+Escape" = "exec com.github.stsdc.monitor";
               "${modifier}+Shift+Escape" = "exec kitty -o confirm_os_window_close=0 btm";
               "${modifier}+s" = "exec grim -g \"$(slurp)\" -t png - | wl-copy -t image/png";
    -          "${modifier}+i" = "exec \"bash ~/.dotfiles/scripts/startup.sh\"";
               "${modifier}+1" = "workspace 1:一";
               "${modifier}+Shift+1" = "move container to workspace 1:一";
               "${modifier}+2" = "workspace 2:二";
    @@ -8709,8 +8966,6 @@ Currently, I am too lazy to explain every option here, but most of it is very se
               "${modifier}+Shift+9" = "move container to workspace 9:九";
               "${modifier}+0" = "workspace 10:十";
               "${modifier}+Shift+0" = "move container to workspace 10:十";
    -          "XF86AudioRaiseVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ +5%";
    -          "XF86AudioLowerVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ -5%";
               "${modifier}+Left" = "focus left";
               "${modifier}+Right" = "focus right";
               "${modifier}+Down" = "focus down";
    @@ -8731,6 +8986,12 @@ Currently, I am too lazy to explain every option here, but most of it is very se
               "${modifier}+Shift+e" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'";
               "${modifier}+r" = "mode resize";
               "${modifier}+Return" = "exec kitty";
    +          "XF86AudioRaiseVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ +5%";
    +          "XF86AudioLowerVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ -5%";
    +          "XF86AudioMute" = "exec pactl set-sink-mute @DEFAULT_SINK@ toggle";
    +          "XF86MonBrightnessUp" = "exec brightnessctl set +5%";
    +          "XF86MonBrightnessDown" = "exec brightnessctl set 5%-";
    +          "XF86Display" = "exec wl-mirror eDP-1";
             } config.swarselsystems.keybindings;
           modes = {
             resize = {
    @@ -8743,7 +9004,7 @@ Currently, I am too lazy to explain every option here, but most of it is very se
             };
           };
           defaultWorkspace = "workspace 1:一";
    -      output = (mapAttrs' eachMonitor monitors);
    +      output = lib.mapAttrs' eachMonitor monitors;
           input = config.swarselsystems.standardinputs;
           workspaceOutputAssign = workplaceOutputs;
           startup = config.swarselsystems.startup ++ [
    @@ -8812,13 +9073,13 @@ Currently, I am too lazy to explain every option here, but most of it is very se
                 };
               }
               {
    -            command = "opacity 0.8, sticky enable, border normal, move container to scratchpad";
    +            command = "resize set width 60 ppt height 60 ppt, opacity 0.8, sticky enable, border normal, move container to scratchpad";
                 criteria = {
                   title = "^kittyterm$";
                 };
               }
               {
    -            command = "opacity 0.95, sticky enable, border normal, move container to scratchpad";
    +            command = "resize set width 60 ppt height 60 ppt, opacity 0.95, sticky enable, border normal, move container to scratchpad";
                 criteria = {
                   title = "^spotifytui$";
                 };
    @@ -8838,7 +9099,7 @@ Currently, I am too lazy to explain every option here, but most of it is very se
                 };
               }
               {
    -            command = "sticky enable";
    +            command = "resize set width 60 ppt height 60 ppt, sticky enable";
                 criteria = {
                   app_id = "discord";
                 };
    @@ -8879,16 +9140,7 @@ Currently, I am too lazy to explain every option here, but most of it is very se
         extraConfig =
           let
             inherit (config.wayland.windowManager.sway.config) modifier;
    -        swayfxSettings = "
    -          blur enable
    -          blur_xray disable
    -          blur_passes 1
    -          blur_radius 1
    -          shadows enable
    -          corner_radius 2
    -          titlebar_separator disable
    -          default_dim_inactive 0.02
    -      ";
    +        swayfxSettings = config.swarselsystems.swayfxConfig;
           in
           "
             exec_always autotiling
    @@ -8918,7 +9170,7 @@ Currently, I am too lazy to explain every option here, but most of it is very se
     
  • -
  • gpg-agent
    +
  • gpg-agent
    { pkgs, ... }:
    @@ -8940,14 +9192,30 @@ services.gpg-agent = {
     
  • +
  • gammastep
    +
    +
    +
    _:
    +{
    +  services.gammastep = {
    +    enable = true;
    +    provider = "manual";
    +    latitude = 48.210033;
    +    longitude = 16.363449;
    +  };
    +}
    +
    +
    +
    +
  • -
    -

    3.4.2. Optional

    +
    +

    3.4.2. Optional

      -
    1. Gaming
      +
    2. Gaming
      @@ -9005,6 +9273,16 @@ This tangles the flake.nix file; This block only needs to be touched when updati
       {
         description = "SwarseFlake - Nix Flake for all SwarselSystems";
       
      +  nixConfig = {
      +    extra-substituters = [
      +      "https://nix-community.cachix.org"
      +    ];
      +
      +    extra-trusted-public-keys = [
      +      "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
      +    ];
      +  };
      +
         inputs = {
       
           nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
      @@ -9102,20 +9380,20 @@ This tangles the flake.nix file; This block only needs to be touched when updati
             );
       
             # pkgs for home-manager builds
      -      homepkgs = import nixpkgs { system = "x86_64-linux";
      -                                  overlays = [ inputs.emacs-overlay.overlay
      -                                               inputs.nur.overlay
      -                                               inputs.nixgl.overlay
      -                                               (final: _prev: {
      -                                                 stable = import inputs.nixpkgs-stable {
      -                                                   inherit (final) system config;
      -                                                 };
      -                                               })
      -                                             ];
      -                                  config.allowUnfree = true;
      -                                };
      +      # homepkgs = import nixpkgs { system = "x86_64-linux";
      +      #                             overlays = [ inputs.emacs-overlay.overlay
      +      #                                          inputs.nur.overlay
      +      #                                          inputs.nixgl.overlay
      +      #                                          (final: _prev: {
      +      #                                            stable = import inputs.nixpkgs-stable {
      +      #                                              inherit (final) system config;
      +      #                                            };
      +      #                                          })
      +      #                                        ];
      +      #                             config.allowUnfree = true;
      +      #                           };
       
      -      # NixOS modules that can only be used on NixOS systems
      +      # # NixOS modules that can only be used on NixOS systems
             nixModules = [
               inputs.stylix.nixosModules.stylix
               inputs.sops-nix.nixosModules.sops
      @@ -9308,9 +9586,10 @@ This tangles the flake.nix file; This block only needs to be touched when updati
             homeConfigurations = {
       
                "swarsel@home-manager" = inputs.home-manager.lib.homeManagerConfiguration {
      -          pkgs = homepkgs;
      +          pkgs = pkgsFor.x86_64-linux;
      +          extraSpecialArgs = { inherit inputs outputs; };
                  modules = homeModules ++ mixedModules ++ [
      -             ./profiles/home-manager/home.nix
      +             ./profiles/home-manager
                  ];
                };
       
      @@ -9754,7 +10033,6 @@ Lastly, individual messages can be reenabled using the (advice-remove '<
       (advice-add 'org-unlogged-message :around #'suppress-messages)
       (advice-add 'magit-auto-revert-mode--init-kludge  :around #'suppress-messages)
       (advice-add 'push-mark  :around #'suppress-messages)
      -(advice-add 'timer-event-handler  :around #'suppress-messages)
       (advice-add 'evil-insert  :around #'suppress-messages)
       (advice-add 'evil-visual-char  :around #'suppress-messages)
       
      @@ -9883,7 +10161,7 @@ We set a hook that runs everytime we save the file. It would be a bit more effic
                               swarsel-swarsel-org-filepath)
             ;; Dynamic scoping to the rescue
             (let ((org-confirm-babel-evaluate nil))
      -        (org-html-export-to-html)
      +        ;; (org-html-export-to-html)
               (org-babel-tangle)
               (swarsel/run-formatting))))
       
      @@ -9998,7 +10276,7 @@ The standard Emacs behaviour for the Python process shell is a bit annoying. Thi
       
    3. -
    4. Nix common prefix bracketer
      +
    5. Nix common prefix bracketer

      This function searches for common delimiters in region and removes them, summarizing all captured lines by it. @@ -10031,7 +10309,7 @@ This function searches for common delimiters in region and removes them, summari

    -
  • Nix formatters
    +
  • Nix formatters

    This formats the org code block at point in accordance to the nixpkgs-fmt formatter @@ -10601,7 +10879,7 @@ This should setup a wordlist that can be used as a dictionary. However, for some

     ;; set the NixOS wordlist by hand
    -(setq ispell-alternate-dictionary "/nix/store/gjmvnbs97cnw19wnqh9m075cdbhy8r8g-wordlist-WORDLIST")
    +(setq ispell-alternate-dictionary (getenv "WORDLIST"))
     
     
    @@ -11604,8 +11882,8 @@ This adds a rudimentary nix-mode to Emacs. I have not really tried this out, as
  • -
    -

    4.4.3. nixpkgs-fmt

    +
    +

    4.4.3. nixpkgs-fmt

    Adds functions for formatting nix code. @@ -13399,7 +13677,6 @@ gpgconf --launch gpg-agent "${modifier}+t" = "exec sway output eDP-1 transform 90, splitv"; "${modifier}+XF86AudioLowerVolume" = "exec grim -g \"$(slurp)\" -t png - | wl-copy -t image/png"; "${modifier}+XF86AudioRaiseVolume" = "exec grim -g \"$(slurp)\" -t png - | wl-copy -t image/png"; - "${modifier}+w" = "exec \"bash ~/.dotfiles/scripts/checkgomuks.sh\""; }; startup = [ @@ -13620,7 +13897,7 @@ My laptop, sadly soon to be replaced by a new one, since most basic functions ar

    Author: Leon Schwarzäugl

    -

    Created: 2024-07-25 Do 17:05

    +

    Created: 2024-07-31 Mi 01:14

    Validate

    diff --git a/profiles/common/gammastep.nix b/profiles/common/gammastep.nix new file mode 100644 index 0000000..516dbf1 --- /dev/null +++ b/profiles/common/gammastep.nix @@ -0,0 +1,9 @@ +_: +{ + services.gammastep = { + enable = true; + provider = "manual"; + latitude = 48.210033; + longitude = 16.363449; + }; +} diff --git a/profiles/common/home/default.nix b/profiles/common/home/default.nix index 0566e31..0361ab1 100644 --- a/profiles/common/home/default.nix +++ b/profiles/common/home/default.nix @@ -27,6 +27,7 @@ ./mako.nix ./sway.nix ./gpg-agent.nix + ./gammastep.nix ]; nix = { diff --git a/profiles/common/home/gammastep.nix b/profiles/common/home/gammastep.nix new file mode 100644 index 0000000..516dbf1 --- /dev/null +++ b/profiles/common/home/gammastep.nix @@ -0,0 +1,9 @@ +_: +{ + services.gammastep = { + enable = true; + provider = "manual"; + latitude = 48.210033; + longitude = 16.363449; + }; +}