Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ jobs:
run: nix develop --command check-clippy
- name: Check Spelling
run: nix develop --command check-spelling
- name: Check nixpkgs-fmt formatting
run: nix develop --command check-nixpkgs-fmt
- name: Check Nix formatting
run: nix develop --command check-nixfmt
- name: Check EditorConfig conformance
run: nix develop --command check-editorconfig
- name: Shell check for nix-installer.sh
Expand Down
209 changes: 131 additions & 78 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,60 @@
};

outputs =
{ self
, nixpkgs
, crane
, nix
, determinate
, ...
} @ inputs:
{
self,
nixpkgs,
crane,
nix,
determinate,
...
}@inputs:
let
nix_tarball_url_prefix = "https://releases.nixos.org/nix/nix-2.33.1/nix-2.33.1-";
supportedSystems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ];
systemsSupportedByDeterminateNixd = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ];
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
];
systemsSupportedByDeterminateNixd = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
];

forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: (forSystem system f));

forSystem = system: f: f rec {
inherit system;
pkgs = import nixpkgs { inherit system; overlays = [ self.overlays.default ]; };
lib = pkgs.lib;
};

nixTarballs = forAllSystems ({ system, ... }:
inputs.nix.tarballs_direct.${system}
or "${inputs.nix.packages."${system}".binaryTarball}/nix-${inputs.nix.packages."${system}".default.version}-${system}.tar.xz");

optionalPathToDeterminateNixd = system: if builtins.elem system systemsSupportedByDeterminateNixd then "${inputs.determinate.packages.${system}.default}/bin/determinate-nixd" else null;
forSystem =
system: f:
f rec {
inherit system;
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
};
lib = pkgs.lib;
};

installerPackage = { pkgs, stdenv, buildPackages }:
nixTarballs = forAllSystems (
{ system, ... }:
inputs.nix.tarballs_direct.${system} or "${inputs.nix.packages."${system}".binaryTarball}/nix-${
inputs.nix.packages."${system}".default.version
}-${system}.tar.xz"
);

optionalPathToDeterminateNixd =
system:
if builtins.elem system systemsSupportedByDeterminateNixd then
"${inputs.determinate.packages.${system}.default}/bin/determinate-nixd"
else
null;

installerPackage =
{
pkgs,
stdenv,
buildPackages,
}:
let
craneLib = crane.mkLib pkgs;
sharedAttrs = {
Expand All @@ -77,30 +104,34 @@
};
};
in
craneLib.buildPackage (sharedAttrs // {
cargoArtifacts = craneLib.buildDepsOnly sharedAttrs;

cargoTestExtraArgs = "--all";

postInstall = ''
cp nix-installer.sh $out/bin/nix-installer.sh
'';

env = sharedAttrs.env // {
RUSTFLAGS = "--cfg tokio_unstable";
NIX_TARBALL_URL = "${nix_tarball_url_prefix}${pkgs.stdenv.hostPlatform.system}.tar.xz";
DETERMINATE_NIX_TARBALL_PATH = nixTarballs.${stdenv.hostPlatform.system};
DETERMINATE_NIXD_BINARY_PATH = optionalPathToDeterminateNixd stdenv.hostPlatform.system;
};
});
craneLib.buildPackage (
sharedAttrs
// {
cargoArtifacts = craneLib.buildDepsOnly sharedAttrs;

cargoTestExtraArgs = "--all";

postInstall = ''
cp nix-installer.sh $out/bin/nix-installer.sh
'';

env = sharedAttrs.env // {
RUSTFLAGS = "--cfg tokio_unstable";
NIX_TARBALL_URL = "${nix_tarball_url_prefix}${pkgs.stdenv.hostPlatform.system}.tar.xz";
DETERMINATE_NIX_TARBALL_PATH = nixTarballs.${stdenv.hostPlatform.system};
DETERMINATE_NIXD_BINARY_PATH = optionalPathToDeterminateNixd stdenv.hostPlatform.system;
};
}
);
in
{
overlays.default = final: prev: {
nix-installer = final.callPackage installerPackage { };
nix-installer-static = final.pkgsStatic.callPackage installerPackage { };
};

devShells = forAllSystems ({ system, pkgs, ... }:
devShells = forAllSystems (
{ system, pkgs, ... }:
let
check = import ./nix/check.nix { inherit pkgs; };
in
Expand All @@ -114,36 +145,44 @@
DETERMINATE_NIXD_BINARY_PATH = optionalPathToDeterminateNixd system;

nativeBuildInputs = with pkgs; [ ];
buildInputs = with pkgs; [
rustc
cargo
clippy
rustfmt
shellcheck
rust-analyzer
cargo-outdated
cacert
# cargo-audit # NOTE(cole-h): build currently broken because of time dependency and Rust 1.80
cargo-watch
nixpkgs-fmt
check.check-rustfmt
check.check-spelling
check.check-nixpkgs-fmt
check.check-editorconfig
check.check-semver
check.check-clippy
editorconfig-checker
toml-cli
]
++ lib.optionals (pkgs.stdenv.isLinux) (with pkgs; [
checkpolicy
semodule-utils
/* users are expected to have a system docker, too */
]);
buildInputs =
with pkgs;
[
rustc
cargo
clippy
rustfmt
shellcheck
rust-analyzer
cargo-outdated
cacert
# cargo-audit # NOTE(cole-h): build currently broken because of time dependency and Rust 1.80
cargo-watch
check.check-rustfmt
check.check-spelling
check.check-nixfmt
check.check-editorconfig
check.check-semver
check.check-clippy
editorconfig-checker
toml-cli

self.formatter.${system}
]
++ lib.optionals (pkgs.stdenv.isLinux) (
with pkgs;
[
checkpolicy
semodule-utils
# users are expected to have a system docker, too
]
);
};
});
}
);

checks = forAllSystems ({ system, pkgs, ... }:
checks = forAllSystems (
{ system, pkgs, ... }:
let
check = import ./nix/check.nix { inherit pkgs; };
in
Expand All @@ -158,27 +197,41 @@
check-spelling
touch $out
'';
check-nixpkgs-fmt = pkgs.runCommand "check-nixpkgs-fmt" { buildInputs = [ check.check-nixpkgs-fmt ]; } ''
check-nixfmt = pkgs.runCommand "check-nixfmt" { buildInputs = [ check.check-nixfmt ]; } ''
cd ${./.}
check-nixpkgs-fmt
check-nixfmt
touch $out
'';
check-editorconfig = pkgs.runCommand "check-editorconfig" { buildInputs = [ pkgs.git check.check-editorconfig ]; } ''
cd ${./.}
check-editorconfig
touch $out
'';
});

packages = forAllSystems ({ system, pkgs, ... }:
check-editorconfig =
pkgs.runCommand "check-editorconfig"
{
buildInputs = [
pkgs.git
check.check-editorconfig
];
}
''
cd ${./.}
check-editorconfig
touch $out
'';
}
);

formatter = forAllSystems ({ pkgs, ... }: pkgs.nixfmt);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check nixfmt references and examine flake.lock for nixpkgs revision
rg -n 'nixfmt' flake.nix flake.lock
echo "---"
echo "Checking flake.lock for nixpkgs revision:"
rg -A5 '"nixpkgs"' flake.lock | head -20

Repository: DeterminateSystems/nix-installer

Length of output: 838


🌐 Web query:

nixpkgs nixfmt RFC 166 package naming 2025 2026

💡 Result:

  • RFC 166 is about standardizing Nix code formatting and establishing the Nix Formatting Team (which maintains the official formatter, nixfmt)—it’s not the RFC that defines nixpkgs package naming rules. [1]
  • nixfmt in nixpkgs (naming / rollout timeline):
    • The RFC-style formatter landed in nixpkgs as nixfmt-rfc-style (testing call posted 2024-02-02). [2]
    • Formatting enforcement in nixpkgs CI was announced 2024-07-23, using nixfmt pinned in the nixpkgs dev environment. [3]
    • A full tree-wide nixpkgs reformat PR was opened 2025-02-10, with a merge-party date noted as 2025-04-01. [4]
    • nixfmt v1.0.0 (first stable release) was announced 2025-07-14. [5]
    • The long-term plan was to rename nixfmt-rfc-stylenixfmt, and by NixOS 25.11 nixpkgs provides the official formatter as pkgs.nixfmt-rfc-style and pkgs.nixfmt. [6]
  • nixpkgs package naming conventions (separate from RFC 166):
    • nixpkgs manual guidelines: generally follow upstream names, keep names lowercase, preserve dashes, and for “unstable” snapshots use pkgname-unstable-YYYY-MM-DD. [7]
    • Wiki conventions for common suffixes (examples): -bin, -unwrapped. [8]

Sources:
[1] https://nixos.org/community/teams/formatting/
[2] https://discourse.nixos.org/t/call-for-testing-nix-formatter/39179
[3] https://discourse.nixos.org/t/enforcing-nix-formatting-in-nixpkgs/49506
[4] https://discourse.nixos.org/t/nix-formatting-team-full-nixpkgs-reformat/61867
[5] https://discourse.nixos.org/t/nixfmt-1-0-0-is-out/66537
[6] https://hackage.haskell.org/package/nixfmt
[7] https://releases.nixos.org/nixpkgs/nixpkgs-17.03pre90950.3ddf76c/manual/epub/OEBPS/ch10s02.html
[8] https://wiki.nixos.org/wiki/Package_naming_conventions


🏁 Script executed:

#!/bin/bash
# Extract the full nixpkgs revision from flake.lock
cat flake.lock | jq '.nodes.nixpkgs.locked' 2>/dev/null || rg -A10 '"nixpkgs"' flake.lock | grep -E '"rev"|"narHash"' | head -5

Repository: DeterminateSystems/nix-installer

Length of output: 444


🏁 Script executed:

#!/bin/bash
# Check nixpkgs repository at the specific revision for nixfmt package
# The revision is: daf6dc47aa4b44791372d6139ab7b25269184d55

# Try to fetch nixfmt package info from that nixpkgs revision
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/tools/nix/nixfmt-rfc-style/default.nix" > /dev/null 2>&1 && echo "nixfmt-rfc-style exists" || echo "Could not verify"

# Also check if there's a nixfmt alias or direct package
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/tools/formatting/nixfmt/default.nix" > /dev/null 2>&1 && echo "nixfmt direct exists" || echo "Could not verify"

# Try to check all-packages.nix for nixfmt references around that revision
echo "Checking all-packages.nix for nixfmt entries..."
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/top-level/all-packages.nix" 2>/dev/null | grep -i "nixfmt" | head -10

Repository: DeterminateSystems/nix-installer

Length of output: 215


🏁 Script executed:

#!/bin/bash
# Check what nixfmt refers to in all-packages.nix at that revision
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/top-level/all-packages.nix" 2>/dev/null | grep -A2 "^\s*nixfmt\s*=" | head -10

Repository: DeterminateSystems/nix-installer

Length of output: 58


🏁 Script executed:

#!/bin/bash
# Search more broadly in all-packages.nix for any nixfmt definitions
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/top-level/all-packages.nix" 2>/dev/null | grep -E "nixfmt" | head -20

Repository: DeterminateSystems/nix-installer

Length of output: 122


🏁 Script executed:

#!/bin/bash
# Check the nixfmt-rfc-style package definition
echo "=== Checking nixfmt-rfc-style/default.nix ==="
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/tools/nix/nixfmt-rfc-style/default.nix" 2>/dev/null | head -20

echo ""
echo "=== Checking for nixfmt package/alias in tools/nix ==="
curl -s "https://api.github.com/repos/NixOS/nixpkgs/contents/pkgs/tools/nix?ref=daf6dc47aa4b44791372d6139ab7b25269184d55" 2>/dev/null | grep -E '"name".*nixfmt' | head -10

echo ""
echo "=== Broader search in all-packages.nix for nixfmt references ==="
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/top-level/all-packages.nix" 2>/dev/null | grep -B2 -A2 "nixfmt" | head -20

Repository: DeterminateSystems/nix-installer

Length of output: 466


🏁 Script executed:

#!/bin/bash
# The curl check said "nixfmt direct exists" but 404 suggests it doesn't
# Let me verify the curl result and check haskellPackages approach

echo "=== Verifying nixfmt-rfc-style path ==="
curl -I "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/tools/nix/nixfmt-rfc-style/default.nix" 2>/dev/null | head -5

echo ""
echo "=== List all in pkgs/tools/nix directory ==="
curl -s "https://api.github.com/repos/NixOS/nixpkgs/contents/pkgs/tools/nix?ref=daf6dc47aa4b44791372d6139ab7b25269184d55" 2>/dev/null | jq -r '.[] | select(.type=="dir") | .name' | grep -i nix

echo ""
echo "=== Check for nixfmt in formatting tools ==="
curl -s "https://api.github.com/repos/NixOS/nixpkgs/contents/pkgs/tools/formatting?ref=daf6dc47aa4b44791372d6139ab7b25269184d55" 2>/dev/null | jq -r '.[] | .name' | grep -i nix

Repository: DeterminateSystems/nix-installer

Length of output: 535


🏁 Script executed:

#!/bin/bash
# Simpler approach: search all-packages.nix file content for nixfmt definitions
echo "=== Full nixfmt search in all-packages.nix ==="
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/top-level/all-packages.nix" 2>/dev/null | grep -n "nixfmt" -i

echo ""
echo "=== Check if there's a aliases or re-exports ==="
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/top-level/all-packages.nix" 2>/dev/null | grep -E "^\s+nix" | grep -i fmt | head -10

echo ""
echo "=== Direct check of the file size and structure around nixfmt ==="
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/top-level/all-packages.nix" 2>/dev/null | wc -l

Repository: DeterminateSystems/nix-installer

Length of output: 345


🏁 Script executed:

#!/bin/bash
# Check the context around line 16526 to understand the nixfmt situation better
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/top-level/all-packages.nix" 2>/dev/null | sed -n '16520,16535p'

echo ""
echo "=== Search for any nixfmt without hyphen in all-packages ==="
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/top-level/all-packages.nix" 2>/dev/null | grep -E "^\s+nixfmt\s*=" 

echo ""
echo "=== Check haskellPackages definitions for nixfmt ==="
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/top-level/haskell-packages.nix" 2>/dev/null | grep -i "nixfmt" | head -5

Repository: DeterminateSystems/nix-installer

Length of output: 861


🏁 Script executed:

#!/bin/bash
# Final verification: does pkgs.nixfmt even exist as a valid reference?
# Check if there's any nixfmt (without -classic) defined anywhere
echo "=== Final search: nixfmt definitions without -classic ==="
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/top-level/all-packages.nix" 2>/dev/null | grep -n "nixfmt[^-]" | head -10

echo ""
echo "=== Check if nixfmt is imported from another file ==="
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/top-level/all-packages.nix" 2>/dev/null | head -100 | grep -E "import|include" | head -10

echo ""
echo "=== Explicit check: is there a plain 'nixfmt' key at all? ==="
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/top-level/all-packages.nix" 2>/dev/null | grep -oE "^\s+nixfmt\s" | head -5

Repository: DeterminateSystems/nix-installer

Length of output: 383


pkgs.nixfmt does not exist in the pinned nixpkgs revision.

At the pinned nixpkgs revision (daf6dc47aa4b44791372d6139ab7b25269184d55, Sept 2025), only nixfmt-classic is defined in pkgs. The formatter output references pkgs.nixfmt which will cause an evaluation error. Use pkgs.nixfmt-classic instead or update to a nixpkgs revision that provides pkgs.nixfmt as an alias to the RFC formatter.

🤖 Prompt for AI Agents
In `@flake.nix` at line 221, The flake references pkgs.nixfmt which does not exist
in the pinned nixpkgs; update the formatter entry to use the available
pkgs.nixfmt-classic (replace pkgs.nixfmt with pkgs.nixfmt-classic in the
formatter = forAllSystems ({ pkgs, ... }: ...) expression) or alternatively
update the pinned nixpkgs revision to one that provides pkgs.nixfmt; ensure the
change targets the formatter declaration that uses forAllSystems and pkgs.


packages = forAllSystems (
{ system, pkgs, ... }:
{
inherit (pkgs) nix-installer nix-installer-static;
default = pkgs.nix-installer-static;
} // nixpkgs.lib.optionalAttrs (pkgs.stdenv.isDarwin) {
}
// nixpkgs.lib.optionalAttrs (pkgs.stdenv.isDarwin) {
determinate-nixd = pkgs.runCommand "determinate-nixd-link" { } ''
ln -s ${optionalPathToDeterminateNixd system} $out
'';
});
}
);

hydraJobs = {
vm-test = import ./nix/tests/vm-test {
Expand Down
Loading
Loading