Merge branch 'main' into teutat3s
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
teutat3s 2023-07-13 17:18:05 +02:00
commit 92a7c57f96
Signed by: teutat3s
GPG key ID: 4FA1D3FA524F22C1
6 changed files with 58 additions and 49 deletions

View file

@ -15,6 +15,8 @@ steps:
commands: commands:
- 'echo DEBUG: Using NIX_FLAGS: $NIX_FLAGS' - 'echo DEBUG: Using NIX_FLAGS: $NIX_FLAGS'
- nix $$NIX_FLAGS develop --command nix flake show - 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.PubSolarOS.config.system.build.toplevel" - nix $$NIX_FLAGS build ".#nixosConfigurations.PubSolarOS.config.system.build.toplevel"
--- ---
@ -147,6 +149,6 @@ volumes:
--- ---
kind: signature kind: signature
hmac: 6aee0ffe22111bb629c0a79940bfbc3fa75f68c5ed5c4bba68abf6797b87a7ab hmac: a116f78a0b22188052893bdb46aa40f8de66438826c10ced362ea183d7644d67
... ...

View file

@ -15,6 +15,9 @@ end_of_line = unset
insert_final_newline = unset insert_final_newline = unset
trim_trailing_whitespace = unset trim_trailing_whitespace = unset
indent_size = unset indent_size = unset
charset = unset
indent_style = unset
indent_size = unset
[{.*,secrets}/**] [{.*,secrets}/**]
end_of_line = unset end_of_line = unset

33
CONTRIBUTING.md Normal file
View 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)

View file

@ -75,11 +75,10 @@
nixos = { nixos = {
imports = [(digga.lib.importOverlays ./overlays)]; imports = [(digga.lib.importOverlays ./overlays)];
overlays = [ overlays = [
deploy.overlay
(self: super: { (self: super: {
deploy-rs = { deploy-rs = {
inherit (inputs.nixos.legacyPackages.x86_64-linux) deploy-rs; inherit (inputs.nixos.legacyPackages.x86_64-linux) deploy-rs;
lib = super.deploy-rs.lib; lib = inputs.deploy.lib.x86_64-linux;
}; };
}) })
]; ];
@ -190,6 +189,16 @@
homeConfigurations = digga.lib.mkHomeConfigurations self.nixosConfigurations; homeConfigurations = digga.lib.mkHomeConfigurations self.nixosConfigurations;
deploy.nodes = digga.lib.mkDeployNodes self.nixosConfigurations { deploy.nodes = digga.lib.mkDeployNodes self.nixosConfigurations {
#example = {
# hostname = "example.com:22";
# sshUser = "bartender";
# fastConnect = true;
# profilesOrder = ["system" "direnv"];
# profiles.direnv = {
# user = "bartender";
# path = self.pkgs.x86_64-linux.nixos.deploy-rs.lib.x86_64-linux.activate.home-manager self.homeConfigurationsPortable.x86_64-linux.bartender;
# };
#};
fae = { fae = {
hostname = "fae.fritz.box:22"; hostname = "fae.fritz.box:22";
sshUser = "pub-solar"; sshUser = "pub-solar";
@ -197,7 +206,7 @@
profilesOrder = ["system" "direnv"]; profilesOrder = ["system" "direnv"];
profiles.direnv = { profiles.direnv = {
user = "pub-solar"; user = "pub-solar";
path = self.channels.nixos.deploy-rs.lib.x86_64-linux.activate.home-manager self.homeConfigurationsPortable.x86_64-linux.pub-solar; path = self.pkgs.x86_64-linux.nixos.deploy-rs.lib.x86_64-linux.activate.home-manager self.homeConfigurationsPortable.x86_64-linux.pub-solar;
}; };
}; };
powder = { powder = {
@ -206,7 +215,7 @@
profilesOrder = ["system" "direnv"]; profilesOrder = ["system" "direnv"];
profiles.direnv = { profiles.direnv = {
user = "pub-solar"; user = "pub-solar";
path = self.channels.nixos.deploy-rs.lib.x86_64-linux.activate.home-manager self.homeConfigurationsPortable.x86_64-linux.pub-solar; path = self.pkgs.x86_64-linux.nixos.deploy-rs.lib.x86_64-linux.activate.home-manager self.homeConfigurationsPortable.x86_64-linux.pub-solar;
}; };
}; };
}; };

View file

@ -88,6 +88,7 @@ in {
# Somehow we need to ensure starship starts later than ble.sh # Somehow we need to ensure starship starts later than ble.sh
# (possible packaging issue?) # (possible packaging issue?)
# https://github.com/akinomyoga/ble.sh/issues/333
eval "$(${pkgs.starship}/bin/starship init bash)" eval "$(${pkgs.starship}/bin/starship init bash)"
[[ ''${BLE_VERSION-} ]] && ble-attach [[ ''${BLE_VERSION-} ]] && ble-attach

View file

@ -1,48 +1,9 @@
#!/usr/bin/env bash #!/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
# We have to stash two times, because:
# --keep-index also stashes the staged changes.
# The staged changes end up in both the stage AND the stash.
# https://overflow.hostux.net/questions/7650797/how-to-stash-only-unstaged-changes-in-git#60875082
old_stash=$(git rev-parse --quiet --verify refs/stash)
git stash push --quiet --staged --message "Staged changes before pre-commit hook"
git stash push --quiet --message "Unstaged changes before pre-commit hook"
if git stash show "stash@{1}" 2>/dev/null; then
git stash pop --quiet --index "stash@{1}"
else
git stash pop --quiet --index "stash@{0}"
fi
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 # Check editorconfig
if ((${#all_files[@]} != 0)); then if ! editorconfig-checker; then
if ! editorconfig-checker -- "${all_files[@]}"; then
printf "%b\n" \ printf "%b\n" \
"\nCode is not aligned with .editorconfig" \ "\nCode is not aligned with .editorconfig" \
"Review the output and commit your fixes" >&2 "Review the output and commit your fixes" >&2
exit 1 exit 1
fi
fi fi