|
|
Line 183: |
Line 183: |
| ]; | | ]; |
| </syntaxhighlight> | | </syntaxhighlight> |
|
| |
| == Using a custom flake ==
| |
|
| |
| Another way to patch and configure suckless software is by using a flake. The patches are inputs of the flake which is why their hashes don't have to be manually specified.
| |
|
| |
| <syntaxhighlight lang="nix">
| |
| {
| |
| description = "st with the alpha patch and a custom config";
| |
|
| |
| inputs = {
| |
| nixpkgs.url = "nixpkgs/nixpkgs-unstable";
| |
| flake-utils.url = "github:numtide/flake-utils";
| |
| # alpha patch
| |
| alpha = {
| |
| url = "https://st.suckless.org/patches/alpha/st-alpha-20220206-0.8.5.diff";
| |
| flake = false;
| |
| };
| |
| };
| |
|
| |
| outputs = { self, nixpkgs, flake-utils, alpha }:
| |
| flake-utils.lib.eachDefaultSystem (system: rec {
| |
| # Create the overlay
| |
| overlays.default = self: super: {
| |
| st = super.st.overrideAttrs (oldAttrs: rec {
| |
| patches = [ alpha ];
| |
| configFile = super.writeText "config.h" (builtins.readFile ./st-config.h);
| |
| postPatch = ''
| |
| ${oldAttrs.postPatch}
| |
| cp ${configFile} config.def.h
| |
| '';
| |
| });
| |
| };
| |
| # Append the overlay to nixpkgs and output the new st package
| |
| packages.default = (nixpkgs.legacyPackages.${system}.appendOverlays [ overlays.default ]).st;
| |
| });
| |
| }
| |
| </syntaxhighlight>
| |
|
| |
| The overlay is also an output of the flake and can be consumed by other flakes like a system configuration.
| |
|
| |
|
| == Remote config == | | == Remote config == |