From 100d784d44d88f53945b8585a88ff5ad05f09077 Mon Sep 17 00:00:00 2001 From: Daniel Firth <dan.firth@homotopic.tech> Date: Wed, 22 Mar 2023 22:26:07 +0000 Subject: [PATCH] add horizon-shell devshell --- README.md | 24 +++++++++++++++++------- flake.lock | 33 +++++++++++++++++++++++++++++++++ flake.nix | 21 +++++++++++++++++++++ 3 files changed, 71 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index d04eb042..9b0e2389 100644 --- a/README.md +++ b/README.md @@ -31,22 +31,32 @@ This package set has the following policy. ## Updating the package set -The package set is generated from the `horizon.dhall` using the following command: +The package set is generated from the `horizon.dhall`. You can edit this in one +of two ways: manually using a text edit, or programatically using +`horizon-shell`. + +### Manual + +Edit the `horizon.dhall` file and add or change some package data. + +Run `horizon-gen-nix` from the remote repository. ``` nix run 'git+https://gitlab.horizon-haskell.net/haskell/horizon-gen-nix?ref=refs/tags/0.10.0' ``` -If you need to do additional manual overrides to the nix code, such as -`addPkgconfigDepends`, edit the `configuration.nix` overlay, which is applied -afterwards. - -## Programmmatic Updates +### Programatic To use `horizon-shell`. ``` -nix run 'git+https://gitlab.horizon-haskell.net/shells/horizon-shell?ref=refs/tags/0.0.7' +nix develop ``` See the in-shell help for usage. + +### Tweaking + +If you need to do additional manual overrides to the nix code, such as +`addPkgconfigDepends`, edit the `configuration/common.nix` overlay, which is +applied last. diff --git a/flake.lock b/flake.lock index 612c32ea..818c8ac2 100644 --- a/flake.lock +++ b/flake.lock @@ -33,6 +33,37 @@ "type": "github" } }, + "get-flake": { + "locked": { + "lastModified": 1673819588, + "narHash": "sha256-gRtwKAlu4htvS6dxyZnW3n+vMS1acqnMGVHqxUdETeY=", + "owner": "ursi", + "repo": "get-flake", + "rev": "e0917b6f564aa5acefb1484b5baf76da21746c3c", + "type": "github" + }, + "original": { + "owner": "ursi", + "repo": "get-flake", + "type": "github" + } + }, + "horizon-shell-flake": { + "flake": false, + "locked": { + "lastModified": 1679341258, + "narHash": "sha256-iVB9GSar0Varbxi0ed98S/1mqXfqcATGpeENOFcjv98=", + "ref": "refs/heads/master", + "rev": "c6b62503082814851d3a78fc64b80c4fd02cb290", + "revCount": 18, + "type": "git", + "url": "https://gitlab.horizon-haskell.net/shells/horizon-shell" + }, + "original": { + "type": "git", + "url": "https://gitlab.horizon-haskell.net/shells/horizon-shell" + } + }, "lint-utils": { "inputs": { "flake-utils": "flake-utils", @@ -105,6 +136,8 @@ "root": { "inputs": { "flake-parts": "flake-parts", + "get-flake": "get-flake", + "horizon-shell-flake": "horizon-shell-flake", "lint-utils": "lint-utils", "nixpkgs": "nixpkgs_2" } diff --git a/flake.nix b/flake.nix index 2ab6e98e..587e5a1a 100644 --- a/flake.nix +++ b/flake.nix @@ -8,7 +8,12 @@ }; inputs = { + get-flake.url = "github:ursi/get-flake"; flake-parts.url = "github:hercules-ci/flake-parts"; + horizon-shell-flake = { + url = "git+https://gitlab.horizon-haskell.net/shells/horizon-shell"; + flake = false; + }; lint-utils.url = "git+https://gitlab.homotopic.tech/nix/lint-utils"; nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; }; @@ -16,7 +21,9 @@ outputs = inputs@ { self + , get-flake , flake-parts + , horizon-shell-flake , lint-utils , nixpkgs , ... @@ -27,6 +34,8 @@ let pkgs = nixpkgs.legacyPackages.${system}; + horizon-shell = get-flake horizon-shell-flake; + haskellLib = pkgs.haskell.lib.compose; legacyPackages = pkgs.callPackage (nixpkgs + /pkgs/development/haskell-modules) { @@ -50,6 +59,16 @@ && v.meta.broken == false) legacyPackages; + devShell = pkgs.mkShell { + buildInputs = [ + horizon-shell.packages.${system}.default + ]; + shellHook = '' + horizon-shell + exit + ''; + }; + in { @@ -58,6 +77,8 @@ nixpkgs-fmt = nixpkgs-fmt { src = self; find = "flake.nix"; }; }; + devShells.default = devShell; + inherit legacyPackages; inherit packages; -- GitLab