feat(flake): start using flake-parts
Deprecate `util`'s `forEachSystem` and `forEachPkgs` Use `flake-parts`'s `mkFlake` Export `flakeModules`
This commit is contained in:
parent
02f7fe0cf5
commit
e832c6558a
4 changed files with 138 additions and 99 deletions
68
flake.lock
68
flake.lock
|
@ -311,6 +311,24 @@
|
|||
}
|
||||
},
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1701473968,
|
||||
"narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts_2": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": [
|
||||
"neovim-nightly-overlay",
|
||||
|
@ -331,7 +349,7 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts_2": {
|
||||
"flake-parts_3": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": [
|
||||
"neovim-nightly-overlay",
|
||||
|
@ -550,7 +568,7 @@
|
|||
},
|
||||
"hercules-ci-effects": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts_2",
|
||||
"flake-parts": "flake-parts_3",
|
||||
"nixpkgs": [
|
||||
"neovim-nightly-overlay",
|
||||
"nixpkgs"
|
||||
|
@ -678,7 +696,7 @@
|
|||
"neovim-nightly-overlay": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat_5",
|
||||
"flake-parts": "flake-parts",
|
||||
"flake-parts": "flake-parts_2",
|
||||
"hercules-ci-effects": "hercules-ci-effects",
|
||||
"neovim-flake": "neovim-flake",
|
||||
"nixpkgs": [
|
||||
|
@ -702,7 +720,7 @@
|
|||
"nix-colors": {
|
||||
"inputs": {
|
||||
"base16-schemes": "base16-schemes",
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
"nixpkgs-lib": "nixpkgs-lib_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1695388192,
|
||||
|
@ -777,6 +795,28 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-github-actions": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"jovian-nixos",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1690328911,
|
||||
"narHash": "sha256-fxtExYk+aGf2YbjeWQ8JY9/n9dwuEt+ma1eUFzF8Jeo=",
|
||||
"owner": "zhaofengli",
|
||||
"repo": "nix-github-actions",
|
||||
"rev": "96df4a39c52f53cb7098b923224d8ce941b64747",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "zhaofengli",
|
||||
"ref": "matrix-name",
|
||||
"repo": "nix-github-actions",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-monitored": {
|
||||
"inputs": {
|
||||
"nix-filter": "nix-filter",
|
||||
|
@ -854,6 +894,24 @@
|
|||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"dir": "lib",
|
||||
"lastModified": 1701253981,
|
||||
"narHash": "sha256-ztaDIyZ7HrTAfEEUt9AtTDNoCYxUdSd6NrRHaYOIxtk=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "e92039b55bcd58469325ded85d4f58dd5a4eaf58",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"dir": "lib",
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib_2": {
|
||||
"locked": {
|
||||
"lastModified": 1694911725,
|
||||
"narHash": "sha256-8YqI+YU1DGclEjHsnrrGfqsQg3Wyga1DfTbJrN3Ud0c=",
|
||||
|
@ -1070,9 +1128,11 @@
|
|||
"deploy-rs": "deploy-rs",
|
||||
"disko": "disko",
|
||||
"flake-compat": "flake-compat_3",
|
||||
"flake-parts": "flake-parts",
|
||||
"hardware": "hardware",
|
||||
"home-manager": "home-manager",
|
||||
"impermanence": "impermanence",
|
||||
"jovian-nixos": "jovian-nixos",
|
||||
"lib-net": "lib-net",
|
||||
"mac-app-util": "mac-app-util",
|
||||
"neovim-nightly-overlay": "neovim-nightly-overlay",
|
||||
|
|
69
flake.nix
69
flake.nix
|
@ -7,6 +7,10 @@
|
|||
url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
};
|
||||
|
||||
flake-parts = {
|
||||
url = "github:hercules-ci/flake-parts";
|
||||
};
|
||||
|
||||
# Nix on Droid
|
||||
nix-on-droid = {
|
||||
url = "github:t184256/nix-on-droid/release-23.05";
|
||||
|
@ -118,56 +122,37 @@
|
|||
};
|
||||
|
||||
outputs =
|
||||
{ self
|
||||
, nixpkgs
|
||||
, nix-on-droid
|
||||
, nix-darwin
|
||||
, mac-app-util
|
||||
, home-manager
|
||||
, impermanence
|
||||
, lib-net
|
||||
, nix-monitored
|
||||
, disko
|
||||
, deploy-rs
|
||||
, agenix
|
||||
, ragenix
|
||||
, agenix-rekey
|
||||
, nur
|
||||
, spicetify-nix
|
||||
, hardware
|
||||
, nix-colors
|
||||
, neovim-nightly-overlay
|
||||
, zig-overlay
|
||||
, zls-overlay
|
||||
, wired
|
||||
, ...
|
||||
} @ inputs:
|
||||
inputs:
|
||||
let
|
||||
inherit (inputs) self;
|
||||
inherit (self) outputs;
|
||||
util = import ./util { inherit inputs outputs; };
|
||||
in
|
||||
{
|
||||
inherit self;
|
||||
inputs.flake-parts.lib.mkFlake { inherit inputs; } ({ withSystem, flake-parts-lib, ... }: {
|
||||
systems = [
|
||||
"aarch64-linux"
|
||||
"i686-linux"
|
||||
"x86_64-linux"
|
||||
"aarch64-darwin"
|
||||
"x86_64-darwin"
|
||||
];
|
||||
|
||||
perSystem = { pkgs, ... }: {
|
||||
# Packages (`nix build`)
|
||||
packages = util.forEachPkgs (pkgs:
|
||||
import ./pkgs { inherit pkgs; }
|
||||
);
|
||||
packages = import ./pkgs { inherit pkgs; };
|
||||
|
||||
# Apps (`nix run`)
|
||||
apps = util.forEachPkgs (pkgs:
|
||||
import ./apps { inherit pkgs; }
|
||||
);
|
||||
apps = import ./apps { inherit pkgs; };
|
||||
|
||||
# Dev Shells (`nix develop`)
|
||||
devShells = util.forEachPkgs (pkgs:
|
||||
import ./shells { inherit pkgs inputs outputs; }
|
||||
);
|
||||
devShells = import ./shells { inherit pkgs inputs outputs; };
|
||||
|
||||
# Formatter
|
||||
formatter = util.forEachPkgs (pkgs:
|
||||
pkgs.nixpkgs-fmt
|
||||
);
|
||||
# Formatter (`nix fmt`)
|
||||
formatter = pkgs.nixpkgs-fmt;
|
||||
};
|
||||
|
||||
flake = {
|
||||
inherit self;
|
||||
|
||||
# Templates
|
||||
templates = import ./templates {
|
||||
|
@ -192,7 +177,8 @@
|
|||
nixosModules
|
||||
nixOnDroidModules
|
||||
nixDarwinModules
|
||||
homeManagerModules;
|
||||
homeManagerModules
|
||||
flakeModules;
|
||||
|
||||
# Configurations
|
||||
nixosConfigurations = util.autoNixosConfigurations;
|
||||
|
@ -201,7 +187,7 @@
|
|||
homeConfigurations = util.autoHomeConfigurations;
|
||||
|
||||
# Secrets
|
||||
agenix-rekey = agenix-rekey.configure {
|
||||
agenix-rekey = inputs.agenix-rekey.configure {
|
||||
userFlake = self;
|
||||
nodes = {
|
||||
inherit (self.nixosConfigurations) jeeves;
|
||||
|
@ -212,4 +198,5 @@
|
|||
deploy.nodes = util.deploy.autoNodes;
|
||||
checks = util.autoChecks;
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
5
modules/flake/README.md
Normal file
5
modules/flake/README.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
Add your reusable flake modules to this directory (<https://flake.parts/>)
|
||||
|
||||
These are considered modules:
|
||||
- files, ending in `.nix` (excluding `default.nix`)
|
||||
- directories, containing `default.nix`
|
|
@ -34,20 +34,6 @@ rec {
|
|||
# NOTE: Implying last argument is the output of `recurseDir`
|
||||
hasDirectories = allSatisfy lib.isAttrs;
|
||||
|
||||
# pkgs helpers
|
||||
forEachSystem = lib.genAttrs [
|
||||
"aarch64-linux"
|
||||
"i686-linux"
|
||||
"x86_64-linux"
|
||||
"aarch64-darwin"
|
||||
"x86_64-darwin"
|
||||
];
|
||||
|
||||
forEachPkgs = f:
|
||||
forEachSystem
|
||||
(system:
|
||||
f nixpkgs.legacyPackages.${system});
|
||||
|
||||
# Modules helpers
|
||||
createModules = baseDir: { passthru ? { inherit inputs outputs; }, ... }:
|
||||
lib.pipe baseDir [
|
||||
|
@ -103,6 +89,7 @@ rec {
|
|||
nixOnDroidModules = createModules ../modules/nix-on-droid { };
|
||||
nixDarwinModules = createModules ../modules/nix-darwin { };
|
||||
homeManagerModules = createModules ../modules/home-manager { };
|
||||
flakeModules = createModules ../modules/flake { };
|
||||
|
||||
# Machines
|
||||
machines = recurseDir ../machines;
|
||||
|
|
Loading…
Reference in a new issue