Skip to content

Commit

Permalink
patches: init
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagokokada committed Dec 11, 2024
1 parent 8ab626b commit 834de34
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 38 deletions.
42 changes: 4 additions & 38 deletions lib/flake-helpers.nix
Original file line number Diff line number Diff line change
Expand Up @@ -69,46 +69,12 @@ in
extraModules ? [ ],
}:
let
inherit (self.outputs.nixosConfigurations.${hostname}) config pkgs;
inherit (nixpkgs.legacyPackages.${system}) applyPatches fetchpatch;

patches = [
# https://github.com/NixOS/nixpkgs/pull/363922
(fetchpatch {
url = "https://github.com/NixOS/nixpkgs/commit/ae6664cc5110afc4aa214c1bd9013899f6324a07.patch";
hash = "sha256-H7RXLGDwtWtLeXfrMVSd0Mab89JNoqhumKu/dE3lqVc=";
})
(fetchpatch {
url = "https://github.com/NixOS/nixpkgs/commit/43e6aa5bd29e0a330462127b96c694392291bd49.patch";
hash = "sha256-GirvMkd5T1dKDxaQrWWAOqTtSLvHzd7+GhjzYvedI5c=";
})
(fetchpatch {
url = "https://github.com/NixOS/nixpkgs/commit/d4c1d6c482f920bbd070304ed573631339258f37.patch";
hash = "sha256-iimCxs7LvJWrFTGWTeFvMzguf0s3ZKRfJfB2hBn0qFQ=";
})
(fetchpatch {
url = "https://github.com/NixOS/nixpkgs/commit/14ab7a484d2c044d344aa2a41072e34f531515e8.patch";
hash = "sha256-8SQUWkhBkdq7IA7Ln6Z9YMu0LqkiZy9PGHcppEYHwjM=";
})
(fetchpatch {
url = "https://github.com/NixOS/nixpkgs/commit/c27b1c401ae659d20e4ed5bd6a50d31f7872fdce.patch";
hash = "sha256-eYhDc4LbpGxk7nvpghivfYYXuZ9Goq9Sf63hy75HItE=";
})
];
inherit (self.outputs.nixosConfigurations.${hostname}) config;
n = import ../patches { inherit nixpkgs system; };

nixosSystem =
args:
if patches != [ ] then
let
nixpkgs' = applyPatches {
inherit patches;
name = "nixpkgs-patched";
src = nixpkgs;
};
in
import (nixpkgs' + "/nixos/lib/eval-config.nix") args
else
nixpkgs.lib.nixosSystem args;
if n.patched then import (n.nixpkgs + "/nixos/lib/eval-config.nix") else n.nixpkgs.lib.nixosSystem;
in
{
nixosConfigurations.${hostname} = nixosSystem {
Expand All @@ -128,7 +94,7 @@ in
};
};

apps.${pkgs.system} = {
apps.${system} = {
"nixosActivations/${hostname}" = mkApp {
drv = config.system.build.toplevel;
exePath = "/activate";
Expand Down
20 changes: 20 additions & 0 deletions patches/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{ nixpkgs, system, ... }:
let
inherit (nixpkgs.legacyPackages.${system}) applyPatches callPackage;
patches = callPackage ./patches.nix { };
nixpkgs' = applyPatches {
inherit patches;
name = "nixpkgs-patched";
src = nixpkgs;
};
in
if patches != [ ] then
{
patched = true;
nixpkgs = nixpkgs';
}
else
{
patched = false;
inherit nixpkgs;
}
24 changes: 24 additions & 0 deletions patches/patches.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{ fetchpatch, ... }:
[
# https://github.com/NixOS/nixpkgs/pull/363922
(fetchpatch {
url = "https://github.com/NixOS/nixpkgs/commit/ae6664cc5110afc4aa214c1bd9013899f6324a07.patch";
hash = "sha256-H7RXLGDwtWtLeXfrMVSd0Mab89JNoqhumKu/dE3lqVc=";
})
(fetchpatch {
url = "https://github.com/NixOS/nixpkgs/commit/43e6aa5bd29e0a330462127b96c694392291bd49.patch";
hash = "sha256-GirvMkd5T1dKDxaQrWWAOqTtSLvHzd7+GhjzYvedI5c=";
})
(fetchpatch {
url = "https://github.com/NixOS/nixpkgs/commit/d4c1d6c482f920bbd070304ed573631339258f37.patch";
hash = "sha256-iimCxs7LvJWrFTGWTeFvMzguf0s3ZKRfJfB2hBn0qFQ=";
})
(fetchpatch {
url = "https://github.com/NixOS/nixpkgs/commit/14ab7a484d2c044d344aa2a41072e34f531515e8.patch";
hash = "sha256-8SQUWkhBkdq7IA7Ln6Z9YMu0LqkiZy9PGHcppEYHwjM=";
})
(fetchpatch {
url = "https://github.com/NixOS/nixpkgs/commit/c27b1c401ae659d20e4ed5bd6a50d31f7872fdce.patch";
hash = "sha256-eYhDc4LbpGxk7nvpghivfYYXuZ9Goq9Sf63hy75HItE=";
})
]

0 comments on commit 834de34

Please sign in to comment.