From ea9de5681061a81e7a3363dc86b36f42d42ef9bd Mon Sep 17 00:00:00 2001 From: Alexander Heldt Date: Sat, 11 Nov 2023 16:14:09 +0100 Subject: [PATCH] pinwheel: Inject src path in flake templates for `skal` --- hosts/pinwheel/modules/skal/default.nix | 6 +++++- hosts/pinwheel/modules/skal/flake-template.nix | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/hosts/pinwheel/modules/skal/default.nix b/hosts/pinwheel/modules/skal/default.nix index b45c749..eab9f34 100644 --- a/hosts/pinwheel/modules/skal/default.nix +++ b/hosts/pinwheel/modules/skal/default.nix @@ -15,11 +15,15 @@ let if [ "$1" == "create" ]; then if [ ! -d "$FLAKE_DIR" ]; then - echo Creating flake "$FLAKE_DIR" + PWD=$(pwd) + echo Creating flake '"$FLAKE_DIR' using '$PWD' as source path" mkdir -p "$FLAKE_DIR" + FLAKE="$FLAKE_DIR"/flake.nix cp ${./flake-template.nix} "$FLAKE" chmod 700 "$FLAKE" + sed -i -e "s|SRC_PATH|$PWD|" "$FLAKE" + ${pkgs.vim}/bin/vim "$FLAKE" exit 0 else diff --git a/hosts/pinwheel/modules/skal/flake-template.nix b/hosts/pinwheel/modules/skal/flake-template.nix index 67e7d9f..881a74e 100644 --- a/hosts/pinwheel/modules/skal/flake-template.nix +++ b/hosts/pinwheel/modules/skal/flake-template.nix @@ -10,6 +10,17 @@ systems = [ "x86_64-linux" ]; in { + packages = nixpkgs.lib.genAttrs systems (system: + # let + # pkgs = nixpkgs.legacyPackages.${system}; + # in + { + default = { + src = SRC_PATH; + }; + } + ); + devShells = nixpkgs.lib.genAttrs systems (system: let pkgs = nixpkgs.legacyPackages.${system};