-
-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce flake.nix for project to build for NixOS (#387)
- Loading branch information
Showing
2 changed files
with
150 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# This flake was initially generated by fh, the CLI for FlakeHub (version 0.1.12) | ||
{ | ||
# Flake inputs | ||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; | ||
naersk.url = "github:nix-community/naersk"; | ||
rust-overlay.url = "github:oxalica/rust-overlay"; | ||
}; | ||
|
||
# Flake outputs that other flakes can use | ||
outputs = { | ||
self, | ||
nixpkgs, | ||
naersk, | ||
rust-overlay, | ||
}: let | ||
supportedSystems = ["x86_64-linux" "aarch64-linux"]; | ||
forEachSupportedSystem = f: | ||
nixpkgs.lib.genAttrs supportedSystems (system: | ||
f rec { | ||
pkgs = import nixpkgs { | ||
inherit system; | ||
overlays = [rust-overlay.overlays.default]; | ||
}; | ||
naersk' = pkgs.callPackage naersk {}; | ||
}); | ||
in { | ||
packages = forEachSupportedSystem ({ | ||
pkgs, | ||
naersk', | ||
}: { | ||
default = naersk'.buildPackage { | ||
src = ./.; | ||
nativeBuildInputs = with pkgs; [ | ||
perl | ||
jq | ||
openconnect | ||
libsoup | ||
webkitgtk | ||
pkg-config | ||
]; | ||
|
||
overrideMain = {...}: { | ||
postPatch = '' | ||
substituteInPlace crates/gpapi/src/lib.rs \ | ||
--replace-fail /usr/bin/gpclient $out/bin/gpclient \ | ||
--replace-fail /usr/bin/gpservice $out/bin/gpservice \ | ||
--replace-fail /usr/bin/gpgui-helper $out/bin/gpgui-helper \ | ||
--replace-fail /usr/bin/gpgui $out/bin/gpgui \ | ||
--replace-fail /usr/bin/gpauth $out/bin/gpauth | ||
''; | ||
}; | ||
|
||
}; | ||
}); | ||
}; | ||
} |