chore/update-infra-07-23 #236
|
@ -15,6 +15,8 @@ steps:
|
|||
commands:
|
||||
- 'echo DEBUG: Using NIX_FLAGS: $NIX_FLAGS'
|
||||
- nix $$NIX_FLAGS develop --command nix flake show
|
||||
- nix $$NIX_FLAGS develop --command treefmt --fail-on-change
|
||||
- nix $$NIX_FLAGS develop --command editorconfig-checker
|
||||
- nix $$NIX_FLAGS build ".#nixosConfigurations.flora-6.config.system.build.toplevel"
|
||||
|
||||
---
|
||||
|
@ -147,6 +149,6 @@ volumes:
|
|||
|
||||
---
|
||||
kind: signature
|
||||
hmac: 5c2b65a2c015f5f11e6d61349693246e3e3c2e88d6aa97d04cb935b13b48b80b
|
||||
hmac: 17811add241edae457584ba78389886df02b5e51820d826ef5fb2d97de2430e2
|
||||
|
||||
...
|
||||
|
|
|
@ -15,6 +15,9 @@ end_of_line = unset
|
|||
insert_final_newline = unset
|
||||
trim_trailing_whitespace = unset
|
||||
indent_size = unset
|
||||
charset = unset
|
||||
indent_style = unset
|
||||
indent_size = unset
|
||||
|
||||
[{.*,secrets}/**]
|
||||
end_of_line = unset
|
||||
|
|
33
CONTRIBUTING.md
Normal file
33
CONTRIBUTING.md
Normal file
|
@ -0,0 +1,33 @@
|
|||
# Quick branch overview
|
||||
|
||||
We work with several branches in this repo. This document aims to explain how
|
||||
to contribute changes to the existing branches.
|
||||
|
||||
### `main` branch
|
||||
|
||||
- Changes to `modules` and `profiles` should go [the main branch](https://git.pub.solar/pub-solar/os/src/branch/main)
|
||||
- Changes can get accepted via: Pull Request
|
||||
- Branch protected from direct `git push`
|
||||
|
||||
### `infra` branch
|
||||
|
||||
- Changes to the [pub.solar](https://pub.solar) infrastructure should be merged [into this branch](https://git.pub.solar/pub-solar/os/src/branch/infra)
|
||||
- Changes can get accepted via: Pull Request
|
||||
- Branch protected from direct `git push`
|
||||
|
||||
### `momo/main` branch
|
||||
|
||||
- Changes to the [Momo](https://momo.koeln) infrastructure should be merged [into this branch](https://git.pub.solar/pub-solar/os/src/branch/momo/main)
|
||||
- Changes can get accepted via: Pull Request
|
||||
- Deployment of changes is [automatic via CI pipeline](https://git.pub.solar/pub-solar/os/src/commit/43bd7421509f7cc9ba06d7c740f3f536a4a2af76/.drone.yml#L20-L38)
|
||||
- Branch protected from direct `git push`
|
||||
|
||||
### `$USER` branches
|
||||
|
||||
- User's custom hosts and changes can be worked on in these branches
|
||||
- Direct `git push` possible
|
||||
- Examples:
|
||||
- [hensoko](https://git.pub.solar/pub-solar/os/src/branch/hensoko)
|
||||
- [b12f](https://git.pub.solar/pub-solar/os/src/branch/b12f)
|
||||
- [axeman](https://git.pub.solar/pub-solar/os/src/branch/axeman)
|
||||
- [teutat3s](https://git.pub.solar/pub-solar/os/src/branch/teutat3s)
|
39
flake.lock
39
flake.lock
|
@ -30,11 +30,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1688145780,
|
||||
"narHash": "sha256-dNUINvO7qM7fItWSeqL2nE/F3IHCGZEeERMkm1i4pP4=",
|
||||
"lastModified": 1688307440,
|
||||
"narHash": "sha256-7PTjbN+/+b799YN7Tk2SS5Vh8A0L3gBo8hmB7Y0VXug=",
|
||||
"owner": "LnL7",
|
||||
"repo": "nix-darwin",
|
||||
"rev": "43587cdb726f73b962f12028055520dbd1d7233f",
|
||||
"rev": "b06bab83bdf285ea0ae3c8e145a081eb95959047",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -291,27 +291,6 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"agenix",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1682203081,
|
||||
"narHash": "sha256-kRL4ejWDhi0zph/FpebFYhzqlOBrk0Pl3dzGEKSAlEw=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "32d3e39c491e2f91152c84f8ad8b003420eab0a1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"keycloak-theme-pub-solar": {
|
||||
"inputs": {
|
||||
"devshell": "devshell_2",
|
||||
|
@ -337,11 +316,11 @@
|
|||
},
|
||||
"latest": {
|
||||
"locked": {
|
||||
"lastModified": 1688231357,
|
||||
"narHash": "sha256-ZOn16X5jZ6X5ror58gOJAxPfFLAQhZJ6nOUeS4tfFwo=",
|
||||
"lastModified": 1689192006,
|
||||
"narHash": "sha256-QM0f0d8oPphOTYJebsHioR9+FzJcy1QNIzREyubB91U=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "645ff62e09d294a30de823cb568e9c6d68e92606",
|
||||
"rev": "2de8efefb6ce7f5e4e75bdf57376a96555986841",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -353,11 +332,11 @@
|
|||
},
|
||||
"nixos": {
|
||||
"locked": {
|
||||
"lastModified": 1688109178,
|
||||
"narHash": "sha256-BSdeYp331G4b1yc7GIRgAnfUyaktW2nl7k0C577Tttk=",
|
||||
"lastModified": 1689209875,
|
||||
"narHash": "sha256-8AVcBV1DiszaZzHFd5iLc8HSLfxRAuqcU0QdfBEF3Ag=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "b72aa95f7f096382bff3aea5f8fde645bca07422",
|
||||
"rev": "fcc147b1e9358a8386b2c4368bd928e1f63a7df2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -195,7 +195,7 @@
|
|||
# profilesOrder = ["system" "direnv"];
|
||||
# profiles.direnv = {
|
||||
# user = "bartender";
|
||||
# path = self.channels.nixos.deploy-rs.lib.x86_64-linux.activate.home-manager self.homeConfigurationsPortable.x86_64-linux.bartender;
|
||||
# path = self.pkgs.x86_64-linux.nixos.deploy-rs.lib.x86_64-linux.activate.home-manager self.homeConfigurationsPortable.x86_64-linux.bartender;
|
||||
# };
|
||||
#};
|
||||
};
|
||||
|
|
|
@ -5,11 +5,6 @@
|
|||
self,
|
||||
...
|
||||
}: {
|
||||
# Changing the Caddyfile should only trigger a reload, not a restart
|
||||
systemd.services.caddy.reloadTriggers = [
|
||||
config.services.caddy.configFile
|
||||
];
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"d '/data/srv/www/os/download/' 0750 hakkonaut hakkonaut - -"
|
||||
];
|
||||
|
@ -18,7 +13,10 @@
|
|||
enable = lib.mkForce true;
|
||||
group = "hakkonaut";
|
||||
email = "admins@pub.solar";
|
||||
globalConfig = lib.mkForce "";
|
||||
enableReload = true;
|
||||
globalConfig = lib.mkForce ''
|
||||
grace_period 60s
|
||||
'';
|
||||
virtualHosts = {
|
||||
"pub.solar" = {
|
||||
logFormat = lib.mkForce ''
|
||||
|
|
|
@ -27,9 +27,11 @@ in {
|
|||
profiles.users.barkeeper
|
||||
|
||||
"${latestModulesPath}/services/misc/gitea.nix"
|
||||
"${latestModulesPath}/services/web-servers/caddy/default.nix"
|
||||
];
|
||||
disabledModules = [
|
||||
"services/misc/gitea.nix"
|
||||
"services/web-servers/caddy/default.nix"
|
||||
];
|
||||
|
||||
config = {
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; {
|
||||
# Both things below are for
|
||||
# https://github.com/NixOS/nixpkgs/issues/124215
|
||||
documentation.info.enable = lib.mkForce false;
|
||||
nix.settings.extra-sandbox-paths = ["/bin/sh=${pkgs.bash}/bin/sh"];
|
||||
}
|
|
@ -19,7 +19,7 @@ in {
|
|||
# Run when initializing an interactive shell
|
||||
initExtra = ''
|
||||
# Show current directory at the top in Alacritty
|
||||
PROMPT_COMMAND='echo -e -n "\e]2;$(basename "$PWD")\e\\"'
|
||||
PROMPT_COMMAND='echo -e -n "\e]2;$(basename "$PWD" | sed "s/${psCfg.user.name}/~/")\e\\"'
|
||||
|
||||
# If a command is not found, show me where it is
|
||||
source ${pkgs.nix-index}/etc/profile.d/command-not-found.sh
|
||||
|
@ -34,7 +34,7 @@ in {
|
|||
|
||||
# Syntax highlighting, auto suggestions, vim modes, etc.
|
||||
# https://github.com/akinomyoga/ble.sh/wiki/Manual-A1-Installation#user-content-nixpkgs
|
||||
source "$(blesh-share)" --attach=none
|
||||
source "$(blesh-share)"/ble.sh --attach=none
|
||||
# ctrl + space to accept autocomplete suggestion
|
||||
ble-bind -m 'auto_complete' -f 'C-@' 'auto_complete/insert-on-end'
|
||||
# Meta (Alt) + Backspace to delete a word
|
||||
|
@ -59,6 +59,7 @@ in {
|
|||
}
|
||||
blehook/eval-after-load complete my/complete-load-hook
|
||||
|
||||
bleopt exec_elapsed_mark=
|
||||
bleopt exec_errexit_mark=
|
||||
bleopt filename_ls_colors="$LS_COLORS"
|
||||
|
||||
|
@ -84,6 +85,11 @@ in {
|
|||
fi
|
||||
|
||||
# end of .bashrc
|
||||
# Somehow we need to ensure starship starts later than ble.sh
|
||||
# (possible packaging issue?)
|
||||
# https://github.com/akinomyoga/ble.sh/issues/333
|
||||
eval "$(${pkgs.starship}/bin/starship init bash)"
|
||||
|
||||
[[ ''${BLE_VERSION-} ]] && ble-attach
|
||||
'';
|
||||
|
||||
|
|
|
@ -10,8 +10,5 @@
|
|||
"--color=fg:#d3d1d4,header:#7accd7,info:#e5c463,pointer:#ef9062"
|
||||
"--color=marker:#ef9062,fg+:#303030,prompt:#e5c463,hl+:#7accd7"
|
||||
];
|
||||
# Use ble.sh for completions, see
|
||||
# modules/terminal-life/bash/default.nix -> bleopt complete_menu_style=desc
|
||||
# and https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A77-Completion
|
||||
enableBashIntegration = false;
|
||||
enableBashIntegration = true;
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
let g:clipboard = {
|
||||
\ 'name': 'wayland-strip-carriage',
|
||||
\ 'copy': {
|
||||
\ '+': 'wl-copy --foreground --type text/plain',
|
||||
\ '*': 'wl-copy --foreground --type text/plain --primary',
|
||||
\ '+': 'wl-copy --foreground --type text/plain --trim-newline',
|
||||
\ '*': 'wl-copy --foreground --type text/plain --primary --trim-newline',
|
||||
\ },
|
||||
\ 'paste': {
|
||||
\ '+': {-> systemlist('wl-paste --no-newline | tr -d "\r"')},
|
||||
|
|
|
@ -25,6 +25,7 @@ in {
|
|||
ansible-language-server
|
||||
ccls
|
||||
gopls
|
||||
nixd
|
||||
nodejs
|
||||
nodePackages.bash-language-server
|
||||
nodePackages.dockerfile-language-server-nodejs
|
||||
|
@ -37,9 +38,8 @@ in {
|
|||
nodePackages.yaml-language-server
|
||||
python3Packages.python-lsp-server
|
||||
python3Full
|
||||
solargraph
|
||||
rnix-lsp
|
||||
rust-analyzer
|
||||
solargraph
|
||||
terraform-ls
|
||||
universal-ctags
|
||||
];
|
||||
|
|
|
@ -122,9 +122,9 @@ lua <<EOF
|
|||
}
|
||||
}
|
||||
},
|
||||
'nixd', --------------------------------- Nix
|
||||
'phpactor', ----------------------------- PHP
|
||||
'pylsp', -------------------------------- Python
|
||||
'rnix', --------------------------------- Nix
|
||||
'solargraph', --------------------------- Ruby
|
||||
'rust_analyzer', ------------------------ Rust
|
||||
['sqlls'] = {
|
||||
|
|
|
@ -1,5 +1,32 @@
|
|||
final: prev: {
|
||||
blesh = prev.blesh.overrideAttrs (oldAttrs: rec {
|
||||
inherit (prev.sources.blesh-nvfetcher) version src;
|
||||
|
||||
dontBuild = false;
|
||||
buildInputs = [prev.git];
|
||||
patchPhase = ''
|
||||
substituteInPlace GNUmakefile \
|
||||
--replace "git submodule update --init --recursive" ""
|
||||
'';
|
||||
nativeCheckInputs = oldAttrs.nativeCheckInputs ++ [prev.busybox];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p "$out/share/blesh/lib"
|
||||
|
||||
cat <<EOF >"$out/share/blesh/lib/_package.sh"
|
||||
_ble_base_package_type=nix
|
||||
|
||||
function ble/base/package:nix/update {
|
||||
echo "Ble.sh is installed by Nix. You can update it there." >&2
|
||||
return 1
|
||||
}
|
||||
EOF
|
||||
|
||||
make install INSDIR=$out/share/blesh
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
});
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ channels: final: prev: {
|
|||
|
||||
inherit
|
||||
(channels.latest)
|
||||
nixd
|
||||
;
|
||||
|
||||
haskellPackages =
|
||||
|
@ -18,4 +19,6 @@ channels: final: prev: {
|
|||
;
|
||||
});
|
||||
});
|
||||
|
||||
vimPlugins = prev.vimPlugins // {inherit (channels.latest.vimPlugins) nvim-lspconfig;};
|
||||
}
|
||||
|
|
|
@ -3,17 +3,17 @@
|
|||
{
|
||||
blesh-nvfetcher = {
|
||||
pname = "blesh-nvfetcher";
|
||||
version = "f16c0d807c8e1fe26fa5d990b561829382cbdc72";
|
||||
version = "1afc616b890e487926897e5b3e3a33e0ad833cb3";
|
||||
src = fetchFromGitHub {
|
||||
owner = "akinomyoga";
|
||||
repo = "ble.sh";
|
||||
rev = "f16c0d807c8e1fe26fa5d990b561829382cbdc72";
|
||||
rev = "1afc616b890e487926897e5b3e3a33e0ad833cb3";
|
||||
fetchSubmodules = true;
|
||||
deepClone = false;
|
||||
leaveDotGit = true;
|
||||
sha256 = "sha256-+tcM1z9uD7WXA7CfHmTbcPRcZfmXZ+Y7y6Bj4QA3f+4=";
|
||||
sha256 = "sha256-gDxx7nDleS2HWIJWc208gcTzuRUEu/JCyepTuOJDAGo=";
|
||||
};
|
||||
date = "2023-06-12";
|
||||
date = "2023-06-29";
|
||||
};
|
||||
instant-nvim-nvfetcher = {
|
||||
pname = "instant-nvim-nvfetcher";
|
||||
|
@ -111,16 +111,4 @@
|
|||
};
|
||||
date = "2022-07-03";
|
||||
};
|
||||
waybar-nvfetcher = {
|
||||
pname = "waybar-nvfetcher";
|
||||
version = "41164905351436db3a124207261f9dd759c6fa1b";
|
||||
src = fetchFromGitHub {
|
||||
owner = "Alexays";
|
||||
repo = "Waybar";
|
||||
rev = "41164905351436db3a124207261f9dd759c6fa1b";
|
||||
fetchSubmodules = false;
|
||||
sha256 = "sha256-aogiOj4pe2AJYxQFh8Dw6xQ2Tb6v4W9zwbGX4t2mStI=";
|
||||
};
|
||||
date = "2023-06-27";
|
||||
};
|
||||
}
|
||||
|
|
|
@ -31,10 +31,6 @@ fetch.github = "zeekay/vim-beautify"
|
|||
src.git = "https://github.com/romainl/Apprentice"
|
||||
fetch.github = "romainl/Apprentice"
|
||||
|
||||
[waybar-nvfetcher]
|
||||
src.git = "https://github.com/Alexays/Waybar"
|
||||
fetch.github = "Alexays/Waybar"
|
||||
|
||||
[blesh-nvfetcher]
|
||||
src.git = "https://github.com/akinomyoga/ble.sh"
|
||||
fetch.github = "akinomyoga/ble.sh"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
self:
|
||||
with self; ''
|
||||
#!/usr/bin/env bash
|
||||
# terminal application launcher for sway, using fzf
|
||||
# original command:
|
||||
# Based on: https://github.com/swaywm/sway/issues/1367
|
||||
# bindsym $altkey+space exec termite --name=launcher -e \
|
||||
|
|
111
profiles/base-user/.gitignore
vendored
111
profiles/base-user/.gitignore
vendored
|
@ -1,111 +0,0 @@
|
|||
*
|
||||
|
||||
!*.nix
|
||||
!/.gitignore
|
||||
|
||||
!/.zshrc
|
||||
!/.Xdefaults
|
||||
!/.Xresources
|
||||
!/.xinitrc
|
||||
!/.config
|
||||
|
||||
!/assets
|
||||
!/assets/wallpaper.jpg
|
||||
|
||||
!/.config/dircolors
|
||||
|
||||
!/.config/xmodmap
|
||||
|
||||
!/.config/environment.d
|
||||
!/.config/environment.d/profile.conf
|
||||
!/.config/environment.d/drone.conf
|
||||
!/.config/environment.d/restic.conf
|
||||
|
||||
!/.config/user-dirs.dirs
|
||||
!/.config/user-dirs.locale
|
||||
|
||||
!/.config/gtk-2.0
|
||||
!/.config/gtk-2.0/gtkrc
|
||||
|
||||
!/.config/gtk-3.0
|
||||
!/.config/gtk-3.0/settings.ini
|
||||
|
||||
!/.config/xsettingsd
|
||||
!/.config/xsettingsd/xsettingsd.conf
|
||||
|
||||
!/.config/mako
|
||||
!/.config/mako/config
|
||||
|
||||
!/.config/alacritty
|
||||
!/.config/alacritty/alacritty.yml
|
||||
|
||||
!/.config/git
|
||||
!/.config/git/config
|
||||
|
||||
!/.config/vifm
|
||||
!/.config/vifm/vifmrc
|
||||
!/.config/vifm/scripts
|
||||
!/.config/vifm/colors
|
||||
!/.config/vifm/colors/base16.vifm
|
||||
|
||||
!/.config/nvim
|
||||
!/.config/nvim/init.vim
|
||||
!/.config/nvim/clipboard.vim
|
||||
!/.config/nvim/lsp.vim
|
||||
!/.config/nvim/quickfixopenall.vim
|
||||
!/.config/nvim/ui.vim
|
||||
|
||||
!/.config/mimeapps.list
|
||||
|
||||
!/.config/libinput-gestures.conf
|
||||
|
||||
!/.config/sway
|
||||
!/.config/sway/config
|
||||
!/.config/sway/config.d
|
||||
!/.config/sway/config.d/applications.conf
|
||||
!/.config/sway/config.d/autostart.conf
|
||||
!/.config/sway/config.d/colorscheme.conf
|
||||
!/.config/sway/config.d/custom-keybindings.conf
|
||||
!/.config/sway/config.d/gaps.conf
|
||||
!/.config/sway/config.d/input-defaults.conf
|
||||
!/.config/sway/config.d/systemd.conf
|
||||
!/.config/sway/config.d/theme.conf
|
||||
!/.config/sway/config.d/biolimo
|
||||
!/.config/sway/config.d/biolimo/screens.conf
|
||||
!/.config/sway/config.d/biolimo/inputs.conf
|
||||
!/.config/sway/config.d/chocolatebar
|
||||
!/.config/sway/config.d/chocolatebar/screens.conf
|
||||
|
||||
!/.config/waybar
|
||||
!/.config/waybar/colorscheme.css
|
||||
!/.config/waybar/config
|
||||
!/.config/waybar/style.css
|
||||
|
||||
!/.config/mutt
|
||||
!/.config/mutt/muttrc
|
||||
!/.config/mutt/base16.muttrc
|
||||
!/.config/mutt/mailcap
|
||||
|
||||
!/.config/offlineimap
|
||||
!/.config/offlineimap/functions.py
|
||||
|
||||
!/.local
|
||||
!/.local/bin
|
||||
!/.local/bin/install-base
|
||||
!/.local/bin/swaylock-bg
|
||||
!/.local/bin/sway-launcher
|
||||
!/.local/bin/sway-service
|
||||
!/.local/bin/toggle-kbd-layout
|
||||
!/.local/bin/wcwd
|
||||
!/.local/bin/vifmrun
|
||||
!/.local/bin/vifmimg
|
||||
!/.local/bin/s
|
||||
!/.local/bin/windows
|
||||
!/.local/bin/import-gtk-settings
|
||||
!/.local/bin/mailto-mutt
|
||||
!/.local/bin/setup-host-conf
|
||||
!/.local/bin/steam-xdg
|
||||
|
||||
!/.local/share
|
||||
!/.local/share/applications
|
||||
!/.local/share/applications/userapp-Firefox.desktop
|
|
@ -21,11 +21,12 @@ in {
|
|||
isNormalUser = true;
|
||||
description = psCfg.user.description;
|
||||
extraGroups = [
|
||||
"wheel"
|
||||
"input"
|
||||
"networkmanager"
|
||||
"lp"
|
||||
"networkmanager"
|
||||
"scanner"
|
||||
"video"
|
||||
"wheel"
|
||||
];
|
||||
initialHashedPassword =
|
||||
if psCfg.user.password != null
|
||||
|
|
|
@ -27,6 +27,16 @@ in {
|
|||
|
||||
programs.dircolors.enable = true;
|
||||
|
||||
programs.less = {
|
||||
enable = true;
|
||||
keys = ''
|
||||
k forw-line
|
||||
i back-line
|
||||
K forw-scroll
|
||||
I back-scroll
|
||||
'';
|
||||
};
|
||||
|
||||
home.file."xinitrc".source = ./.xinitrc;
|
||||
|
||||
xdg.enable = true;
|
||||
|
|
|
@ -1,38 +1,9 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if git rev-parse --verify HEAD >/dev/null 2>&1; then
|
||||
against=HEAD
|
||||
else
|
||||
# Initial commit: diff against an empty tree object
|
||||
against=$(${git}/bin/git hash-object -t tree /dev/null)
|
||||
fi
|
||||
|
||||
# Stash only unstaged changes, keeping staged changes
|
||||
old_stash=$(git rev-parse --quiet --verify refs/stash)
|
||||
git stash push --quiet --keep-index -m 'Unstaged changes before pre-commit hook'
|
||||
new_stash=$(git rev-parse --quiet --verify refs/stash)
|
||||
|
||||
diff="git diff-index --name-only --cached $against --diff-filter d"
|
||||
|
||||
mapfile -t all_files < <($diff)
|
||||
|
||||
# Format staged files
|
||||
if ((${#all_files[@]} != 0)); then
|
||||
treefmt "${all_files[@]}" &&
|
||||
git add "${all_files[@]}"
|
||||
fi
|
||||
|
||||
# If unstaged changes were stashed re-apply to working tree
|
||||
if [ "$old_stash" != "$new_stash" ]; then
|
||||
git stash pop --quiet
|
||||
fi
|
||||
|
||||
# Check editorconfig
|
||||
if ((${#all_files[@]} != 0)); then
|
||||
if ! editorconfig-checker -- "${all_files[@]}"; then
|
||||
printf "%b\n" \
|
||||
"\nCode is not aligned with .editorconfig" \
|
||||
"Review the output and commit your fixes" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! editorconfig-checker; then
|
||||
printf "%b\n" \
|
||||
"\nCode is not aligned with .editorconfig" \
|
||||
"Review the output and commit your fixes" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue