From 526b9aceade54c434ccbd48f42c1215e0cddf1a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20Schwarz=C3=A4ugl?= Date: Tue, 31 Dec 2024 17:55:08 +0100 Subject: [PATCH] feat: add general template --- SwarselSystems.org | 1 + templates/default.nix | 1 + templates/default/.envrc | 1 + templates/default/flake.nix | 30 ++++++++++++++++++++++++++++++ templates/other_flake.nix | 19 ------------------- 5 files changed, 33 insertions(+), 19 deletions(-) create mode 100644 templates/default/.envrc create mode 100644 templates/default/flake.nix delete mode 100644 templates/other_flake.nix diff --git a/SwarselSystems.org b/SwarselSystems.org index 4d429f4..1e663f5 100644 --- a/SwarselSystems.org +++ b/SwarselSystems.org @@ -488,6 +488,7 @@ This file defines the templates that are being exposed by the flake. These can b "rust" "go" "cpp" + "default" ]; in lib.swarselsystems.mkTemplates templateNames diff --git a/templates/default.nix b/templates/default.nix index a97ad93..1fdc932 100644 --- a/templates/default.nix +++ b/templates/default.nix @@ -5,6 +5,7 @@ let "rust" "go" "cpp" + "default" ]; in lib.swarselsystems.mkTemplates templateNames diff --git a/templates/default/.envrc b/templates/default/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/templates/default/.envrc @@ -0,0 +1 @@ +use flake diff --git a/templates/default/flake.nix b/templates/default/flake.nix new file mode 100644 index 0000000..a37b7b5 --- /dev/null +++ b/templates/default/flake.nix @@ -0,0 +1,30 @@ +{ + description = "General purpose Flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + systems.url = "github:nix-systems/default"; + }; + + outputs = + { nixpkgs + , systems + , ... + }: + let + forEachSystem = nixpkgs.lib.genAttrs (import systems); + pkgsFor = forEachSystem (system: import nixpkgs { inherit system; }); + in + { + formatter = forEachSystem (system: pkgsFor.${system}.nixpkgs-fmt); + + devShells = forEachSystem (system: { + default = pkgsFor.${system}.mkShell { + packages = with pkgsFor.${system}; [ + + ]; + }; + }); + + }; +} diff --git a/templates/other_flake.nix b/templates/other_flake.nix deleted file mode 100644 index f40e5b6..0000000 --- a/templates/other_flake.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ - description = "General Flake"; - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - }; - - outputs = { nixpkgs, ... }: - let - system = "x86_64-linux"; - pkgs = nixpkgs.legacyPackages.${system}; - in - { - devShells.${system}.default = pkgs.mkShell { - packages = with pkgs; [ - # fill here - ]; - }; - }; -}