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-parts = {
url = "github:hercules-ci/flake-parts";
};
nixos-hardware.url = "github:NixOS/nixos-hardware";
pre-commit-hooks = {
@ -97,6 +101,7 @@
, ha-now-playing
, pamedia
, nixinate
, flake-parts
, ...
} @ inputs:
with inputs; let
@ -137,7 +142,19 @@
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
{
flake-parts.lib.mkFlake { inherit inputs; } {
overlays.default = import ./overlays;
# overlay = final: prev: {
# unstable = import nixpkgs {
# system = "x86_64-linux";
# config.allowUnfree = true;
# };
# };
systems = [
"x86_64-linux"
"aarch64-linux"
];
nixosModules = builtins.listToAttrs (map
(x: {
name = x;
value = import (./modules + "/${x}");
})
(builtins.attrNames (builtins.readDir ./modules)));
flake = {
nixosConfigurations = builtins.listToAttrs (map
(machine: {
name = machine;
value = defSystem (machines.${machine}.system or "x86_64-linux")
{
imports = [
machines.${machine}.config
];
}
(machines.${machine}.deploy or null);
})
(builtins.attrNames machines));
overlays.default = import ./overlays;
apps = nixinate.nixinate.x86_64-linux self;
}
// (flake-utils.lib.eachSystem [ "x86_64-linux" ])
(
system:
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
nixosModules = builtins.listToAttrs (map
(x: {
name = x;
value = import (./modules + "/${x}");
})
(builtins.attrNames (builtins.readDir ./modules)));
nixosConfigurations = builtins.listToAttrs (map
(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;
};
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;
nix-plugins = pkgs.nix-plugins;
backscrub = pkgs.backscrub;
bl3auto = pkgs.bl3auto;
commitgpt = pkgs.commitgpt;
obs-backgroundremoval = pkgs.obs-backgroundremoval;
};
@ -235,13 +254,13 @@
devShells.default = with pkgs;
mkShell {
inherit (self.checks.${system}.pre-commit-check) shellHook;
inherit (self'.checks.pre-commit-check) shellHook;
name = "dotfiles";
packages = [
pkgs.sops
ssh-to-age
age
nodejs-18_x
nodejs
nodePackages.typescript-language-server
nodePackages.yaml-language-server
nodePackages.vscode-css-languageserver-bin
@ -251,6 +270,8 @@
nix-prefetch-scripts
nix-prefetch-github
nix-prefetch-docker
nix-top
nix-tree
popsicle
terraform
terraform-ls
@ -271,6 +292,6 @@
};
formatter = pkgs.nixpkgs-fmt;
}
);
};
};
}