From 349f8cdb87757bf8947a43351ba45ef6f35e6dc0 Mon Sep 17 00:00:00 2001 From: Erwin Boskma Date: Sun, 21 May 2023 22:14:04 +0200 Subject: [PATCH] Migrate from flake-utils to flake-parts --- flake.nix | 127 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 74 insertions(+), 53 deletions(-) diff --git a/flake.nix b/flake.nix index 302eec8..d8d16c2 100644 --- a/flake.nix +++ b/flake.nix @@ -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; - } - ); + }; + }; }