-
-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
115 additions
and
16 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,31 +1,66 @@ | ||
{ | ||
description = "Nix User Repository"; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; | ||
flake-parts = { | ||
url = "github:hercules-ci/flake-parts"; | ||
inputs.nixpkgs-lib.follows = "nixpkgs"; | ||
}; | ||
treefmt-nix = { | ||
url = "github:numtide/treefmt-nix"; | ||
inputs.nixpkgs.follows = "nixpkgs"; | ||
}; | ||
}; | ||
|
||
outputs = | ||
{ self }: | ||
{ | ||
inputs@{ flake-parts, nixpkgs, ... }: | ||
let | ||
inherit (nixpkgs) lib; | ||
manifest = (builtins.fromJSON (builtins.readFile ./repos.json)).repos; | ||
overlay = final: prev: { | ||
nur = import ./default.nix { | ||
nurpkgs = prev; | ||
pkgs = prev; | ||
}; | ||
}; | ||
nixosModules.nur = | ||
{ lib, pkgs, ... }: | ||
{ | ||
options.nur = lib.mkOption { | ||
type = lib.mkOptionType { | ||
name = "nur"; | ||
description = "An instance of the Nix User repository"; | ||
check = builtins.isAttrs; | ||
in | ||
flake-parts.lib.mkFlake { inherit inputs; } { | ||
systems = builtins.filter ( | ||
system: builtins.hasAttr system nixpkgs.legacyPackages | ||
) nixpkgs.lib.platforms.all; | ||
flake = { | ||
overlay = lib.warn "nur.overlay has been replaced by nur.overlays.default" overlay; # Added 2024-12-06 | ||
nixosModules.nur = lib.throw "nur.nixosModules.nur has been replaced by nur.modules.nixos.default"; # Added 2024-12-06 | ||
hmModules.nur = lib.throw "nur.hmModules.nur has been replaced by nur.modules.home-manager.default"; # Added 2024-12-06 | ||
|
||
overlays = { | ||
default = overlay; | ||
}; | ||
modules = { | ||
nixos = { | ||
default = { | ||
nixpkgs.overlays = [ overlay ]; | ||
}; | ||
description = "Use this option to import packages from NUR"; | ||
default = import self { | ||
nurpkgs = pkgs; | ||
pkgs = pkgs; | ||
}; | ||
home-manager = { | ||
default = { | ||
nixpkgs.overlays = [ overlay ]; | ||
}; | ||
}; | ||
}; | ||
hmModules.nur = self.nixosModules.nur; | ||
}; | ||
imports = [ | ||
inputs.flake-parts.flakeModules.modules | ||
inputs.treefmt-nix.flakeModule | ||
]; | ||
perSystem = | ||
{ pkgs, ... }: | ||
{ | ||
treefmt.programs.nixfmt.enable = true; | ||
# legacyPackages is used because nur is a package set | ||
# This trick with the overlay is used because it allows NUR packages to depend on other NUR packages | ||
legacyPackages = (pkgs.extend overlay).nur; | ||
}; | ||
}; | ||
} |