diff options
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/full/flake.nix | 34 | ||||
| -rw-r--r-- | templates/full/nix/default.nix | 10 | ||||
| -rw-r--r-- | templates/full/nix/derivation.nix | 1 | ||||
| -rw-r--r-- | templates/full/nix/dev.nix | 32 | ||||
| -rw-r--r-- | templates/full/nix/packages.nix | 22 | ||||
| -rw-r--r-- | templates/full/nix/shell.nix | 17 |
6 files changed, 44 insertions, 72 deletions
diff --git a/templates/full/flake.nix b/templates/full/flake.nix index a98971a..b9be66c 100644 --- a/templates/full/flake.nix +++ b/templates/full/flake.nix @@ -2,40 +2,22 @@ description = ""; inputs = { - nixpkgs.url = "nixpkgs/nixos-unstable"; + nixpkgs.url = "nixpkgs/nixpkgs-unstable"; - compat = { - url = "github:edolstra/flake-compat"; - flake = false; - }; - - parts = { + flake-parts = { url = "github:hercules-ci/flake-parts"; inputs.nixpkgs-lib.follows = "nixpkgs"; }; - pre-commit = { - url = "github:cachix/pre-commit-hooks.nix"; - inputs = { - nixpkgs.follows = "nixpkgs"; - nixpkgs-stable.follows = "nixpkgs"; - flake-compat.follows = "compat"; - }; + flake-compat = { + url = "github:edolstra/flake-compat"; + flake = false; }; }; - outputs = { - parts, - pre-commit, - ... - } @ inputs: - parts.lib.mkFlake {inherit inputs;} { - imports = [ - pre-commit.flakeModule - - ./nix/dev.nix - ./nix/packages.nix - ]; + outputs = inputs: + inputs.flake-parts.lib.mkFlake {inherit inputs;} { + imports = [./nix]; systems = [ "x86_64-linux" diff --git a/templates/full/nix/default.nix b/templates/full/nix/default.nix new file mode 100644 index 0000000..c0457fd --- /dev/null +++ b/templates/full/nix/default.nix @@ -0,0 +1,10 @@ +{ + imports = [ + ./shell.nix + ./packages.nix + ]; + + perSystem = {pkgs, ...}: { + formatter = pkgs.alejandra; + }; +} diff --git a/templates/full/nix/derivation.nix b/templates/full/nix/derivation.nix new file mode 100644 index 0000000..043b140 --- /dev/null +++ b/templates/full/nix/derivation.nix @@ -0,0 +1 @@ +{hello}: hello diff --git a/templates/full/nix/dev.nix b/templates/full/nix/dev.nix deleted file mode 100644 index e3197ff..0000000 --- a/templates/full/nix/dev.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ - perSystem = { - pkgs, - config, - self', - ... - }: { - pre-commit = { - settings.hooks = { - alejandra.enable = true; - deadnix.enable = true; - nil.enable = true; - statix.enable = true; - }; - }; - - devShells = { - default = pkgs.mkShell { - shellHook = config.pre-commit.installationScript; - - packages = with pkgs; [ - self'.formatter - deadnix - nil - statix - ]; - }; - }; - - formatter = pkgs.alejandra; - }; -} diff --git a/templates/full/nix/packages.nix b/templates/full/nix/packages.nix index 8b23ea7..562823e 100644 --- a/templates/full/nix/packages.nix +++ b/templates/full/nix/packages.nix @@ -1,24 +1,18 @@ -{self, ...}: { +{self, ...}: let + version = self.shortRev or self.dirtyShortRev or "unknown"; +in { flake.overlays.default = _: prev: { - foo = prev.callPackage ./derivation.nix {inherit self;}; + hello = prev.callPackage ./derivation.nix {inherit version;}; }; perSystem = { - lib, pkgs, + self', ... }: { - package = let - fixup = lib.filterAttrs ( - _: v: - builtins.elem (v.meta.platforms or []) && !(v.meta.broken or false) - ); - - unfiltered = lib.fix (final: self.overlays.default final pkgs); - pkgs' = fixup unfiltered; - in { - inherit (pkgs') foo; - default = pkgs'.foo; + package = { + hello = pkgs.callPackage ./derivation.nix {inherit version;}; + default = self'.packages.hello; }; }; } diff --git a/templates/full/nix/shell.nix b/templates/full/nix/shell.nix new file mode 100644 index 0000000..66cd1a4 --- /dev/null +++ b/templates/full/nix/shell.nix @@ -0,0 +1,17 @@ +{ + perSystem = { + pkgs, + self', + ... + }: { + devShells = { + default = pkgs.mkShell { + packages = [ + self'.formatter + ]; + + inputsFrom = [self'.packages.hello]; + }; + }; + }; +} |
