diff --git a/nix/configurations/installer/tungsten.nix b/nix/configurations/installer/tungsten.nix index 28526aa7..8388ad77 100644 --- a/nix/configurations/installer/tungsten.nix +++ b/nix/configurations/installer/tungsten.nix @@ -1,7 +1,4 @@ -{ - lib, - ... -}: { +{lib, ...}: { imports = [ ../../nixosModules/extra/macbook-swap-fn-ctrl.nix ../../configurations/tungsten/nixos/hardware-configuration.nix diff --git a/nix/configurations/tungsten/home/misc.nix b/nix/configurations/tungsten/home/misc.nix index 8d1f2d3d..76673db8 100644 --- a/nix/configurations/tungsten/home/misc.nix +++ b/nix/configurations/tungsten/home/misc.nix @@ -28,7 +28,6 @@ pkgs.last-resort ]; - home.file = { ".xscreensaver".source = "${./xscreensaver/.xscreensaver}"; }; diff --git a/nix/configurations/vanadium/nixos/programs.nix b/nix/configurations/vanadium/nixos/programs.nix index 279f6cc0..59a4b7c4 100644 --- a/nix/configurations/vanadium/nixos/programs.nix +++ b/nix/configurations/vanadium/nixos/programs.nix @@ -1,7 +1,4 @@ -{ - lib, - ... -}: { +{lib, ...}: { imports = [ # # Docker diff --git a/nix/configurations/vanadium/overlay.nix b/nix/configurations/vanadium/overlay.nix index bf42647e..14bedb4f 100644 --- a/nix/configurations/vanadium/overlay.nix +++ b/nix/configurations/vanadium/overlay.nix @@ -10,41 +10,42 @@ let infuse = lib.flip infuse-lib.v1.infuse; in # Why shouldn't I go crazy with overlays? - (final: infuse { - cmus.__input.alsaSupport = _: false; + (final: + infuse { + cmus.__input.alsaSupport = _: false; - fish.__input.usePython = _: false; + fish.__input.usePython = _: false; - tmux.__input.withSixel = _: false; + tmux.__input.withSixel = _: false; - ranger.__input.imagePreviewSupport = _: false; - ranger.__input.sixelPreviewSupport = _: false; + ranger.__input.imagePreviewSupport = _: false; + ranger.__input.sixelPreviewSupport = _: false; - vlc.__input.chromecastSupport = _: false; - vlc.__input.waylandSupport = _: false; + vlc.__input.chromecastSupport = _: false; + vlc.__input.waylandSupport = _: false; - # I don't really use helix, but it's nice to have the W alias just in case - helix.__output.patches.__append = [ - ./patches/helix/W-as-write.patch - ]; + # I don't really use helix, but it's nice to have the W alias just in case + helix.__output.patches.__append = [ + ./patches/helix/W-as-write.patch + ]; - fcitx5.__output.cmakeFlags.__append = [ - (lib.cmakeFeature "ENABLE_EMOJI" "Off") - (lib.cmakeFeature "ENABLE_WAYLAND" "Off") - ]; - fcitx5.__output.patches.__append = [ - ./patches/fcitx5/disable-clipboard.patch - ./patches/fcitx5/disable-quickphrase.patch - ./patches/fcitx5/disable-unicode.patch - ]; - fcitx5-chinese-addons.__output.cmakeFlags.__append = [ - (lib.cmakeFeature "ENABLE_BROWSER" "Off") - (lib.cmakeFeature "ENABLE_CLOUDPINYIN" "Off") - (lib.cmakeFeature "ENABLE_DATA" "Off") - ]; - fcitx5-chinese-addons.__output.patches.__append = [ - ./patches/fcitx5-chinese-addons/disable-chttrans.patch - ./patches/fcitx5-chinese-addons/disable-fullwidth.patch - # Note: disabling pinyin helper breaks canjie - ]; - }) + fcitx5.__output.cmakeFlags.__append = [ + (lib.cmakeFeature "ENABLE_EMOJI" "Off") + (lib.cmakeFeature "ENABLE_WAYLAND" "Off") + ]; + fcitx5.__output.patches.__append = [ + ./patches/fcitx5/disable-clipboard.patch + ./patches/fcitx5/disable-quickphrase.patch + ./patches/fcitx5/disable-unicode.patch + ]; + fcitx5-chinese-addons.__output.cmakeFlags.__append = [ + (lib.cmakeFeature "ENABLE_BROWSER" "Off") + (lib.cmakeFeature "ENABLE_CLOUDPINYIN" "Off") + (lib.cmakeFeature "ENABLE_DATA" "Off") + ]; + fcitx5-chinese-addons.__output.patches.__append = [ + ./patches/fcitx5-chinese-addons/disable-chttrans.patch + ./patches/fcitx5-chinese-addons/disable-fullwidth.patch + # Note: disabling pinyin helper breaks canjie + ]; + }) diff --git a/nix/devShells/flora.nix b/nix/devShells/flora.nix index 9b86e3d7..076867ee 100644 --- a/nix/devShells/flora.nix +++ b/nix/devShells/flora.nix @@ -14,19 +14,28 @@ in hlib = pkgs.haskell.lib; - callHackage = {name, version}: - let pkg = pkgs.haskell.packages.ghc910.callHackage name version {}; - in hlib.dontCheck (hlib.doJailbreak pkg); + callHackage = { + name, + version, + }: let + pkg = pkgs.haskell.packages.ghc910.callHackage name version {}; + in + hlib.dontCheck (hlib.doJailbreak pkg); in { name = "flora"; - packages = with pkgs; - let + packages = with pkgs; let haskellPackages = haskell.packages.ghc910; in # These don't build directly and need to be pinned map callHackage [ - {name = "fourmolu"; version = "0.17.0.0";} - {name = "postgresql-migration"; version = "0.2.1.8";} + { + name = "fourmolu"; + version = "0.17.0.0"; + } + { + name = "postgresql-migration"; + version = "0.2.1.8"; + } ] ++ [ haskellPackages.ghcid diff --git a/nix/homeModules/common/lazygit.nix b/nix/homeModules/common/lazygit.nix index ac966506..9a4ff0d6 100644 --- a/nix/homeModules/common/lazygit.nix +++ b/nix/homeModules/common/lazygit.nix @@ -1,7 +1,10 @@ -{config, lib, ...}: let - cfg = config.programs.lazygit; -in { + config, + lib, + ... +}: let + cfg = config.programs.lazygit; +in { programs.tmux.extraConfig = lib.mkIf cfg.enable '' bind -n C-g run-shell "tmux new-window ${lib.getExe cfg.package}" ''; diff --git a/nix/homeModules/common/neovim.nix b/nix/homeModules/common/neovim.nix index 1b7e4bf9..6df8c118 100644 --- a/nix/homeModules/common/neovim.nix +++ b/nix/homeModules/common/neovim.nix @@ -1,4 +1,9 @@ -{pkgs, lib, config, ...}: let +{ + pkgs, + lib, + config, + ... +}: let cfg = config.programs.neovim; in { config = lib.mkIf cfg.enable { diff --git a/nix/homeModules/extra/tmux-fish-integration.nix b/nix/homeModules/extra/tmux-fish-integration.nix index 6424ae35..f396a631 100644 --- a/nix/homeModules/extra/tmux-fish-integration.nix +++ b/nix/homeModules/extra/tmux-fish-integration.nix @@ -1,11 +1,17 @@ # This module integrates tmux with fish -{pkgs, lib, config, ...}: { - +{ + pkgs, + lib, + config, + ... +}: { assertions = [ - { assertion = config.programs.fish.enable; + { + assertion = config.programs.fish.enable; message = "Should have fish enabled"; } - { assertion = config.programs.tmux.enable; + { + assertion = config.programs.tmux.enable; message = "Should have tmux enabled"; } ]; @@ -26,5 +32,4 @@ home.packages = with pkgs; [ tmux-sessionizer ]; - } diff --git a/npins/default.nix b/npins/default.nix index 65924762..6e3194a2 100644 --- a/npins/default.nix +++ b/npins/default.nix @@ -1,11 +1,11 @@ /* - This file is provided under the MIT licence: +This file is provided under the MIT licence: - Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ # Generated by npins. Do not modify; will be overwritten regularly let @@ -13,8 +13,10 @@ let version = data.version; # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295 - range = - first: last: if first > last then [ ] else builtins.genList (n: first + n) (last - first + 1); + range = first: last: + if first > last + then [] + else builtins.genList (n: first + n) (last - first + 1); # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257 stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1)); @@ -27,120 +29,124 @@ let # If the environment variable NPINS_OVERRIDE_${name} is set, then use # the path directly as opposed to the fetched source. # (Taken from Niv for compatibility) - mayOverride = - name: path: - let - envVarName = "NPINS_OVERRIDE_${saneName}"; - saneName = stringAsChars (c: if (builtins.match "[a-zA-Z0-9]" c) == null then "_" else c) name; - ersatz = builtins.getEnv envVarName; - in - if ersatz == "" then - path + mayOverride = name: path: let + envVarName = "NPINS_OVERRIDE_${saneName}"; + saneName = stringAsChars (c: + if (builtins.match "[a-zA-Z0-9]" c) == null + then "_" + else c) + name; + ersatz = builtins.getEnv envVarName; + in + if ersatz == "" + then path else # this turns the string into an actual Nix path (for both absolute and # relative paths) builtins.trace "Overriding path of \"${name}\" with \"${ersatz}\" due to set \"${envVarName}\"" ( - if builtins.substring 0 1 ersatz == "/" then - /. + ersatz - else - /. + builtins.getEnv "PWD" + "/${ersatz}" + if builtins.substring 0 1 ersatz == "/" + then /. + ersatz + else /. + builtins.getEnv "PWD" + "/${ersatz}" ); - mkSource = - name: spec: - assert spec ? type; - let + mkSource = name: spec: + assert spec ? type; let path = - if spec.type == "Git" then - mkGitSource spec - else if spec.type == "GitRelease" then - mkGitSource spec - else if spec.type == "PyPi" then - mkPyPiSource spec - else if spec.type == "Channel" then - mkChannelSource spec - else if spec.type == "Tarball" then - mkTarballSource spec - else - builtins.throw "Unknown source type ${spec.type}"; + if spec.type == "Git" + then mkGitSource spec + else if spec.type == "GitRelease" + then mkGitSource spec + else if spec.type == "PyPi" + then mkPyPiSource spec + else if spec.type == "Channel" + then mkChannelSource spec + else if spec.type == "Tarball" + then mkTarballSource spec + else builtins.throw "Unknown source type ${spec.type}"; in - spec // { outPath = mayOverride name path; }; + spec // {outPath = mayOverride name path;}; - mkGitSource = - { - repository, - revision, - url ? null, - submodules, - hash, - branch ? null, - ... - }: + mkGitSource = { + repository, + revision, + url ? null, + submodules, + hash, + branch ? null, + ... + }: assert repository ? type; # At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository # In the latter case, there we will always be an url to the tarball - if url != null && !submodules then - builtins.fetchTarball { - inherit url; - sha256 = hash; # FIXME: check nix version & use SRI hashes - } - else - let + if url != null && !submodules + then + builtins.fetchTarball { + inherit url; + sha256 = hash; # FIXME: check nix version & use SRI hashes + } + else let url = - if repository.type == "Git" then - repository.url - else if repository.type == "GitHub" then - "https://github.com/${repository.owner}/${repository.repo}.git" - else if repository.type == "GitLab" then - "${repository.server}/${repository.repo_path}.git" - else - throw "Unrecognized repository type ${repository.type}"; - urlToName = - url: rev: - let - matched = builtins.match "^.*/([^/]*)(\\.git)?$" url; + if repository.type == "Git" + then repository.url + else if repository.type == "GitHub" + then "https://github.com/${repository.owner}/${repository.repo}.git" + else if repository.type == "GitLab" + then "${repository.server}/${repository.repo_path}.git" + else throw "Unrecognized repository type ${repository.type}"; + urlToName = url: rev: let + matched = builtins.match "^.*/([^/]*)(\\.git)?$" url; - short = builtins.substring 0 7 rev; + short = builtins.substring 0 7 rev; - appendShort = if (builtins.match "[a-f0-9]*" rev) != null then "-${short}" else ""; - in - "${if matched == null then "source" else builtins.head matched}${appendShort}"; + appendShort = + if (builtins.match "[a-f0-9]*" rev) != null + then "-${short}" + else ""; + in "${ + if matched == null + then "source" + else builtins.head matched + }${appendShort}"; name = urlToName url revision; in - builtins.fetchGit { - rev = revision; - inherit name; - # hash = hash; - inherit url submodules; - }; + builtins.fetchGit { + rev = revision; + inherit name; + # hash = hash; + inherit url submodules; + }; - mkPyPiSource = - { url, hash, ... }: + mkPyPiSource = { + url, + hash, + ... + }: builtins.fetchurl { inherit url; sha256 = hash; }; - mkChannelSource = - { url, hash, ... }: + mkChannelSource = { + url, + hash, + ... + }: builtins.fetchTarball { inherit url; sha256 = hash; }; - mkTarballSource = - { - url, - locked_url ? url, - hash, - ... - }: + mkTarballSource = { + url, + locked_url ? url, + hash, + ... + }: builtins.fetchTarball { url = locked_url; sha256 = hash; }; in -if version == 5 then - builtins.mapAttrs mkSource data.pins -else - throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`" + if version == 5 + then builtins.mapAttrs mkSource data.pins + else throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`"