summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/basic/flake.nix69
-rw-r--r--templates/default.nix10
-rw-r--r--templates/full/default.nix15
-rw-r--r--templates/full/flake.nix7
-rw-r--r--templates/full/nix/default.nix8
-rw-r--r--templates/full/nix/derivation.nix2
-rw-r--r--templates/full/nix/packages.nix24
-rw-r--r--templates/full/nix/shell.nix20
-rw-r--r--templates/nixos/flake.nix53
9 files changed, 102 insertions, 106 deletions
diff --git a/templates/basic/flake.nix b/templates/basic/flake.nix
index 53ab44b..1840cb1 100644
--- a/templates/basic/flake.nix
+++ b/templates/basic/flake.nix
@@ -5,48 +5,41 @@
nixpkgs.url = "nixpkgs/nixos-unstable";
};
- outputs = {
- self,
- nixpkgs,
- ...
- }: let
- systems = [
- "x86_64-linux"
- "aarch64-linux"
- "x86_64-darwin"
- "aarch64-darwin"
- ];
+ outputs =
+ { self, nixpkgs, ... }:
+ let
+ systems = [
+ "x86_64-linux"
+ "aarch64-linux"
+ "x86_64-darwin"
+ "aarch64-darwin"
+ ];
- forAllSystems = fn: nixpkgs.lib.genAttrs systems (sys: fn nixpkgs.legacyPackages.${sys});
- version = self.shortRev or self.dirtyShortRev or "unknown";
- in {
- devShells = forAllSystems ({
- pkgs,
- system,
- ...
- }: {
- default = pkgs.mkShell {
- packages = with pkgs; [
- bash
- ];
+ forAllSystems = fn: nixpkgs.lib.genAttrs systems (sys: fn nixpkgs.legacyPackages.${sys});
+ version = self.shortRev or self.dirtyShortRev or "unknown";
+ in
+ {
+ devShells = forAllSystems (
+ { pkgs, system, ... }:
+ {
+ default = pkgs.mkShell {
+ packages = with pkgs; [ bash ];
- inputsFrom = [self.packages.${system}.hello];
- };
- });
+ inputsFrom = [ self.packages.${system}.hello ];
+ };
+ }
+ );
- formatter = forAllSystems (pkgs: pkgs.alejandra);
+ formatter = forAllSystems (pkgs: pkgs.alejandra);
- packages = forAllSystems ({
- pkgs,
- system,
- ...
- }: {
- hello = pkgs.callPackage ./. {inherit version;};
- default = self.packages.${system}.hello;
- });
+ packages = forAllSystems (
+ { pkgs, system, ... }:
+ {
+ hello = pkgs.callPackage ./. { inherit version; };
+ default = self.packages.${system}.hello;
+ }
+ );
- overlays.default = _: prev: {
- hello = prev.callPackage ./. {inherit version;};
+ overlays.default = _: prev: { hello = prev.callPackage ./. { inherit version; }; };
};
- };
}
diff --git a/templates/default.nix b/templates/default.nix
index 349f9df..1c67349 100644
--- a/templates/default.nix
+++ b/templates/default.nix
@@ -9,8 +9,8 @@ let
inherit description;
};
in
- builtins.mapAttrs toTemplate {
- basic = "minimal boilerplate for my flakes";
- full = "big template for complex flakes (using flake-parts)";
- nixos = "minimal boilerplate for flake-based nixos configuration";
- }
+builtins.mapAttrs toTemplate {
+ basic = "minimal boilerplate for my flakes";
+ full = "big template for complex flakes (using flake-parts)";
+ nixos = "minimal boilerplate for flake-based nixos configuration";
+}
diff --git a/templates/full/default.nix b/templates/full/default.nix
index 5804660..6466507 100644
--- a/templates/full/default.nix
+++ b/templates/full/default.nix
@@ -1,10 +1,9 @@
-(import
- (let
+(import (
+ let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in
- fetchTarball {
- url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
- sha256 = lock.nodes.flake-compat.locked.narHash;
- })
- {src = ./.;})
-.defaultNix
+ fetchTarball {
+ url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
+ sha256 = lock.nodes.flake-compat.locked.narHash;
+ }
+) { src = ./.; }).defaultNix
diff --git a/templates/full/flake.nix b/templates/full/flake.nix
index b9be66c..9d33ecb 100644
--- a/templates/full/flake.nix
+++ b/templates/full/flake.nix
@@ -15,9 +15,10 @@
};
};
- outputs = inputs:
- inputs.flake-parts.lib.mkFlake {inherit inputs;} {
- imports = [./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
index c0457fd..66bb711 100644
--- a/templates/full/nix/default.nix
+++ b/templates/full/nix/default.nix
@@ -4,7 +4,9 @@
./packages.nix
];
- perSystem = {pkgs, ...}: {
- formatter = pkgs.alejandra;
- };
+ perSystem =
+ { pkgs, ... }:
+ {
+ formatter = pkgs.alejandra;
+ };
}
diff --git a/templates/full/nix/derivation.nix b/templates/full/nix/derivation.nix
index 043b140..ac18240 100644
--- a/templates/full/nix/derivation.nix
+++ b/templates/full/nix/derivation.nix
@@ -1 +1 @@
-{hello}: hello
+{ hello }: hello
diff --git a/templates/full/nix/packages.nix b/templates/full/nix/packages.nix
index 562823e..e48cdde 100644
--- a/templates/full/nix/packages.nix
+++ b/templates/full/nix/packages.nix
@@ -1,18 +1,18 @@
-{self, ...}: let
+{ self, ... }:
+let
version = self.shortRev or self.dirtyShortRev or "unknown";
-in {
+in
+{
flake.overlays.default = _: prev: {
- hello = prev.callPackage ./derivation.nix {inherit version;};
+ hello = prev.callPackage ./derivation.nix { inherit version; };
};
- perSystem = {
- pkgs,
- self',
- ...
- }: {
- package = {
- hello = pkgs.callPackage ./derivation.nix {inherit version;};
- default = self'.packages.hello;
+ perSystem =
+ { pkgs, self', ... }:
+ {
+ 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
index 66cd1a4..680c875 100644
--- a/templates/full/nix/shell.nix
+++ b/templates/full/nix/shell.nix
@@ -1,17 +1,13 @@
{
- perSystem = {
- pkgs,
- self',
- ...
- }: {
- devShells = {
- default = pkgs.mkShell {
- packages = [
- self'.formatter
- ];
+ perSystem =
+ { pkgs, self', ... }:
+ {
+ devShells = {
+ default = pkgs.mkShell {
+ packages = [ self'.formatter ];
- inputsFrom = [self'.packages.hello];
+ inputsFrom = [ self'.packages.hello ];
+ };
};
};
- };
}
diff --git a/templates/nixos/flake.nix b/templates/nixos/flake.nix
index 235ce27..1ae27dc 100644
--- a/templates/nixos/flake.nix
+++ b/templates/nixos/flake.nix
@@ -9,31 +9,36 @@
};
};
- outputs = {nixpkgs, ...} @ inputs: let
- systems = [
- "x86_64-linux"
- "aarch64-linux"
- "x86_64-darwin"
- "aarch64-darwin"
- ];
+ outputs =
+ { nixpkgs, ... }@inputs:
+ let
+ systems = [
+ "x86_64-linux"
+ "aarch64-linux"
+ "x86_64-darwin"
+ "aarch64-darwin"
+ ];
- forAllSystems = fn: nixpkgs.lib.genAttrs systems (sys: fn nixpkgs.legacyPackages.${sys});
- in {
- nixosConfigurations.myComputer = nixpkgs.lib.nixosSystem {
- system = "x86_64-linux";
- modules = [./configuration.nix];
- specialArgs = {inherit inputs;};
- };
-
- devShells = forAllSystems (pkgs: {
- default = pkgs.mkShellNoCC {
- packages = with pkgs; [
- just
- fzf
- ];
+ forAllSystems = fn: nixpkgs.lib.genAttrs systems (sys: fn nixpkgs.legacyPackages.${sys});
+ in
+ {
+ nixosConfigurations.myComputer = nixpkgs.lib.nixosSystem {
+ system = "x86_64-linux";
+ modules = [ ./configuration.nix ];
+ specialArgs = {
+ inherit inputs;
+ };
};
- });
- formatter = forAllSystems (pkgs: pkgs.alejandra);
- };
+ devShells = forAllSystems (pkgs: {
+ default = pkgs.mkShellNoCC {
+ packages = with pkgs; [
+ just
+ fzf
+ ];
+ };
+ });
+
+ formatter = forAllSystems (pkgs: pkgs.alejandra);
+ };
}