Mailcap and flake check (#26)

This commit is contained in:
Patrick Stevens
2023-10-04 15:25:52 +01:00
committed by GitHub
parent 8f956b631c
commit 3743aead94
4 changed files with 37 additions and 34 deletions

View File

@@ -7,28 +7,6 @@ on:
branches: [ main ] branches: [ main ]
jobs: jobs:
shellcheck:
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
- name: "Install Nix"
uses: "cachix/install-nix-action@v23"
with: { "extra_nix_config": "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" }
- name: "Run Shellcheck"
run: "nix develop --command bash -c \"find . -type f -name '*.sh' | xargs shellcheck\""
format:
runs-on: "ubuntu-latest"
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
- name: "Install Nix"
uses: "cachix/install-nix-action@v23"
with: { "extra_nix_config": "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" }
- name: "Run Alejandra"
run: "nix develop --command alejandra --check ."
flake-check: flake-check:
runs-on: "ubuntu-latest" runs-on: "ubuntu-latest"
steps: steps:
@@ -45,6 +23,4 @@ jobs:
steps: steps:
- run: "echo \"All required checks complete.\"" - run: "echo \"All required checks complete.\""
needs: needs:
- "shellcheck"
- "format"
- "flake-check" - "flake-check"

View File

@@ -1,13 +1,13 @@
#!/bin/sh #!/bin/sh
install_nix () { install_nix() {
echo "Installing Nix..." echo "Installing Nix..."
diskutil list > /dev/null || export PATH="/usr/sbin:$PATH" diskutil list >/dev/null || export PATH="/usr/sbin:$PATH"
curl -L https://nixos.org/nix/install | sh -s -- --darwin-use-unencrypted-nix-store-volume --daemon || exit 1 curl -L https://nixos.org/nix/install | sh -s -- --darwin-use-unencrypted-nix-store-volume --daemon || exit 1
echo "Nix installed." echo "Nix installed."
} }
install_darwin_build () { install_darwin_build() {
echo "Installing nix-darwin..." echo "Installing nix-darwin..."
nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer || exit 1 nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer || exit 1
./result/bin/darwin-installer || exit 1 ./result/bin/darwin-installer || exit 1

View File

@@ -41,6 +41,7 @@
# contentAddressedByDefault = true; # contentAddressedByDefault = true;
allowUnfree = true; allowUnfree = true;
}; };
systems = ["aarch64-darwin" "aarch64-linux" "x86_64-linux"];
in let in let
overlays = [emacs.overlay] ++ import ./overlays.nix; overlays = [emacs.overlay] ++ import ./overlays.nix;
recursiveMerge = attrList: let recursiveMerge = attrList: let
@@ -108,6 +109,29 @@
]; ];
}; };
}; };
checks = let
fmt-check = system: let
pkgs = import nixpkgs {inherit config system;};
in
pkgs.stdenvNoCC.mkDerivation {
name = "fmt-check";
src = ./.;
nativeBuildInputs = [pkgs.alejandra pkgs.shellcheck pkgs.shfmt];
checkPhase = ''
find . -type f -name '*.sh' | xargs shfmt -d -s -i 2 -ci
alejandra -c .
find . -type f -name '*.sh' -exec shellcheck -x {} \;
'';
installPhase = "mkdir $out";
dontBuild = true;
doCheck = true;
};
in
builtins.listToAttrs (builtins.map (system: {
name = system;
value = {fmt-check = fmt-check system;};
})
systems);
devShells = let devShells = let
devShell = system: ( devShell = system: (
let let
@@ -120,8 +144,9 @@
); );
in in
builtins.listToAttrs (builtins.map (system: { builtins.listToAttrs (builtins.map (system: {
name = system; name = system;
value = devShell system; value = devShell system;
}) ["aarch64-darwin" "aarch64-linux" "x86_64-linux"]); })
systems);
}; };
} }

View File

@@ -3,17 +3,19 @@
outfile="$1/resharper-host/GlobalSettingsStorage.DotSettings" outfile="$1/resharper-host/GlobalSettingsStorage.DotSettings"
if [ -e "$outfile" ]; then if [ -e "$outfile" ]; then
existing=$(readlink "$outfile") existing=$(readlink "$outfile")
if [ $? -eq 1 ] ; then if [ $? -eq 1 ]; then
echo "Backing up existing settings file $outfile" echo "Backing up existing settings file $outfile"
mv "$outfile" "$outfile.bak" mv "$outfile" "$outfile.bak"
ln -s "NIX-RIDER-CONFIG/GlobalSettingsStorage.DotSettings" "$outfile" ln -s "NIX-RIDER-CONFIG/GlobalSettingsStorage.DotSettings" "$outfile"
else else
case "$existing" in case "$existing" in
"/nix/store/"*) "/nix/store/"*)
ln -fs "NIX-RIDER-CONFIG/GlobalSettingsStorage.DotSettings" "$outfile" ;; ln -fs "NIX-RIDER-CONFIG/GlobalSettingsStorage.DotSettings" "$outfile"
;;
*) *)
echo "Refusing to overwrite existing symlink to $existing" && \ echo "Refusing to overwrite existing symlink to $existing" &&
exit 1 ;; exit 1
;;
esac esac
fi fi
else else