diff --git a/flake.nix b/flake.nix index af999bc..8e518a6 100644 --- a/flake.nix +++ b/flake.nix @@ -94,7 +94,6 @@ overlays = [ inputs.hypr-contrib.overlays.default - inputs.hyprland.overlays.default inputs.neovim-nightly-overlay.overlay overlay ]; diff --git a/modules/profiles/base.nix b/modules/profiles/base.nix index 459a65d..d79ad69 100644 --- a/modules/profiles/base.nix +++ b/modules/profiles/base.nix @@ -34,42 +34,54 @@ let which-nix = pkgs.writeFishApplication { name = "which-nix"; - runtimeInputs = with pkgs; [ which coreutils-full ]; + runtimeInputs = with pkgs; [ which coreutils-full procps ]; text = /* fish */ '' - readlink -f (which $argv) + function recurse -a path; + if not test -f "$path" + return + end + + echo $path + if test -L $path + recurse (readlink $path) + end + end + + for arg in $argv + recurse (which $arg) + end ''; completions = /* fish */ '' complete -c which-nix -fa '(__fish_complete_command)' ''; }; - gi = pkgs.writeFishApplication - { - name = "gi"; - runtimeInputs = with pkgs; [ fzf gum curl ]; - text = /* fish */ '' - set url https://www.gitignore.io/api + gi = pkgs.writeFishApplication { + name = "gi"; + runtimeInputs = with pkgs; [ fzf gum curl ]; + text = /* fish */ '' + set url https://www.gitignore.io/api - if test (count $argv) -eq 0 - set choice ( curl -sL $url/list \ - | string split "," \ - | fzf -m \ - | string join "," ) - else - set choice (string join "," $argv[1..]) - end + if test (count $argv) -eq 0 + set choice ( curl -sL $url/list \ + | string split "," \ + | fzf -m \ + | string join "," ) + else + set choice (string join "," $argv[1..]) + end - if gum confirm "Overwrite current .gitignore?" - curl -sL $url/$choice > .gitignore - else - curl -sL $url/$choice >> .gitignore - end - ''; - completions = /* fish */ '' - set args (curl -sL https://www.gitignore.io/api/list | string split ",") - complete -c gi -fa "$args" - ''; - }; + if gum confirm "Overwrite current .gitignore?" + curl -sL $url/$choice > .gitignore + else + curl -sL $url/$choice >> .gitignore + end + ''; + completions = /* fish */ '' + set args (curl -sL https://www.gitignore.io/api/list | string split ",") + complete -c gi -fa "$args" + ''; + }; in { users.users.moritz = { diff --git a/modules/programs/fish.nix b/modules/programs/fish.nix index de683ab..f6e8c92 100644 --- a/modules/programs/fish.nix +++ b/modules/programs/fish.nix @@ -8,9 +8,12 @@ with lib; let cfg = config.my.programs.fish; shellConfig = config.my.shell; - exportVariables = - lib.mapAttrsToList (n: v: ''set -x ${n} "${v}"'') shellConfig.variables; - exportedVariables = lib.concatStringsSep "\n" exportVariables; + exportedVariables = + let + exportVariables = + lib.mapAttrsToList (n: v: ''set -x ${n} "${v}"'') shellConfig.variables; + in + lib.concatStringsSep "\n" exportVariables; in { options.my.programs.fish.enable = mkEnableOption "fish"; diff --git a/modules/programs/hyprland/default.nix b/modules/programs/hyprland/default.nix index e208565..7c1cefa 100644 --- a/modules/programs/hyprland/default.nix +++ b/modules/programs/hyprland/default.nix @@ -9,7 +9,8 @@ with lib; let cfg = config.my.programs.hyprland; - hyprland = pkgs.hyprland.override { enableNvidiaPatches = cfg.nvidiaSupport; }; + hyprland-nvidia = pkgs.hyprland.override { enableNvidiaPatches = true; }; + hyprland = if cfg.nvidiaSupport then hyprland-nvidia else pkgs.hyprland; in { options.my.programs.hyprland = { diff --git a/modules/services/openconnect.nix b/modules/services/openconnect.nix index 87c37a1..6eddd64 100644 --- a/modules/services/openconnect.nix +++ b/modules/services/openconnect.nix @@ -17,7 +17,7 @@ in gateway = "vpn.uni-leipzig.de"; protocol = "anyconnect"; user = "mb18cele@uni-leipzig.de"; - # NOTE file content as follows: + # NOTE: file content as follows: # # "1-Standard-Uni" or "2-Spezial-Alles" # Explanation: diff --git a/overlays/builders.nix b/overlays/builders.nix index 813b7d3..359a4af 100644 --- a/overlays/builders.nix +++ b/overlays/builders.nix @@ -2,7 +2,33 @@ _: final: _: with final.lib; -{ +rec { + fishFile = + { name + , destination + , content + , checkPhase ? null + }: + final.writeTextFile { + inherit name destination; + executable = true; + allowSubstitutes = true; + preferLocalBuild = false; + text = '' + #!${getExe final.fish} + + ${content} + ''; + + checkPhase = + if checkPhase == null then '' + runHook preCheck + ${getExe final.fish} -n "$target" + runHook postCheck + '' + else checkPhase; + }; + writeFishApplication = { name , text @@ -11,30 +37,21 @@ with final.lib; , checkPhase ? null }: let - fishFile = destination: content: final.writeTextFile { - inherit name destination; - executable = true; - allowSubstitutes = true; - preferLocalBuild = false; - text = '' - #!${getExe final.fish} + runtimeHeader = optionalString (runtimeInputs != [ ]) + ''export PATH="${makeBinPath runtimeInputs}:$PATH"''; - ${optionalString (runtimeInputs != [ ]) ''export PATH="${makeBinPath runtimeInputs}:$PATH"''} - - ${content} - ''; - - checkPhase = - if checkPhase == null then '' - runHook preCheck - ${getExe final.fish} -n "$target" - runHook postCheck - '' - else checkPhase; + script = fishFile { + inherit checkPhase; + name = "${name}_script"; + destination = "/bin/${name}"; + content = concatLines [ runtimeHeader text ]; + }; + completions_file = fishFile { + inherit checkPhase; + name = "${name}_completions"; + destination = "/share/fish/vendor_completions.d/${name}.fish"; + content = concatLines [ runtimeHeader completions ]; }; - - script = fishFile "/bin/${name}" text; - completions_file = fishFile "/share/fish/vendor_completions.d/${name}.fish" completions; in final.symlinkJoin { inherit name; diff --git a/overlays/packages.nix b/overlays/packages.nix index 66b2624..973523e 100644 --- a/overlays/packages.nix +++ b/overlays/packages.nix @@ -11,6 +11,7 @@ final: prev: version = lib.my.mkVersionInput inputs.rofi-wayland; }); timers = inputs.timers.packages.${prev.system}.default; + hyprland = inputs.hyprland.packages.${prev.system}.default; fzf1 = final.writeShellApplication { name = "fzf1";