Skip to content

Commit

Permalink
Temporarily remove determinate nix-darwin module
Browse files Browse the repository at this point in the history
  • Loading branch information
lucperkins committed Sep 23, 2024
1 parent 093d46b commit af35b00
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 64 deletions.
86 changes: 24 additions & 62 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

96 changes: 94 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,32 @@
description = "Nome: my Nix home";

inputs = {
determinate.url = "https://flakehub.com/f/DeterminateSystems/determinate/*";
#determinate.url = "https://flakehub.com/f/DeterminateSystems/determinate/*";
fh = { url = "https://flakehub.com/f/DeterminateSystems/fh/*"; inputs.nixpkgs.follows = "nixpkgs"; };
jelly = { url = "github:lucperkins/jelly"; inputs.nixpkgs.follows = "nixpkgs"; };
fenix = { url = "https://flakehub.com/f/nix-community/fenix/0.1.*"; inputs.nixpkgs.follows = "nixpkgs"; };
flake-checker = { url = "https://flakehub.com/f/DeterminateSystems/flake-checker/*"; inputs.nixpkgs.follows = "nixpkgs"; };
home-manager = { url = "https://flakehub.com/f/nix-community/home-manager/0.2405.*"; inputs.nixpkgs.follows = "nixpkgs"; };
nix.url = "https://flakehub.com/f/DeterminateSystems/nix/2.0";
nix-darwin = { url = "github:LnL7/nix-darwin"; inputs.nixpkgs.follows = "nixpkgs"; };
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2405.*";
nixpkgs-unstable.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*";
nuenv = { url = "https://flakehub.com/f/DeterminateSystems/nuenv/0.1.*"; inputs.nixpkgs.follows = "nixpkgs"; };
uuidv7 = { url = "git+ssh://git@github.com/DeterminateSystems/uuidv7.git"; inputs.nixpkgs.follows = "nixpkgs"; };

determinate-nixd-aarch64-linux = {
url = "https://install.determinate.systems/determinate-nixd/rev/2c18a8f38492d35be64d4e497b720938f17cc9f5/aarch64-linux";
flake = false;
};
determinate-nixd-x86_64-linux = {
url = "https://install.determinate.systems/determinate-nixd/rev/2c18a8f38492d35be64d4e497b720938f17cc9f5/x86_64-linux";
flake = false;
};
determinate-nixd-aarch64-darwin = {
url = "https://install.determinate.systems/determinate-nixd/rev/2c18a8f38492d35be64d4e497b720938f17cc9f5/macOS";
flake = false;
};
determinate-nixd-x86_64-darwin.follows = "determinate-nixd-aarch64-darwin";
};

outputs = inputs:
Expand Down Expand Up @@ -88,10 +103,87 @@
gleam = inputs.nixpkgs-unstable.legacyPackages.${system}.gleam;
};

packages = forEachSupportedSystem ({ system, pkgs, ... }: {
default = pkgs.runCommand "determinate-nixd" { } ''
mkdir -p $out/bin
cp ${inputs."determinate-nixd-${system}"} $out/bin/determinate-nixd
chmod +x $out/bin/determinate-nixd
$out/bin/determinate-nixd --help
'';
});

darwinConfigurations."${username}-${system}" = inputs.nix-darwin.lib.darwinSystem {
inherit system;
modules = [
inputs.determinate.darwinModules.default
({ lib, config, pkgs, ... }:
let
mkPreferable = inputs.nixpkgs.lib.mkOverride 750;
in
{
nix.package = inputs.nix.packages."${pkgs.stdenv.system}".default;

nix.registry.nixpkgs = {
exact = true;

from = {
type = "indirect";
id = "nixpkgs";
};

# NOTE(cole-h): The NixOS module exposes a `flake` option that is a fancy wrapper around
# setting `to` -- we don't want to clobber this if users have set it on their own
to = lib.mkIf (config.nix.registry.nixpkgs.flake or null == null) (mkPreferable {
type = "tarball";
url = "https://flakehub.com/f/DeterminateSystems/nixpkgs-weekly/0.1.0.tar.gz";
});
};

nix.settings = {
bash-prompt-prefix = "(nix:$name)\\040";
extra-experimental-features = [ "nix-command" "flakes" ];
extra-nix-path = [ "nixpkgs=flake:nixpkgs" ];
extra-substituters = [ "https://cache.flakehub.com" ];
};

nix.useDaemon = true;

launchd.daemons.nix-daemon.serviceConfig = {
StandardErrorPath = lib.mkForce "/var/log/determinate-nixd.log";
StandardOutPath = lib.mkForce "/var/log/determinate-nixd.log";

ProgramArguments = lib.mkForce [
"${inputs.self.packages.${pkgs.stdenv.system}.default}/bin/determinate-nixd"
"--nix-bin"
"${config.nix.package}/bin"
];

Sockets = {
"determinate-nixd.socket" = {
# We'd set `SockFamily = "Unix";`, but nix-darwin automatically sets it with SockPathName
SockPassive = true;
SockPathName = "/var/run/determinate-nixd.socket";
};

"nix-daemon.socket" = {
# We'd set `SockFamily = "Unix";`, but nix-darwin automatically sets it with SockPathName
SockPassive = true;
SockPathName = "/var/run/nix-daemon.socket";
};
};

SoftResourceLimits = {
NumberOfFiles = mkPreferable 1048576;
NumberOfProcesses = mkPreferable 1048576;
Stack = mkPreferable 67108864;
};
HardResourceLimits = {
NumberOfFiles = mkPreferable 1048576;
NumberOfProcesses = mkPreferable 1048576;
Stack = mkPreferable 67108864;
};
};
})
#inputs.determinate.darwinModules.default
inputs.self.darwinModules.base
inputs.self.darwinModules.caching
inputs.home-manager.darwinModules.home-manager
Expand Down

0 comments on commit af35b00

Please sign in to comment.