Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nixfmt classic formatter #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{ pkgs ? import <nixpkgs> {} }:
{ pkgs ? import <nixpkgs> { } }:

let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
sourceInfo = lock.nodes.flake-compat.locked;
flake-compat = fetchTarball {
url = "https://github.com/${sourceInfo.owner}/${sourceInfo.repo}/archive/${sourceInfo.rev}.tar.gz";
url =
"https://github.com/${sourceInfo.owner}/${sourceInfo.repo}/archive/${sourceInfo.rev}.tar.gz";
sha256 = sourceInfo.narHash;
};
flake = (pkgs.callPackage flake-compat { src = ./.; });
in
flake.defaultNix
in flake.defaultNix
111 changes: 55 additions & 56 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
{
inputs = {
# This has SBCL 2.4.10 and docktuil 3.1.3 which are known to work
nixpkgs.url = "github:NixOS/nixpkgs/af51545ec9a44eadf3fe3547610a5cdd882bc34e";
nixpkgs.url =
"github:NixOS/nixpkgs/af51545ec9a44eadf3fe3547610a5cdd882bc34e";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I must say this feels like a regression..

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes it does break lines that I wish it wouldn't. I will leave justification for why this one in a regular comment.

cl-nix-lite.url = "github:hraban/cl-nix-lite";
flake-compat = {
# Use my own fixed-output-derivation branch because I don’t want users to
Expand All @@ -38,68 +39,66 @@
type = types.bool;
default = builtins.hasAttr pkgs.stdenv.system self.packages;
example = true;
description = "Whether to enable mac-app-util home manager integration";
description =
"Whether to enable mac-app-util home manager integration";
};
};
config = lib.mkIf config.targets.darwin.mac-app-util.enable {
home.activation = {
trampolineApps = let
mac-app-util = self.packages.${pkgs.stdenv.system}.default;
in lib.hm.dag.entryAfter [ "writeBoundary" ] ''
fromDir="$HOME/Applications/Home Manager Apps"
toDir="$HOME/Applications/Home Manager Trampolines"
${mac-app-util}/bin/mac-app-util sync-trampolines "$fromDir" "$toDir"
'';
trampolineApps =
let mac-app-util = self.packages.${pkgs.stdenv.system}.default;
in lib.hm.dag.entryAfter [ "writeBoundary" ] ''
fromDir="$HOME/Applications/Home Manager Apps"
toDir="$HOME/Applications/Home Manager Trampolines"
${mac-app-util}/bin/mac-app-util sync-trampolines "$fromDir" "$toDir"
'';
};
};
};
darwinModules.default = { pkgs, ... }: {
system.activationScripts.postActivation.text = let
mac-app-util = self.packages.${pkgs.stdenv.system}.default;
in ''
${mac-app-util}/bin/mac-app-util sync-trampolines "/Applications/Nix Apps" "/Applications/Nix Trampolines"
'';
system.activationScripts.postActivation.text =
let mac-app-util = self.packages.${pkgs.stdenv.system}.default;
in ''
${mac-app-util}/bin/mac-app-util sync-trampolines "/Applications/Nix Apps" "/Applications/Nix Trampolines"
'';
};
}
//
(with flake-utils.lib; eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system}.extend cl-nix-lite.overlays.default;
in {
packages = {
default = pkgs.callPackage ({
lispPackagesLite
, dockutil
, findutils
, jq
, rsync
}: with lispPackagesLite; lispScript rec {
name = "mac-app-util";
src = ./main.lisp;
dependencies = [
alexandria
inferior-shell
cl-interpol
cl-json
str
trivia
];
nativeBuildInputs = [ pkgs.makeBinaryWrapper ];
postInstall = ''
wrapProgramBinary "$out/bin/${name}" \
--suffix PATH : "${with pkgs; lib.makeBinPath [
dockutil
rsync
findutils
jq
]}"
'';
installCheckPhase = ''
$out/bin/${name} --help
'';
doInstallCheck = true;
meta.license = pkgs.lib.licenses.agpl3Only;
}) {};
};
}));
} // (with flake-utils.lib;
eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system}.extend
cl-nix-lite.overlays.default;
in {
packages = {
default = pkgs.callPackage
({ lispPackagesLite, dockutil, findutils, jq, rsync }:
with lispPackagesLite;
lispScript rec {
name = "mac-app-util";
src = ./main.lisp;
dependencies = [
alexandria
inferior-shell
cl-interpol
cl-json
str
trivia
];
nativeBuildInputs = [ pkgs.makeBinaryWrapper ];
postInstall = ''
wrapProgramBinary "$out/bin/${name}" \
--suffix PATH : "${
with pkgs;
lib.makeBinPath [ dockutil rsync findutils jq ]
}"
'';
installCheckPhase = ''
$out/bin/${name} --help
'';
doInstallCheck = true;
meta.license = pkgs.lib.licenses.agpl3Only;
}) { };
};

formatter = pkgs.nixfmt-classic;
}));
}