Skip to content

Commit

Permalink
flake: add function to spoof unfree local pkgs
Browse files Browse the repository at this point in the history
  • Loading branch information
spikespaz committed Sep 16, 2022
1 parent 26f4b2f commit ce5373f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion flake.nix
Expand Up @@ -30,6 +30,7 @@
...
}: let
system = "x86_64-linux";
allowUnfree = true;

inherit (nixpkgs) lib;
flib = import ./lib.nix lib;
Expand All @@ -38,7 +39,7 @@
# manually import the packages subflake to avoid locking issues
# this flake must have the same inputs that dotpkgs expects
dotpkgs = (import ./dotpkgs/flake.nix).outputs inputs;
in {
in flib.spoofAllowUnfree allowUnfree {
# merge the packages flake into this one
inherit (dotpkgs) packages nixosModules homeManagerModules;

Expand Down
17 changes: 17 additions & 0 deletions lib.nix
Expand Up @@ -12,4 +12,21 @@ lib: rec {
];
# same as above but with an attrset of named flake inputs
flatFlakes = system: builtins.mapAttrs (_: f: flatFlake f system);
# spoof the license of every package
spoofAllowUnfree = maybe: flake: (
if maybe
then lib.recursiveUpdate flake {
# spoof the licenses for local flake packages
packages =
builtins.mapAttrs (_: system:
builtins.mapAttrs (_: package:
package.overrideAttrs (old: {
meta.license =
old.meta.license // { free = true; };
})
) system
) flake.packages;
}
else flake
);
}

0 comments on commit ce5373f

Please sign in to comment.