Migrate from flake-utils to flake-parts

This commit is contained in:
Erwin Boskma 2023-05-21 22:14:04 +02:00
parent f32c4e1ac0
commit 349f8cdb87
Signed by: erwin
SSH key fingerprint: SHA256:9LmFDe1C6jSrEyqxxvX8NtJBmcbB105XoqyUZF092bg

127
flake.nix
View file

@ -11,6 +11,10 @@
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
flake-parts = {
url = "github:hercules-ci/flake-parts";
};
nixos-hardware.url = "github:NixOS/nixos-hardware"; nixos-hardware.url = "github:NixOS/nixos-hardware";
pre-commit-hooks = { pre-commit-hooks = {
@ -97,6 +101,7 @@
, ha-now-playing , ha-now-playing
, pamedia , pamedia
, nixinate , nixinate
, flake-parts
, ... , ...
} @ inputs: } @ inputs:
with inputs; let with inputs; let
@ -137,7 +142,19 @@
super.makeModulesClosure (x // { allowMissing = true; }); super.makeModulesClosure (x // { allowMissing = true; });
}); });
config.allowUnfree = true; config = {
permittedInsecurePackages = [
# *Exceptionally*, those packages will be cached with their *secure* dependents
# because they will reach EOL in the middle of the 23.05 release
# and it will be too much painful for our users to recompile them
# for no real reason.
# Remove them for 23.11.
"nodejs-16.20.0"
"openssl-1.1.1t"
];
allowUnfree = true;
};
}; };
} }
@ -155,63 +172,65 @@
; ;
}; };
in in
{ flake-parts.lib.mkFlake { inherit inputs; } {
overlays.default = import ./overlays; systems = [
# overlay = final: prev: { "x86_64-linux"
# unstable = import nixpkgs { "aarch64-linux"
# system = "x86_64-linux"; ];
# config.allowUnfree = true;
# };
# };
nixosModules = builtins.listToAttrs (map flake = {
(x: {
name = x;
value = import (./modules + "/${x}");
})
(builtins.attrNames (builtins.readDir ./modules)));
nixosConfigurations = builtins.listToAttrs (map overlays.default = import ./overlays;
(machine: {
name = machine;
value = defSystem (machines.${machine}.system or "x86_64-linux")
{
imports = [
machines.${machine}.config
];
}
(machines.${machine}.deploy or null);
})
(builtins.attrNames machines));
apps = nixinate.nixinate.x86_64-linux self; nixosModules = builtins.listToAttrs (map
} (x: {
// (flake-utils.lib.eachSystem [ "x86_64-linux" ]) name = x;
( value = import (./modules + "/${x}");
system: })
let (builtins.attrNames (builtins.readDir ./modules)));
pkgs = import nixpkgs {
inherit system; nixosConfigurations = builtins.listToAttrs (map
overlays = [ (machine: {
self.overlays.default name = machine;
ha-now-playing.overlays.${system} value = defSystem (machines.${machine}.system or "x86_64-linux")
pamedia.overlays.${system} {
]; imports = [
config = { machines.${machine}.config
allowUnsupportedSystem = true; ];
allowUnfree = true; }
}; (machines.${machine}.deploy or null);
}; })
# pkgs = nixpkgs.legacyPackages.${system}; (builtins.attrNames machines));
in
apps = nixinate.nixinate.x86_64-linux self;
};
perSystem = { self', pkgs, system, lib, ... }:
# let
# pkgs = import nixpkgs {
# inherit system;
# overlays = [
# self.overlays.default
# ha-now-playing.overlays.${system}
# pamedia.overlays.${system}
# ];
# config = {
# allowUnsupportedSystem = true;
# allowUnfree = true;
# };
# };
# # pkgs = nixpkgs.legacyPackages.${system};
# in
{ {
packages = flake-utils.lib.flattenTree {
packages = {
rofi-wayland = pkgs.rofi-wayland; rofi-wayland = pkgs.rofi-wayland;
nix-plugins = pkgs.nix-plugins; nix-plugins = pkgs.nix-plugins;
backscrub = pkgs.backscrub; backscrub = pkgs.backscrub;
bl3auto = pkgs.bl3auto; bl3auto = pkgs.bl3auto;
commitgpt = pkgs.commitgpt;
obs-backgroundremoval = pkgs.obs-backgroundremoval; obs-backgroundremoval = pkgs.obs-backgroundremoval;
}; };
@ -235,13 +254,13 @@
devShells.default = with pkgs; devShells.default = with pkgs;
mkShell { mkShell {
inherit (self.checks.${system}.pre-commit-check) shellHook; inherit (self'.checks.pre-commit-check) shellHook;
name = "dotfiles"; name = "dotfiles";
packages = [ packages = [
pkgs.sops pkgs.sops
ssh-to-age ssh-to-age
age age
nodejs-18_x nodejs
nodePackages.typescript-language-server nodePackages.typescript-language-server
nodePackages.yaml-language-server nodePackages.yaml-language-server
nodePackages.vscode-css-languageserver-bin nodePackages.vscode-css-languageserver-bin
@ -251,6 +270,8 @@
nix-prefetch-scripts nix-prefetch-scripts
nix-prefetch-github nix-prefetch-github
nix-prefetch-docker nix-prefetch-docker
nix-top
nix-tree
popsicle popsicle
terraform terraform
terraform-ls terraform-ls
@ -271,6 +292,6 @@
}; };
formatter = pkgs.nixpkgs-fmt; formatter = pkgs.nixpkgs-fmt;
} };
); };
} }