From e94415e1e08d84fbd6fa22535262e196e379513a Mon Sep 17 00:00:00 2001 From: atagen Date: Thu, 21 May 2026 22:11:36 +1000 Subject: [PATCH] drop flake-utils --- flake.lock | 34 ---------------- flake.nix | 116 +++++++++++++++++++++++++++++------------------------ 2 files changed, 64 insertions(+), 86 deletions(-) diff --git a/flake.lock b/flake.lock index 02bc5c9..33982ec 100644 --- a/flake.lock +++ b/flake.lock @@ -1,23 +1,5 @@ { "nodes": { - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1778869304, @@ -36,7 +18,6 @@ }, "root": { "inputs": { - "flake-utils": "flake-utils", "nixpkgs": "nixpkgs", "rust-overlay": "rust-overlay" } @@ -60,21 +41,6 @@ "repo": "rust-overlay", "type": "github" } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 129f92f..eaa7f82 100644 --- a/flake.nix +++ b/flake.nix @@ -3,21 +3,25 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - flake-utils.url = "github:numtide/flake-utils"; rust-overlay = { url = "github:oxalica/rust-overlay"; inputs.nixpkgs.follows = "nixpkgs"; }; }; - outputs = { self, nixpkgs, flake-utils, rust-overlay }: - flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] - (system: + outputs = { self, nixpkgs, rust-overlay }: + let + systems = [ "x86_64-linux" "aarch64-linux" ]; + forAllSystems = nixpkgs.lib.genAttrs systems; + + pkgsFor = system: import nixpkgs { + inherit system; + overlays = [ rust-overlay.overlays.default ]; + }; + + perSystem = system: let - pkgs = import nixpkgs { - inherit system; - overlays = [ rust-overlay.overlays.default ]; - }; + pkgs = pkgsFor system; rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; @@ -44,7 +48,7 @@ in { # `nix develop` — full dev environment. - devShells.default = pkgs.mkShell ({ + devShell = pkgs.mkShell ({ name = "headroom-dev"; nativeBuildInputs = nativeBuildTools ++ [ @@ -69,58 +73,66 @@ } // commonEnv); # `nix build` — the final packaged daemon + CLI. - packages = rec { - default = headroom; + headroom = rustPlatform.buildRustPackage ({ + pname = "headroom"; + # Pull from the workspace Cargo.toml — the per-crate + # manifests use `version.workspace = true` which evaluates + # to a table here, not a string. + version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).workspace.package.version; - headroom = rustPlatform.buildRustPackage ({ - pname = "headroom"; - # Pull from the workspace Cargo.toml — the per-crate - # manifests use `version.workspace = true` which evaluates - # to a table here, not a string. - version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).workspace.package.version; + src = ./.; - src = ./.; + cargoLock = { + lockFile = ./Cargo.lock; + # allowBuiltinFetchGit = true; + }; - cargoLock = { - lockFile = ./Cargo.lock; - # allowBuiltinFetchGit = true; - }; + nativeBuildInputs = nativeBuildTools; + buildInputs = nativeAudioBuildInputs; - nativeBuildInputs = nativeBuildTools; - buildInputs = nativeAudioBuildInputs; + # We ship one binary from the workspace: `headroom` (cli + daemon). + cargoBuildFlags = [ "-p" "headroom-cli" ]; + doCheck = true; + cargoTestFlags = [ "--workspace" ]; - # We ship one binary from the workspace: `headroom` (cli + daemon). - cargoBuildFlags = [ "-p" "headroom-cli" ]; - doCheck = true; - cargoTestFlags = [ "--workspace" ]; + # Install the systemd user unit (templated with @bindir@ + # so the unit refers to the absolute path of the binary in + # this derivation, never to whatever happens to be on + # PATH) and ship the canonical profiles under + # share/headroom/profiles so users / modules can copy + # them into XDG_CONFIG_HOME on first run. + postInstall = '' + install -Dm644 contrib/systemd/headroom.service \ + "$out/lib/systemd/user/headroom.service" + substituteInPlace "$out/lib/systemd/user/headroom.service" \ + --replace-fail '@bindir@' "$out/bin" - # Install the systemd user unit (templated with @bindir@ - # so the unit refers to the absolute path of the binary in - # this derivation, never to whatever happens to be on - # PATH) and ship the canonical profiles under - # share/headroom/profiles so users / modules can copy - # them into XDG_CONFIG_HOME on first run. - postInstall = '' - install -Dm644 contrib/systemd/headroom.service \ - "$out/lib/systemd/user/headroom.service" - substituteInPlace "$out/lib/systemd/user/headroom.service" \ - --replace-fail '@bindir@' "$out/bin" + mkdir -p "$out/share/headroom/profiles" + cp -r profiles/. "$out/share/headroom/profiles/" + ''; - mkdir -p "$out/share/headroom/profiles" - cp -r profiles/. "$out/share/headroom/profiles/" - ''; + meta = with pkgs.lib; { + description = "AGC + compressor + true-peak limiter daemon for PipeWire"; + license = licenses.gpl3Plus; + platforms = platforms.linux; + mainProgram = "headroom"; + }; + } // commonEnv); + }; + in + { + devShells = forAllSystems (system: { + default = (perSystem system).devShell; + }); - meta = with pkgs.lib; { - description = "AGC + compressor + true-peak limiter daemon for PipeWire"; - license = licenses.gpl3Plus; - platforms = platforms.linux; - mainProgram = "headroom"; - }; - } // commonEnv); - }; + packages = forAllSystems (system: + let ps = perSystem system; in rec { + default = headroom; + headroom = ps.headroom; + }); + + formatter = forAllSystems (system: (pkgsFor system).nixpkgs-fmt); - formatter = pkgs.nixpkgs-fmt; - }) // { # System-independent outputs — modules. nixosModules.default = import ./nix/nixos-module.nix self; homeModules.default = import ./nix/home-module.nix self;