From c697c60a8f5854dd8a640e17c10c3bc2588ad6af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Mon, 30 Dec 2024 22:25:43 +0100 Subject: [PATCH] nix flake: add overlay, conform to standards --- flake.nix | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/flake.nix b/flake.nix index 9ffea8d..e195b3b 100644 --- a/flake.nix +++ b/flake.nix @@ -13,17 +13,18 @@ supportedSystems = [ "x86_64-linux" "aarch64-linux" ]; forAllSystems = nixpkgs.lib.genAttrs supportedSystems; in { - packages = forAllSystems (system: - let - pkgs = nixpkgs.legacyPackages.${system}; - package = pkgs.haskellPackages.callPackage ./default.nix {}; - in { - default = package; - brockman = package; + overlays.default = self: super: { + go-shortener = self.haskellPackages.callPackage ./default.nix {}; + }; + packages = forAllSystems (system: { + default = (import nixpkgs { + inherit system; + overlays = [ self.overlays.default ]; + }).go-shortener; vm = nixos-generators.nixosGenerate { - inherit pkgs; - modules = [ self.nixosModule (import nix/vm.nix) ]; + pkgs = nixpkgs.legacyPackages.${system}; + modules = [ self.nixosModules.default (import nix/vm.nix) ]; format = "vm-nogui"; }; }); @@ -62,9 +63,9 @@ buildInputs = [ pkgs.cabal-install ]; })); - nixosModule = { config, lib, pkgs, ... }: import nix/module.nix { - package = pkgs.haskellPackages.callPackage ./default.nix {}; - inherit config lib pkgs; + nixosModules.default = { ... }: { + imports = [nix/module.nix]; + nixpkgs.overlays = [ self.overlays.default ]; }; }; }