flake: refactor

This commit is contained in:
xeals 2023-02-23 09:48:25 +11:00
parent ada5f02f08
commit b21cbda697
Signed by: xeals
GPG Key ID: A498C7AF27EC6B5C
2 changed files with 46 additions and 48 deletions

16
flake.lock generated
View File

@ -1,5 +1,20 @@
{ {
"nodes": { "nodes": {
"flake-utils": {
"locked": {
"lastModified": 1676283394,
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1650194139, "lastModified": 1650194139,
@ -18,6 +33,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
} }

View File

@ -2,62 +2,44 @@
description = "xeals's Nix repository"; description = "xeals's Nix repository";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs }: outputs = { self, nixpkgs, flake-utils }:
let let
inherit (nixpkgs) lib; inherit (nixpkgs) lib;
inherit (flake-utils.lib) mkApp;
supportedSystems = [
"aarch64-darwin"
"aarch64-linux"
"i686-linux"
"x86_64-darwin"
"x86_64-linux"
];
forAllSystems = f: lib.genAttrs supportedSystems (system: f system);
in in
{ flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs { inherit system; };
in
{
packages =
lib.filterAttrs
(_: drv: builtins.elem system (drv.meta.platforms or [ ]))
(import ./pkgs/top-level/all-packages.nix { inherit pkgs; });
nixosModules = lib.mapAttrs (_: path: import path) (import ./modules); apps = {
alacritty = mkApp { drv = pkgs.alacritty-ligatures; exePath = "/bin/alacritty"; };
nixosModule = { protonmail-bridge = mkApp { drv = pkgs.protonmail-bridge; };
imports = lib.attrValues self.nixosModules; protonmail-bridge-headless = mkApp { drv = pkgs.protonmail-bridge; };
psst-cli = mkApp { drv = pkgs.psst; exePath = "/bin/psst-cli"; };
psst-gui = mkApp { drv = pkgs.psst; exePath = "/bin/psst-gui"; };
samrewritten = mkApp { drv = pkgs.samrewritten; };
spotify-ripper = mkApp { drv = pkgs.spotify-ripper; };
};
})
// {
nixosModules = lib.mapAttrs (_: path: import path) (import ./modules) // {
default = {
imports = lib.attrValues self.nixosModules;
};
}; };
overlays = import ./overlays // { overlays = import ./overlays // {
pkgs = _final: prev: import ./pkgs/top-level/all-packages.nix { pkgs = prev; }; pkgs = _: prev: import ./pkgs/top-level/all-packages.nix { pkgs = prev; };
default = _: _: { xeals = nixpkgs.lib.composeExtensions self.overlays.pkgs; };
}; };
overlay = _final: _prev: {
xeals = nixpkgs.lib.composeExtensions self.overlays.pkgs;
};
packages = forAllSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
xPkgs = import ./pkgs/top-level/all-packages.nix { inherit pkgs; };
in
lib.filterAttrs
(_attr: drv: builtins.elem system (drv.meta.platforms or [ ]))
xPkgs);
apps = forAllSystems (system:
let
mkApp = opts: { type = "app"; } // opts;
pkgs = self.packages.${system};
in
{
alacritty = mkApp { program = "${pkgs.alacritty-ligatures}/bin/alacritty"; };
protonmail-bridge = mkApp { program = "${pkgs.protonmail-bridge}/bin/protonmail-bridge"; };
protonmail-bridge-headless = mkApp { program = "${pkgs.protonmail-bridge}/bin/protonmail-bridge"; };
psst-cli = mkApp { program = "${pkgs.psst}/bin/psst-cli"; };
psst-gui = mkApp { program = "${pkgs.psst}/bin/psst-gui"; };
samrewritten = mkApp { program = "${pkgs.samrewritten}/bin/samrewritten"; };
spotify-ripper = mkApp { program = "${pkgs.spotify-ripper}/bin/spotify-ripper"; };
});
}; };
} }