summaryrefslogtreecommitdiff
path: root/templates/standard/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'templates/standard/flake.nix')
-rw-r--r--templates/standard/flake.nix44
1 files changed, 24 insertions, 20 deletions
diff --git a/templates/standard/flake.nix b/templates/standard/flake.nix
index 9c80e4b..23f6853 100644
--- a/templates/standard/flake.nix
+++ b/templates/standard/flake.nix
@@ -5,6 +5,7 @@
outputs =
{ self, nixpkgs }:
+
let
inherit (nixpkgs) lib;
@@ -16,54 +17,57 @@
];
forAllSystems = lib.genAttrs systems;
- nixpkgsFor = nixpkgs.legacyPackages;
in
+
{
checks = forAllSystems (
system:
+
let
- pkgs = nixpkgsFor.${system};
+ pkgs = nixpkgs.legacyPackages.${system};
mkCheck =
name: deps: script:
- pkgs.runCommand name { nativeBuildInputs = deps; } script;
+ pkgs.runCommand name { nativeBuildInputs = deps; } ''
+ ${script}
+ touch $out
+ '';
in
- {
- nixfmt = mkCheck "check-nixfmt" [ pkgs.nixfmt-rfc-style ] ''
- nixfmt --check ${self}
- touch $out
- '';
+ {
+ nixfmt = mkCheck "check-nixfmt" [ pkgs.nixfmt-rfc-style ] "nixfmt --check ${self}/**.nix";
}
);
devShells = forAllSystems (
system:
+
let
- pkgs = nixpkgsFor.${system};
+ pkgs = nixpkgs.legacyPackages.${system};
in
- {
- default = pkgs.mkShell {
- packages = [ pkgs.bash ];
- inputsFrom = [ self.packages.${system}.hello ];
+ {
+ default = import ./shell.nix {
+ inherit pkgs;
+ inherit (self.packages.${system}) hello;
};
}
);
- formatter = forAllSystems (system: nixpkgsFor.${system}.nixfmt-rfc-style);
+ formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style);
+
+ nixosModules.default = lib.modules.importApply ./nix/module.nix { inherit self; };
packages = forAllSystems (
system:
+
let
- pkgs = import ./default.nix {
- pkgs = nixpkgsFor.${system};
- };
+ pkgs = nixpkgs.legacyPackages.${system};
- isAvailable = lib.meta.availableOn { inherit system; };
- pkgs' = lib.filterAttrs (_: isAvailable) pkgs;
+ pkgs' = import ./default.nix { inherit pkgs; };
in
- pkgs // { default = pkgs'.hello or pkgs.emptyFile; }
+
+ pkgs' // { default = pkgs'.hello or pkgs.emptyFile; }
);
};
}