From aca8cbdb0efe9bf45812d6b50d5a2a678380c270 Mon Sep 17 00:00:00 2001 From: Christopher James Hayward Date: Wed, 16 Mar 2022 11:46:31 -0400 Subject: [PATCH] Use flake instead of shell --- flake.lock | 41 +++++++++++++++++++++++++++++++++++++++++ flake.nix | 26 ++++++++++++++++++++++++++ shell.nix | 17 ----------------- 3 files changed, 67 insertions(+), 17 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix delete mode 100644 shell.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..62763a8 --- /dev/null +++ b/flake.lock @@ -0,0 +1,41 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1644229661, + "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1647350163, + "narHash": "sha256-OcMI+PFEHTONthXuEQNddt16Ml7qGvanL3x8QOl2Aao=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3eb07eeafb52bcbf02ce800f032f18d666a9498d", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..df30222 --- /dev/null +++ b/flake.nix @@ -0,0 +1,26 @@ +{ + description = "Wedding site for Chris & Scotia 2023."; + + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = inputs @ { self, nixpkgs, ... }: + inputs.flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + weddingSiteDir = "$HOME/.local/source/wedding-site/public/"; + weddingSiteTgt = "ubuntu@chrishayward.xyz:/var/www/wedding"; + weddingSiteUpdate = pkgs.writeShellScriptBin "wedding-site-update" '' + ${pkgs.rsync}/bin/rsync -aP ${weddingSiteDir} ${weddingSiteTgt} + ''; + in + rec { + devShell = pkgs.mkShell { + buildInputs = with pkgs; [ + hugo + weddingSiteUpdate + ]; + }; + } + ); +} diff --git a/shell.nix b/shell.nix deleted file mode 100644 index fa9c8cb..0000000 --- a/shell.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ pkgs ? import { } }: - -let - myUpdateWeddingSite = pkgs.writeShellScriptBin "update-wedding-site" '' - ${pkgs.rsync}/bin/rsync -aP $HOME/.local/source/wedding-site/public/ ubuntu@chrishayward.xyz:/var/www/wedding - ''; - -in -with pkgs; -mkShell { - buildInputs = [ - pkgs.hugo - myUpdateWeddingSite - ]; - shellHook = '' - ''; -}