From d4706504062f822b93869143de8601859177facd Mon Sep 17 00:00:00 2001 From: Alexander Heldt Date: Sat, 15 Jun 2024 13:18:56 +0200 Subject: [PATCH] pinwheel: Add `pants` (called through `nix-alien`) to `work` module --- flake.lock | 134 ++++++++++++++++++++++-- flake.nix | 5 + hosts/pinwheel/modules/work/default.nix | 7 +- hosts/pinwheel/modules/work/pants.nix | 39 +++++++ 4 files changed, 178 insertions(+), 7 deletions(-) create mode 100644 hosts/pinwheel/modules/work/pants.nix diff --git a/flake.lock b/flake.lock index 9e902d3..a6128b0 100644 --- a/flake.lock +++ b/flake.lock @@ -67,6 +67,21 @@ "type": "github" } }, + "flake-compat": { + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems_2" @@ -85,6 +100,24 @@ "type": "github" } }, + "flake-utils_2": { + "inputs": { + "systems": "systems_3" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -166,6 +199,63 @@ "type": "github" } }, + "nix-alien": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils_2", + "nix-filter": "nix-filter", + "nix-index-database": "nix-index-database", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1718448591, + "narHash": "sha256-TDzUlwvCmkY4IzEMLV7vmB/GlKznsS+/oBO4Z6z9ACE=", + "owner": "thiagokokada", + "repo": "nix-alien", + "rev": "d457975f39a4eaf8bec55b7cc3ff26226d4fb062", + "type": "github" + }, + "original": { + "owner": "thiagokokada", + "repo": "nix-alien", + "type": "github" + } + }, + "nix-filter": { + "locked": { + "lastModified": 1710156097, + "narHash": "sha256-1Wvk8UP7PXdf8bCCaEoMnOT1qe5/Duqgj+rL8sRQsSM=", + "owner": "numtide", + "repo": "nix-filter", + "rev": "3342559a24e85fc164b295c3444e8a139924675b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nix-filter", + "type": "github" + } + }, + "nix-index-database": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1718011381, + "narHash": "sha256-sFXI+ZANp/OC+MwfJoZgPSf4xMdtzQMe1pS3FGti4C8=", + "owner": "nix-community", + "repo": "nix-index-database", + "rev": "88ad3d7501e22b2401dd72734b032b7baa794434", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-index-database", + "type": "github" + } + }, "nixos-hardware": { "locked": { "lastModified": 1718429294, @@ -184,15 +274,15 @@ }, "nixpkgs": { "locked": { - "lastModified": 1718318537, - "narHash": "sha256-4Zu0RYRcAY/VWuu6awwq4opuiD//ahpc2aFHg2CWqFY=", - "owner": "nixos", + "lastModified": 1717786204, + "narHash": "sha256-4q0s6m0GUcN7q+Y2DqD27iLvbcd1G50T2lv08kKxkSI=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "e9ee548d90ff586a6471b4ae80ae9cfcbceb3420", + "rev": "051f920625ab5aabe37c920346e3e69d7d34400e", "type": "github" }, "original": { - "owner": "nixos", + "owner": "NixOS", "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" @@ -214,6 +304,22 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1718318537, + "narHash": "sha256-4Zu0RYRcAY/VWuu6awwq4opuiD//ahpc2aFHg2CWqFY=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "e9ee548d90ff586a6471b4ae80ae9cfcbceb3420", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "pppdotpm-site": { "inputs": { "nixpkgs": [ @@ -242,8 +348,9 @@ "home-manager": "home-manager_2", "hyprland-contrib": "hyprland-contrib", "nh": "nh", + "nix-alien": "nix-alien", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "pppdotpm-site": "pppdotpm-site" } }, @@ -276,6 +383,21 @@ "repo": "default", "type": "github" } + }, + "systems_3": { + "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 27faea2..19c1631 100644 --- a/flake.nix +++ b/flake.nix @@ -31,6 +31,11 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + nix-alien = { + url = "github:thiagokokada/nix-alien"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + pppdotpm-site = { url = "git+ssh://git@codeberg.org/ppp/ppp.pm-site.git?ref=main"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/hosts/pinwheel/modules/work/default.nix b/hosts/pinwheel/modules/work/default.nix index 3dbbeaf..a78748e 100644 --- a/hosts/pinwheel/modules/work/default.nix +++ b/hosts/pinwheel/modules/work/default.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, config, ... }: +{ inputs, pkgs, lib, config, ... }: let gitEnabled = config.mod.git.enable; goEnabled = config.mod.go.enable; @@ -14,6 +14,11 @@ in home.packages = [ (pkgs.callPackage ./syb-cli.nix {}) + (pkgs.callPackage ./pants.nix { + nix-alien = inputs.nix-alien.packages."${pkgs.system}".nix-alien; + }) + pkgs.unzip # needed by pants + (pkgs.jetbrains.plugins.addPlugins pkgs.jetbrains.idea-ultimate [ "ideavim" ]) (pkgs.google-cloud-sdk.withExtraComponents [ pkgs.google-cloud-sdk.components.gke-gcloud-auth-plugin ]) (pkgs.graphite-cli.overrideAttrs(_: { diff --git a/hosts/pinwheel/modules/work/pants.nix b/hosts/pinwheel/modules/work/pants.nix new file mode 100644 index 0000000..9a761fc --- /dev/null +++ b/hosts/pinwheel/modules/work/pants.nix @@ -0,0 +1,39 @@ +{ + stdenv, + fetchurl, + writeShellScriptBin, + nix-alien, + ... +}: +let + version = "0.11.0"; + + unpatched = stdenv.mkDerivation { + name = "scie-pants"; + version = version; + sourceRoot = "."; + phases = [ + "installPhase" + "patchPhase" + ]; + + src = fetchurl { + url = "https://github.com/pantsbuild/scie-pants/releases/download/v${version}/scie-pants-linux-x86_64"; + sha256 = "sha256-ifP5gjTdLMXyVSKda6pPBNNcnJZ0giuqikFBk7cXgHI="; + }; + + installPhase = '' + runHook preInstall + + mkdir -p $out/bin + cp $src $out/bin/pants + chmod +x $out/bin/pants + + runHook postInstall + ''; + }; +in +writeShellScriptBin "pants" '' + export LD_LIBRARY_PATH=$NIX_LD_LIBRARY_PATH + ${nix-alien}/bin/nix-alien ${unpatched}/bin/pants -- "$@" +''