Skip to content

Commit

Permalink
Simplifies the Nix files
Browse files Browse the repository at this point in the history
Rebuilt the flake using `fh init`. Moves the derviation inside the flake, removes unnecessary files
  • Loading branch information
imgrant committed Feb 21, 2025
1 parent d2532d1 commit 5eb3a31
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 72 deletions.
45 changes: 0 additions & 45 deletions default.nix

This file was deleted.

17 changes: 16 additions & 1 deletion flake.lock

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

66 changes: 53 additions & 13 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,21 +1,61 @@
# This flake was initially generated by fh, the CLI for FlakeHub (version 0.1.18)
{
description = "A tool to configure scoped DNS resolvers on macOS";
# A helpful description of your flake
description = "Scoped DNS helper tool for macOS";

inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2411.*";
# Flake inputs
inputs = {
flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*";

outputs = { nixpkgs, ... }:
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/*";
};

# Flake outputs that other flakes can use
outputs = { self, flake-schemas, nixpkgs }:
let
forAllSystems = gen:
nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed
(system: gen nixpkgs.legacyPackages.${system});
in {
packages = forAllSystems (pkgs: { default = pkgs.callPackage ./. { }; });
# Helpers for producing system-specific outputs
supportedSystems = [ "aarch64-darwin" ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs { inherit system; };
});
in
{
# Schemas tell Nix about the structure of your flake's outputs
schemas = flake-schemas.schemas;

packages = forEachSupportedSystem ({ pkgs }: {
default = pkgs.stdenv.mkDerivation {
name = "scopeddnsutil";
src = ./.;

# Including SwiftPM as a nativeBuildInput provides a buildPhase for you.
# This by default performs a release build using SwiftPM, essentially:
# swift build -c release
nativeBuildInputs = with pkgs; [
swift
swiftpm
];

installPhase = ''
binPath="$(swiftpmBinPath)"
mkdir -p $out/bin
cp $binPath/scopeddnsutil $out/bin/
'';
};
});

devShells = forAllSystems (pkgs: {
default = pkgs.mkShell.override { inherit (pkgs.swiftPackages) stdenv; } {
buildInputs = [ pkgs.swift pkgs.swiftpm pkgs.swiftpm2nix pkgs.swiftPackages.Foundation ];
LD_LIBRARY_PATH = "${pkgs.swiftPackages.Dispatch}/lib";
# Development environments
devShells = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell {
# Pinned packages available in the environment
packages = with pkgs; [
nixpkgs-fmt
swift
swiftpm
swiftpm2nix
swiftPackages.Foundation
];
};
});
};
}
}
6 changes: 0 additions & 6 deletions nix/default.nix

This file was deleted.

7 changes: 0 additions & 7 deletions nix/workspace-state.json

This file was deleted.

0 comments on commit 5eb3a31

Please sign in to comment.