feat: use nixfmt

This commit is contained in:
Oskar Manhart 2024-09-09 10:31:41 +02:00
parent b0f2830224
commit 7d5cce374c
4 changed files with 122 additions and 102 deletions

View File

@ -1,5 +1,6 @@
ci: ci:
autoupdate_branch: "rewrite" autoupdate_branch: "rewrite"
skip: [nixfmt]
repos: repos:
- repo: https://github.com/Lucas-C/pre-commit-hooks - repo: https://github.com/Lucas-C/pre-commit-hooks
@ -48,3 +49,8 @@ repos:
rev: v0.10.0.1 rev: v0.10.0.1
hooks: hooks:
- id: shellcheck - id: shellcheck
- repo: https://github.com/NixOS/nixfmt
rev: d0c0cda4fe6b7ae2b9aa37f3ee15e6412573eb01
hooks:
- id: nixfmt

View File

@ -6,19 +6,22 @@
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
}; };
outputs = { outputs =
{
nixpkgs, nixpkgs,
flake-utils, flake-utils,
... ...
}: }:
flake-utils.lib.eachDefaultSystem ( flake-utils.lib.eachDefaultSystem (
system: let system:
pkgs = import nixpkgs {inherit system;}; let
in { pkgs = import nixpkgs { inherit system; };
formatter = pkgs.alejandra; in
{
formatter = pkgs.nixfmt-rfc-style;
packages.winapps = pkgs.callPackage ./packages/winapps {}; packages.winapps = pkgs.callPackage ./packages/winapps { };
packages.winapps-launcher = pkgs.callPackage ./packages/winapps-launcher {}; packages.winapps-launcher = pkgs.callPackage ./packages/winapps-launcher { };
} }
); );
} }

View File

@ -7,11 +7,12 @@
callPackage, callPackage,
yad, yad,
... ...
}: let }:
let
rev = "eaa660d39bf3f49b136c98c87c35e3e12f118f8f"; rev = "eaa660d39bf3f49b136c98c87c35e3e12f118f8f";
hash = "sha256-7lkx/O4dOdVqAPX6s2IkkM6Ggbzmz9sm++20BBeoUQ4="; hash = "sha256-7lkx/O4dOdVqAPX6s2IkkM6Ggbzmz9sm++20BBeoUQ4=";
in in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "winapps-launcher"; pname = "winapps-launcher";
version = "git+${rev}"; version = "git+${rev}";
@ -22,8 +23,11 @@ in
inherit rev hash; inherit rev hash;
}; };
nativeBuildInputs = [makeWrapper]; nativeBuildInputs = [ makeWrapper ];
buildInputs = [yad (callPackage ../winapps {})]; buildInputs = [
yad
(callPackage ../winapps { })
];
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
@ -52,7 +56,7 @@ in
icon = "winapps"; icon = "winapps";
comment = meta.description; comment = meta.description;
desktopName = "WinApps"; desktopName = "WinApps";
categories = ["Utility"]; categories = [ "Utility" ];
}) })
]; ];
@ -63,4 +67,4 @@ in
platforms = platforms.linux; platforms = platforms.linux;
license = licenses.gpl3; license = licenses.gpl3;
}; };
} }

View File

@ -9,11 +9,12 @@
netcat-gnu, netcat-gnu,
iproute2, iproute2,
... ...
}: let }:
let
rev = "7bae17e3a3607e6b93c7cfc4155dfbdca7bba005"; rev = "7bae17e3a3607e6b93c7cfc4155dfbdca7bba005";
hash = "sha256-PP4POMwHCsAdiCxZkjXlON84F0Mg3Pd5bHEI6tC+Sds="; hash = "sha256-PP4POMwHCsAdiCxZkjXlON84F0Mg3Pd5bHEI6tC+Sds=";
in in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "winapps"; pname = "winapps";
version = "git+${rev}"; version = "git+${rev}";
@ -24,25 +25,26 @@ in
inherit rev hash; inherit rev hash;
}; };
nativeBuildInputs = [makeWrapper]; nativeBuildInputs = [ makeWrapper ];
buildInputs = [freerdp3 libnotify dialog netcat-gnu iproute2]; buildInputs = [
freerdp3
libnotify
dialog
netcat-gnu
iproute2
];
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
patchShebangs install/inquirer.sh
mkdir -p $out mkdir -p $out
mkdir -p $out/src mkdir -p $out/src
cp -r ./ $out/src/ patchShebangs install/inquirer.sh
install -m755 -D bin/winapps $out/bin/winapps
install -m755 -D setup.sh $out/bin/winapps-setup
sed -E -i \ sed -E -i \
-e 's/grep -q -E "\\blibvirt\\b"/grep -q -E "\\blibvirtd\\b"/' \ -e 's/grep -q -E "\\blibvirt\\b"/grep -q -E "\\blibvirtd\\b"/' \
$out/bin/winapps bin/winapps
sed -E -i \ sed -E -i \
-e 's/grep -q -E "\\blibvirt\\b"/grep -q -E "\\blibvirtd\\b"/' \ -e 's/grep -q -E "\\blibvirt\\b"/grep -q -E "\\blibvirtd\\b"/' \
@ -54,7 +56,12 @@ in
-e 's|\$SUDO ln -s "./bin/winapps" "\$\{BIN_PATH\}/winapps"||' \ -e 's|\$SUDO ln -s "./bin/winapps" "\$\{BIN_PATH\}/winapps"||' \
-e 's|\$SUDO ln -s "./setup.sh" "\$\{BIN_PATH\}/winapps-setup"||' \ -e 's|\$SUDO ln -s "./setup.sh" "\$\{BIN_PATH\}/winapps-setup"||' \
-e "s|\$\{BIN_PATH\}/winapps|$out/bin/winapps|" \ -e "s|\$\{BIN_PATH\}/winapps|$out/bin/winapps|" \
$out/bin/winapps-setup ./setup.sh
cp -r ./ $out/src/
install -m755 -D bin/winapps $out/bin/winapps
install -m755 -D setup.sh $out/bin/winapps-setup
for f in winapps-setup winapps; do for f in winapps-setup winapps; do
wrapProgram $out/bin/$f \ wrapProgram $out/bin/$f \
@ -70,6 +77,6 @@ in
description = "Run Windows applications (including Microsoft 365 and Adobe Creative Cloud) on GNU/Linux with KDE, GNOME or XFCE, integrated seamlessly as if they were native to the OS. Wayland is currently unsupported."; description = "Run Windows applications (including Microsoft 365 and Adobe Creative Cloud) on GNU/Linux with KDE, GNOME or XFCE, integrated seamlessly as if they were native to the OS. Wayland is currently unsupported.";
mainProgram = "winapps"; mainProgram = "winapps";
platforms = platforms.linux; platforms = platforms.linux;
license = licenses.gpl3; license = licenses.agpl3Plus;
}; };
} }