This repository has been archived by the owner on Apr 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
57 lines (48 loc) · 1.53 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{
description = "A LaunchDeamon that fixes the zshrc and bashrc files for Nix on Darwin.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
src = pkgs.lib.cleanSourceWith {
src = ./.;
filter = path: type: builtins.match "^.*/(((nix-darwin-fixer|vendor)(/.+)?)|(go[.](mod|sum)))$" path != null;
};
bin = pkgs.buildGoModule {
pname = "nix-darwin-fixer";
version = "0.0.1";
subPackages = [ "nix-darwin-fixer" ];
src = src;
vendorHash = null;
CGO_ENABLED = "0";
};
binWrapped = pkgs.runCommand "nix-darwin-fixer"
{
buildInputs = [ pkgs.makeWrapper ];
} ''
mkdir -p $out/bin
makeWrapper ${bin}/bin/nix-darwin-fixer $out/bin/nix-darwin-fixer \
--set SELF_NIX_STORE_PATH $out
'';
sudoWrapper = pkgs.writeShellScriptBin "nix-darwin-fixer"
''
set -e
exec sudo ${binWrapped}/bin/nix-darwin-fixer "$@"
'';
in
{
packages = { } // (pkgs.lib.optionalAttrs pkgs.stdenv.isDarwin {
default = sudoWrapper;
bin = binWrapped;
});
devShells.default = pkgs.mkShell {
packages = [
pkgs.go
];
};
});
}