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": {
|
"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": {
|
"inputs": {
|
||||||
"nixpkgs-lib": [
|
"nixpkgs-lib": [
|
||||||
"neovim-nightly-overlay",
|
"neovim-nightly-overlay",
|
||||||
|
@ -331,7 +349,7 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-parts_2": {
|
"flake-parts_3": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs-lib": [
|
"nixpkgs-lib": [
|
||||||
"neovim-nightly-overlay",
|
"neovim-nightly-overlay",
|
||||||
|
@ -550,7 +568,7 @@
|
||||||
},
|
},
|
||||||
"hercules-ci-effects": {
|
"hercules-ci-effects": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-parts": "flake-parts_2",
|
"flake-parts": "flake-parts_3",
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"neovim-nightly-overlay",
|
"neovim-nightly-overlay",
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
|
@ -678,7 +696,7 @@
|
||||||
"neovim-nightly-overlay": {
|
"neovim-nightly-overlay": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-compat": "flake-compat_5",
|
"flake-compat": "flake-compat_5",
|
||||||
"flake-parts": "flake-parts",
|
"flake-parts": "flake-parts_2",
|
||||||
"hercules-ci-effects": "hercules-ci-effects",
|
"hercules-ci-effects": "hercules-ci-effects",
|
||||||
"neovim-flake": "neovim-flake",
|
"neovim-flake": "neovim-flake",
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
|
@ -702,7 +720,7 @@
|
||||||
"nix-colors": {
|
"nix-colors": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"base16-schemes": "base16-schemes",
|
"base16-schemes": "base16-schemes",
|
||||||
"nixpkgs-lib": "nixpkgs-lib"
|
"nixpkgs-lib": "nixpkgs-lib_2"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1695388192,
|
"lastModified": 1695388192,
|
||||||
|
@ -777,6 +795,28 @@
|
||||||
"type": "github"
|
"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": {
|
"nix-monitored": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nix-filter": "nix-filter",
|
"nix-filter": "nix-filter",
|
||||||
|
@ -854,6 +894,24 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs-lib": {
|
"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": {
|
"locked": {
|
||||||
"lastModified": 1694911725,
|
"lastModified": 1694911725,
|
||||||
"narHash": "sha256-8YqI+YU1DGclEjHsnrrGfqsQg3Wyga1DfTbJrN3Ud0c=",
|
"narHash": "sha256-8YqI+YU1DGclEjHsnrrGfqsQg3Wyga1DfTbJrN3Ud0c=",
|
||||||
|
@ -1070,9 +1128,11 @@
|
||||||
"deploy-rs": "deploy-rs",
|
"deploy-rs": "deploy-rs",
|
||||||
"disko": "disko",
|
"disko": "disko",
|
||||||
"flake-compat": "flake-compat_3",
|
"flake-compat": "flake-compat_3",
|
||||||
|
"flake-parts": "flake-parts",
|
||||||
"hardware": "hardware",
|
"hardware": "hardware",
|
||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
"impermanence": "impermanence",
|
"impermanence": "impermanence",
|
||||||
|
"jovian-nixos": "jovian-nixos",
|
||||||
"lib-net": "lib-net",
|
"lib-net": "lib-net",
|
||||||
"mac-app-util": "mac-app-util",
|
"mac-app-util": "mac-app-util",
|
||||||
"neovim-nightly-overlay": "neovim-nightly-overlay",
|
"neovim-nightly-overlay": "neovim-nightly-overlay",
|
||||||
|
|
69
flake.nix
69
flake.nix
|
@ -7,6 +7,10 @@
|
||||||
url = "github:nixos/nixpkgs/nixos-unstable";
|
url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
flake-parts = {
|
||||||
|
url = "github:hercules-ci/flake-parts";
|
||||||
|
};
|
||||||
|
|
||||||
# Nix on Droid
|
# Nix on Droid
|
||||||
nix-on-droid = {
|
nix-on-droid = {
|
||||||
url = "github:t184256/nix-on-droid/release-23.05";
|
url = "github:t184256/nix-on-droid/release-23.05";
|
||||||
|
@ -118,56 +122,37 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
{ self
|
inputs:
|
||||||
, 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:
|
|
||||||
let
|
let
|
||||||
|
inherit (inputs) self;
|
||||||
inherit (self) outputs;
|
inherit (self) outputs;
|
||||||
util = import ./util { inherit inputs outputs; };
|
util = import ./util { inherit inputs outputs; };
|
||||||
in
|
in
|
||||||
{
|
inputs.flake-parts.lib.mkFlake { inherit inputs; } ({ withSystem, flake-parts-lib, ... }: {
|
||||||
inherit self;
|
systems = [
|
||||||
|
"aarch64-linux"
|
||||||
|
"i686-linux"
|
||||||
|
"x86_64-linux"
|
||||||
|
"aarch64-darwin"
|
||||||
|
"x86_64-darwin"
|
||||||
|
];
|
||||||
|
|
||||||
|
perSystem = { pkgs, ... }: {
|
||||||
# Packages (`nix build`)
|
# Packages (`nix build`)
|
||||||
packages = util.forEachPkgs (pkgs:
|
packages = import ./pkgs { inherit pkgs; };
|
||||||
import ./pkgs { inherit pkgs; }
|
|
||||||
);
|
|
||||||
|
|
||||||
# Apps (`nix run`)
|
# Apps (`nix run`)
|
||||||
apps = util.forEachPkgs (pkgs:
|
apps = import ./apps { inherit pkgs; };
|
||||||
import ./apps { inherit pkgs; }
|
|
||||||
);
|
|
||||||
|
|
||||||
# Dev Shells (`nix develop`)
|
# Dev Shells (`nix develop`)
|
||||||
devShells = util.forEachPkgs (pkgs:
|
devShells = import ./shells { inherit pkgs inputs outputs; };
|
||||||
import ./shells { inherit pkgs inputs outputs; }
|
|
||||||
);
|
|
||||||
|
|
||||||
# Formatter
|
# Formatter (`nix fmt`)
|
||||||
formatter = util.forEachPkgs (pkgs:
|
formatter = pkgs.nixpkgs-fmt;
|
||||||
pkgs.nixpkgs-fmt
|
};
|
||||||
);
|
|
||||||
|
flake = {
|
||||||
|
inherit self;
|
||||||
|
|
||||||
# Templates
|
# Templates
|
||||||
templates = import ./templates {
|
templates = import ./templates {
|
||||||
|
@ -192,7 +177,8 @@
|
||||||
nixosModules
|
nixosModules
|
||||||
nixOnDroidModules
|
nixOnDroidModules
|
||||||
nixDarwinModules
|
nixDarwinModules
|
||||||
homeManagerModules;
|
homeManagerModules
|
||||||
|
flakeModules;
|
||||||
|
|
||||||
# Configurations
|
# Configurations
|
||||||
nixosConfigurations = util.autoNixosConfigurations;
|
nixosConfigurations = util.autoNixosConfigurations;
|
||||||
|
@ -201,7 +187,7 @@
|
||||||
homeConfigurations = util.autoHomeConfigurations;
|
homeConfigurations = util.autoHomeConfigurations;
|
||||||
|
|
||||||
# Secrets
|
# Secrets
|
||||||
agenix-rekey = agenix-rekey.configure {
|
agenix-rekey = inputs.agenix-rekey.configure {
|
||||||
userFlake = self;
|
userFlake = self;
|
||||||
nodes = {
|
nodes = {
|
||||||
inherit (self.nixosConfigurations) jeeves;
|
inherit (self.nixosConfigurations) jeeves;
|
||||||
|
@ -212,4 +198,5 @@
|
||||||
deploy.nodes = util.deploy.autoNodes;
|
deploy.nodes = util.deploy.autoNodes;
|
||||||
checks = util.autoChecks;
|
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`
|
# NOTE: Implying last argument is the output of `recurseDir`
|
||||||
hasDirectories = allSatisfy lib.isAttrs;
|
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
|
# Modules helpers
|
||||||
createModules = baseDir: { passthru ? { inherit inputs outputs; }, ... }:
|
createModules = baseDir: { passthru ? { inherit inputs outputs; }, ... }:
|
||||||
lib.pipe baseDir [
|
lib.pipe baseDir [
|
||||||
|
@ -103,6 +89,7 @@ rec {
|
||||||
nixOnDroidModules = createModules ../modules/nix-on-droid { };
|
nixOnDroidModules = createModules ../modules/nix-on-droid { };
|
||||||
nixDarwinModules = createModules ../modules/nix-darwin { };
|
nixDarwinModules = createModules ../modules/nix-darwin { };
|
||||||
homeManagerModules = createModules ../modules/home-manager { };
|
homeManagerModules = createModules ../modules/home-manager { };
|
||||||
|
flakeModules = createModules ../modules/flake { };
|
||||||
|
|
||||||
# Machines
|
# Machines
|
||||||
machines = recurseDir ../machines;
|
machines = recurseDir ../machines;
|
||||||
|
|
Loading…
Reference in a new issue