2021-01-14 01:13:58 +00:00
|
|
|
{
|
|
|
|
description = "Tool for working with macOS defaults.";
|
|
|
|
|
|
|
|
inputs = {
|
2021-06-03 21:09:26 +00:00
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-21.05-darwin";
|
2021-01-25 18:39:15 +00:00
|
|
|
devshell.url = "github:numtide/devshell/";
|
2021-01-14 01:13:58 +00:00
|
|
|
flake-compat = { url = "github:edolstra/flake-compat"; flake = false; };
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
2021-01-25 18:39:15 +00:00
|
|
|
plist-source = { url = "github:malob/plist/monadfail"; flake = false; };
|
2021-01-14 01:13:58 +00:00
|
|
|
};
|
|
|
|
|
2021-01-25 18:39:15 +00:00
|
|
|
outputs = { self, devshell, nixpkgs, flake-utils, plist-source, ... }:
|
2021-01-14 01:13:58 +00:00
|
|
|
flake-utils.lib.eachSystem [ "x86_64-darwin" ] (system: let
|
2021-01-25 18:39:15 +00:00
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
2021-03-24 00:37:59 +00:00
|
|
|
compiler = pkgs.haskell.packages.ghc8104;
|
2021-01-25 18:39:15 +00:00
|
|
|
hlib = pkgs.haskell.lib;
|
|
|
|
plist = hlib.markUnbroken (hlib.overrideSrc compiler.plist { src = plist-source; });
|
2021-06-03 21:09:26 +00:00
|
|
|
prefmanager = compiler.callCabal2nix "prefmanager" ./. { inherit plist; };
|
2021-01-25 18:39:15 +00:00
|
|
|
mkShell = devshell.legacyPackages.${system}.mkShell;
|
2021-01-14 01:13:58 +00:00
|
|
|
in rec {
|
|
|
|
# Built by `nix build .`
|
2021-01-25 18:39:15 +00:00
|
|
|
defaultPackage = prefmanager;
|
|
|
|
packages.prefmanager = defaultPackage;
|
2021-01-14 01:13:58 +00:00
|
|
|
|
|
|
|
# Run `prefmanager` with `nix run .`
|
2021-01-25 18:39:15 +00:00
|
|
|
defaultApp = { type = "app"; program = "${prefmanager}/bin/prefmanager"; };
|
|
|
|
apps.prefmanager = defaultApp;
|
2021-01-14 01:13:58 +00:00
|
|
|
|
2021-01-25 18:39:15 +00:00
|
|
|
# # This is used by `nix develop .`
|
|
|
|
devShell = mkShell {
|
|
|
|
name = "prefmanager";
|
|
|
|
packages = [
|
|
|
|
compiler.haskell-language-server
|
|
|
|
compiler.implicit-hie
|
2021-01-28 02:22:20 +00:00
|
|
|
compiler.weeder
|
2021-01-25 18:39:15 +00:00
|
|
|
pkgs.cabal2nix
|
2021-01-14 01:13:58 +00:00
|
|
|
pkgs.stack
|
2021-01-28 02:22:20 +00:00
|
|
|
pkgs.hlint
|
2021-01-14 01:13:58 +00:00
|
|
|
];
|
2021-01-25 18:39:15 +00:00
|
|
|
commands = [
|
|
|
|
{
|
|
|
|
help = "Regenerate hie.yaml (run from project root)";
|
|
|
|
name = "hie";
|
|
|
|
category = "project";
|
|
|
|
command = "gen-hie > hie.yaml";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
help = "Update prefmanager.nix (run from project root)";
|
|
|
|
name = "2nix";
|
|
|
|
category = "project";
|
|
|
|
command = "cabal2nix --hpack . > prefmanager.nix";
|
|
|
|
}
|
|
|
|
];
|
2021-01-14 01:13:58 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|